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 express = require('express') | |
var app = express.createServer() | |
// Configuration | |
app.configure(function() { | |
this.set('views', __dirname + '/views') | |
.set('view engine', 'jade') | |
.use(express.static(__dirname + '/public')) | |
.set('view options', {title: 'Express'}) |
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
<?php | |
class c { | |
public $f; | |
public function __construct() { | |
$this->f = function() { echo 'coucou'; }; | |
} | |
} | |
// Note: "public $f = function() {...}" is a syntax error... |
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
#!/bin/bash | |
# Requirements: sed, grep, curl, pkill | |
# User configuration | |
LOCAL_INSTALL="/usr/lib/sublime-text-2" # Must be user-writable | |
REPO="dev" # "dev" for dev releases, or "2" for beta releases | |
TARGET_BUILD="Linux 32 bit" # can be one of "Windows", "Windows 64 bit", "OS X", "Linux 32 bit", "Linux 64 bit" | |
# Check if sublime text is running |
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
"use strict"; | |
this.MysqlBinlogTailer = MysqlBinlogTailer; | |
var EventEmitter = require('events').EventEmitter; | |
var fs = require('fs'); | |
var path = require('path'); | |
/** | |
* Tails a Mysql binlog and emits an event for every query executed. | |
*/ |
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
curl -H 'Content-Type: application/json' -X POST http://localhost:5984/_replicate -d ' {"source": "http://isaacs.iriscouch.com/registry", "target": "npmregistry", "create_target": true, "continuous": true} ' |
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
// https://github.com/mozilla/browserid/wiki/Advanced-BrowserID-Features | |
function login () { | |
function gotAssertion (assertion) { | |
if (assertion) { | |
// User chose not to log in, or an error occurred | |
} else { | |
// Ajax call to server to check email | |
} | |
} |
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 io = require('socket.io').listen(8123); | |
io.sockets.on('connection', function (socket) { | |
socket.on('username', function (username) { | |
this.set('username', username, function () { | |
socket.broadcast.emit('newcomer', username); | |
socket.emit('ready', username); | |
}); | |
}); |
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
library(igraph) | |
library(reshape) | |
library(plyr) | |
require(RJSONIO) | |
require(RCurl) | |
# Google Spreadsheet key (must be published to the web) | |
key='0AqGkLMU9sHmLdGNYZDVyTWl1ZmtNbmFzWGlpUkt1Tmc' | |
# Sheet gid name | |
gid=105 |
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
# Retrieve repository URL | |
function svn-url() { | |
LANG=en_US svn info "$1" | grep '^URL *:' | sed 's/^URL *: //' | |
} | |
# Branching | |
function svn-branch() { | |
if [ ! -d .svn ]; then return 1; fi | |
if svn-url | grep '/trunk' &> /dev/null; then | |
echo trunk |