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
fetch( 'https://gist.githubusercontent.com/MAKIO135/0f0c45136069ee6e7366afef684f3373/raw/89e9b1600f2ff9331ddc9f12a9f58500d9ad09ae/pi.json' ) | |
.then( resp => resp.json() ) | |
.then( json => { | |
let pi = json.pi | |
let i = 0; | |
setInterval( function run(){ | |
console.clear() | |
console.log( + pi.charAt( i ) ) | |
i++; |
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
var googleFontsBaseUrl="//fonts.gstatic.com/s/",googleFonts=[{name:"ABeeZee",styles:["regular","italic"],files:[{style:"regular",url:"abeezee/v10/mE5BOuZKGln_Ex0uYKpIaw.ttf"},{style:"italic",url:"abeezee/v10/kpplLynmYgP0YtlJA3atRw.ttf"}]},{name:"Abel",styles:["regular"],files:[{style:"regular",url:"abel/v7/RpUKfqNxoyNe_ka23bzQ2A.ttf"}]},{name:"AbhayaLibre",styles:["regular","500","600","700","800"],files:[{style:"500",url:"abhayalibre/v2/wBjdF6T34NCo7wQYXgzrc5MQuUSAwdHsY8ov_6tk1oA.ttf"},{style:"600",url:"abhayalibre/v2/wBjdF6T34NCo7wQYXgzrc2v8CylhIUtwUiYO7Z2wXbE.ttf"},{style:"700",url:"abhayalibre/v2/wBjdF6T34NCo7wQYXgzrc0D2ttfZwueP-QU272T9-k4.ttf"},{style:"800",url:"abhayalibre/v2/wBjdF6T34NCo7wQYXgzrc_qsay_1ZmRGmC8pVRdIfAg.ttf"},{style:"regular",url:"abhayalibre/v2/zTLc5Jxv6yvb1nHyqBasVy3USBnSvpkopQaUR-2r7iU.ttf"}]},{name:"AbrilFatface",styles:["regular"],files:[{style:"regular",url:"abrilfatface/v8/X1g_KwGeBV3ajZIXQ9VnDojjx0o0jr6fNXxPgYh_a8Q.ttf"}]},{name:"Aclonica",styles:["regular"],files:[{style:"regula |
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
<!DOCTYPE html> | |
<title>Hello Reactor</title> | |
<script src="reactor.js"></script> | |
<script src="main.js"></script> |
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
const test = ( f, _n ) => { | |
console.log( ( new Array( _n || 1000 ) ).fill( 0 ).map( n => { | |
let t0 = performance.now() | |
f() | |
let t1 = performance.now() | |
return t1 - t0 | |
} ).reduce( ( sum, d ) => sum+=d ) + ' ms' ) | |
} | |
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
h1 Percussion | |
section.switches.loading | |
.start.hidden | |
button type="button" Start | |
- keys = [ "a", "s", "d", "f", "j", "k", "l", ";" ] | |
- %w( highHat crash bell rim snare tom1 tom2 kick ).each_with_index do |instrument, i| | |
.instrument data-instrument=instrument | |
- 16.times do |tick| | |
button.tick type="checkbox" data-tick=tick = keys[i] | |
p Built by <a href="http://twitter.com/LandonSchropp" target="_blank">Landon Schropp</a> as part of the <a href="http://codepen.io/collection/fDxJj/" target="_blank">Randoms Collection</a> |
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
######################################### | |
## Sonic Pi Drum Machine | |
## coded by Darin Wilson | |
## | |
use_bpm 95 | |
in_thread(name: :drum_machine) do | |
# choose your kit here (can be :acoustic, :acoustic_soft, :electro, :toy) |
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
/** | |
* This class lets you encode animated GIF files | |
* Base class : http://www.java2s.com/Code/Java/2D-Graphics-GUI/AnimatedGifEncoder.htm | |
* @author Kevin Weiner (original Java version - [email protected]) | |
* @author Thibault Imbert (AS3 version - bytearray.org) | |
* @version 0.1 AS3 implementation | |
*/ | |
//import flash.utils.ByteArray; |
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
// Based on Fisher–Yates shuffle ( https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle ) | |
// and Shuffling an Array in JavaScript ( https://www.kirupa.com/html5/shuffling_array_js.htm ) | |
// returns a new array shuffled | |
Array.prototype.shuffle = function() { | |
let tmpArray = [ ... this ]; // create a copy of original array | |
for( let i = tmpArray.length - 1; i; i -- ) { | |
let randomIndex = ~~( Math.random() * ( i + 1 ) ); | |
[ tmpArray[ i ], tmpArray[ randomIndex ] ] = [ tmpArray[ randomIndex ], tmpArray[ i ] ]; // swap | |
} |
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
const hexToRgb = hex => { | |
hex = parseInt(hex[0] != '#' ? hex : hex.substring(1), 16) | |
return [ | |
hex >> 16 & 255, | |
hex >> 8 & 255, | |
hex & 255 | |
] | |
} |
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
function ease( variable, target, easingVal, sensib ) { | |
var d = target - variable; | |
var sensib = sensib || 1; | |
if ( Math.abs( d ) > sensib ) variable += d * easingVal; | |
else variable = target; | |
return variable; | |
} |