Skip to content

Instantly share code, notes, and snippets.

View derek's full-sized avatar

Derek Gathright derek

View GitHub Profile
@derek
derek / gist:3599f91c5ea96a3f3045
Created August 5, 2014 18:51
Function.prototype.bind CoffeeScript polyfill
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind#Compatibility
Function::bind ?= (oThis, args...) ->
fNOP = ->
fNOP:: ?= @::
fBound = =>
context = if this instanceof fNOP and oThis then this else oThis
@apply context, args.concat arguments
fBound:: = new fNOP()
@derek
derek / gist:674668
Created November 12, 2010 20:57
Snagging Github repos with YQL
// Create a JSONP wrapper
function executeYQL(yql, callbackFuncName) {
var url = "http://query.yahooapis.com/v1/public/yql?q=" + encodeURIComponent(yql) + "&env=store://datatables.org/alltableswithkeys&format=json&callback="+callbackFuncName;
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = url;
head.appendChild(script);
}
@derek
derek / gist:701418
Created November 16, 2010 04:26
Node.js/YQL winner generator
/*
The winner generator for SoCal.js November meetup
Be sure to `npm install yql` first!
Written by Derek Gathright (@derek)
*/
var sys = require("sys"),
@derek
derek / gist:702934
Created November 17, 2010 03:34
SoCal.js November Meetup: Link List
Stoyan's Slides
http://www.slideshare.net/stoyan
Luke's Slides
http://slidesha.re/ayTsaR
Stoyan's twitter
http://twitter.com/stoyanstefanov
Luke's twitter
@derek
derek / gist:708091
Created November 20, 2010 19:43
Installing NPM on webOS 2.0
root@roadrunner:/# cd /tmp
root@roadrunner:/# wget https://download.github.com/isaacs-npm-v0.1.23-0-g1c13d07.zip
root@roadrunner:/# unzip isaacs-npm-v0.1.23-0-g1c13d07.zip
root@roadrunner:/# cd isaacs-npm-1c13d07
root@roadrunner:/# node cli.js install
root@roadrunner:/# npm -v
npm it worked if it ends with ok
npm cli [ '-v' ]
0.1.23
@derek
derek / gist:967018
Created May 11, 2011 18:34
Beautified Google Doodle for 5/11/11
(function() {
try {
if (!google.doodle) google.doodle = {};
var d = [[307, 48, 88, 89], [307, 48, 89, 89], [307, 48, 91, 89], [305, 49, 93, 89], [305, 50, 93, 88], [305, 50, 93, 88], [306, 52, 92, 86], [305, 53, 93, 84], [305, 54, 94, 83], [306, 54, 93, 83], [307, 54, 92, 83], [307, 54, 92, 83], [308, 54, 90, 83], [308, 54, 90, 83], [306, 53, 91, 84], [306, 53, 91, 84], [308, 53, 90, 84], [308, 53, 90, 84], [305, 53, 92, 84], [305, 52, 92, 85], [306, 52, 91, 85], [308, 51, 88, 87, 1], [308, 50, 88, 88], [308, 49, 88, 88], [307, 49, 89, 88], [307, 50, 89, 87], [308, 51, 89, 86], [307, 54, 90, 83], [307, 57, 90, 80], [306, 58, 92, 79], [306, 58, 92, 79], [305, 60, 92, 77], [302, 61, 95, 76], [302, 63, 95, 74], [302, 51, 96, 86], [302, 66, 98, 71], [304, 67, 96, 69], [301, 63, 96, 74], [301, 58, 93, 79], [291, 52, 94, 85], [288, 50, 71, 88], [285, 43, 76, 95], [285, 37, 70, 101], [281, 29, 55, 109], [278, 20, 58, 119], [278, 20, 55, 119, 1], [277, 12, 121, 127], [271, 2, 122, 138], [267, 1,
@derek
derek / gist:977487
Created May 17, 2011 21:52
jslinux beautified
/*
PC Emulator
Copyright (c) 2011 Fabrice Bellard
Redistribution or commercial use is prohibited without the author's
permission.
*/
"use strict";
var aa;
var ba = [1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1];
var ca = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 1, 2, 3, 4, 5, 6, 7
@derek
derek / gist:1017507
Created June 9, 2011 19:24
Beautified Google Doodle for 06/09/11 - Les Paul
(function() {
var g = null,
h;
try {
if (!google.doodle) google.doodle = {};
var j,
m,
o,
p,
r,
@derek
derek / gist:1389403
Created November 23, 2011 18:09
YUI 3 Button Proposal

YUI Button

Goal

To introduce a new Button component for YUI 3 that addresses the following user stories

  • "I want buttons on my site to look consistent & attractive."
  • "I want to be able to programmatically control buttons in my application."
  • "I want to my buttons to be intelligent and interact with one another in groups."
  • "I want my application to be able to dynamically generate buttons."
@derek
derek / dabblet.css
Created December 16, 2011 00:26 — forked from anonymous/dabblet.css
Untitled
.yui3-button {
/* Structure */
display: inline-block;
*display: inline;
zoom: 1;
font-size: 100%;
margin: 0;
padding: 0 1em;
line-height: normal;
line-height: 2.0;