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
| # | |
| # See also: http://almosteffortless.com/2008/12/11/easy-upload-via-url-with-paperclip/ | |
| # | |
| # Allow "uploads via url" with Rails and Paperclip | |
| # | |
| # http://www.thoughtbot.com/projects/paperclip | |
| # http://github.com/thoughtbot/paperclip/tree/master | |
| # http://groups.google.com/group/paperclip-plugin/browse_thread/thread/456401eb93135095 | |
| # | |
| # This example is designed to work with a "Photo" model that has an "Image" attachment |
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 ruby | |
| require 'csv' | |
| # This assumes: | |
| # - Ruby 1.9's CSV library, if you are using 1.8, use FasterCSV. | |
| # | |
| # https://raw.github.com/hadley/data-baby-names/master/baby-names.csv | |
| csv_fname = "baby-names.csv" |
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
| # GNU Screen - main configuration file | |
| # All other .screenrc files will source this file to inherit settings. | |
| # Author: Christian Wills - cwills.sys@gmail.com | |
| # Allow bold colors - necessary for some reason | |
| attrcolor b ".I" | |
| # Tell screen how to set colors. AB = background, AF=foreground | |
| termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' |
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
| namespace :assets do | |
| desc "Check that all assets have valid encoding" | |
| task :check => :environment do | |
| paths = ["app/assets", "lib/assets", "vendor/assets"] | |
| extensions = ["js", "coffee", "css", "scss"] | |
| paths.each do |path| | |
| dir_path = Rails.root + path |
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
| RSpec.configure do |config| | |
| config.before(:suite) do | |
| ActiveRecord::Base.establish_connection database['one'] | |
| DatabaseCleaner.strategy = :deletion | |
| ActiveRecord::Base.establish_connection config.database['two'] | |
| DatabaseCleaner.strategy = :deletion | |
| end | |
| config.before(:each) do |
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
| #map_canvas{:style=>"width: 400px; height: 400px"} | |
| %script{:type => "text/javascript", :src=>"http://maps.google.com/maps/api/js?sensor=false"} | |
| = javascript_include_tag 'map' | |
| :javascript | |
| $(document).ready(function(){mappit("#{address}")}); |
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
| james@Blue-moon:~/rails_projects/first_app$ gem install heroku | |
| Fetching: term-ansicolor-1.0.5.gem (100%) | |
| Fetching: rest-client-1.6.3.gem (100%) | |
| Fetching: configuration-1.3.1.gem (100%) | |
| Fetching: launchy-0.4.0.gem (100%) | |
| Fetching: heroku-2.3.6.gem (100%) | |
| Successfully installed term-ansicolor-1.0.5 | |
| Successfully installed rest-client-1.6.3 | |
| Successfully installed configuration-1.3.1 | |
| Successfully installed launchy-0.4.0 |
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
| # RSpec matcher to spec delegations. | |
| # | |
| # Usage: | |
| # | |
| # describe Post do | |
| # it { should delegate(:name).to(:author).with_prefix } # post.author_name | |
| # it { should delegate(:month).to(:created_at) } | |
| # it { should delegate(:year).to(:created_at) } | |
| # 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
| With this code: | |
| browser.link(:text, "Move questions to...").click | |
| browser.alert do | |
| browser.button(:id => "alert").click | |
| end #=> "the alert message" | |
| I get this error: |
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
| # Dealing with namespaces in Nokogiri. | |
| # | |
| # First thing you must do is abandon what you're used to with Builder, | |
| # namespaces aren't just attributes on an element, they uniquely identify | |
| # what sort of element you are building and, as such, you are better off | |
| # specifying them manually. | |
| # | |
| # The key here is accessing the Nokogiri::XML::Element being built with | |
| # b.parent, then you can set the namespace (distinguished by an element | |
| # with a prefix such as "soap12:Envelope") or add a default namespace |