Skip to content

Instantly share code, notes, and snippets.

View sferik's full-sized avatar

Erik Berlin sferik

View GitHub Profile
@tomstuart
tomstuart / gist:4382332089a8402bf475
Created April 30, 2014 12:59
Person#age gives the wrong answer for a person who hasn’t had their birthday yet this year
require 'active_support/time'
require 'active_support/testing/time_helpers'
require 'rspec/expectations'
include ActiveSupport::Testing::TimeHelpers
include RSpec::Matchers
class Person < Struct.new(:birthday)
def age
Date.today.year - birthday.year
end
@nicolasembleton
nicolasembleton / restart_bluetooth.sh
Last active May 11, 2024 17:43
Restart Bluetooth Daemon on Mac OS X without restarting
#!/bin/bash
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
@JoshCheek
JoshCheek / png_dots.rb
Last active January 11, 2016 15:51
Freaky Dot Patterns, based on this video by Numberphile: https://www.youtube.com/watch?v=QAja2jp1VjE
# Pics at https://twitter.com/josh_cheek/status/681062928980783104
# Gif at https://twitter.com/josh_cheek/status/686465757476065280
# Based on https://www.youtube.com/watch?v=QAja2jp1VjE
require 'chunky_png'
require 'matrix'
include Math
def white
ChunkyPNG::Color.rgb(255, 255, 255)
end