Skip to content

Instantly share code, notes, and snippets.

View sskirby's full-sized avatar

Sean Kirby sskirby

  • Nulogy Corp.
  • Toronto, Ontario
View GitHub Profile
@sskirby
sskirby / gear_test.rb
Last active December 18, 2015 04:39
testing outbound query methods - stubbed
require "mocha/setup"
class GearTest < MiniTest::Unit:TestCase
def test_calculates_gear_inches
gear = Gear.new(
chainring: 52,
cog: 11,
wheel: stub(diameter: 29))
assert_in_delta(137.1,
gear.gear_inches,
@sskirby
sskirby / gear.rb
Created June 13, 2013 03:37
Gear class from Sandi Metz's "The Magic Tricks of Testing"
class Gear
attr_reader :chainring, :cog, :wheel
def initialize(args)
# ...
end
def gear_inches
ratio * wheel.diameter
end

Keybase proof

I hereby claim:

  • I am sskirby on github.
  • I am seank (https://keybase.io/seank) on keybase.
  • I have a public key whose fingerprint is F417 A0AB 1343 4478 EC80 403D 6DA5 7F41 B7EE 34C0

To claim this, I am signing this object:

@sskirby
sskirby / repository.rb
Created September 26, 2015 02:19
Proposed API for Vorpal v0.0.7
require 'vorpal'
module TreeRepository
extend self
# The engine is basically the same as the old repository (some methods have been renamed, see below)
# but it is not intended to be used directly.
engine = Vorpal.define do
map Tree do
attributes :name
@sskirby
sskirby / useLocalStorageState.js
Created November 11, 2021 17:32
React hook for state persisted to local storage
import * as React from 'react'
/**
*
* @param {String} key The key to set in localStorage for this value
* @param {Object} defaultValue The value to use if it is not already in localStorage
* @param {{serialize: Function, deserialize: Function}} options The serialize and deserialize functions to use (defaults to JSON.stringify and JSON.parse respectively)
*/
function useLocalStorageState(
#!/usr/bin/env bash
# ABOUTME: Cursor environment startup script that starts Docker service and switches to docker group
# ABOUTME: Ensures all subsequent processes run with docker group permissions
set -euo pipefail
# Start Docker service (equivalent to current start command)
sudo service docker start --add-host=cursor:127.0.0.1