- watch for ActiveRecord Relation, like
has_many
,has_many :through
- watch for
user_roles
, `group_users - UPDATE
action
This file contains 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
# Update, upgrade and install development tools: | |
apt-get update | |
apt-get -y upgrade | |
apt-get -y install build-essential | |
apt-get -y install git-core | |
# Install rbenv | |
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv | |
# Add rbenv to the path: |
This file contains 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
PAPERCLIP_CONFIG = {} |
This file contains 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
#CAPTURE NEW: rails db:restore_from_production\[capture\] | |
#DOWNLOAD LATEST: rails db:restore_from_production\[download\] | |
#RESTORE: rails db:restore_from_production | |
#[HEROKU_APP_NAME] = Name of your heroku app. | |
#[NUMBER_OF_CORES] = Number of concurrent jobs to run for pg_restore. | |
namespace :db do | |
desc 'Pull down the latest backup from Heroku and rebuild your local database with it.' | |
task :restore_from_production, [:process] => :environment do |task, args| |
This file contains 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
# Configure the reverse-proxy on port 443 | |
server { | |
# general configs | |
keepalive_timeout 30; | |
listen 127.0.0.1:443 ssl; | |
server_name api.example.com; | |
# ssl configs | |
ssl_certificate /path/to/api.crt; | |
ssl_certificate_key /path/to/api.key; |
http://support.apple.com/kb/HT5856?viewlocale=en_US&locale=en_US
-
Download the macOS installer from the Mac App Store and make sure it's in your main Applications folder.
-
Connect a properly formatted 8GB (or larger) drive. Rename the drive to
Untitled
. (The command in the next step assumes the drive is namedUntitled
.) -
Run command in terminal:
This file contains 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 tip(msg); puts; puts msg; puts "-"*100; end | |
# | |
# 30 Ruby 1.9 Tips, Tricks & Features: | |
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/ | |
# | |
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2" | |
tip "Ruby 1.9 supports named captures in regular expressions!" |
Ubuntu 12.10 setup (rbenv/RVM, Janus, PostgreSQL)
- Some utilities:
sudo apt-get install vim tmux git curl
- Copy/paste from the command line:
This file contains 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
# File: app/controllers/api/api_controller.rb | |
class Api::ApiController < ActionController::Base | |
# Consider subclassing ActionController::API instead of Base, see | |
# http://api.rubyonrails.org/classes/ActionController/API.html | |
protect_from_forgery with: :null_session | |
before_action :authenticate | |
def self.disable_turbolinks_cookies | |
skip_before_action :set_request_method_cookie |
require 'csv'
require 'open-uri'
csv_text = open('http://www.vvv.hh.yyy.ggg/~hhhh/uuuu.csv')
csv = CSV.parse(csv_text, :headers=>true)
csv.each do |row|
puts row
end
OlderNewer