Skip to content

Instantly share code, notes, and snippets.

@austenito
austenito / integration_spec.rb
Created April 11, 2012 12:50
Integration Testing w/ Sorcery
describe "Shopping Cart Requests" do
let!(:user) { Fabricate(:user) }
before(:each) do
login_user_post("admin", "admin")
end
context "when I visit the shopping cart" do
it " show the logged in users' cart items " do
#Test stuff
@austenito
austenito / interview.md
Last active June 7, 2020 19:37
Ruby Interview Questions

Ruby Questions

  • What is a class?
  • What is an object?
  • What is a module? Can you tell me the difference between classes and modules?
  • Can you tell me the three levels of method access control for classes and modules? What do they imply about the method?
  • There are three ways to invoke a method in ruby. Can you give me at least two?
  • Explain this ruby idiom: a ||= b
  • What does self mean?
@austenito
austenito / answers.md
Last active December 4, 2019 12:35
Answers to Ruby Interview Questions

Answers to [Ruby Interview Questions][1]

What is a class?

A text-book answer: classes are a blue-print for constructing computer models for real or virtual objects... boring.

In reality: classes hold data, have methods that interact with that data, and are used to instantiate objects.

Like this.

NoMethodError: undefined method `logger=' for ActionCable::Server::Base:Class
Did you mean? logger
/Users/austenito/.gem/ruby/2.3.1/gems/timber-2.0.4/lib/timber/frameworks/rails.rb:50:in `set_logger'
/Users/austenito/.gem/ruby/2.3.1/gems/timber-2.0.4/lib/timber/frameworks/rails.rb:14:in `block in <class:Railtie>'
/Users/austenito/.gem/ruby/2.3.1/gems/railties-5.0.0.1/lib/rails/initializable.rb:30:in `instance_exec'
/Users/austenito/.gem/ruby/2.3.1/gems/railties-5.0.0.1/lib/rails/initializable.rb:30:in `run'
/Users/austenito/.gem/ruby/2.3.1/gems/railties-5.0.0.1/lib/rails/initializable.rb:55:in `block in run_initializers'
/Users/austenito/.rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
/Users/austenito/.rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
/Users/austenito/.rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
module Router
class ApiConstraints
def initialize(options)
@version = options[:version]
@default = options[:default]
end
def default?
@default
end
### Keybase proof
I hereby claim:
* I am austenito on github.
* I am austenito (https://keybase.io/austenito) on keybase.
* I have a public key whose fingerprint is BE7D D06E 9399 B7A5 38C3 1C95 600A F3AC 13F0 1194
To claim this, I am signing this object:

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

; <<>> DiG 9.8.3-P1 <<>> bonobos.com TXT
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 59297
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;bonobos.com. IN TXT
;; ANSWER SECTION:
analytics.track('Completed Order', {
orderId: '306167171',
total: 286.76,
revenue: 268,
discount: 0,
shipping: 0,
tax: 18.76,
currency: 'USD',
pants-fit: ['tailored', 'slim', 'athletic'],
color: ['blue','redrums'],
@austenito
austenito / query.rb
Created January 3, 2014 19:32
Logging Mongodb queries in rails console
if Moped.logger == Rails.logger
Moped.logger = Logger.new($stdout)
true
else
Moped.logger = Rails.logger
false
end