This is a proposal. It does not match the code as of writing.
This describes the minimum contract that Stream objects must adhere to in order to properly interoperate with pipes.
The parent class for all stream objects. Implements the pipe
var MM = require('modestmaps'), | |
Canvas = require('canvas'), | |
Image = Canvas.Image; | |
get = require('get'), | |
express = require('express'); | |
function renderStaticMap(provider, dimensions, zoom, location, callback) { | |
var canvas = new Canvas(dimensions.x, dimensions.y), | |
ctx = canvas.getContext('2d'); |
var FS = require('fs'); | |
var Fiber = require('./fiber'); // Not to be confused with the existing node-fibers module | |
// readFile is a normal non-blocking, async function, but internally it can use | |
// the coroutine helper fiber. These kinds of coroutines are no more dangerous | |
// to the caller than any other async function. | |
function readfile(filename, next) { | |
// The call to Fiber is non-blocking. It's contents are only run sync till | |
// the first call to wait and then it returns. | |
Fiber(function (resume, wait) { |
/** | |
* Underscore function that combines _.find and _.indexOf | |
* Source: https://github.com/documentcloud/underscore/issues/413 | |
* | |
* _.indexBy([2, 6, 4, 7, 9, 0], function(num) { | |
* return num % 2 === 1; | |
* }); | |
* => 3 | |
*/ |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> | |
<title>Stripe Getting Started Form</title> | |
<script type="text/javascript" src="https://js.stripe.com/v1/"></script> | |
<!-- jQuery is used only for this example; it isn't required to use Stripe --> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> | |
<script type="text/javascript"> | |
// this identifies your website in the createToken call below |
As configured in my dotfiles.
start new:
tmux
start new with session name:
var http = require('http') | |
var fork = require('child_process').fork; | |
function fib(n) { | |
if (n < 2) { | |
return 1; | |
} else { | |
return fib(n - 2) + fib(n - 1); | |
} | |
} |
Data.Model = Backbone.Model.extend({ | |
toJSON: function(){ | |
var clone = _.clone(this.attributes); | |
_.each(clone, function (attr, idx) { | |
if(attr.toJSON){ | |
clone[idx] = attr.toJSON(); | |
} | |
}); | |
return clone; | |
} |
transitionViewControllers(vc1, vc2, 0.15, nil, function(){ | |
view.frame = CGRectMake(100,100,100,100); | |
}, function(){ | |
view.removeFromSuperview(); | |
}); |
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |