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 Lesson < ActiveRecord::Base | |
belongs_to :period | |
validates_presence_of :period_id | |
end | |
class Period < ActiveRecord::Base | |
has_many :lessons, :dependent=>:delete_all | |
validates_associated :lessons | |
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
if Rails.configuration.try(:sass) | |
Rails.application.config.middleware.delete(Sass::Plugin::Rack) | |
Rails.configuration.sass.tap do |config| | |
config.load_paths << "#{Gem.loaded_specs['compass'].full_gem_path}/frameworks/compass/stylesheets" | |
config.preferred_syntax = :sass | |
end | |
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
Views = { | |
render: function (name, locals) { | |
var tmpl = $("[name=" + name + "]").html(); | |
var locals = locals || {}; | |
return require("jade.js").compile(tmpl)(locals); | |
}, | |
replace: function (sel, name, locals) { | |
return sel.html(this.render(name, locals)); | |
} |
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
Uploads.setup = function (options) { | |
var defaults = { | |
runtimes: 'html5, flash, html4', | |
url: '/', | |
browse_button : 'pickfiles', | |
container : 'container', | |
max_file_size : '10mb', | |
filters : [ | |
{title : "Image files", extensions : "jpg,jpeg,gif,png"} | |
], |
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
When 'I add some pictures' do | |
path = File.expand_path(File.join(Rails.root, 'test', 'fixtures', 'dummy_image.png')) | |
find("input[type=file]").set(path) | |
page.execute_script("App.Uploads.uploader.start()") | |
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 | |
require 'csv' | |
require 'json' | |
if ARGV.size != 2 | |
puts 'Usage: csv_to_json input_file.csv output_file.json' | |
puts 'This script uses the first line of the csv file as the keys for the JSON properties of the objects' | |
exit(1) | |
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
$sprite-height: 0px; | |
@each $state in ordered, contacted, certified, in_transport_to_dealer, client_available, client_delivered{ | |
.#{$state}{ | |
background-position:left $sprite-height; | |
$sprite-height: $sprite-height - 100; | |
} | |
} |
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
window.$ = new class Dollar | |
class Wrapper | |
#Utility function that returns the classes of the current object, except name | |
allClassesExceptOne = (name, elem) -> | |
(cl for cl in elem.className.split(" ") when cl isnt name and cl isnt "") | |
constructor: (elem) -> | |
elem extends Wrapper.prototype | |
return elem |
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
require 'eventmachine' | |
require 'em-http' | |
require 'fiber' | |
def async_fetch(url) | |
f = Fiber.current | |
http = EventMachine::HttpRequest.new(url).get | |
http.callback { f.resume(http) } | |
return Fiber.yield | |
end |
OlderNewer