Skip to content

Instantly share code, notes, and snippets.

@oojikoo-gist
oojikoo-gist / cocoapdo_with_rbenv-gemset.md
Created February 28, 2016 09:27
ios: pod install with rbenv-gemset

how to pod install with rbenv-gemset on my local

$ initgemset
$ gem install cocoapods --install-dir [.gemsetname-gemsets]/
$ pod init
# after add Podfile
$ pod install [pod-name]
@oojikoo-gist
oojikoo-gist / rails_http_status_code_symbol.rb
Created February 11, 2016 07:36
rails: http status code symbol
HTTP_STATUS_CODES = {
100 => 'Continue',
101 => 'Switching Protocols',
102 => 'Processing',
200 => 'OK',
201 => 'Created',
202 => 'Accepted',
203 => 'Non-Authoritative Information',
204 => 'No Content',
205 => 'Reset Content',
@oojikoo-gist
oojikoo-gist / rails_models_cheetsheet.md
Last active February 4, 2016 22:01
rails: models cheetsheet

Rails Models

more advanced

Generating models

$ rails g model User

Associations

@oojikoo-gist
oojikoo-gist / rails_routes_cheetsheet.md
Created February 3, 2016 03:47
rails: routes cheetsheet

A summary of the Rails Guides on Routes, plus other tips.

The Rails router recognizes URLs and dispatches them to a controller's action. It can also generate paths and URLs, avoiding the need to hardcode strings in your views.

Examples

# Redirects /orders/report to orders#report.
get 'orders/report', to: 'orders#report'
@oojikoo-gist
oojikoo-gist / rails_huston.rb
Created February 1, 2016 06:11
rails: huston.rb
# Houston
# https://github.com/nomad/houston
# Local and Remote Notification Programming Guide - The Feedback Service
# https://goo.gl/vEhEJE
require 'houston'
APN = Houston::Client.development
APN.certificate = File.read("development.pem")
@oojikoo-gist
oojikoo-gist / rails_4_binstub_upgrade.md
Last active January 19, 2016 07:47
rails: rails 4 binstub upgrade

In Rails 4, your app's bin/ directory contains executables that are versioned like any other source code, rather than stubs that are generated on demand.

Here's how to upgrade:

  bundle config --delete bin    # Turn off Bundler's stub generator
  rake rails:update:bin         # Use the new Rails 4 executables
  git add bin                   # Add bin/ to source control
@oojikoo-gist
oojikoo-gist / .gitignore
Last active January 14, 2016 08:06
rails: gitignore
# Created by https://www.gitignore.io/api/rails
### Rails ###
*.rbc
capybara-*.html
.rspec
/log
/tmp
/db/*.sqlite3
/db/*.sqlite3-journal
@oojikoo-gist
oojikoo-gist / rails_rspec_model_example.rb
Created January 13, 2016 13:25
rails: rspec model example
context 'check columns exsitence' do
it { is_expected.to respond_to :first_name }
it { is_expected.to respond_to :last_name }
it { is_expected.to respond_to :profilable }
it { is_expected.to respond_to :birth }
it { is_expected.to respond_to :gender }
it { is_expected.to respond_to :bio }
end
context 'model validation and associations' do
@oojikoo-gist
oojikoo-gist / active_admin.rb
Created January 11, 2016 00:28
rails: active admin init
ActiveAdmin.setup do |config|
# == Site Title
#
# Set the title that is displayed on the main layout
# for each of the active admin pages.
#
config.site_title = "Carrierwave Ios Rails Example"
# Set the link url for the title. For example, to take
# users to your main site. Defaults to no link.
@oojikoo-gist
oojikoo-gist / carrierwave.rb
Created January 11, 2016 00:26
rails: carrierwave initializer
CarrierWave.configure do |config|
if Rails.env.test? || Rails.env.cucumber?
config.storage = :file
config.enable_processing = false
elsif ENV.key?('S3_KEY')
config.storage = :fog
# let's Carrierwave work on Heroku
config.cache_dir = Rails.root + '/tmp/uploads'