(C-x means ctrl+x, M-x means alt+x)
The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:
| var _ = require('underscore'), | |
| util = require('util'); | |
| // intercept stdout, passes thru callback | |
| // also pass console.error thru stdout so it goes to callback too | |
| // (stdout.write and stderr.write are both refs to the same stream.write function) | |
| // returns an unhook() function, call when done intercepting | |
| module.exports = function interceptStdout(callback) { | |
| var old_stdout_write = process.stdout.write, | |
| old_console_error = console.error; |
| require 'formula' | |
| class Nginx < Formula | |
| homepage 'http://nginx.org/' | |
| url 'http://nginx.org/download/nginx-1.2.1.tar.gz' | |
| sha1 '4fb69411f6c3ebb5818005955a085e891e77b2d8' | |
| devel do | |
| url 'http://nginx.org/download/nginx-1.3.2.tar.gz' | |
| sha1 'a3507cb2f13332489804f79885541c717f8f4bf0' |
| #!/bin/bash | |
| # install homebrew's official php tap | |
| brew tap josegonzalez/homebrew-php | |
| # install homebrew-dupes (required to install zlib, php54's dependency) | |
| brew tap homebrew/dupes | |
| # install nginx + mysql + php 5.4 + php-fpm + apc + xdebug | |
| brew install nginx mysql |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset=utf-8 /> | |
| <title>Hello</title> | |
| <link rel="stylesheet" href="styles.css"> | |
| </head> | |
| <body> | |
| Hello World | |
| </body> |
| #!/usr/bin/env node | |
| "use strict"; | |
| var debug = require('_debugger'); | |
| var c = new debug.Client(); | |
| function main() { | |
| console.log('requesting trace'); | |
| c.reqBacktrace(function(err,trace) { | |
| if (!err) { |
| /* "Thunks, Trampolines, and Continuation Passing" | |
| * Python implementation from http://jtauber.com/blog/2008/03/30/ | |
| * JavaScript implementation by Thomas Darr <[email protected]>. | |
| */ | |
| // thunk = lambda name: lambda *args: lambda: name(*args) | |
| var thunk = function thunk(fn) { | |
| return function _thunk() { | |
| var splat = Array.prototype.slice.apply(arguments); | |
| return function __thunk() { return fn.apply(this, splat); }; |
This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.
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.| gnome-cups-manager | |
| ------------------ | |
| Once upon a time there was a printer who lived in the woods. He was a | |
| lonely printer, because nobody knew how to configure him. He hoped | |
| and hoped for someone to play with. | |
| One day, the wind passed by the printer's cottage. "Whoosh," said the | |
| wind. The printer became excited. Maybe the wind would be his | |
| friend! |