Skip to content

Instantly share code, notes, and snippets.

View jed's full-sized avatar

Jed Schmidt jed

View GitHub Profile
@jed
jed / error.txt
Created December 26, 2010 00:23
error in flickrtouchr when trying to download a picture with a slash in the title
Traceback (most recent call last):
File "flickrtouchr/flickrtouchr.py", line 368, in <module>
inodes[photoid] = getphoto(imgurl, target)
File "flickrtouchr/flickrtouchr.py", line 170, in getphoto
fh = open(filename, "w")
IOError: [Errno 2] No such file or directory: u"japan '09/20091002220101-3975078266_o-vanilla ice cream w/ coffee @ sushi sen, nishi azabu.jpg"
@jed
jed / guid.js
Created January 4, 2011 17:21
objective: a function for generating guids of unique entities
// objective: a function for generating guids of unique entities
// usage: guid( obj ) => integer
// approach 1
// entities kept in a hash array, key id found by iteration
// pros:
// (1) unobtrusive; doesn't pollute objects with expandos
// (2) ids can't be accidentally deleted/changed
// (3) ids can be assigned to any type of object
@jed
jed / guids.js
Created January 5, 2011 22:21
a javascript include that uses the DOM to test 4 guid schemes
var guid = {
// uses an expando to store the id on the object
// wicked fast, but not reliable without DOM hackery (see jQuery source)
"expando": function( last ) {
return function guid( obj ) {
if ( obj ) {
if ( obj.guid ) return obj.guid
obj.guid = last
@jed
jed / configure
Created January 21, 2011 03:04
results of ./configure on OS X 10.6.6
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for program gcc or cc : /usr/bin/gcc
Checking for gcc : ok
Traceback (most recent call last):
File "/Users/jed/desktop/node/tools/waf-light", line 158, in <module>
Scripting.prepare(t, cwd, VERSION, wafdir)
@jed
jed / gist:843289
Created February 25, 2011 02:28 — forked from tobie/gist:842085
var domReady = !document.readyState && document.addEventListener
? function( fn ){ document.addEventListener( "domContentLoaded", fn ) }
: function( fn ){ setTimeout( /in/( document.readyState ) ? function(){ domReady( fn ) }, 50 ) : fn ) }
curl -N localhost:8080
@jed
jed / ATNDNT.js
Created April 2, 2011 10:41
a script that lets you know when your friends sign up for new ATND.org events
var http = require( "http" )
, url = require( "url" )
, exec = require( "child_process" ).exec
, username = process.argv[ 2 ]
, seconds = +process.argv[ 3 ] || 300
, friends
, events = {}
if ( !username ) {
@jed
jed / README.md
Created April 4, 2011 14:02
a small module for autorequiring. warning: MAGIC!

autorequire.js

Copyright (c) 2011 Jed Schmidt

a small module for auto-importing modules in node.js.

usage

require( "./autorequire" )
require.auto( <module-name> )
@jed
jed / getVars.js
Created April 9, 2011 09:41
a function that takes code and returns a list of variable names needing declaration
var getVars = function( dummy, err, re ) {
try { eval( dummy ) } catch( e ) { err += e }
re = new RegExp( "^" + err.replace( dummy, "(\\w+)" ) + "$" )
return function( code ) {
var args = []
, name
while ( 1 ) {
@jed
jed / README.md
Created April 11, 2011 04:20
turns a DOM into (fab) markup language

this is a (fab) experiment i've been toying with. it's a bookmarklet that serializes the DOM on the current page to (fab) code. the idea is to eventually be able to slurp out an existing page into static code, and then slowly start to introduce dynamic behavior using (fab).

to try it, create a bookmarklet with this source:

javascript:with(document)(body.appendChild(createElement('script')).src='https://gist.github.com/raw/913050/5e6c66b14256c12d4842945768e9351b1b798a27/index.js?'+Date.now())._

use with care, because it'll overwrite the current page contents. i think it'd be nice to use github's oauth support to save it in a gist.