Skip to content

Instantly share code, notes, and snippets.

const TOKENS = {
id: /[a-z]+/,
num: /(?:[0-9]+\.)?[0-9]+/,
op: /[+-/*]/,
leftparen: /\(/,
rightparen: /\)/,
error: /./
}
function* tokenize(str, tokens) {
<script>
const url = 'chrome-devtools://devtools/bundled/inspector.html?nodeFrontend=true'
fetch(`http://localhost:${location.search.slice(1)}/json`)
.then(res => res.json())
.then(results => results.find(x => x.url == location).webSocketDebuggerUrl)
.then(wsurl => ({then: addEventListener.bind(new WebSocket(wsurl), 'open')}))
.then(ev => ev.target.send(JSON.stringify({
method: 'Page.navigate',
id: 0,
params: {url}
@sgentle
sgentle / gist:7a550550e0a7b220a5e6
Created February 27, 2016 17:43
Beyoncé numbers
22
10213223
10311233
10313314
10313315
10313316
10313317
10313318
10313319
21322314
@sgentle
sgentle / gist:58e3e37c28a7662d014f
Created April 26, 2015 10:08
Audio loops in CoffeeScript with fetch and Promises
ctx = new (AudioContext || webkitAudioContext)
addAudio = (src) ->
fetch src
.then (response) -> response.arrayBuffer()
.then (audioData) -> new Promise (accept) -> ctx.decodeAudioData audioData, accept
.then (buffer) ->
node = ctx.createBufferSource()
node.buffer = buffer
node.loop = true
node.connect ctx.destination
<div autofocus></div>
<script>
navigator.webkitGetUserMedia({audio: true}, function(){}, function(){});
window.onresize = function() {
requestAnimationFrame(function() {
document.body.style.backgroundColor = "red";
});
window.onresize = function(){};
};

Keybase proof

I hereby claim:

  • I am sgentle on github.
  • I am sgentle (https://keybase.io/sgentle) on keybase.
  • I have a public key whose fingerprint is DE22 29B5 2F68 37CA 370C 85B4 29CA 85AE 3B87 C23B

To claim this, I am signing this object:

#!/bin/bash
QUALITY=${2:-bestvideo}
if [[ $1 == "http"* ]]; then
URL=`youtube-dl -f $QUALITY -g $1`;
else
URL=$1
fi
open -na /Applications/VLC.app "$URL" --args --loop --no-osd --no-macosx-nativefullscreenmode --video-wallpaper
echo 'tell application "VLC" to close every window' | osascript
or#orCorroreoraortoreorsor oraornor oroorborjoreorcortor orworhoroorsoreor orkoreoryorsor oraorroreor ortorhoreor oraorrorgoruormoreornortorsor
orSoreortor or=or or(oraorrorgorsor.or.or.or)or or-or>or
or or oreorloreormorsor or=or oriorfor oraorrorgorsor[or0or]or.orcoroornorsortorroruorcortoroorror.ornoraormoreor or=or=or or"orAorrorroraoryor"or ortorhoreornor oraorrorgorsor[or0or]or oreorlorsoreor oraorrorgorsor
or
or or or@or[oreorloreormor]or or=or ortorroruoreor orforoorror oreorloreormor oriornor oreorloreormorsor
or or or or or
or or orroreortoruorrornor or@or
or
preloads = $('img.preload')
preloads.load(_.barrier(preloads.length, function() { alert("all images loaded!"); }));
javascript:var s=document.createElement('script');s.src='http://encodedrecords.com/dickbar/dickbar.js';document.head.appendChild(s);