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
#!/usr/bin/env node | |
var request = require('request'); | |
var given = process.argv.splice(2); | |
function command(args) { | |
var payload = {}; | |
if (args[0]) payload.power = args[0]; | |
if (parseFloat(args[1])) payload.brightness = parseFloat(args[1]); |
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
#!/usr/bin/env node | |
'use strict'; | |
// memoization: factorial of n is FACTORIALS[n] | |
const FACTORIALS = [0, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800, 479001600, 6227020800, 87178291200, 1307674368000, 20922789888000, 355687428096000, 6402373705728000, 121645100408832000, 2432902008176640000, 51090942171709440000, 1124000727777607680000, 25852016738884976640000, 620448401733239439360000, 15511210043330985984000000, 403291461126605635584000000, 10888869450418352160768000000, 304888344611713860501504000000, 8841761993739701954543616000000, 265252859812191058636308480000000, 8222838654177922817725562880000000, 263130836933693530167218012160000000, 8683317618811886495518194401280000000, 295232799039604140847618609643520000000, 10333147966386144929666651337523200000000, 371993326789901217467999448150835200000000, 13763753091226345046315979581580902400000000, 523022617466601111760007224100074291200000000, 20397882081197443358640281739902897356800000000, 8159152832478977343456112695961158942720000 |
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 THRESHOLD = 0.8; // I find this to be a good number | |
function isInViewPort(el) { | |
// getBoundingClientRect() compared with body scrolltop and innerHeight | |
const BCR = el.getBoundingClientRect(); | |
const elTop = BCR.top; | |
const elWidth = BCR.height; | |
return (elTop > 0 && elTop < THRESHOLD * window.innerHeight) || elTop < 0; |
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
.js { | |
// javascript executing environment | |
.reveal { | |
transition: opacity .8s, transform .7s; | |
opacity: 0; | |
transform: translateY(50px); | |
&.appear { | |
opacity: 1; | |
transform: translateY(0); |
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
console.log("YTFixer Enabled");var xsp=document.getElementById("player"),xsh=document.getElementById("placeholder-player"),xsw=document.getElementById("watch7-content"),xst,xso,xsn=document.getElementById("watch7-sidebar-contents");function YTFix(){xst=document.getElementById("theater-background").clientHeight;xtn=(xst+10).toString()+"px";xsp.style.position="fixed";xsh.style.display="none";xsp.style.top="62px";xsp.style.zIndex="10";xsw.style.position="relative";xsw.style.top=xtn;if(xst==720){xsp.style.marginLeft="calc(50% - 853px)"}else if(xst==480){xsp.style.marginLeft="calc(50% - 640px)"}else if(xst==360){xsp.style.marginLeft="calc(50% - 533px)"}else if(xst==240){xsp.style.marginLeft="calc(50% - 213px)"}else{xsp.style.marginLeft="100px"}if(window.innerWidth<=1084 && window.innerWidth>640){xsp.style.marginLeft="0"};if(window.innerWidth>640){xsn.style.position="relative";xsn.style.top=xtn}console.log("YT Video Fixed by YTFixer")};function hashX(){if(window.location.href.indexOf("://www.youtube.com/watch")>-1) |
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
#!/usr/bin/env node | |
var exec = require('child_process').exec | |
// accept input from pipe in | |
var data = '' | |
var IN = process.stdin | |
IN.resume() | |
IN.setEncoding('utf8') |
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
// Constants | |
const M_RATES = [ | |
0, | |
0.001, | |
0.01, | |
0.1, | |
]; | |
const POP_SIZE = 100; | |
const GENERATIONS = 50; |
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 is pretty crude. I didn't really care though since it was | |
// mostly something fueled by curiosity after a long road trip | |
// and wasn't intended to capture things like collisions / AI control of speeds. | |
// All code in this file is licensed under the MIT License. | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> |
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> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title>TypeScript Practice</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<style> | |
body { | |
font-family: sans-serif; |
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
import {LitElement, html} from '@polymer/lit-element'; | |
let __taskid_ref = 0; | |
const taskid = () => { | |
return __taskid_ref ++; | |
} | |
class PolyItem extends LitElement { | |
static get properties() { |
OlderNewer