(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| " Switch wrap off for everything | |
| set nowrap | |
| if has("autocmd") | |
| " This is probably in your .vimrc already. No need to duplicate! | |
| filetype plugin indent on | |
| " Set File type to 'text' for files ending in .txt | |
| autocmd BufNewFile,BufRead *.txt setfiletype text |
| #!/bin/bash | |
| APP_NAME="your-app-name-goes-here" | |
| APP_PATH=/home/deploy/${APP_NAME} | |
| # Production environment | |
| export RAILS_ENV="production" | |
| # This loads RVM into a shell session. Uncomment if you're using RVM system wide. | |
| # [[ -s "/usr/local/lib/rvm" ]] && . "/usr/local/lib/rvm" |
| -- model | |
| some sort of constant hash: | |
| HASH_NAME = { | |
| 0 => "Choose:", | |
| 1 => "On-Campus Recruiting - CSO",· | |
| 2 => "CSO Staff Referral", | |
| 3 => "Faculty Contact",· | |
| 4 => "Career Day",· | |
| 5 => "CSO Summer Job Listing",· | |
| 6 => "Alumni Contact",· |
| # put this file in spec/javascripts/support directory | |
| require 'barista' | |
| require 'logger' | |
| require File.join(Rails.root, 'config/initializers/barista_config') | |
| Barista.configure do |c| | |
| c.env = 'test' | |
| c.logger = Logger.new(STDOUT) |
| define(function(require) { | |
| var sinon = require('sinon'); | |
| var _ = require('underscore'); | |
| // fakeResponse | |
| // ------------ | |
| // | |
| // High-level helper for responding equally to all Ajax requests. | |
| // |
| defmodule ApplicationRouter do | |
| use Dynamo.Router | |
| prepare do | |
| # Pick which parts of the request you want to fetch | |
| # You can comment the line below if you don't need | |
| # any of them or move them to a forwarded router | |
| conn.fetch([:cookies, :params]) | |
| end |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| # Clear existing task so we can replace it rather than "add" to it. | |
| Rake::Task["deploy:compile_assets"].clear | |
| desc "Precompile assets locally and then rsync to web servers" | |
| task :compile_assets do | |
| # compile assets locally | |
| run_locally do | |
| with rails_env: fetch(:stage) do | |
| execute :bundle, "exec rake assets:precompile" | |
| end |
| # Clear existing task so we can replace it rather than "add" to it. | |
| Rake::Task["deploy:compile_assets"].clear | |
| namespace :deploy do | |
| desc 'Compile assets' | |
| task :compile_assets => [:set_rails_env] do | |
| # invoke 'deploy:assets:precompile' | |
| invoke 'deploy:assets:precompile_local' | |
| invoke 'deploy:assets:backup_manifest' |
| def pf(path) | |
| picturefill(path, "AltText") do | |
| b = path.scan(/(^.*)\.(jpg|png|gif)/).flatten | |
| sizes = { | |
| :small => "#{b[0]}_small.#{b[1]}", | |
| :medium => "#{b[0]}_medium.#{b[1]}", | |
| :medium_high_dpi => "#{b[0]}_medium_high_dpi.#{b[1]}", | |
| :large => "#{b[0]}_large.#{b[1]}", | |
| :large_high_dpi => "#{b[0]}_large_high_dpi.#{b[1]}" | |
| } |