cd my_project
git init .
git add . # add everything
git commit -m 'Initial commit'
... make some changes ...
| Object.extend(String.prototype, { | |
| /** | |
| * Converts an underscore string into object attribute format for submission | |
| * to a server (Based on Rails). | |
| * | |
| * To attributize the string client_firstName | |
| * "client_firstName".attributize() | |
| * => client[first_name] | |
| * | |
| * To attributize the string client_addresses__street |
| # app/helpers/application_helper.rb | |
| def sanitized_object_name(object_name) | |
| object_name.gsub(/\]\[|[^-a-zA-Z0-9:.]/,"_").sub(/_$/,"") | |
| end | |
| def sanitized_method_name(method_name) | |
| method_name.sub(/\?$/, "") | |
| end | |
| def form_tag_id(object_name, method_name) |
| Factory.define :application do |factory| | |
| factory.attachment :sample, "public/samples/sample.doc", "application/msword" | |
| end |
| adb shell pm list packages |
| # Creates a new Rails 4 application configured with | |
| # Slim, PostgreSQL, TestUnit (minitest), FactoryGirl, SimpleCov, Capybara, Capistrano ... | |
| # | |
| # Based on template generated at http://railswizard.org/ | |
| # USAGE | |
| # $ rails new APP_NAME -JTm rails_app_template.rb | |
| # Will be specified by default Gemfile | |
| # gem 'rails', '4.2.0' |
| # ... | |
| gem 'carrierwave' | |
| gem 'fog', '~> 1.0.0' # Need to specify version, as carrierwave references older (0.9.0) which doesn't allow configuration of Rackspace UK Auth URL |
| # Solution from http://www.jamiepenney.co.nz/2011/09/23/testing-content_for-in-rails-3-x-helpers-with-rspec/ | |
| describe ApplicationHelper do | |
| describe "title" do | |
| it "should return an h2 tag with the given title" do | |
| helper.title("Lorem Ipsum") | |
| helper.content_for(:page_title).should eql "<h2>Lorem Ipsum</h2>" | |
| end | |
| it "should return the supplied block if a block was given" do |
| # DEPRECATED: use https://gist.github.com/cblunt/1042832 | |
| # rails new my-app -m [raw url to this file] | |
| gem 'json' | |
| # Slim template | |
| gem 'slim-rails' | |
| gem 'simple_form' |
| # spec/support/spec_support.rb | |
| def login_as(user = nil) | |
| user ||= Factory.create(:user) | |
| session[:user_id] = user.id | |
| end | |
| def current_user | |
| User.find(session[:user_id]) | |
| rescue |