Skip to content

Instantly share code, notes, and snippets.

@Deradon
Deradon / live.rb
Last active December 16, 2016 14:36
Re-run a command whenever a file in directory is changed!
#!/usr/bin/env ruby
# Re-run a command whenever a file in directory is changed!
#
# Inspired by: http://ngauthier.com/2012/02/quick-tests-with-bash.html
# Thanks Nick!
#
# Patrick Helm (me@patrick-helm.de), 2013
#
#
@Deradon
Deradon / wtf.rb
Created November 7, 2012 20:24
wtf.rb
def rgb_to_hsv(r, g, b)
if r == b && r == g
h = s = 0
v = (0.299 * r + 0.587 * g + 0.114 * b) / 255
else
max = [r, g, b].max.to_f
min = [r, g, b].min.to_f
v = max
s = min