Skip to content

Instantly share code, notes, and snippets.

View brendanjcaffrey's full-sized avatar

Brendan Caffrey brendanjcaffrey

View GitHub Profile
@qerub
qerub / lifx-sunrise-simulator.rb
Last active September 9, 2020 11:44
LIFX Sunrise Simulator
require "lifx" # http://www.rubydoc.info/gems/lifx
def calculate_color(i) # 0 <= i <= 1
h = [40 * 2 * i, 40].min # will be 40 (yellow) at i=1/2 and stay there
s = 1.0 - [(i - 0.5) * 2, 0].max # will be 1 until i=1/2 and then go down to 0
b = i
LIFX::Color.hsbk(h, s, b, LIFX::Color::KELVIN_MIN)
end
duration = 10 * 60 # seconds
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active May 19, 2024 17:40
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@seanlilmateus
seanlilmateus / forwardable.rb
Created May 24, 2013 07:57
rubymotion Forwardable module
module Forwardable
FORWARDABLE_VERSION = "1.1.0"
@debug = nil
class << self
attr_accessor :debug
end
# Takes a hash as its argument. The key is a symbol or an array of
# symbols. These symbols correspond to method names. The value is
@nlively
nlively / rails_cloc.sh
Created April 5, 2012 19:02
Count lines of code in a rails project
#!/bin/bash
find . \( -iname '*.rb' -o -iname '*.css' -o -iname '*.js' -o -iname '*.erb' -o -iname '*.html' -o -iname '*.haml' -o -iname '*.scss' -o -iname '*.coffee' \) -exec wc -l {} + | sort -n
@timothyekl
timothyekl / gist:1217887
Created September 14, 2011 21:44
Cross-platform: recompile LaTeX documents using Ruby, Guard
# Tested with Ruby 1.9
# Needs gem "guard" (https://github.com/guard/guard)
# Needs gem "guard-shell" (https://github.com/guard/guard-shell)
# Uses process "growlnotify" (http://growl.info/extras.php)
# Uses process "pdflatex" from standard TeXLive distribution
guard 'shell' do
watch(%r{(.+)\.tex}) do |m|
`growlnotify -m #{m[0]} Recompiling`
`pdflatex -interaction=batchmode #{m[0]} >/dev/null`