# change mirror to ubuntu.osuosl.org first
sudo apt-get update
sudo apt-get install build-essential libreadline-dev libssl-dev zlib1g-dev libxml2-dev libxslt-dev
| class AccountSignup | |
| def self.new(warden, acccount_params) | |
| account = Subscribem::Account.create(account_params) | |
| account.create_schema | |
| UserSignup.new(warden, account, account.owner) | |
| end | |
| end | |
| (function($){ | |
| // | |
| //-------------------------------------- Model : Image | |
| // | |
| Image = Backbone.Model.extend({ | |
| defaults: { | |
| 'delete' : false | |
| } | |
| }); | |
| [1] pry(#<Activity>)> activity | |
| => #<Activity _id: 512e3ef99a4b7cecef000005, created_at: 2013-02-27 17:14:33 UTC, updated_at: 2013-02-27 17:14:33 UTC, slug: {"en"=>"activity2", "id"=>"activity2"}, search_slug: {"en"=>""}, category_ids: ["512e3ef99a4b7cecef000006"], name: {"en"=>"activity2"}, position: nil, icon: nil> | |
| [2] pry(#<Activity>)> activity.categories | |
| => [#<Category _id: 512e3ef99a4b7cecef000006, created_at: 2013-02-27 17:14:33 UTC, updated_at: 2013-02-27 17:14:33 UTC, slug: {"en"=>"category3", "id"=>"category3"}, search_slug: {"en"=>"category3", "id"=>"category3"}, parent_id: nil, activity_ids: ["512e3ef99a4b7cecef000005"], level: 0, name: {"en"=>"category3"}, description: nil, group: nil, classification: "Category", position: 1>] | |
| [3] pry(#<Activity>)> category1 | |
| => #<Category _id: 512e3ef99a4b7cecef000006, created_at: 2013-02-27 17:14:33 UTC, updated_at: 2013-02-27 17:14:33 UTC, slug: {"en"=>"category3", "id"=>"category3"}, search_slug: {"en"=>"category3", "id"=>"category3"}, parent_id: nil, activity_i |
| require "bundler/capistrano" | |
| set :port, XXXX | |
| server "XX.XXX.XXX.XX", :web, :app, :db, primary: true | |
| set :application, "XXXXXXX" | |
| set :user, "XXXXXXX" | |
| set :deploy_to, "/home/#{user}/apps/#{application}" | |
| set :deploy_via, :remote_cache | |
| set :use_sudo, false | |
| set :scm, "git" |
| class SomeModel | |
| include Mongoid::Document | |
| field :date, :type => Date | |
| validates_presence_of :date | |
| def date=(value) | |
| begin | |
| date_parsed = value.to_date | |
| write_attribute :date, date_parsed |
| require "pry" | |
| ### REPL EXAMPLE | |
| # | |
| # ARGV array holds any additional parameters when the program is run | |
| # | |
| # STDIN.gets.chomp - waits for the user to input on the terminal | |
| # | |
| # |
| # == Schema Information | |
| # | |
| # Table name: projects | |
| # | |
| # id :integer not null, primary key | |
| # site_url :string | |
| # scrape_date :date | |
| # scrape_page :integer | |
| # project_url :string | |
| # project_id :string |
| class Dog | |
| attr_writer :name | |
| def initialize(name) | |
| @name = name | |
| end | |
| def bark | |
| puts "patrick" | |
| end |
| # lib/tasks/db.rake | |
| namespace :db do | |
| desc "Dumps the database to db/APP_NAME.dump" | |
| task :dump => :environment do | |
| cmd = nil | |
| with_config do |app, host, db, user| | |
| cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump" | |
| end | |
| puts cmd |