Skip to content

Instantly share code, notes, and snippets.

@billycsete
billycsete / perlinNoise.js
Created June 18, 2016 02:03
Perlin Noise
// Perlin Noise
var Noise = function () {
var p = [ 151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,
23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,
174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,
133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,
89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,
@billycsete
billycsete / .gitignore
Created April 24, 2016 20:14
default ignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Numerous always-ignore extensions #
@billycsete
billycsete / sublime-settings.json
Last active July 13, 2016 16:57
Sublime Settings
{
"theme": "Material-Theme.sublime-theme",
"color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme",
"draw_white_space": "all",
"fade_fold_buttons": false,
"ensure_newline_at_eof_on_save": true,
"highlight_line": true,
"font_size": 13,
"line_padding_bottom": 3,
"line_padding_top": 3,
@billycsete
billycsete / lobotomized-owl.css
Created October 29, 2015 22:39
Lobotomized Owl
body * + * {
margin-top: 1.5rem;
}
@billycsete
billycsete / hasParent.js
Created September 22, 2015 22:24
Find out if an element is the parent of another element
function hasParent( e, p ) {
if ( !e ) return false;
var el = e.target || e.srcElement || e || false;
while ( el && el != p ) {
el = el.parentNode || false;
}
return ( el!==false );
}
@billycsete
billycsete / getRandomInt.js
Created September 22, 2015 22:23
Random integer generator
/**
* Random integer generator
* @param {Number} min - minimum value
* @param {Number} max - maximum value
*/
function getRandomInt( min, max ) {
return Math.floor( Math.random() * (max - min + 1) ) + min;
}
@billycsete
billycsete / ColorLuminance.js
Last active September 22, 2015 22:19
Change the lightness of a hex color value
function ColorLuminance(hex, lum) {
// validate hex string
hex = String(hex).replace(/[^0-9a-f]/gi, '');
if (hex.length < 6) {
hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2];
}
lum = lum || 0;
// convert to decimal and change luminosity
var rgb = "#", c, i;
for (i = 0; i < 3; i++) {
@billycsete
billycsete / scrollTo.js
Last active May 11, 2016 12:32
Animate scroll to element function
// first add raf shim
// http://www.paulirish.com/2011/requestanimationframe-for-smart-animating/
window.requestAnimFrame = (function(){
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
function( callback ){
window.setTimeout(callback, 1000 / 60);
};
})();
@billycsete
billycsete / _selfclear.scss
Created September 5, 2015 21:45
Self clear mixin
// ====================================
// Self Clear
// ====================================
@mixin selfclear {
&:after {
content: '';
display: table;
clear: both;
}
@billycsete
billycsete / Preferences.sublime-settings
Last active September 22, 2015 22:17
Sublime user preferences
{
"color_scheme": "Packages/Theme - Spacegray/base16-eighties.dark.tmTheme",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"trim_trailing_white_space_on_save": true,
"auto_complete_cycle": true,
"fade_fold_buttons": false,
"font_size": 13,
"highlight_line": true,
"ignored_packages":