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
@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
<html>
<body></body>
<script src="phonegap.js"></script>
<script>
function assert(msg, booleanCondition) {
if (!booleanCondition) {
alert("assertion failed: " + msg);
return false;
} else {
return true;
@alunny
alunny / dates.rb
Created July 13, 2011 19:24
pulling times out of git
require 'time'
def all_dates filename
`git log --pretty=format:%ai #{ filename }`.split("\n")
end
def created_at filename
Time.parse all_dates(filename).last
end