Skip to content

Instantly share code, notes, and snippets.

@molawson
molawson / example.rb
Created December 7, 2023 17:30
Destructuring Ruby objects with pattern matching
class Thing
attr_reader :name, :type
def initialize(name, type)
@name = name
@type = type
end
def deconstruct_keys(_keys)
{ name:, type: }
class DefinitelyNotHash
def initialize(val)
@val = val
end
end
class HashIsh
def initialize(val)
@val = val
end
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "repeatable"
end
Schedule = Repeatable::Schedule
module ScheduleHelpers
@molawson
molawson / _.md
Last active September 26, 2017 20:15
New computer setup

Download and run on a fresh install of macOS

curl -fsS https://gist.githubusercontent.com/molawson/8f6b40f5e96218c0a0880616c81bf41d/raw/setup.sh
sh setup.sh

Keybase proof

I hereby claim:

  • I am molawson on github.
  • I am molawson (https://keybase.io/molawson) on keybase.
  • I have a public key whose fingerprint is 5A04 8BFD 2658 A149 C5DA A4B5 0A61 4E31 16E3 EBD0

To claim this, I am signing this object:

@molawson
molawson / newcomputer.md
Created April 16, 2012 23:06
The steps I take for setting up a computer with Mac OS X

System settings

  1. Run Software Update
  2. Disable "natural" scrolling
  3. Enable two-finger right click
  4. Increase trackpad tracking speed
  5. Map Control to the Caps Lock key
  6. Change Spotlight shortcut to Option + Space
  7. Disable auto-dimming in Energy Saver and increase sleep times
  8. Remove Bluetooth and Time Machine from menu bar