This file contains hidden or 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
| source "https://rubygems.org" | |
| gem "rack" | |
| gem "tzinfo" |
This file contains hidden or 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
| # A sample Gemfile | |
| source "https://rubygems.org" | |
| gem 'mechanize' |
This file contains hidden or 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
| # method to evaluate the block for a default value if the | |
| # conversion to date fails | |
| # string.to_date return nil if the string is blank | |
| # so we yield to get the default value from the block there | |
| # or on a parse error | |
| def string_to_date(string,&block) | |
| string.to_date || yield | |
| rescue => e | |
| block_given? ? yield : raise | |
| end |
This file contains hidden or 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
| -content_for :title do | |
| Child Title | |
| The rest of the page goes here |
This file contains hidden or 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
| module UserCache | |
| def self.expire_cache(id) | |
| @base ||= ActionController::Base.new | |
| fragments = [ "user_#{id}", "mini_user_#{id}", | |
| "admin_user_#{id}", "admin_mini_user_#{id}", | |
| "admin_video_user_#{id}", "video_user_#{id}", | |
| "archive_column", "archive", | |
| "admin_archive_column", "admin_archive", | |
| "embedded_video_#{id}"] | |
| fragments.each do |fragment| |
This file contains hidden or 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
| # sources: | |
| # http://www.igodigital.com/blog/blog/notes-on-cyber-weekend-targeted-email-campaigns/custom-error-handling-in-rails-303 | |
| # To test in dev, use the production setting below | |
| # config/environments/development.rb | |
| config.consider_all_requests_local = false | |
| # delete the 404.html, and 500.html files. | |
| # generate an error controller | |
| `rails g controller Errors 404 500` |
This file contains hidden or 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
| #!/usr/bin/env bash | |
| export PATH="$PATH:/usr/texbin/" | |
| which pandoc &>/dev/null | |
| if [ $? -eq 0 ] | |
| then | |
| if [ ! -n "$1" ] | |
| then | |
| echo 'defaulting to pdf' | |
| file_name='scalingphp.pdf' | |
| else |
This file contains hidden or 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 'rake', '=0.8.7' | |
| require 'rake' | |
| require 'rake/testtask' | |
| require 'rake/rdoctask' | |
| #TODO don't shell out quite as much | |
| namespace :bootstrap do | |
| task :dev => ['bootstrap:copy_configs', 'bootstrap:bundle_gems', 'bootstrap:database'] do | |
| run_cmd "bundle exec rake db:test:prepare" | |
| end |
This file contains hidden or 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
| require 'action_view' | |
| require 'ostruct' | |
| require 'erb' | |
| require 'flog' | |
| require 'ruby_parser' | |
| require 'sexp_processor' | |
| ERBHandler = ActionView::Template::Handlers::ERB.new | |
| def new_template(body, details={format: :html}) |
This file contains hidden or 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
| require 'action_view' | |
| require 'ostruct' | |
| require 'erb' | |
| require 'flog' | |
| require 'ruby_parser' | |
| require 'sexp_processor' | |
| ERBHandler = ActionView::Template::Handlers::ERB.new | |
| def new_template(body, details={format: :html}) |