Skip to content

Instantly share code, notes, and snippets.

View clhenrick's full-sized avatar

Chris Henrick clhenrick

View GitHub Profile
@gf3
gf3 / jsonp.js
Created June 18, 2009 18:18
Simple JSONP in vanilla JS
/**
* loadJSONP( url, hollaback [, context] ) -> Null
* - url (String): URL to data resource.
* - hollaback (Function): Function to call when data is successfully loaded,
* it receives one argument: the data.
* - context (Object): Context to invoke the hollaback function in.
*
* Load external data through a JSONP interface.
*
* ### Examples
@ryanflorence
ryanflorence / static_server.js
Last active April 26, 2024 16:18
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs")
port = process.argv[2] || 8888;
http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname
, filename = path.join(process.cwd(), uri);
@darktable
darktable / app.yaml
Created March 16, 2011 19:10
GAE: App.yaml designed for serving a static site on Google App Engine (Python). Copy your static html and files into a folder called "static" next to app.yaml. Contains a bunch of mimetype declarations from html5boilerplate's .htaccess. May not be neces
application: you-app-name-here
version: 1
runtime: python
api_version: 1
default_expiration: "30d"
handlers:
- url: /(.*\.(appcache|manifest))
mime_type: text/cache-manifest
@stefanfoulis
stefanfoulis / osx_developer_installation.rst
Last active December 23, 2019 02:32
Instructions on how to setup an OSX developer machine for (python/django) development

OSX Developer System installation

This guide assumes a fresh install of Mac OSX 10.7 Lion.

Brew User

@benjchristensen
benjchristensen / index.html
Created August 16, 2011 03:21
Animated Line Graphs / Sparklines using SVG Path and d3.js
<html>
<head>
<title>Animated Sparkline using SVG Path and d3.js</title>
<script src="http://mbostock.github.com/d3/d3.v2.js"></script>
<style>
/* tell the SVG path to be a thin blue line without any area fill */
path {
stroke: steelblue;
stroke-width: 1;
fill: none;
@cdown
cdown / gist:1163649
Last active April 9, 2024 01:10
Bash urlencode and urldecode
urlencode() {
# urlencode <string>
old_lc_collate=$LC_COLLATE
LC_COLLATE=C
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:$i:1}"
case $c in
@artero
artero / launch_sublime_from_terminal.markdown
Last active January 25, 2024 16:57 — forked from olivierlacan/launch_sublime_from_terminal.markdown
Launch Sublime Text 2 from the Mac OS X Terminal

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

@jaysonrowe
jaysonrowe / FizzBuzz.js
Created January 11, 2012 01:39
FizzBuzz JavaScript solution
for (var i=1; i <= 20; i++)
{
if (i % 15 == 0)
console.log("FizzBuzz");
else if (i % 3 == 0)
console.log("Fizz");
else if (i % 5 == 0)
console.log("Buzz");
else
console.log(i);
@cspickert
cspickert / GoogleSpreadsheets.py
Created January 20, 2012 23:40
Export a Google Spreadsheet using python.
#!/usr/bin/python
import re, urllib, urllib2
class Spreadsheet(object):
def __init__(self, key):
super(Spreadsheet, self).__init__()
self.key = key
class Client(object):
@kitschpatrol
kitschpatrol / gist:1823610
Created February 14, 2012 04:45
Recording Video from OpenFrameworks
#include "ofxQtVideoSaver.h"
...
// in your class definition
ofImage recordingImage;
ofxQtVideoSaver saver;
...