<%= f.input :state, :collection => ['SA', 'WA'] %> <%= f.input :state,
:as => :radio_buttons,
| class Notifier < ActionMailer::Base | |
| delivers_from 'notifications@example.com' | |
| def welcome(user) | |
| @user = user # available to the view | |
| mail(:subject => 'Welcome!', :to => user.email_address) | |
| # auto renders both welcome.text.erb and welcome.html.erb | |
| end | |
| def goodbye(user) |
| These are some snips to help you converting video to flash and thumbnails using ruby and paperclip. | |
| Needed: ffmpeg & flvtool, RVideo gem, paperclip | |
| Converting the video is done using outside of paperclip, as this could take quite a while. Paperclip by default does it's conversions during the request, and the last thing you want is a request hanging for 10minutes while ffmpeg does it's thing. It is advised to do this conversion somewhere in the background using Resque or DelayedJob. (make sure not to run to many conversions at one time on your machine) | |
| Most video thumbnailing solutions out there will create all thumbnails from the video. This solution (on paperclip 2.3.0) however will create one large "temp_thumbnail" once and all consequent thumbnails can use this temporary version. | |
| VideoGeometry will make sure that the target dimensions for ffmpeg are always a multiple of 2 and as close as possible to the desired dimensions without breaking the aspect ratio of the original video. |
| class AddAttachmentsDataToWrapper < ActiveRecord::Migration | |
| def self.up | |
| add_column :wrappers, :data_file_name, :string | |
| add_column :wrappers, :data_content_type, :string | |
| add_column :wrappers, :data_file_size, :integer | |
| add_column :wrappers, :data_updated_at, :datetime | |
| end | |
| def self.down | |
| remove_column :wrappers, :data_file_name |
| var express = require('express'); | |
| var redis = require('redis'); | |
| const serverType = process.argv[2]; | |
| const serverHost = process.argv[3]; | |
| const serverPort = parseInt(process.argv[4]); | |
| const redisPort = 6379; | |
| const redisHost = '127.0.0.1'; |
| # Forked to get it working with Rails 3 and RSpec 2 | |
| # | |
| # From http://github.com/jaymcgavren | |
| # | |
| # Save this as rcov.rake in lib/tasks and use rcov:all => | |
| # to get accurate spec/feature coverage data | |
| # | |
| # Use rcov:rspec or rcov:cucumber | |
| # to get non-aggregated coverage reports for rspec or cucumber separately |
| curl -s -XPOST localhost:9200/_bulk?pretty=true --data-binary ' | |
| { "index" : { "_index" : "parent_child", "_type" : "store", "_id" : "store1" } } | |
| { "name" : "auchan", "owner" : "chris" } | |
| { "index" : { "_index" : "parent_child", "_type" : "department", "_id" : "department1", "parent" : "store1" } } | |
| { "name" : "toys", "numberOfProducts" : 150 } | |
| { "index" : { "_index" : "parent_child", "_type" : "product", "_id" : "product1", "parent" : "department1", "routing" : "store1" } } | |
| { "name" : "gun", "trademark" : "tiger", "price" : 9, "store_id" : "store1" } | |
| ' |
Follow the steps below to install Team City 9.0.3 on Ubuntu with Nginx as the proxy for port 80.
Install Team City:
# will install on port 8111
sudo wget -c https://gist.githubusercontent.com/sandcastle/9282638/raw/teamcity-install.sh -O /tmp/teamcity-install.sh
| #Model | |
| @user.should have(1).error_on(:username) # Checks whether there is an error in username | |
| @user.errors[:username].should include("can't be blank") # check for the error message | |
| #Rendering | |
| response.should render_template(:index) | |
| #Redirecting | |
| response.should redirect_to(movies_path) |
| # Compiled source # | |
| ################### | |
| *.com | |
| *.class | |
| *.dll | |
| *.exe | |
| *.o | |
| *.so | |
| # Packages # |