Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am noeldelgado on github.
  • I am noeldelgado (https://keybase.io/noeldelgado) on keybase.
  • I have a public key whose fingerprint is C40F C2CD 2F62 0FE4 B92E 7A87 8ADA 2558 4608 B182

To claim this, I am signing this object:

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;
};
var values = [];
var pr = function(min, max, factor) {
while(min < max) {
min = Math.round(min / factor);
values.push( min );
}
return values;
};
// 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
"A".charCodeAt(); // => 65
(65).toString(2); // => "1000001"
parseInt("100000", 2); // => 65
String.fromCharCode(65); // => "A"
@noeldelgado
noeldelgado / safewebcolors
Last active December 15, 2015 21:49
generates an array with the full list of safe-web-colours
var colors = [],
pattern = ["0","3","6","9","c","f"],
plength = pattern.length,
a, b, c;
for (a = 0; a < plength; a += 1) {
for (b = 0; b < plength; b += 1) {
for (c = 0; c < plength; c += 1) {
colors.push( pattern[a]+pattern[a] + pattern[b]+pattern[b] + pattern[c]+pattern[c] );
}
@noeldelgado
noeldelgado / Exact # Rows an Columns
Created April 17, 2013 16:13
Calculate the exact number of rows and columns for N number of items
var N = 216, // total number of items
rows = Math.floor( Math.sqrt( N ) ),
columns = 0;
while ( N % rows != 0 ) {
rows = rows - 1;
}
columns = N / rows;
var orderByHSL = function( x, y ) {
var hslx, hsly;
var pad = function(value) {
var l = value.length;
while (l < 3) {
l += 1;
value = "0" + value;
}
return value;
};
@noeldelgado
noeldelgado / gist:7095622
Last active December 26, 2015 04:49
Compiled HTML and CSS of this pen http://codepen.io/noeldelgado/pen/pGwFx
<header>
<div class="container">
<h1>Direction-aware hover effect</h1>
<p>CSS &amp; bits of JS</p>
</div>
</header>
<div class="container">
<ul>
<li>
@noeldelgado
noeldelgado / index.js
Created May 5, 2016 17:52
requirebin sketch
var Gemini = require('gemini-scrollbar');
var A = new Gemini({
element: document.querySelector('.scroller-a')
}).create();
var B = new Gemini({
element: document.querySelector('.scroller-b')
}).create();