Skip to content

Instantly share code, notes, and snippets.

View micahboyd's full-sized avatar

Micah Boyd micahboyd

  • Qantas Hotels
  • Melbourne, AUS
View GitHub Profile
@tristang
tristang / open_struct_struct_hash.rb
Created September 2, 2016 13:50
OpenStruct vs Struct vs Hash performance
require 'benchmark'
require 'ostruct'
REP = 1000000
User = Struct.new(:name, :age)
USER = "User".freeze
AGE = 21
HASH = {:name => USER, :age => AGE}.freeze
@Integralist
Integralist / Ruby Lambdas.md
Last active August 28, 2025 08:25
Ruby lambdas

Lambda: standard

# Creating a lambda
l = lambda { |name| "Hi #{name}!" }

# Executing the lambda
l.call("foo") # => Hi foo!
@lfender6445
lfender6445 / gist:9919357
Last active October 8, 2025 09:24
Pry Cheat Sheet

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb - load your rails into a pry session

Debugger