This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//artificially delay a javascript redirect w/anonymous function | |
//n represents delay in seconds | |
(function(){ | |
var i,c=0,n=3; | |
i=window.setInterval(function(){ | |
if(c++==n){ | |
window.clearInterval(i); | |
top.location='http://redirect-here.tld/'; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function $arr(xargs) { | |
return Array.prototype.slice.call(xargs); | |
} | |
//sample usage: | |
function someotherfn(arg1,arg2,arg3){ | |
$args = $arr(arguments); | |
$args.sort(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
em { | |
font-weight: bold; | |
font-style: normal; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Cross-browser object.watch and object.unwatch | |
// object.watch | |
if (!Object.prototype.watch) { | |
Object.prototype.watch = function (prop, handler) { | |
var oldval = this[prop], newval = oldval, | |
getter = function () { | |
return newval; | |
}, | |
setter = function (val) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// the agility of javascript's ternary operation... | |
// lots of folks don't seem aware of the subsequent assignments available | |
function ternary(a,b) { | |
var c,d,tis=''; | |
c = (d = a==b) ? tis='tis true' : tis='tis false'; | |
return [c,d,tis]; | |
} | |
console.log(ternary(true,true)); | |
console.log(ternary(true,false)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
// require https://github.com/pmcelhaney/Mustache.cfc | |
mustache = createobject('component','cfc/mustache');//dump(mustache); | |
//view template: | |
hello_templ = '<h1>Hello, {{thing}}</h1>'; | |
//model object: | |
hello_model = { | |
thing = 'Mustache' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* JavaScript whatevCache - v0.2pre - 12/30/2010 | |
* http://benalman.com/ | |
* | |
* Copyright (c) 2010 "Cowboy" Ben Alman | |
* Dual licensed under the MIT and GPL licenses. | |
* http://benalman.com/about/license/ | |
*/ | |
// whatevCache.set( key, value [, ttl ] ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// replace 'foo' with the name of the plugin, etc | |
(function($){ | |
$.fn.foo = function(opts) { | |
var settings = $.extend({}, $.fn.foo.defaults, opts); | |
return this.each(function() { | |
var $this = $(this); | |
// plugin code here... | |
}); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
writeoutput( | |
stache.render( | |
$.getTMPL(mustache_path & "navigation.mustache"), | |
$.getJSON(fixtures_path & "navigation.json") | |
) | |
); | |
</cfscript> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# modes | |
use strict; | |
use warnings; | |
# modules | |
use Text::CSV; | |
my $csv = 'DATA.TXT'; |
OlderNewer