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 UserHelper | |
| class UserCompletion < Completely | |
| step "user_completion.fill_out_profile", :link => user_profile_path do | |
| user_profile.has_all_data? | |
| end | |
| list_elt 'ul.user_completion' | |
| item_elt 'li.user_step' | |
| item_completed_class 'completed' |
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
| class Composable | |
| @include = (modules...) -> | |
| @composable_modules ||= [] | |
| for module in modules | |
| @composable_modules.push module | |
| apply_mixins: -> | |
| @__proto__.constructor.composable_modules ||= [] | |
| for module in @__proto__.constructor.composable_modules | |
| for key, value of module.prototype |
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
| { | |
| :close_dquote => encode_fallback('”', encoding, '"'), | |
| :close_squote => encode_fallback('’', encoding, '\''), | |
| :copyright => encode_fallback('©', encoding, '(c)'), | |
| :ellipsis => encode_fallback('…', encoding, '...'), | |
| :em_dash => encode_fallback('—', encoding, '---'), | |
| :en_dash => encode_fallback('–', encoding, '--'), | |
| :open_dquote => encode_fallback('“', encoding, '"'), | |
| :open_squote => encode_fallback('‘', encoding, '\''), | |
| :trademark => encode_fallback('®', encoding, '(r)'), |
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
| Install some aptitude packages: | |
| sudo apt-get install nginx libssl-dev libmysqlclient-dev git-core libxslt-dev libxml2-dev | |
| Grab some ruby, install that muh | |
| wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p0.tar.gz | |
| cd ruby-1.9.2-p0 | |
| ./configure ; make ; sudo make install | |
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 LazyLoadHelper | |
| def lazy_load(&block) | |
| content_id = ActiveSupport::SecureRandom.hex | |
| EM.add_timer 2 do | |
| javascript = %{$('##{content_id}').replaceWith('#{ | |
| escape_javascript(capture(&block)) | |
| }')} | |
| Juggernaut.send_to_channels(javascript, [content_id]) |
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
| scope :search do |*keywords| | |
| where("FIND_IN_SET(search_column, '#{keywords.join(',')}')") | |
| 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
| class ActiveRecord::Base | |
| def self.find_by_id(id) | |
| find(id) | |
| rescue ActiveRecord::RecordNotFound | |
| nil | |
| end | |
| 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
| radius_options = %w{3 5 10 25 50}.map{|x| [x, x+" mi"]} | |
| select_tag('search_radius[in_miles]', options_for_select(radius_options, params[:search_radius][:in_miles]) |
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
| class Email::Base < ActiveRecord::Base | |
| self.abstract_class = true | |
| establish_connection 'drip_email_marketing' | |
| end | |
| # Ensure that config/database.yml has connection information for drip_email_marketing | |
| # | |
| # Make all other classes using this DB connection use this base class as their ancestor |
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/local/bin/ruby | |
| require 'sinatra' | |
| require 'nokogiri' | |
| XMLFILEPATH = 'database.xml' | |
| # Put the XML database | |
| get '/' do | |
| [200, {"Content-Type" => 'text/xml'}, File.open(XMLFILEPATH, 'r')] | |
| end |