- Header and a Brief description (should match package.json)
- Example (if applicable)
- Motivation (if applicable)
- API Documentation: This will likely vary considerably from library to library.
- Installation
- Tests
- Contributors
- License
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (var i = 0; i < 1024 * 1024; i++) { | |
process.nextTick(function () { Math.sqrt(i) } ) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MyView = Backbone.View.extend({ | |
events: { | |
"click #someButton": "doThat", | |
"change #someInput": "changeIt" | |
}, | |
doThat: function(){ ... }, | |
changeIt: function(){ ... } | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function runSpecs() { | |
// configure the spec runner | |
var specRunner = new Hilo.SpecRunner({ | |
src: "Hilo", | |
specs: "specs", | |
helpers: "specs/Helpers" | |
}); | |
// Handle any errors in the execution that | |
// were not part of a failing test |
Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:
getTweetsFor("domenic", function (err, results) {
// the rest of your code goes here.
});
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var zlib = require('zlib'); | |
var completed = 0; | |
function printProcMem() { | |
if (completed % 100 == 0) { | |
var mem = process.memoryUsage(); | |
console.log('%d %d %d %d', | |
completed, mem.rss / 1000000, mem.heapTotal / 1000000, mem.heapUsed / 1000000); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var arDrone = require('ar-drone'); | |
var client = arDrone.createClient(); | |
client.takeoff(); | |
client | |
.after(5000, function() { | |
this.clockwise(0.5); | |
}) | |
.after(3000, function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var domain = require('domain'); | |
var d = domain.create() | |
var fs = require('fs') | |
server = require('http').createServer( | |
function(req, res) { | |
var d2 = domain.create(); | |
d2.add(req) | |
d2.add(res) |
Just install this in your apps like so:
gem 'test-spec-mini', :git => 'git://gist.github.com/1806986.git', :require => 'mini'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Get and install <repo>. | |
# | |
get() { | |
local prev=`pwd` | |
local repo=$1 | |
rm -fr /tmp/get \ | |
&& mkdir /tmp/get \ | |
&& cd /tmp/get \ |
OlderNewer