Skip to content

Instantly share code, notes, and snippets.

View tylerstalder's full-sized avatar

Tyler Stalder tylerstalder

View GitHub Profile

Keybase proof

I hereby claim:

  • I am tylerstalder on github.
  • I am tylerstalder (https://keybase.io/tylerstalder) on keybase.
  • I have a public key whose fingerprint is 9394 82CF A95B EE51 7DF1 6154 25CD 072E DAEE 360C

To claim this, I am signing this object:

@tylerstalder
tylerstalder / setup.js
Created July 15, 2014 15:41
Requiring ezel-apps
//
// Sets up intial project settings, middleware, mounted apps, and
// global configuration such as overriding Backbone.sync and
// populating sharify data
//
var c = require('../config'),
express = require('express'),
Backbone = require('backbone'),
sharify = require('sharify'),
<?xml version="1.0" encoding="utf-8"?>
<OdfBody DocumentCode="AT0000000" Serial="250428" Time="170759394"
Date="20120712" FeedFlag="P" LogicalDate="20120712" DocumentType="DT_PARTIC"
Version="51">
<Competition Code="OG2012">
<Participant Code="1083553" Parent="1083553" Status="ACCRED"
GivenName="Dayron" FamilyName="Robles" PrintName="ROBLES Dayron"
PrintInitialName="ROBLES D" TVName="Dayron ROBLES" TVInitialName="D. ROBLES"
Gender="M" Organisation="CUB" BirthDate="19861119" PlaceofBirth="ISLA DE LA JUVENTUD"
CountryofBirth="CUB" Nationality="CUB" MainFunctionId="AA01"
@tylerstalder
tylerstalder / gist:1352274
Created November 9, 2011 18:00
Return anonymous function pattern
var boom = function() {
return function(e) {
// amazing fancy things
e.target.style.color = "red";
}
}
$('#button').click(boom());
@tylerstalder
tylerstalder / gist:1168653
Created August 24, 2011 17:46
Hashchange polling example
describe("hashchange.polling", function() {
it("changing the hash will trigger when the polling loop catches it", function() {
var callback = jasmine.createSpy();
jQuery(window).bind( 'hashchange', callback);
window.location.hash = 'test';
waits(200);
@tylerstalder
tylerstalder / gist:945574
Created April 28, 2011 00:46
NLP script
# -*- coding: utf-8 -*-
import sys
import json
import nltk
# Load in textual data from wherever you've saved it
BUZZ_DATA = sys.argv[1]
buzz_data = json.loads(open(BUZZ_DATA).read())
@tylerstalder
tylerstalder / gist:945573
Created April 28, 2011 00:46
Sample data for nlp
[
{"content":"e ultimately depends in large measure on the jurors who serve in our courts."},
{"content":"The United States Constitdution and the Washington State Constitution guarantees all people the right to trial by an impartial jury. Justice ultimately depends in large measure on the jurors who serve in our courts."},
{"content":"The Unitedultimately depends in large measure on the jurors who serve in our courts."}
]
@tylerstalder
tylerstalder / gist:935167
Created April 21, 2011 18:23
iPhone find file in mbdb
#!/usr/bin/env python
import sys
def getint(data, offset, intsize):
"""Retrieve an integer (big-endian) and new offset from the current offset"""
value = 0
while intsize > 0:
value = (value<<8) + ord(data[offset])
offset = offset + 1
intsize = intsize - 1
@tylerstalder
tylerstalder / Handling URL parameters in NodeJS
Created April 15, 2011 17:22
Pulling and parsing the parameters from the URL
/*
* This is the standard hello world from nodejs.org with a couple lines added to parse URL parameters
*/
var http = require('http'),
url = require('url'),
qs = require('querystring');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
var testQuery = url.parse(req.url, true);
@tylerstalder
tylerstalder / json2couch
Created April 13, 2011 21:43
Simple script to load a json file into couchdb
var fs = require('fs'),
sys = require('sys'),
http = require('http');
var fileName = process.argv[2];
var database = process.argv[3];
var dataFeed = fs.readFileSync(fileName, encoding='utf8');
var requestData = JSON.parse(dataFeed);