Skip to content

Instantly share code, notes, and snippets.

View jed's full-sized avatar

Jed Schmidt jed

View GitHub Profile
@jed
jed / newOperator.js
Created November 28, 2011 13:14
an attempt to make the new operator dynamically invokeable
// usage: newOperator(constructor, [arg1, arg2, ...])
// example: newOperator(Date, [1995, 11, 24])
// => should be identical to new Date(1995, 11, 24)
function newOperator(constructor, args) {
var i = args.length + 1
, params = []
, fn
while (i--) params[i] = "$" + i
@jed
jed / dsl.coffee
Created November 25, 2011 14:52
example dsl
HTML lang: en,
HEAD {},
TITLE "Hello, world."
META charset: "utf8"
BODY {},
DIV id: "container"
"Welcome to my website."
@jed
jed / sync.js
Created November 23, 2011 15:24
turn an async function sync
// Usage:
// function asyncAdd(a, b, cb){ cb(a + b ) }
//
// var syncAdd = sync(asyncAdd)
// , sum = syncAdd(2, 2)
//
// assert(sum == 4)
//
// NOTE:
// this only works for functions that execute their callback before returning.
@jed
jed / github.js
Created November 14, 2011 12:24
github auth
var url = require("url")
, https = require("https")
exports.Application = function(options) {
if (!options.secret) throw "No application secret provided."
if (!options.clientId) throw "No application client ID provided."
return function(req, res) {
var protocol = res.socket.encrypted ? "https" : "http"
, uri = protocol + "://" + req.headers.host + req.url
@jed
jed / index.md
Created November 1, 2011 15:44
Jxck's NodeFest Postmortem

Tokyo NodeFest 2011 (translated by jedschmidt from the original)

I'm a little late to write this, but I presented at and helped run Tokyo NodeFest 2011 on 10/29.

Tokyo NodeFest 2011

My presentation was aimed at beginners, using live-coding to explain how to use Express and Socket.IO to build a simple application. I worked a little bit on the slides, but they paled in comparison to Guillermo "wizard-level hacker" Rauch's awesome session, making me keenly aware of how great these things can be.

The slides I used are below. The HTML I used had a demo embedded, as you can read later. I also uploaded them to SlideShare.

@jed
jed / talks.txt
Created October 29, 2011 07:01
#nodefest lightning talks
A simple 3D modeling tool using Kinect
Developing applications with Next JS
Using Node.js with Windows Azure
UV-Shell
Buiding a smartphone application in 100% coffeescript
A web browser MORPG with Node.js + WebSocket
Moji-TV = Node.js + Socket.io + Titanium
@jed
jed / after.js
Created October 19, 2011 20:54
crushing 1000 booleans
a="[                                      true]";for(b in c="         true,false,false,true,".split(""))a=a.replace(RegExp(c[b][0],"g"),c[b].slice(1));eval(a)
@jed
jed / LICENSE.txt
Created September 7, 2011 14:20 — forked from 140bytes/LICENSE.txt
fletcher checksum
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@jed
jed / LICENSE.txt
Created September 7, 2011 13:30 — forked from 140bytes/LICENSE.txt
adler32 checksum
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@jed
jed / README.md
Created September 3, 2011 06:34
testing namespace collisions for 2-byte abbreviated keys for the document object

experimenting with a more general way of hashing a namespace, for future javascript golf. the idea is that existing browser objects can be hashed so that wasteful strings like createDocumentFragment can be avoided entirely, and keys from several objects (such as document, window, String, etc.) can be hashed into one namespace.

for example:

d = document
d.body.appendChild(d.createElement("script")).src="URL"

could be shortened to