When working with times and dates in Rails applications, you need to deal with the following problem: In Rails, Time...
This will eventually be integrated into jQuery UI with the multiple: true option, but right now this is the way...
Use this if you want to show or hide part of a form if certain options are selected or boxes...
jamesgolick / resource_controller at Github module ResourceController module Actions def index load_collection before :index response_for :index end
So you screwed up and copied Paperclip secrets from one project to another. Here is a semi-automatic, painful way...
Show all sockets (Unix & TCP/UDP), both listening and established ones: netstat -anp To limit the output e.g. to listening TCP...
Ruport’s acts_as_reportable module provides support for using ActiveRecord for data collection. You can use it to get...
When doing a query like this: SELECT id FROM users WHERE (users.id IN (899,1084,1095,100,2424,2429,2420...
An alternative to this technique is using VCR. VCR allows you to record and replay real HTTP responses, saving you...
String manipulation extensions for the Underscore.js javascript library.
This method is defined automatically and only given for boolean attributes create_table "users", :force => true do |t| t.boolean "email...
validates_attachment_content_type :image, :content_type => /^image\/(jpg|jpeg|pjpeg|png|x-png|gif)$/, :message => 'file type is not...
Open the configuration file: gksudo gedit /usr/share/vte/termcap/xterm Find a line like this: :co#80:it#8:li#24:\
In a nutshell: to avoid your shell character set from messing with imports, use -r to export and SOURCE when...
ALTER DATABASE database_name CHARACTER SET "utf8"; ALTER DATABASE database_name COLLATE "utf8_unicode_ci"; After that, for...
Ancestry is a gem/plugin that allows the records of a Ruby on Rails ActiveRecord model to be organised as a...
In Webkit you can use the HTML5-attribute autofocus: = form.text_field :title, :autofocus => 'autofocus' Here is a jQuery fallback for...
This may be awkward to set up, but will work once you're done. Fun facts:
Unless all MySQL server defaults are set to UTF-8, mysqldump encodes UTF-8 characters incorrectly and only outputs correct...
Most of these will not work in newer projects because these use the Capybara/Rack::Test combo in lieu of Webrat...
When a paperclip attachment gains a new style and you have many attachments, reprocessing can take ages. This is because...
has_attached_file( :avatar, :styles => { :large => "300x300", :small => "100x100" }, :convert_options => { all => "-colorspace RGB" } )
script/runner -e development 'Article.all.each { |a| a.image.reprocess! if a.image.exists? }; "done"'
To test concurrent code, you will need to run multiple threads. Unfortunately, when you use blocking system calls (e.g. locks...