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
# Rails Template: something_great.rb | |
# by Jim Garvin (coderifous) | |
# | |
# * shoulda/mocha/factory girl | |
# * pacecar for lots of automatic scopes | |
# * haml | |
# * sprockets for javascript management | |
# * will paginate | |
# * limerick_rake gives some nice utilities | |
# * asks for a hoptoad API key, and if given, will setup hoptoad initializer |
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
movie.rb: | |
# With help from | |
# http://almosteffortless.com/2008/12/11/easy-upload-via-url-with-paperclip/ | |
has_attached_file :poster, | |
:styles => { | |
:small => "150x150>" | |
} |
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
// An Unobtrusive Javascript (UJS) driver based on explicit behavior definitions. Just | |
// put a "data-behaviors" attribute on your view elements, and then assign callbacks | |
// for those named behaviors via Behaviors.add. | |
var Behaviors = { | |
observers: {}, | |
observe: function(trigger) { | |
$(document.body).observe(trigger, this.onTrigger.bind(this)); | |
}, |
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
<script type="text/javascript"> | |
$(document).ready(function() { | |
var href = $("#redirect_url")[0].href; | |
$("a#replace_me").attr("href", href); | |
$("a#replace_me").text(href); | |
$("#redirect_to").hide(); | |
}); | |
</script> | |
<p>Greetings. We are now redirecting you to the site that you requested.</p> |
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
<p id="redirect_to">You will be redirected to the following URL in 5 seconds: <a id="redirect_url" href="<your link's url>"><Your link's url></a></p> |
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 Rating < ActiveRecord::Base | |
belongs_to :user | |
belongs_to :rater, :class_name => 'User', :foreign_key => 'rater_id' | |
belongs_to :account | |
attr_accessible :score, :rater_id, :user_id, :rater, :user | |
VALID_SCORES = 1..3 | |
validates_presence_of :score, :user_id, :rater_id, :account_id |
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
Autotest.add_hook :initialize do |autotest| | |
%w{.git .svn .hg .DS_Store ._* vendor tmp log doc solr}.each do |exception| | |
autotest.add_exception(exception) | |
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
#!/usr/bin/env ruby | |
require 'bundler' | |
gems = ARGV | |
if gems.empty? | |
puts "Updating all gems" | |
Bundler.definition(true) |
OlderNewer