This file contains 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 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 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 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 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 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 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 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 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=? |
This file contains 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
Apartment::TenantNotFound: One of the following schema(s) is invalid: "sdf-sdh" "demo-1", "shared_extensions" | |
/Users/almokhtar/Desktop/vroom/app/models/tenant.rb:41:in `switch_to' | |
/Users/almokhtar/Desktop/vroom/app/models/tenant.rb:77:in `block in with_each' | |
/Users/almokhtar/Desktop/vroom/app/models/tenant.rb:76:in `with_each' | |
/Users/almokhtar/Desktop/vroom/lib/tasks/quote.rake:6:in `block (2 levels) in <main>' | |
Apartment::Tenant.create('sdf-sdh') |