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 LayoutHelper | |
| def title(page_title, show_title = true) | |
| content_for(:title) { page_title.to_s } | |
| @show_title = show_title | |
| end | |
| def show_title? | |
| @show_title | |
| 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
| def formatted_date_range(start_date, end_date = nil) | |
| if start_date && end_date | |
| same_month = start_date.month == end_date.month | |
| same_year = start_date.year == end_date.year | |
| date = "#{start_date.strftime("%B %e")} - #{end_date.strftime("%e, %Y")}" if same_month && same_year | |
| date = "#{start_date.strftime("%B %e")} - #{end_date.strftime("%B %e, %Y")}" if !same_month && same_year | |
| date = "#{start_date.strftime("%B %e, %Y")} - #{end_date.strftime("%B %e, %Y")}" if !same_year | |
| else | |
| date = start_date.strftime("%A, %B %e, %Y") |
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
| def border(string) | |
| length = (80 - string.length) / 2 | |
| border = '+' * length | |
| "#{border} #{string} #{border}" | |
| 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
| # Regex to find/replace colons for converting css to sass with textmate | |
| # For example, converts: | |
| # body | |
| # color: gray | |
| # into: | |
| # body | |
| # :color gray | |
| # find |
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
| # Regex to find/replace colons for converting css to sass with textmate | |
| # For example, converts: | |
| # body | |
| # color: gray | |
| # into: | |
| # body | |
| # :color gray | |
| # find |
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
| var javascript_for = function(controller, action, anonymous_function) { | |
| var correct_controller = APP.controller_name === controller, | |
| correct_action = APP.action_name === action || 'all'; | |
| if (correct_controller && correct_action) { | |
| anonymous_function(); | |
| }; | |
| }; | |
| javascript_for('events', 'index', function() { |
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/lib64/ruby/site_ruby/1.8/rubygems.rb:233:in `activate': can't activate i18n (~> 0.5.0, runtime) for ["mail-2.2.11", "actionmailer-3.0.1", "rails-3.0.1"], already activated i18n-0.4.2 for ["activemodel-3.0.1", "actionpack-3.0.1", "rails-3.0.1"] (Gem::LoadError) |
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
| Dewey.authentication :client, :email => 'your-email', :password => 'your-pass' | |
| id = Dewey.put(File.new('example.txt'), 'My Second Upload') | |
| puts id # => in my case returned: document:1DDxIGsmK3wIJpdJC-qGK4y-R8onzDrBPm89y7BbO_Zg | |
| original = Dewey.get(id) | |
| puts original.inspect # => nil |
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
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |
| "http://www.w3.org/TR/html4/strict.dtd"> | |
| <head> | |
| <style> | |
| .contenta {margin-top: 25px;} | |
| .contenta h1 {color: #333; font-weight: normal; border-bottom: 1px solid #bbb; margin: 25px 0px; padding-bottom: 7px;} | |
| .contenta h2 {color: #777; font-weight: normal; margin: 20px 0px 0px 2px;} | |
| </style> |
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
| # in spec helper | |
| class User | |
| def role?(role) | |
| true | |
| end | |
| end |