save_and_open_page
have_button(locator)| # | |
| # ~/app/helpers/combo_helper.rb | |
| # | |
| # Association => { { id: 1, association: "Coolest" } , { id: 2, association: "Hardest" } } | |
| # | |
| # Model Class << ActiveRecord::Base | |
| # has_many :associations | |
| # end | |
| # | |
| # Use: |
| # Ao invés de fazer: | |
| # dentro de uma iteração | |
| h = {} | |
| h[:somekey] = {} if h[:somekey].nil? | |
| h[:somekey][:otherkey] = [] if h[:somekey][:otherkey].nil? | |
| h[:somekey][:otherkey] << item_da_teracao | |
| # Teremos um hash: { somekey: { :otherkey => [1, 2, 3, 4] } } |
| fn = "filename" | |
| compressed_file_name = "#{fn}.gz" | |
| Zlib::GzipWriter.open(compressed_file_name) do |gz| | |
| gz.mtime = File.mtime(fn) | |
| gz.orig_name = fn | |
| gz.write IO.binread(fn) | |
| end |
| #!/usr/bin/env ruby | |
| module Spreedsheet | |
| module ColumnNotation | |
| def seed | |
| @seed ||= ('A'..'Z').to_a | |
| end | |
| def position_to_column_notation(num, minus = 0) | |
| m = num.divmod(seed.size) |
| states = <<STATES | |
| AC,Acre | |
| AL,Alagoas | |
| AP,Amapá | |
| AM,Amazonas | |
| BA,Bahia | |
| CE,Ceará | |
| ES,Espírito Santo | |
| GO,Goiás | |
| MA,Maranhão |
| dpkg -l linux-* | grep -v libc | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | xargs sudo apt-get -y purge |
| #!/bin/bash | |
| sudo aptitude update | |
| sudo aptitude -y install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev autoconf libc6-dev libncurses5-dev automake libtool bison subversion libffi-dev |
cribbed from http://pastebin.com/xgzeAmBn
Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.
| upstream unicorn_server { | |
| server unix:/tmp/unicorn.sock fail_timeout=0; | |
| } | |
| server { | |
| listen 80; | |
| root /usr/src/app/public; | |
| try_files $uri @unicorn_server; |