Skip to content

Instantly share code, notes, and snippets.

View alunny's full-sized avatar

Andrew Lunny alunny

  • Twitter
  • San Francisco, CA
View GitHub Profile
(higgins={bot:function(){return Math.random()>0.5?"it's just JavaScript":"Dojo already did it"}}).bot()
@alunny
alunny / fakegap.js
Created October 22, 2010 00:24
first (very rough) stab at faking touch events
document.addEventListener('click', function (evt) {
if (typeof evt.target.ontouchend == 'function') {
evt.target.ontouchend.call(evt.target, evt);
}
}, false);
@alunny
alunny / advanced.training.libraries.md
Created October 28, 2010 18:43
PhoneGap Advanced: training libraries
@alunny
alunny / description.md
Created November 26, 2010 22:22
my git configuration

My Git Configuration

For best results, use hub and git bash completion (included with git under contrib/completion).

/**
* Contains utility functions to be used in various places.
*/
var util = {};
/**
* Checks the types and sanitizes arguments for functions with optional
* parameters and default values.
*
// lazy loading and caching templates
// callback receives rendered html - can write to the DOM or whatnot
var TMPL_PREFIX = 'tmpl.'
function renderTemplate(callback, identifier, data) {
// check localStorage for identifier
var data = data || {},
key = TMPL_PREFIX + identifier,
url = 'templates/' + identifier + '.mustache',
@alunny
alunny / thumbs.alunny.js
Created March 2, 2011 07:36 — forked from mwbrooks/thumbs.alunny.js
455 bytes bitches
(function(window, document, notDefined) {
/**
* Do not use thumbs.js on touch-enabled devices
*/
if (document.ontouchstart!=notDefined) return;
/**
* Map touch events to mouse events
*/
@alunny
alunny / styleDiff.js
Created March 12, 2011 20:53
check which styles are different bw two html elements
// check which style properties are different between two DOM elements
// obv. needs a browser with getComputedStyle
function styleDiff(first, second) {
var oneStyle = getComputedStyle(first),
twoStyle = getComputedStyle(second),
diff = [],
i,
prop;
for (i = 0; i < oneStyle.length; i++) {
# sed in place, for OS X (Darwin) and Linux
# user-agent detection - probably not the best way
DASHI=''
unamestr=`uname`
if [[ "$unamestr" == 'Linux' ]]; then
DASHI="-i"
elif [[ "$unamestr" == 'Darwin' ]]; then
DASHI='-i ""'
@alunny
alunny / inane.txt
Created April 21, 2011 22:47
xui demo
This is some text right here