Skip to content

Instantly share code, notes, and snippets.


Jed Schmidt jed

View GitHub Profile
jed / level-incremental-id.js
Last active Dec 17, 2015
an approach for incremental ids using levelup.
View level-incremental-id.js
var levelup = require("levelup")
var path = __dirname + "db"
var options = {encoding: "json"}
var db = levelup(path, options)
function id(cb) {
if (typeof cb != "function") throw new TypeError
if (!id.queue) {
id.queue = []
View install_local-tld_error.txt
$ npm -g install local-tld
npm http GET
npm http 304
> local-tld@3.0.6 preuninstall /usr/local/lib/node_modules/local-tld
> ./bin/local-tld-uninstall
++ id -u
+ '[' 501 -eq 0 ']'
+ SUDO=sudo
jed /
Created Oct 19, 2012
Rendering templates obsolete

(tl;dr DOM builders like [domo][domo] trump HTML templates on the client.)

Like all web developers, I've used a lot of template engines. Like most, I've also written a few of them, some of which even [fit in a tweet][140].

The first open-source code I ever wrote was also one of the the first template engines for node.js, [a port][node-tmpl] of the mother of all JavaScript template engines, [John Resig][jresig]'s [micro-templates][tmpl]. Of course, these days you can't swing a dead cat without hitting a template engine; one in eight packages on npm ([2,220][npm templates] of 16,226 as of 10/19) involve templates.

John's implementation has since evolved and [lives on in Underscore.js][underscore], which means it's the default choice for templating in Backbone.js. And for a while, it's all I would ever use when building a client-side app.

But I can't really see the value in client-side HTML templates anymore.

jed /
Created Oct 6, 2012
2012 JavaScript Roundup, Disney-style @ JSCONF EU 4ß

Objective-C (to the tune of Under the Sea)

If you're shipping iOS apps,

and dream of the bucks you'll make,

you might think of "going native",

but Xcode's a big headache.

jed /
Created Aug 27, 2012
installing node on a new ec2 instance (amazon AMI)
sudo yum update
sudo yum install -y gcc-c++.x86_64
sudo yum install -y openssl-devel.x86_64
sudo yum install -y make.x86_64
sudo yum install -y git
git clone git://
cd node
jed / adler32.js
Created Jul 21, 2012
non-obfuscated adler32
View adler32.js
function adler32(string) {
var length = string.length
, modulus = 65521
, index = 0
, a = 1
, b = 0
while (index < length) {
a += string.charCodeAt(index++)
a %= modulus
jed / .gitignore
Created Jul 3, 2012
View .gitignore
jed / balcony.txt
Created Jun 8, 2012
project balcony
View balcony.txt
XX: whole tile
xx: cut tile (20cm)
2cm deep gutter
xx xx xx xx xx xx xx xx xx xx xx |
[] XX XX XX [] XX XX XX XX [] XX |
jed / request.js
Created Apr 23, 2012
prototype plugin pattern idea to make middleware less magical
View request.js
function Request(req, res) {
this.upstream = request
this.downstream = response
Request.prototype = {
start: function() {
// kick off the default chain of handlers
jed / lyrics.txt
Created Apr 15, 2012
baumkuchen by ohashi trio
View lyrics.txt
回り出す木馬に おどけたふりして
小さな靴を鳴らして はしゃぐ君を見てた
何気なく開けてみる 大きな扉は
古ぼけた僕の大事な おもちゃ箱みたいさ
odoridasu mokuba ni odoketa furishite
chiisana kutsu o narashite hashagu kimi o miteta
nanigenaku aketemiru ookina tobira wa
furuboketa boku no daijina omochabako mitai sa