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
"A".charCodeAt(); // => 65 | |
(65).toString(2); // => "1000001" | |
parseInt("100000", 2); // => 65 | |
String.fromCharCode(65); // => "A" |
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
// base 10 to base 2 | |
var number_b10 = 17; | |
( number_b10 ).toString(2); // => "10001" | |
// base 2 to base 10 | |
var number_b2 = "10001"; | |
parseInt( number_b2, 2 ); // => 17 |
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
var golden_ratio = 1.6180339887498948482, | |
values = []; | |
var gr = function(min, max) { | |
while(min < max) { | |
min = Math.round( min * golden_ratio ); | |
values.push( min ); | |
} | |
return values; | |
}; |
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
var values = []; | |
var pr = function(min, max, factor) { | |
while(min < max) { | |
min = Math.round(min / factor); | |
values.push( min ); | |
} | |
return values; | |
}; |
NewerOlder