Skip to content

Instantly share code, notes, and snippets.

@subtleGradient
subtleGradient / animation.js
Created April 29, 2010 18:12
Simple animation implementation uses CSS Animation where available uses MooTools' Fx for other browsers
/*
---
name : Animation
provides : Animation
description : |
Simple animation implementation
uses CSS Animation where available
uses MooTools' Fx for other browsers
authors : Valerio Proietti (http://mad4milk.net)
@subtleGradient
subtleGradient / git-transmit
Created April 26, 2010 19:11
git-transmit opens your recently modified files using Panic's Transmit.app DockSend
#!/usr/bin/env bash
# author: Thomas Aylott SubtleGradient.com
echo "Transmitting"
for i in `git log -${1:-1} $2 --name-only|grep -E '^[^ ]+$'|sort|uniq`; do
if [[ -e $i ]]; then
echo " $i"
open -a Transmit $i
fi
done
@subtleGradient
subtleGradient / gitT
Created April 14, 2010 20:27
Open the most recently changed files from your git log using Panic's Transmit.app
echo "Transmitting"
for i in `git log -${1:-1} --name-only|grep -E '^[^ ]+$'|sort|uniq`; do
if [[ -e $i ]]; then
echo " $i"
open -a Transmit $i
fi
done
var iterations = 999999, control = '', eq_same = '', seq_same = '', eq_diff = '', seq_diff = '', st, en;
setTimeout(function(){
st = +new Date();
for (i = 0; i < iterations; i++);
en = +new Date();
control = en - st;
print();
},100);
@subtleGradient
subtleGradient / global.jq.js
Created April 9, 2010 05:15
HTML5 Template with className states and browser detection
// Swap classes onload and domready
$(function(){ $('html').removeClass('not-ready').addClass('ready'); }); // jQuery
$(window).load(function(){ $('html').removeClass('loading').addClass('loaded'); });
// target a specific version
if (navigator.isIE == 6){
// do stuff for IE6
}
// Deliever different behaviour for a group of IE versions
var Person = Class.subclass(function(def, Protected, Generic, Parent){
// Private
// Available to all methods in this definition
var private_variable;
// Protected
// Available to this Class, its instances, all subclasses and all their instances
// Protected methods are bound to each instance
Array.append(array,array2) // MooTools 1.3wip
Array.clean(array) // MooTools 1.3wip
Array.combine(array,array2) // MooTools 1.3wip
Array.concat(array[,item1[,item2[,...]]]) // JavaScript 1.6
Array.contains(array,item[,from]) // MooTools 1.3wip
Array.empty(array) // MooTools 1.3wip
Array.erase(array,item) // MooTools 1.3wip
Array.every(array,callback[,thisObject]) // JavaScript 1.6
Array.every(array,fn[,bind]) // MooTools 1.3wip
Array.filter(array,callback[,thisObject]) // JavaScript 1.6
@subtleGradient
subtleGradient / HTML 5.tmLanguage
Created March 2, 2010 17:41
HTML 5 tmLanguage TextMate Language Syntax Parser thing
<?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>bundleUUID</key>
<string>4A3012B7-3A3F-4B2A-871C-2E6266BC0A21</string>
<key>fileTypes</key>
<array>
<string>html</string>
<string>htm</string>
@subtleGradient
subtleGradient / getArg.without-arguments.js
Created February 22, 2010 18:34
Rough proof-of-concept on how to get an array of arguments with accessing `arguments`. Needs benchmarking to verify that it actually improves performance; Could be optimized
/*
---
source : http://gist.github.com/gists/311328
provides : getArg
description : Get an array of arguments with accessing `arguments`
version : Rough proof-of-concept
author : Thomas Aylott
site : SubtleGradient.com
@subtleGradient
subtleGradient / big.MyDBDSL.jQ.js
Created February 22, 2010 03:01
Mythical syntax experiment if there were other jQuery-esque DSLs for other things
// Do some more of the same sort of stuff with another DB search
// Bind the DB to the UI
MyDBDSL("#big")
.change(function(){
var rows = MyDBDSL(this).rows();
jQuery("#products #big").removeClass('db-error')
.find("form .db-invalid").removeClass('db-invalid').end()
.find("table").html( rows.html() );
})