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
$.sort_by_numbers = (ulClass, number) -> | |
$("ul.#{ulClass} li").sort (a, b) -> | |
if parseInt($(a).data("#{number}")) > parseInt($(b).data("#{number}")) then 1 else -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
$.sort_by_words = (ulClass, name) -> | |
$("ul.#{ulClass} li").sort (a, b) -> | |
if $(a).data("#{name}").toLowerCase() > $(b).data("#{name}").toLowerCase() then 1 else -1 | |
.appendTo("ul.#{ulClass}") |
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
# ActiveRecord migration by @bridgeutopia (http://www.blog.bridgeutopiaweb.com/post/activerecord-migrations-for-sinatra/) | |
# Added "rake reverse_migrate" to do reverse migration | |
require 'rake' | |
require 'active_record' | |
require 'logger' | |
require 'yaml' | |
desc "Import DB" | |
task :import => :environment do |
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
// get url parameters with javascript (e.g.: sample.html?udid=123&device=iphone) | |
function getURLParams() { | |
var params= new Object(); | |
var query = window.location.search.substring(1); | |
var pairs = query.split('&'); | |
for (var i=0; i<pairs.length; i++) { | |
var pos = pairs[i].indexOf('='); | |
if (pos > 0) { | |
var key = pairs[i].substring(0,pos); | |
var val = pairs[i].substring(pos+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
module ActiveRecord | |
class Base | |
def set_attr(key,value) | |
write_attribute(key, value) | |
end | |
def get_attr(key) | |
read_attribute(key) | |
end | |
end |
NewerOlder