This file contains hidden or 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
| # Filed under: uuid, id, random | |
| ### | |
| a: placeholder | |
| ### | |
| b = (a) -> | |
| ### | |
| if the placeholder was passed, return a random number from 0 to 15 unless b | |
| is 8, in which case a random number from 8 to 11 in hexadecimal or |
This file contains hidden or 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
| # Filed under: 140bytes, identifier, object, id, hashcode | |
| # Gives every object a unique ID. | |
| (() -> | |
| Object.prototype.getHashCode = ((i) -> | |
| i = 0 | |
| () -> | |
| if this.h = this.h then this.h else i++ | |
| )() |
This file contains hidden or 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
| # Filed under: color, convert, hsl, rgb | |
| # Converts hue-saturation-lightness to red-green-blue color value. | |
| ### | |
| @param a hue | |
| @param b saturation | |
| @param c lightness | |
| ### | |
| hsl2rgb = (a, b, c) -> |
This file contains hidden or 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
| # Filed under: hex, color, rgb | |
| # Converts a hex string to RGB. | |
| ### | |
| @param a a "#xxxxxx" hex string, | |
| ### | |
| hex2rgb = (a) -> | |
| ### | |
| turn it into a number by taking the hexadecimal prefix and the |
This file contains hidden or 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
| # Filed under: 140bytes, fibonacci, recursive | |
| # calculate fibonacci (recursively) | |
| fibonacci = (n) -> | |
| if n > 1 then f(n - 1) + f(n - 2) else n |
NewerOlder