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 you have the following setup, Rails autoload will depend on load order in a hard-to-trace way: | |
# app/models/foo.rb | |
class Foo | |
def initialize(arg) | |
@arg = arg | |
end | |
end | |
# app/models/foo/bar.rb |
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
# in an early initializer | |
def PinMonkeypatch!(gem_name, expected_version) | |
if gem_spec = Gem.loaded_specs[gem_name] | |
actual_version = gem_spec.version.to_s | |
if actual_version != expected_version | |
raise "Monkeypatch for #{gem_name} requires version "\ | |
"#{expected_version}, but current version is #{actual_version}" | |
end | |
else |
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
-- here's my start.sh -- | |
cd /var/www/tshirts/current && nohup thin start -e production -p6000 -s3 -d && cd /var/www/tshirts/current && nohup rake jaxer:sync:staging; export DISPLAY=":80" && nohup Xvfb :80 -screen 0 1280x1024x24 & nohup /opt/AptanaJaxer/scripts/start.sh | |
-- here's my cap deploy:start -- | |
task :start, :roles => [:web, :db, :app] do | |
run "#{deploy_to}/current/config/start.sh" | |
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
class Color | |
def hex | |
[@red, @green, @blue].map do |el| | |
r = el.to_s(16) | |
r = '0' + r if r.size < 2 | |
r | |
end.join | |
end | |
alias_method :to_s, :hex |
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 PagesController < ApplicationController | |
def index | |
respond_to do |format| | |
format.js { render :template => "pages/#{params['path']}"} | |
end | |
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
# step 1 | |
def index | |
respond_to do |format| | |
format.js {render_erb} | |
end | |
end | |
# step 2 | |
def index |
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
Paperclip::Attachment.interpolations[:hashed_id_3x3] = lambda do |attachment, style| | |
hash = Digest::MD5.hexdigest(attachment.instance.id.to_s) | |
hash_path = '' | |
3.times { hash_path += '/' + hash.slice!(0..2) } | |
hash_path(1..12) | |
end | |
Paperclip::Attachment.interpolations[:hashed_id] = lambda do |attachment, style| | |
Digest::MD5.hexdigest(attachment.instance.id.to_s) | |
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 gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:Compatibility> <w:BreakWrappedTables /> <w:SnapToGridInCell /> <w:ApplyBreakingRules /> <w:WrapTextWithPunct /> <w:UseAsianBreakRules /> <w:UseFELayout /> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--> <!-- /* Font Definitions */ @font-face {font-family:SimSun; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 680460288 22 0 262145 0;} @font-face {font-family:\"\\@SimSun\"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 680460288 22 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:\"\"; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:\"Times New Roman\"; mso-fareast-font-family:SimSun;} @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
- [F] sqlite3-ruby | |
- [F] flexmock | |
- [F] turn | |
- [ ] hoe = 1.8.2 | |
- [ ] rubyforge = 1.0.1 | |
- [I] rake = 0.8.3 | |
- [F] rcov | |
- [F] paperclip | |
- [F] mime-types | |
- [R] rubyzip = 0.9.1 |
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
gem_plugin (0.2.3) | |
gemsonrails (0.7.2) | |
rubygems-update (1.3.1, 1.3.0, 1.2.0, 1.1.1) |