Skip to content

Instantly share code, notes, and snippets.

# Use vim keybindings in copy mode
setw -g mode-keys vi
# Setup 'v' to begin selection as in Vim
bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# Update default binding of `Enter` to also use copy-pipe
unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
</body>
</html>
var express = require('express');
var hasBody = require('express/node_modules/connect').utils.hasBody;
var getBody = require('express/node_modules/connect/node_modules/raw-body');
var app = express();
app.use(express.static(__dirname));
app.post('/enter', express.urlencoded(), function (req, res, next) {
if (req.body.wifi) console.log('"' + (new Date).toGMTString() + '","enter","'+req.body.wifi+'"');
next();
});
app.post('/leave', express.urlencoded(), function (req, res, next) {
var co = require('co');
var thunkify = require('thunkify');
var asyncMath = function (list, cb) {
setTimeout(function () {
cb(null, Math.max.apply(Math, list), Math.min.apply(Math, list));
}, 500);
};
function binary(fn) {
'use strict';
var http = require('http');
var request = require('request');
var nth = require('co-nth-arg');
var _ = require('lodash');
module.exports = function (propName, options) {
propName = propName || 'api';
var routeProto = require('express/lib/router/route').prototype;
var routerProto = require('express/lib/router');
var methods = require('express/node_modules/methods').concat(['all']);
wrapCallback = function (c) {
return c;
}
methods.forEach(function (method) {
var orig = routeProto[method];
routeProto[method] = function () {
var callbacks = utils.flatten([].slice.call(arguments));
function isMasterRunning() {
var pidFilePath = path.join(__dirname, 'ds.pid');
var strpid;
var isRunning;
if (fs.existsSync(pidFilePath)) {
strpid = fs.readFileSync(pidFilePath, 'utf-8');
isRunning = require('is-running')(parseInt(strpid, 10));
}
if (isRunning) {
return strpid;
#!/usr/bin/env bash
export N_PREFIX=$HOME/.ivm
export N_BIN=$N_PREFIX/bin
test -d $N_BIN || mkdir -p $N_BIN
pushd $N_BIN
wget https://raw.githubusercontent.com/demohi/ivm/ce260674aeb8a446a3790784461156085f634c5b/bin/ivm
chmod a+x ivm
popd
echo 'export N_PREFIX=$HOME/.ivm' >> .bashrc
#!/usr/bin/env bash
curl https://raw.githubusercontent.com/creationix/nvm/v0.22.2/install.sh | bash
cd .nvm
git remote add ljharb https://github.com/ljharb/nvm.git
git fetch ljharb
git checkout ljharb/iojs
@undoZen
undoZen / jspm-react-hot-reloader-demo.sh
Last active April 13, 2016 06:18
jspm-react-hot-reloader-demo
#!/usr/bin/env bash
git clone https://github.com/guybedford/jspm-react-component-demo.git
cd jspm-react-component-demo
npm i --save-dev jspm@beta chokidar-socket-emitter ecstatic
./node_modules/.bin/jspm i
./node_modules/.bin/jspm i --dev systemjs-hot-reloader #update to fix a bug
echo 'installation done, have fun!'
echo 'first `cd jspm-react-component-demo` into demo directory, then'