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
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :jquery => ['jquery', 'jquery-ui', 'rails'] | |
ActiveSupport.on_load(:action_view) do | |
ActiveSupport.on_load(:after_initialize) do | |
ActionView::Helpers::AssetTagHelper::register_javascript_expansion :defaults => ['jquery', 'jquery-ui', 'rails'] | |
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
{22:21}[ruby-1.9.2@testapp]~/Desktop/testapp@master✗✗✗ ben% autotest | |
loading autotest/rspec2 | |
^CInterrupt a second time to quit | |
^C% |
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
0) Be nice, but not too nice. | |
1) Do no serious harm | |
2) No serious Rails or Ruby questions | |
3) Leave the gun. Take the cannoli. |
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
{16:24}[ruby-1.9.2]~/Desktop ben% rails new testapp -m https://github.com/benlangfeld/rails-templates/raw/master/base.rb | |
....normal rails new output..... | |
The template [/Users/ben/Desktop/https:/github.com/benlangfeld/rails-templates/raw/master/base.rb] could not be loaded. Error: Could not find "/Users/ben/Desktop/https:/github.com/benlangfeld/rails-templates/raw/master/base.rb" in any of your source paths. Your current source paths are: | |
/Users/ben/Developer/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.3/lib/rails/generators/rails/app/templates |
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
var rosterPushParams = [CPDictionary dictionaryWithObjectsAndKeys:@"iq", @"name", Strophe.NS.ROSTER, @"namespace", @"type", @"set"]; | |
[_connection registerSelector:@selector(_didReceiveRosterPush:) ofObject:self withDict:rosterPushParams]; |
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
class IntervalArray < Array | |
attr_reader :range, :step_size | |
def initialize(range, step_size = 1) | |
super() | |
@range = range | |
@step_size = step_size | |
regenerate | |
end | |
def range=(range) |
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
puts :hi |
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
var countyOptionsTemplate = new EJS({text: "<option value=''></option><% for(var i=0; i<data.length; i++) { %><option value='<%= i %>'><%= data[i]['name'] %> County</option><% } %>"}); | |
var locationData = new Object(); | |
function GetScopedCounties(e) { | |
var selectedState = $('#LocationState').val(); | |
if (!selectedState) { | |
return; | |
} | |
countyOptionsTemplate.update('LocationCounty', locationData[selectedState].counties); | |
} |
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
def self.get_breaking_news(min) | |
doc = Hpricot.XML open("http://bensbargains.net/rss.xml/") | |
cutoff_time = Time.now - 60 * min | |
(doc/"item").map do |item| | |
profit_margin = (temp_deal.cost_retail.nil? || temp_deal.cost.nil?) ? nil : temp_deal.cost_retail - temp_deal.cost | |
Deal.new :name => (item/"title").inner_html, :description => (item/"description").inner_text + (item/"link").inner_html, :guid => (item/"guid").inner_html, :cost => get_price(temp_deal.name), :cost_retail => get_price_retail(temp_deal.description), :profit_margin => profit_margin, :source => "bensbargains" | |
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
class ActiveRecord::Base | |
def skip_stamp | |
self.record_timestamps = false | |
yield | |
self.record_timestamps = true | |
end | |
end |