use dashes (-) for branches, it's easier to write than underscore (_)
- pull latest changes in the master branch git checkout master git pull origin master
- checkout on-your-feature
| %w(1 2 3) => [1,2,3] | |
| %Q{ my super long | |
| string on several lines | |
| } | |
| <<-SQL | |
| /* lets write some SQL */ | |
| select users.* from users; |
| # credits goes to SKORKS | |
| # http://www.skorks.com/2009/09/ruby-exceptions-and-exception-handling/ | |
| # raise an exception | |
| raise TypeError, 'You must give me truth' if value == false | |
| # raise RuntimeError | |
| raise "Hello" | |
| # basic block |
| /* get service from the console */ | |
| var service = angular.element('[ng-app]').injector().get('MyService'); |
| =Navigating= | |
| visit('/projects') | |
| visit(post_comments_path(post)) | |
| =Clicking links and buttons= | |
| click_link('id-of-link') | |
| click_link('Link Text') | |
| click_button('Save') | |
| click('Link Text') # Click either a link or a button | |
| click('Button Value') |
| require 'ostruct' | |
| require 'forwardable' | |
| class MockActiveRecord < OpenStruct | |
| def save(opts); end | |
| alias_method :save!, :save | |
| def attributes | |
| to_h.symbolize_keys |
| # after cloning the repo of rbenv | |
| cd ~/.rbenv | |
| git pull | |
| cd plugins/ruby-build | |
| git pull | |
| rbenv install -l | |
| rbenv install 2.1.2 |
| # @gf3’s Sexy Bash Prompt, inspired by “Extravagant Zsh Prompt” | |
| # Shamelessly copied from https://github.com/gf3/dotfiles | |
| # Screenshot: http://i.imgur.com/s0Blh.png | |
| if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then | |
| export TERM=gnome-256color | |
| elif infocmp xterm-256color >/dev/null 2>&1; then | |
| export TERM=xterm-256color | |
| fi |
| module DelayedJobScopes | |
| extend ActiveSupport::Concern | |
| included do | |
| scope :error, -> (error) { failed.where('last_error ILIKE (?)', "%#{error.strip}%") } | |
| scope :failed, -> { where('last_error IS NOT NULL') } | |
| scope :queues, -> (queues) { where(queue: queues) } | |
| end | |
| def id_in_args |
| # Ruby API server install | |
| # ------------------------ | |
| # instal dev tool: git for clone, gcc & make to compile ruby, libssl-dev to compile ssl for ruby | |
| # g++ is for gem dependencies | |
| sudo apt-get install gcc git make libssl-dev g++ | |