View grecent.sh
# via http://stackoverflow.com/a/5188364/794170
git for-each-ref --sort=committerdate refs/heads/ --format="%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))"
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>es6 proxy #jsbench #jsperf</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
View nodejs6-proxy.md

#Create dynamic objects in a nodejs6 REPL with Proxy

Nodejs 6.x comes with ES6 Proxy support baked in. Just like Ruby's method-missing (aka ghost methods), you can intercept getters and setters on an object and, like ActiveRecord in Rails, write rich APIs that can take any method or property name you like.

They are particularly fun in a REPL, where you might want to handle undefined variables.

For example, say we started a nodejs REPL via:

View App.js
import Start from './Start'
import NextPage from './NextPage'
const Views = { Start, NextPage }
<Navigator
initialRoute={{ view: 'Start' }}
renderScene={(route, navigator) => {
const SceneComponent = Views[route.view];
return <SceneComponent {...route.props} navigator={navigator} />;
View echoline.sh
#Usage echoline LINE_NUMBER FILE
function echoline() { sed -n "$(($1 - 5)),$(($1 + 5))p" $2; }
View gist:3987615
git branch --merged master | grep -v 'master$' | xargs git branch -d
View gist:3987610
git branch -r --merged master | sed 's/ *origin\///' | grep -v 'master$' | xargs -I% git push origin :%
View example.coffee
class Person
info: {}
setName: (name) -> @info.name = name
justin = new Person()
justin.setName "justin"
paul = new Person()
View gist:3195313
doc = document.implementation.createDocument('http://www.w3.org/1999/xhtml', 'html')
doc.documentElement.innerHTML = "<div><p class='first'>...</p></div>"
nodeList = doc.querySelectorAll(".first")
View main.coffee
require.config
baseUrl: '/static/coffee/app'
paths:
text: '/static/js/require.text'
underscore: '/static/js/underscore-min'
backbone: '/static/js/backbone-min'
backboneTP: '/static/js/backbone-tastypie'
shim:
underscore:
exports: '_'