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
/* yt-ad-buster.js: Prevents a YouTube video from being used as an ad by toggling visibility when views from ad are detected. | |
Usage: | |
Go to video "Details" page and run this script. | |
To stop, focus on main page and press Escape. | |
When running, the main page header should turn RED. | |
When stopped, the header should turn light blue. | |
If the main page is hidden in a tab, the automation may run slower. | |
If it runs too fast, YouTube will rate limit with 429 RESOURCE_EXHAUSTED errors. | |
*/ | |
class AdBusterRunner { |
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
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } | |
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } | |
function run() { | |
return _run.apply(this, arguments); | |
} | |
function _run() { | |
_run = _asyncToGenerator(function* () { |
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
/* yt-autotoggler.js: Periodically toggles visibility of a YouTube video. | |
Usage: | |
Go to video "Details" page and run this script. Requires pop-ups. | |
To stop, focus on main page and press Escape. | |
When running, the main page header should turn violet. | |
When stopped, the headers should turn light blue. | |
If the main page is hidden in a tab, the automation may run slower. | |
If `baseInterval` is less than 4 seconds, YouTube will rate limit with 429 RESOURCE_EXHAUSTED errors. | |
*/ | |
async function run() { |
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
<b>test</b> |
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
function cf (ps) { | |
ps = [...ps].reverse() | |
let x0 = 1 | |
let i = 0 | |
while (i++ < 10000000) { | |
let x1 = x0 | |
for (let p of ps) { | |
x1 = p + 1 / x1 |
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
function* dragonCurveGen(startPoint, endPoint, maxIterations, left) { | |
const M = { | |
mult: (m, v) => [ | |
m[0][0] * v[0] + m[0][1] * v[1], | |
m[1][0] * v[0] + m[1][1] * v[1] | |
], | |
minus: (u, v) => [u[0] - v[0], u[1] - v[1]], | |
plus: (u, v) => [u[0] + v[0], u[1] + v[1]], | |
left: [[0.5, -0.5], [0.5, 0.5]], |
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
function sumNaive (n, acc = 0) { | |
if (n === 0) { | |
return acc | |
} | |
return sumNaive(n - 1, acc + n) | |
} | |
// console.log(sumNaive(1000)) | |
// console.log(sumNaive(100000)) |
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
import React from 'react' | |
import Vector from 'core/Vector' | |
function angleTo (u, v) { | |
return Math.atan2(u.cross(v), u.dot(v)) | |
} | |
export default function Speedometer ({rider, prevRider, toolbarsOpen}) { | |
let style = {position: 'absolute', top: toolbarsOpen ? 40 : 0, right: 0, padding: 8, textAlign: 'right', fontFamily: 'monospace', backgroundColor: 'rgba(255,255,255,0.8)'} | |
let avgPos = rider.points.reduce((acc, {pos}) => acc.add(pos), new Vector(0, 0)).divS(rider.points.length) |
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
/* | |
* float.js | |
* fromHex: takes a 64-bit number encoded as a hex string (eg 34F5CA0157FF00FF) | |
* and returns a float whose binary representation is this number | |
* toHex: takes a number and returns the binary encoding as a hex string | |
*/ | |
/*eslint-env node */ | |
'use strict'; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<style type="text/css"> | |
html, body { | |
width: 100%; | |
height: 100%; | |
} | |
</style> |
NewerOlder