Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
| Cmd+C | copy current line (if no selection) |
| Cmd+X | cut current line (if no selection) |
| Ctrl+⇧+K | delete line |
| Cmd+↩ | insert line after |
Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.
| Cmd+C | copy current line (if no selection) |
| Cmd+X | cut current line (if no selection) |
| Ctrl+⇧+K | delete line |
| Cmd+↩ | insert line after |
| #First you need to copy password_salt and encrypted_password to your new object model | |
| #Using this because I have to export my database User to another application and old, | |
| # app are using devise 1.0.x and new app using 2.1.x | |
| Class User < ActiveRecord::Base | |
| alias :devise_valid_password? :valid_password? | |
| def valid_password?(password) | |
| begin |
This guide enables you to install (ruby-build) and use (rbenv) multiple versions of ruby, isolate project gems (gemsets and/or bundler), and automatically use appropriate combinations of rubies and gems.
# Ensure system is in ship-shape.
aptitude install git zsh libssl-dev zlib1g-dev libreadline-dev libyaml-dev
| # Paginate a collection | |
| # | |
| # Usage: | |
| # | |
| # {% paginate contents.projects by 5 %} | |
| # {% for project in paginate.collection %} | |
| # {{ project.name }} | |
| # {% endfor %} | |
| # {% endpaginate %} | |
| # |
| #Add in your project in config/initializers/will_paginate.rb | |
| #in my case I'm adding the attribute page_number with value of target | |
| WillPaginate::ActionView::LinkRenderer.class_eval do | |
| def link(text, target, attributes = {}) | |
| attributes.merge!(page_number: "#{target}") | |
| super text, target, attributes | |
| end | |
| end |
| # rbenv | |
| export PATH="$HOME/.rbenv/bin:$PATH" | |
| source ~/.git-prompt.sh | |
| eval "$(rbenv init -)" | |
| source ~/.rbenv/completions/rbenv.bash | |
| # prompt with ruby version | |
| # rbenv version | sed -e 's/ .*//' | |
| __rbenv_ps1 () | |
| { |
| class CostCenterPresenter | |
| def initialize(object, query) | |
| @object = object | |
| @query = query | |
| end | |
| # results: [ | |
| #1# { text: "Western", children: [ | |
| #2# { id: "CA", text: "California" }, | |
| #2# { id: "AZ", text: "Arizona" } | |
| # ] }, |
| # First the end result of what we want: | |
| class Foo | |
| before_hook :whoa | |
| before_hook :amazing | |
| def test | |
| puts "This is kinda cool!" | |
| end |
| # Paginate a collection | |
| # | |
| # Usage: | |
| # | |
| # {% paginate contents.projects by 5 %} | |
| # {% for project in paginate.collection %} | |
| # {{ project.name }} | |
| # {% endfor %} | |
| # {% endpaginate %} |