Skip to content

Instantly share code, notes, and snippets.

View stephenhandley's full-sized avatar
🎾
let

Stephen Handley stephenhandley

🎾
let
View GitHub Profile
@stephenhandley
stephenhandley / DelegatingRouter.js
Created March 30, 2012 11:59
modified backbone router to easily delegate handlers
// Modified from from Backbone.Router v 0.9.2
DelegatingRouter = (function() {
var DelegatingRouter = function(args) {
if (!args.delegate) { throw("delegate is required arg to DelegateRouter"); }
if (!args.routes) { throw("routes is required arg to DelegateRouter"); }
Backbone.history || (Backbone.history = new Backbone.History);
_delegate_routes(this, args.delegate, args.routes);
@stephenhandley
stephenhandley / Cordova.plist
Created April 28, 2012 08:07
default Cordova 1.6.1 new project plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIWebViewBounce</key>
<true/>
<key>TopActivityIndicator</key>
<string>gray</string>
<key>EnableLocation</key>
<false/>
#!/bin/env node
// OpenShift sample Node application
// Get the environment variables we need.
var ipaddr = process.env.OPENSHIFT_INTERNAL_IP;
var port = process.env.OPENSHIFT_INTERNAL_PORT || 8080;
if (typeof ipaddr === "undefined") {
console.warn('No OPENSHIFT_INTERNAL_IP environment variable');
}
<html>
<h1>wordpress dot com</h1>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
var location = window.location.href;
var node_app_url = "http://localhost:8000";
var node_path = node_app_url + "?wp_url=" + encodeURIComponent(location);
var iframe = $("<iframe>").attr('src', node_path);
var LocalStorageCache = (function () {
function _now() {
return (new Date()).getTime();
}
function _isExpired(json) {
var expired = false;
if (json.hasOwnProperty('ttl')) {
expired = ((json.timestamp + json.ttl) < _now());
@stephenhandley
stephenhandley / substanceware
Created December 11, 2013 06:06
substanceware
/*
* ----------------------------------------------------------------------------
* "THE {$substance}WARE LICENSE" (Revision 69):
* {$author}<{$email}> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy {$author} ${substance} in return.
* ----------------------------------------------------------------------------
*/
Fs = require('fs')
Path = require('path')
ChildProcess = require('child_process')
TYPES = {
"PNG image data" : 'png'
"JPEG image data" : 'jpg'
"GIF image data" : 'gif'
"TIFF image data" : 'tiff'
Verifying that +stephenhandley is my openname (Bitcoin username). https://onename.io/stephenhandley
<html>
<head>
<link href='http://fonts.googleapis.com/css?family=Lato:100,300,400,700,900,100italic,300italic,400italic,700italic,900italic' rel='stylesheet' type='text/css'>
<style>
body {
font-family : 'Lato', sans-serif;
font-size : 100px;
padding-left : 40px;
}
.thin { font-weight : 100; }
@stephenhandley
stephenhandley / AND_ALL_OF_THESE_APPROACHES_R_LAME.coffee
Created November 29, 2014 04:33
finding object in array of objects by property value
BARFS = [
{
x : 10
name : 'pizza'
}
{
x : 11
name : 'tacos'
}
{