The JavaScript blog.


validation github data node graphs

tcomb-validation, Bug Life

Posted on .


tcomb-validation (GitHub: gcanti / tcomb-validation, License: MIT) by Giulio Canti is a general purpose validation library that can be used with (or without) React and Backbone.

It's based on the tcomb library which is a runtime type checking library.

Using the plain JavaScript API, you can check types like this:

var t = require('tcomb-validation');  
var validate = t.addons.validation.validate;

validate(1, t.Str).isValid();  
validate('a', t.Str).isValid();  

If you call firstError, you'll get an Error object with a description of what failed the validation. You can combine validators using the struct method, and these can be passed to validate so you can validate forms. You can even pass a JSON schema to validate.

The Backbone integration works by calling validate like this:

var Model = Backbone.Model.extend({  
  validate: function (attrs, options) {
    return validate(attrs, Attrs).errors;

Bug Life

Bug Life

Bug Life was created for the GitHub Data Challenge, and displays a chart derived from issue data. It includes the labels and issue life cycle events, so you can see what the common labels are and how long it takes to close issues.

The screenshot I included was of Backbone, and generating it required authorisation with the GitHub API. Bug Life handles this quite well -- once the API limit was hit I just had to click Authorize and that was pretty much it.

The author has included some explanations of the charts on the project's demo page:

This is a popular repo on github - backbone. It has a rich history, well organized labels and release cycles. On version 0.9.0, when backbone reached a relatively stable state, many issues were closed. Before this release there were other important ones, for example 0.5.0.

After 0.9.0 backbone lived through 3 other important milestones: 0.9.9, 1.0.0 and 1.1.0. Each of these releases was focused on different aspects. Right before version 0.9.9 most open issues were of type change, while before version 1.1.0 most open issues were of type bug.


speech github storage chrome api

Speech Router, Botdylan, Google Cloud Storage

Posted on .

Speech Router

Speech Router (GitHub: lukasolson / speech-router, License: MIT) is a router that wraps around Chrome's Web Speech API. It's based around a constructor function that accepts a routes object:

new SpeechRouter({  
  routes: {
    'search google for *query': function(query) {
      window.open('https://google.com/search?q=' + query);

If you haven't seen the Web Speech API before, it's worth checking out. At least the results seem quite good with my accent and Chrome -- your mileage may vary!


Botdylan (GitHub: botdylan / botdylan, License: MIT) by Pau Ramon is a Hubot-inspired GitHub automation system:

We use GitHub heavily. There are some repetitive tasks that were taking away our time to hack on a better product. Since we are in the productivity space we decided to stop doing things manually and start to have a more productive environment to work with.

It can do things like add labels to issues based on events, integrate with a CI server, talk to chat rooms, and so on. It runs as a daemon, and can execute tasks periodically in the background.

Google Cloud Storage

Google Cloud Storage, sent in by Jonathan Simon, is a screencast that demonstrates a JavaScript application that talks to Google's Cloud Storage platform. The source code is here: storage-getting-started-javascript.

This demonstration covers getting started with Google Cloud Storage using JavaScript. See the process of setting up the sample application, running the sample and using it to try out Cloud Storage API commands like 'list buckets'.


console github fsm

Red Dwarf, Stately.js, ansi_up

Posted on .

Red Dwarf

Red Dwarf

Red Dwarf (GitHub: rviscomi / red-dwarf, License: MIT) by Rick Viscomi is a heat map visualisation of GitHub repository stars. It can display stars for a specific repository, so the joyent/node heat map is pretty interesting given the sheer amount of stars it has.

Google Maps is used for geocoding and displaying the map, and GitHub supplies the raw data. Both of these APIs are accessible with client-side JavaScript, so the whole thing can work purely in-browser. The visualisation itself is drawn using Heatmap Layer, provided by Google Maps.


Stately.js logo

Stately.js (License: MIT) by Florian Schäfer is a finite-state automaton engine, suitable for use in client-side projects. Given that most of us are used to working with events, state machines work quite naturally in JavaScript. Stately.js allows transitions to be tracked using notifications, and handlers can be registered and removed as required.

Florian's documentation is detailed, and the "door" example is an easy one to follow if you're confused about how the project can be used. Some simple tests have also been included, with a small HTML test harness.


ansiup example

I still hang out in IRC, and I still like using Mutt for email. There's something reassuring about the glare of colourful text-based interfaces that no GUI will ever replace. If you're a fellow console hacker, then you may find a use for ansiup (License: _MIT, npm: ansi_up) by Dru Nelson. It converts text with ANSI terminal colour commands into HTML, so you can take your FIGlet-powered nonsense to the web and annoy people with it there.

Dru says this project has been used "in production" since early 2012 -- I wonder what it's being used for?


frameworks cappuccino github

GitHub Issues in Cappuccino

Posted on .

GitHub Issues built with Cappuccino looks
incredible. Not only that, it feels usable too -- details like inline
windows that can be moved around and keyboard shortcuts all work as
you'd expect.

What's amazing about this is it not only pushes client-side JavaScript
but it also uses Heroku's Node beta! The blog post on
Cappuccino.org has more details: GitHub Issues Cappuccino

280 North continue to embrace JavaScript for every aspect of their development cycle, yet there aren't that many apps
out there based on Cappuccino. I've never understood why it hasn't
caught on more, but I suspect Objective-J puts people off.

I make a large portion of my income from iPhone development, and I'm a
big believer of Objective-C, which means I'm comfortable with both
JavaScript and Objective-J. I think it's likely that once Mac and iPhone
developers are sold on Cappuccino and Atlas
we'll see lots of Cappuccino web apps cropping up.

If you've made any Cappuccino apps, open source or commercial, please
let me know in the comments and I'll write up a feature about them in
the future.