This file contains 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
class Element < ActiveRecord::Base | |
attr_accessible :target_type, :target_id, :reason | |
def target | |
target_type.constantize.find target_id | |
rescue | |
nil | |
end |
This file contains 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/env ruby | |
# resolve bin path, ignoring symlinks | |
require "pathname" | |
bin_file = Pathname.new(__FILE__).realpath | |
# add self to libpath | |
path = File.expand_path("../../lib", bin_file) | |
$LOAD_PATH.unshift path |
This file contains 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
url = "http://api.education.com/service/service.php?f=schoolSearch&key=mykey&sn=sf&v=4&latitude=41.6054224116913&longitude=-87.8814947605133&distance=5&resf=json&callback="; | |
$.getJSON(url, function(data) { console.log(data); }) | |
.success(function() { alert("second success"); }) | |
.error(function() { alert("error"); }) | |
.complete(function(data) { console.log(data); }); |
This file contains 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
class Application < Sinatra::Base | |
use CoffeeHandler | |
get '/' do | |
slim :page | |
end | |
get '/works' do | |
slim :page |