Skip to content

Instantly share code, notes, and snippets.

View jeremyckahn's full-sized avatar

Jeremy Kahn jeremyckahn

View GitHub Profile
<html>
<head>
<script type="text/javascript">
// inits
var loopLimit = 100000000,
countLimit = 5,
wait = 500;
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>index</title>
<meta name="generator" content="TextMate http://macromates.com/">
<meta name="author" content="arcus">
<!-- Date: 2010-08-04 -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>
/* Cachey jQuery Plugin
*
* A collaboration between:
*
* Ross Davidson - draggor@gmail.com
* Jeremy Kahn - jeremyckahn@gmail.com
* Ben Mills - ben@bmdev.org
*
* To use, simply load this script after you load jQuery. As elements are selected, they are cached.
* When they are called again, the cached reference is called automatically, there is no DOM traversal.
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>index</title>
<meta name="generator" content="TextMate http://macromates.com/">
<meta name="author" content="arcus">
<!-- Date: 2010-08-04 -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>
// Specify an event handler for a given event and phase
HTMLNode.prototype.addEventListener = function(eventName, handler, phase){
// Make a __handlers object on this element if there is none already
if(!this.__handlers){
this.__handlers = {};
}
// If there are no event handler lists for this event, add them
if(!this.__handlers[eventName]){
this.__handlers[eventName] = {capture : [], bubble: []};
/*
jQuery Value Easer v0.1
by Jeremy Kahn - jeremyckahn@gmail.com
Idea of animating a detached DOM element inspired from Ben Nadel:
http://www.bennadel.com/blog/2007-Using-jQuery-s-animate-Method-To-Power-Easing-Based-Iteration.htm
Sample usage:
$.valEase({
@jeremyckahn
jeremyckahn / downloadframework
Created October 17, 2010 18:41
BASH script to download and install all of the JavaScriptMVC framework from Github.
# Download script...
# Does not yet account for individual user forks, but at least gets all the code onto your machine.
git clone git@github.com:jupiterjs/javascriptmvc.git
cd javascriptmvc
git submodule init
git submodule update
git submodule foreach git checkout master
@jeremyckahn
jeremyckahn / JS object ordering
Created December 10, 2010 03:53
Forcing property orders for browsers
// This code shows how to order the properties of an object numerically.
var a = {}, _a = {}, arr = [], i, p;
a[100] = '100';
a[5] = '5';
a[75] = '75';
for (i in a){
arr.push(parseInt(i, 10));
@jeremyckahn
jeremyckahn / .bash_profile
Created February 16, 2011 05:45
For Mac.
export PATH=$HOME/local/node/bin:$PATH
alias ls='ls -lah'
alias closure='java -jar ~/Documents/Tools/compiler-latest/compiler.jar'
alias svnaddall='svn status | grep -v "^.[ \t]*\..*" | grep "^?" | awk '{print $2}' | xargs svn add'
@jeremyckahn
jeremyckahn / svnaddall.sh
Created March 3, 2011 16:32
Adds a whole bunch o' shit to an SVN repo
# Adds a whole bunch o' shit to an SVN repo
# http://codesnippets.joyent.com/posts/show/45
svn status | grep -v "^.[ \t]*\..*" | grep "^?" | awk '{print $2}' | xargs svn add