Instantly share code, notes, and snippets.

View this.js
var slice = [].slice
var array = []
console.log(array.push)
var object = {
f: function (x, y) {
var vargs = slice.call(arguments)
console.log(this.i, x, y)
},
View profiling.irc
[12:38:59] <prettyrobots> Any nice blog posts on profiling Node.js?
[12:39:10] <prettyrobots> I've run a program with `--prof`, but I can't find a way to visualize it.
[12:40:40] kessler (~kessler@odap-199-203-61-108.bb.netvision.net.il) left IRC. (Ping timeout: 246 seconds)
[12:42:08] joates (~joates@host109-152-220-28.range109-152.btcentralplus.com) left IRC. (Quit: Leaving)
[12:43:15] Maciek416 (~Maciek@2601:7:2100:2c1:e4b2:2ee:277d:28d1) left IRC. (Ping timeout: 272 seconds)
[12:50:33] peutetre (~peutetre@ip18861980.dynamic.kabel-deutschland.de) left IRC. (Quit: peutetre)
[12:51:03] toddself_zz is now known as toddself
[12:56:17] kessler (~kessler@odap-199-203-61-108.bb.netvision.net.il) joined the channel.
[13:02:04] phated (~phated@ip72-208-140-83.ph.ph.cox.net) joined the channel.
[13:03:43] kumavis (~kumavis@107-219-148-42.lightspeed.sntcca.sbcglobal.net) joined the channel.
View id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8MFjTKBo8r+bEVSHP12kHxe88ec9Nuk0YaTzoh+du9ZxytuZsjsA/1vxkA4w3gJbNJbrv20CRPChietSpTFMEVrbpbNjNDTYUwJxn+cIEwuA8xGFbURb0Ukq2jDlBBYqUv0WyQHTjTRK+jTVhodE1EB536r6bW4sNP2wKA7TtxQmGHalXAf+OhLtsgfGVvGQl0fHyYrDdPl04G6maGHDP3dtOKgr/UYgcj+ga4K/YCo8AjQovRE0fy/qqovYHvRhfrFA8GO5zQ/n0dIb+AdjMI2JYjsMVKgOprdZ3tDO1b6XYNfU2Mq3FmRoc8purItVbj2+XQ0vmLU6wN8Hs7uih alan
View versions.md

TL;DR

An interface to an algorithm is not an abstraction of a problem domain. It is an implementation. Understanding the algorithm is a requirement for applying it. It should expose the meaningful properties of the algorithm. If you black box it at too low a level, you frustrate the developer who understands the algorithm, forcing them to write their own.

  • Leak all the abstractions. Arrays, sets, maps and graphs are a valid level of abstraction.
  • Make decisions and turn them into rules. Fear not commitment.

The Problem In Need of Interface

I don't like to write about software, that is the first thought. The second

View Output on Fedora 16
[ [ 0, 1859987 ], [ 0, 1678600 ], [ 0, 1074869 ], [ 0, 1100038 ] ]
[ [ 0, 2997281 ], [ 0, 2231579 ], [ 0, 2200601 ], [ 0, 3107400 ] ]
[ [ 0, 2925 ], [ 0, 2907 ], [ 0, 2910 ], [ 0, 2860 ] ]
[ [ 0, 2869 ], [ 0, 2895 ], [ 0, 2800 ], [ 0, 2851 ] ]
[ [ 0, 1425 ], [ 0, 1925 ], [ 0, 1858 ], [ 0, 1383 ] ]
View javascript.vim.patch
--- /usr/share/vim/vim73/syntax/javascript.vim 2012-10-16 19:57:21.000000000 -0400
+++ javascript.vim 2012-10-16 19:56:57.000000000 -0400
@@ -34,8 +34,8 @@
syn match javaScriptCommentSkip "^[ \t]*\*\($\|[ \t]\+\)"
syn region javaScriptComment start="/\*" end="\*/" contains=@Spell,javaScriptCommentTodo
syn match javaScriptSpecial "\\\d\d\d\|\\."
-syn region javaScriptStringD start=+"+ skip=+\\\\\|\\"\|\\\n+ end=+"\|$+ contains=javaScriptSpecial,@htmlPreproc
-syn region javaScriptStringS start=+'+ skip=+\\\\\|\\'\|\\\n+ end=+'\|$+ contains=javaScriptSpecial,@htmlPreproc
+syn region javaScriptStringD start=+"+ skip=+\\\\\|\\"+ end=+"\|$+ contains=javaScriptSpecial,@htmlPreproc
+syn region javaScriptStringS start=+'+ skip=+\\\\\|\\'+ end=+'\|$+ contains=javaScriptSpecial,@htmlPreproc
View README.md

US Median Age by County

A display of US median age by county using the census.ide.org API.

View rere.js
const REGEX = new RegExp('(\\' + '/ . * + ? | ( ) [ ] { } \\'.split(' ').join('|\\') + ')', 'g');
View gist:3267134
cmake_minimum_required (VERSION 2.6)
include(BundleUtilities)
project(synapse)
if (UNIX)
set(gecko_defs "-DXP_UNIX")
if(APPLE)
set(gecko_defs "${gecko_defs} -DXP_MACOSX")
endif()
View decode.js
var fs = require('fs');
var file = new Buffer(fs.readFileSync('shapefile-filereader.zip', 'utf8'), 'binary');
console.log(file.length)
fs.writeFileSync('out.zip', file);