Skip to content

Instantly share code, notes, and snippets.

View jimmont's full-sized avatar

Jim Montgomery jimmont

View GitHub Profile
@eligrey
eligrey / object-watch.js
Created April 30, 2010 01:38
object.watch polyfill in ES5
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
@FrankGrimm
FrankGrimm / nodepost-1.js
Created November 9, 2010 15:31
HTTP body in node.js
var http = require('http');
http.createServer(function (req, res) {
// set up some routes
switch(req.url) {
case '/':
console.log("[501] " + req.method + " to " + req.url);
res.writeHead(501, "Not implemented", {'Content-Type': 'text/html'});
res.end('<html><head><title>501 - Not implemented</title></head><body><h1>Not implemented!</h1></body></html>');
break;
@rpavlik
rpavlik / fix_homebrew.rb
Created January 6, 2011 20:32 — forked from mxcl/install_homebrew.markdown
Fix permissions on /usr/local for Homebrew
#!/usr/bin/ruby
#
# This script fixes /usr/local only.
#
# 6th January 2010:
# Modified the script to just fix, rather than install. - rpavlik
#
# 30th March 2010:
# Added a check to make sure user is in the staff group. This was a problem
# for me, and I think it was due to me migrating my account over several
@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
@clee
clee / binary-plist.js
Created June 3, 2011 21:36
initial binary plist implementation in nodejs
#!/usr/bin/env node
var fs = require('fs');
var sys = require('sys');
var bin = require('binary');
function bytesize(n) {
// JavaScript can't handle 64-bit ints natively.
// TODO: hack it up anyway.
// (n & 0xFFFFFFFF00000000) ? 8 : ...
@nateps
nateps / gist:1172490
Created August 26, 2011 01:38
Hide the address bar in a fullscreen iPhone or Android web app
<!DOCTYPE html>
<meta charset=utf-8>
<meta name=viewport content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name=apple-mobile-web-app-capable content=yes>
<meta name=apple-mobile-web-app-status-bar-style content=black>
<title>Test fullscreen</title>
<style>
html, body {
margin: 0;
padding: 0;
@Rnhatch
Rnhatch / index.html
Last active April 12, 2017 01:08
D3 Blocks: Play with transitions and color scales of 1000 blocks.
<!DOCTYPE html>
<html>
<head>
<!--<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="expires" content="0" />-->
<title>Tutorial: introduction to D3</title>
<script type="text/javascript" src="array.js"></script>
<script type="text/javascript" src="string.js"></script>
<script type="text/javascript" src="jquery-1.4.4.min.js"></script>
@reid
reid / remote.md
Created December 31, 2011 17:37
Garage door opener with Arduino

iPhone Garage Remote

Instead of buying two door remotes, I bought one and control it with my iPhone.

Parts

First, I stole nearly everything from MyDoorOpener.com. Their version uses parts I could not find and requires a $6 iPhone app. Let's improve on that.

Almost everything can be found at RadioShack.

@paulirish
paulirish / rAF.js
Last active March 22, 2024 00:00
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@joshbirk
joshbirk / samplerest.js
Created February 3, 2012 19:57
Sample of using passport w/ mult strategies
var fs = require("fs")
var ssl_options = {
key: fs.readFileSync('privatekey.pem'),
cert: fs.readFileSync('certificate.pem')
};
var port = process.env.PORT || 3000;
var express = require('express');
var ejs = require('ejs');
var passport = require('passport')