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 deep(o, q, p = '.', d = 0, s = new Set()) { | |
try { | |
if (d > 5 || s.has(o)) { | |
console.log('depth met or seen', s.has(o), d) | |
} else if (Array.isArray(o)) { | |
s.add(o) | |
return [].concat(...o.map((a, b) => deep.apply(this, [a, q, p + ['[', ']'].join(b), d + 1, s]))) | |
} else if (o instanceof Object) { | |
s.add(o) |
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 I = x => x; | |
const K = x => y => x; | |
const A = f => x => f(x); | |
const T = x => f => f(x); | |
const W = f => x => f(x)(x); | |
const C = f => y => x => f(x)(y); | |
const B = f => g => x => f(g(x)); | |
const S = f => g => x => f(x)(g(x)); | |
const P = f => g => x => y => f(g(x))(g(y)); | |
const Y = f => (g => g(g))(g => f(x => g(g)(x))); |
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(url, inj) { | |
inj(url).then(function() { | |
const node = new Ipfs() | |
node.on('error', errorObject => console.error(errorObject)) | |
node.on('ready', () => { | |
console.log('nodeready') | |
node.stop(() => { | |
console.log('node gone') | |
}) |
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(){ | |
function aWorker(){ | |
onmessage = function(e) { | |
console.log('Message received from main script'); | |
var workerResult = 'Result: ' + (e.data[0] * e.data[1]); | |
console.log('Posting message back to main script'); | |
postMessage(workerResult); | |
} | |
var i = 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
(function(url, inj) { | |
inj(url).then(function() { | |
var ALPHABET = '0123456789'; | |
var MESSAGE = '314159'; | |
var button = document.createElement('button'); | |
document.body.appendChild(button) | |
button.addEventListener('click', onButton); | |
function onButton() { |
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(url, inj) { | |
inj(url).then(function() { | |
if (annyang) { | |
// Let's define a command. | |
var commands = { | |
'hello': function() { alert('Hello world!'); } | |
}; | |
// Add our commands to annyang |
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(url, inj) { | |
inj(url).then(function() { | |
html2canvas(document.body).then(function(canvas) { | |
document.body.appendChild(canvas); | |
}); | |
}) | |
})('https://html2canvas.hertzen.com/dist/html2canvas.min.js', (src, head = true) => new Promise(function(c, d) { |
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(a){var b=a.createElement("button");b.innerText="Screencap";b.onclick=function(){var d=a.querySelector("video"),e=a.createElement("canvas"),b=e.getContext("2d"),c=a.createElement("a");e.width=d.videoWidth;e.height=d.videoHeight;b.drawImage(d,0,0);c.download=[ytcsi.data_.info.docid,d.currentTime,".png"].join("-");c.href=e.toDataURL();a.body.appendChild(c);c.click();a.body.removeChild(c)};a.querySelector("h1.title").appendChild(b)})(document); |
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 AudioContext = window.AudioContext || window.webkitAudioContext; | |
var audioContext = new AudioContext(); | |
var synthDelay = audioContext.createDelay(0.2); | |
synthDelay.connect(audioContext.destination) | |
// request audio stream from the user's webcam | |
navigator.mediaDevices.getUserMedia({ | |
audio: true | |
}) | |
.then(function (stream) { |
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(style, func){ | |
document.addEventListener('sentinel-load', function(){ | |
sentinel.on(style, func); | |
}) | |
var a=document.createElement("script");a.src='//cdn.rawgit.com/muicss/sentineljs/0.0.4/dist/sentinel.min.js';a.type="text/javascript"; | |
document.head.appendChild(a); | |
})('.my-div', function(el) { | |
el.innerHTML = 'The sentinel is always watching.'; | |
}) |