Skip to content

Instantly share code, notes, and snippets.

View cmcculloh's full-sized avatar

Christopher McCulloh cmcculloh

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Conforming XHTML 1.0 Strict Template</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script>
<script type="text/javascript">
$(function(){
$("#selectBoxId").change(function(){
var selectedValue = $(this).find(":selected").val();
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Conforming XHTML 1.0 Strict Template</title>
<style>
@-webkit-keyframes turnit{
from{
-webkit-transform: rotate(0deg);
}
cQuery.animations = [];
setInterval("cQuery.runAnimations()", 100);
cQuery.runAnimations = function(){
for(var i=0; i < cQuery.animations.length; i++){
cQuery.animations[i].animation();
}
}
<?
$n = 10;
$i = 3;
if(calc($n) < calc($i){
import os
def listDirectory(directory, tabStops, originalPath):
tabStops = tabStops + "\t"
os.chdir(directory)
newPath = os.getcwd()
dirlist = os.listdir(".")
@cmcculloh
cmcculloh / post-receive-email
Created November 18, 2010 19:52
Example of a post receive email file called by a git hook that sends a color coded formatted html email of the git diff
#!/bin/sh
#
# Copyright (c) 2007 Andy Parkins
#
# An example hook script to mail out commit update information. This hook
# sends emails listing new revisions to the repository introduced by the
# change being reported. The rule is that (for branch updates) each commit
# will appear on one email and one email only.
#
# This hook is stored in the contrib/hooks directory. Your distribution
@cmcculloh
cmcculloh / speed test
Created January 14, 2011 17:46
Speed testing local vs namespaced vs global var
var n = 0,
i = 0,
GL = {
i: 0,
};
//incrementation on a local variable
console.time('local');
n = 0;
while(n < 2000000){
@cmcculloh
cmcculloh / Old Busted Loop
Created January 14, 2011 19:55
Classic JS loop...
for(i = 0; i < Obj.length; i++){}
@cmcculloh
cmcculloh / Better Loop
Created January 14, 2011 19:56
A better version of the classic
for(i = 0, ii = Obj.length; i < ii; i++){}
@cmcculloh
cmcculloh / Best Loop
Created January 14, 2011 19:57
This one is the shortest in execution time
for(i = Obj.length; i--;){}