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!
\
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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` |