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
#!/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 | |
# | |
# |
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
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 |
NewerOlder