This file contains hidden or 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
Stash current changes | |
git > Stash > Stash (Include Untracked) | |
Create stash as patch | |
git stash show "stash@{0}" -p > changes.patch | |
Apply patch | |
git apply changes.patch |
This file contains hidden or 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
Opening/Creating CSV File | |
First up, require the CSV library in your file. You don't need to install any gem for it, it comes bundled with your installation of ruby. | |
require "csv" | |
Then, to create a new CSV file you're going to; | |
csv = CSV.open("people.csv", "a+") | |
This will "open" a CSV file called "people.csv" in read-write mode where new writes will be added to the back of the file (append). If the file doesn't exist yet, it'll create it. Here's an overview of the different modes; | |
Modes Description |
This file contains hidden or 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
ActiveJob.perform_now |
This file contains hidden or 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
ActiveJob.perform_now |
This file contains hidden or 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
-scheme:chrome-extension |
This file contains hidden or 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
class Person < ActiveRecord::Base | |
attr_accessor :skip_some_callbacks | |
before_validation :do_something, unless: :skip_some_callbacks | |
after_validation :do_something_else, unless: :skip_some_callbacks | |
end | |
person = Person.new(person_params) | |
person.skip_some_callbacks = true | |
person.save |
This file contains hidden or 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
gem 'pg' | |
require 'pg' | |
def with_db | |
db = PG.connect( | |
dbname: 'dbname', | |
user: 'user', | |
password: 'password' | |
) | |
begin | |
yield db |
This file contains hidden or 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
register via the static website | |
add url to /etc/hosts | |
go to link with 3000 | |
ex | |
http://conway-and-hicks-co.inc.services:3000 |
This file contains hidden or 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
git branch -r --sort=-committerdate --format='%(HEAD)%(color:yellow)%(refname:short)|%(color:bold green)%(committerdate:relative)|%(color:blue)%(subject)|%(color:magenta)%(authorname)%(color:reset)' --color=always | column -ts'|' |
This file contains hidden or 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
export RACK_TIMEOUT_SERVICE_TIMEOUT=? |