<%= f.input :state, :collection => ['SA', 'WA'] %> <%= f.input :state,
:as => :radio_buttons,
| 0-mail.com | |
| 0815.ru | |
| 0clickemail.com | |
| 0wnd.net | |
| 0wnd.org | |
| 10minutemail.com | |
| 20minutemail.com | |
| 2prong.com | |
| 30minutemail.com | |
| 3d-painting.com |
| require "bundler/capistrano" | |
| server "server", :web, :app, :db, primary: true | |
| set :application, "<application>" | |
| set :user, "<user>" | |
| set :group, "wheel" | |
| set :deploy_to, "/home/#{user}/apps/#{application}" | |
| set :deploy_via, :remote_cache | |
| set :use_sudo, false |
| #!/bin/bash | |
| #Warsync - a tool for speeding up rsync of war files by unzipping them on the source and target and then rsyncing the diffs | |
| echo "Usage: $0 source.war destinationserver" | |
| CURRENTDIR=$PWD | |
| WARFILE="$CURRENTDIR/$1" | |
| REMOTEHOST=$2 | |
| CURRENTUSER=$USER | |
| REMOTEHOME="/home/$CURRENTUSER" | |
| WARFILENAME=`basename $1` | |
| echo "source is $WARFILE target is $TARGET" |
| { | |
| "Version": "2008-10-17", | |
| "Id": "0c762de8-f56b-488d-a4a4-20d1cb31df2f", | |
| "Statement": [ | |
| { | |
| "Sid": "Allow in my domains", | |
| "Effect": "Allow", | |
| "Principal": { | |
| "AWS": "*" | |
| }, |
| # define a method to run rake tasks | |
| def run_rake(task, options={}, &block) | |
| rake = fetch(:rake, 'rake') | |
| rails_env = fetch(:rails_env, 'production') | |
| command = "cd #{current_path} && #{rake} #{task} RAILS_ENV=#{rails_env}" | |
| run(command, options, &block) | |
| end |
Rails flash messages with AJAX requests
| upstream myapp { | |
| server unix:///myapp/tmp/puma.sock; | |
| } | |
| server { | |
| listen 80; | |
| server_name myapp.com; | |
| # ~2 seconds is often enough for most folks to parse HTML/CSS and | |
| # retrieve needed images/icons/frames, connections are cheap in |
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
| fields = [:switch, :sha_ind, :dtdm, :utdm, :ttdm, :actual] | |
| def create_struct name, fields | |
| Struct.new(name, *fields) | |
| end | |
| def create_singleton_struct name, fields | |
| if Struct::const_defined? name | |
| Struct.const_get name | |
| else |