Skip to content

Instantly share code, notes, and snippets.

View springmeyer's full-sized avatar

Dane Springmeyer springmeyer

View GitHub Profile
@pamelafox
pamelafox / util.js
Created April 13, 2012 17:44
JavaScript Utility Libraries (Scroll down!)
var ED = ED || {};
// Utility functions
ED.util = (function() {
// Data structure functions
function each(object, callback) {
if (object === null) return;
@bmander
bmander / polyline.js
Created April 13, 2012 04:31
polynomial line fitting
function translate(tx, ty, func){
return function(x,y){
var xprime = x-tx;
var yprime = y-ty;
return func(xprime,yprime);
}
}
function rotate(theta, func){
/*
In a child process, each of the stdio streams may be set to
one of the following:
1. A new file descriptor in the child, dup2'ed to the parent and
exposed to JS as a Stream object.
2. A copy of a file descriptor from the parent, with no other
added magical stuff.
3. A black hole - no pipe created.
@aaronpk
aaronpk / github-post-receive.rb
Created April 8, 2012 19:53
Automatically configure post-receive hooks on all your Github repositories
require 'json'
require 'uri'
require 'httpclient'
require 'redis'
require 'mw-irc'
# First, get an access token for your account on the command line
# curl -d '{"scopes":["repo"],"note":"Post-Receive Hooks"}' -u 'username:******' https://api.github.com/authorizations
# Paste your access token here
/*
In a child process, each of the stdio streams may be set to
one of the following:
1. A new file descriptor in the child, dup2'ed to the parent and
exposed to JS as a Stream object.
2. A copy of a file descriptor from the parent, with no other
added magical stuff.
3. A black hole - no pipe created.
@perrygeo
perrygeo / gist:2279331
Created April 1, 2012 23:10
pep8 tricks
pep8 --statistics -qq --filename=*.py /usr/local/src/madrona/madrona/
pep8 --select=E202,E201 --repeat . > ~/pep8.txt
vim -q ~/pep8.txt
# :map z :cn
# type z to cycle through all instances; puts your cursor right on the spot
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
<?xml version="1.0" encoding="utf-8"?>
<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs" background-color="rgb(255,255,255)">
<Style name="drainage">
<Rule>
<Filter>([HYC]=8)</Filter>
<CompositingSymbolizer fill="rgb(153,204,255,127)" smooth="1" comp-op="exclusion"/>
</Rule>
</Style>
<Style name="highway-border">
<Rule>
@GothAck
GothAck / index.js
Created March 20, 2012 18:33
Parsing BIG compressed XML data (OpenStreetMap) with Node.js
#!/usr/bin/env node
/*
* Parsing BIG compressed data with Node.js and SAX
* Probably some bugs, but worked fine for OpenStreetMap Great Britain bz2
* Greg Miell 2012
*/
// Simple string trim prototype extension
String.prototype.trim = function() {
@artemp
artemp / generate_metatiles.py
Created March 19, 2012 19:13
Render metatiles
#!/usr/bin/env python
from math import pi,cos,sin,log,exp,atan
import sys, os
DEG_TO_RAD = pi/180
RAD_TO_DEG = 180/pi
def minmax (a,b,c):
a = max(a,b)