View gist:69d219511ca1398a8f5b1d0030085dc6
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
did:3:kjzl6cwe1jw149x0rcxc5b3ltxrgh7nwt4pab0eg04gqvztfbr52wizt8iwkk1b |
View pico_rgb_game.py
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 picokeypad as keypad | |
import random | |
import time | |
debug = 0 | |
keypad.init() | |
keypad.set_brightness(1.0) | |
guess = random.randint(0, 15) |
View index.html
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 name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
View console.help.js
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.help = function(arg) { | |
if(arg === null || arg === undefined) return console.log(arg); | |
if(typeof(arg) === 'string') return console.log(arg); | |
if('__help' in arg) { console.log(arg.__help); } | |
if('__help' in arg.constructor) { console.log(arg.constructor.__help); } | |
console.log(arg); | |
} | |
.bind(console); | |
View index.js
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
// Welcome! require() some modules from npm (like you were using browserify) | |
// and then hit Run Code to run your code on the right side. | |
// Modules get downloaded from browserify-cdn and bundled in your browser. | |
require('xmldom-alpha') |
View range.js
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 range = function* (stop = 0, step = 1) { | |
const shouldStop = (n)=>stop >= 0 ? (n < stop) : (n > stop); | |
const interval = (n)=>stop >= 0 ? n + step : n - step; | |
let itr = function*() { | |
let i = 0; | |
while (shouldStop(i)) { | |
yield i; | |
i = interval(i); | |
} | |
}; |
View range.js
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 range = (stop) => { stop = stop || 0; const shouldStop = (n) => stop >= 0 ? (n < stop) : (n > stop); const interval = (n) => stop >= 0 ? n + 1 : n - 1; let itr = {}; itr[Symbol.iterator] = function* () { let i = 0; while(shouldStop(i)) { yield i; i = interval(i);}}; return itr; }; | |
for(let i of range(100)) | |
console.log(i) | |
for(let i of range(-100)) | |
console.log(i) |
View applyTemplate.js
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 applyTemplate = (templateElement, data) => { | |
const element = templateElement.content.cloneNode(true); | |
const treeWalker = document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT, () => NodeFilter.FILTER_ACCEPT); | |
while(treeWalker.nextNode()) { | |
const node = treeWalker.currentNode; | |
for(let bindAttr in node.dataset) { | |
let isBindableAttr = (bindAttr.indexOf('bind_') == 0) ? true : false; | |
if(isBindableAttr) { | |
let dataKeyString = node.dataset[bindAttr]; |
View screenrecord.js
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() { | |
// Download locally | |
function download(blob) { | |
var url = window.URL.createObjectURL(blob); | |
var a = document.createElement('a'); | |
a.style.display = 'none'; | |
a.href = url; | |
a.download = 'test.webm'; | |
document.body.appendChild(a); | |
a.click(); |
View canvasrecord.js
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() { | |
let canvas = document.querySelector('canvas'); | |
// Optional frames per second argument. | |
let stream = canvas.captureStream(25); | |
var options = {mimeType: 'video/webm; codecs=vp9'}; | |
let recorder = new MediaRecorder(stream, options); | |
let blobs = []; | |
function download(blob) { | |
var url = window.URL.createObjectURL(blob); |
NewerOlder