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
window.cookies = { | |
set: function(name, value, days) { | |
if (name) { | |
if (days) { | |
var date = new Date(); | |
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); | |
var expires = "; expires=" + date.toGMTString(); | |
} | |
else { | |
var expires = ""; |
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
before_filter :hash_options | |
def hash_options | |
params[:options] = Hash[*((params[:options].size % 2) == 0) ? params[:options] : (params[:options] + [nil])] if params[:options] | |
end |
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(){ | |
var eventMatchers = { | |
'HTMLEvents': /^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/, | |
'MouseEvents': /^(?:click|mouse(?:down|up|over|move|out))$/ | |
} | |
var defaultOptions = { | |
pointerX: 0, | |
pointerY: 0, | |
button: 0, | |
ctrlKey: 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
namespace :tmp do | |
namespace :assets do | |
desc "Clears javascripts/cache and stylesheets/cache" | |
task :clear => :environment do | |
FileUtils.rm(Dir['public/javascripts/cache/[^.]*']) | |
FileUtils.rm(Dir['public/stylesheets/cache/[^.]*']) | |
end | |
end | |
end |
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
window.scope = "window"; | |
Function.prototype.bind = function(scope) { | |
var _function = this; | |
return function() { | |
return _function.apply(scope, arguments); | |
} | |
} |
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.prototype.bind = function(scope) { | |
_function = this; | |
return function() { | |
_function.apply(scope, arguments); | |
} | |
} | |
window.scope = "window"; |
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
Hash.fromQueryString = function(string) { | |
var hash = new Hash(); | |
var array = string.gsub(/^#/, '').split(/=|&/); | |
for (var i = 0; i < array.length; i+=2) { | |
if(array[i +1] != undefined) { | |
hash.set(array[i], array[i + 1]); | |
} | |
} |
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
name.downcase.gsub(/'/, "").gsub(/[^[:alnum:]]/, "_").gsub(/_{2,}/, "_").gsub(/^_|_$/, "") | |
# scrub out: ^contractions ^non-alpha-num characters ^extra underscores ^other underscores |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Custom jQuery Filter with Parameters</title> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> | |
<script type="text/javascript"> | |
(function($) { | |
$.expr[':'].hasTitle = function(elem, index, list) { | |
var params = eval("([" + list[2] + list[3] + list[2] + "])"); | |
for (var i = 0; i < params.length; i++) { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>RegEx jQuery Filter</title> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> | |
<script type="text/javascript"> | |
(function($){ | |
$.expr[':'].regex = function(elem, index, match) { | |
var matchParams = match[3].split(','), | |
validLabels = /^(data|css):/, |
OlderNewer