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(); |
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); |
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 waitForElement(selector) { | |
return new Promise(function(resolve, reject) { | |
var element = document.querySelector(selector); | |
if(element) { | |
resolve(element); | |
return; | |
} | |
var observer = new MutationObserver(function(mutations) { |
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 monitorEvents(element) { | |
var log = function(e) { console.log(e);}; | |
var events = []; | |
for(var i in element) { | |
if(i.startsWith("on")) events.push(i.substr(2)); | |
} | |
events.forEach(function(eventName) { | |
element.addEventListener(eventName, log); | |
}); |
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
from microbit import * | |
# quickly create a level of two rows, with pixels set to 0 hits and 1 hits | |
blocks = [[1 - i for j in range(5) ] for i in range(2)] | |
ball = [2, 3] | |
ball_direction = [1,-1] | |
paddle = [2, 4] | |
previous_game_time = running_time() | |
ball_timing = running_time() | |
game_time = running_time() |
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"> | |
<link rel="manifest" href="https://jsbin-user-assets.s3.amazonaws.com/kinlan/manifest.json"> | |
<title>iOS Manifest Polyfill</title> | |
</head> | |
<body> |
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>Add to Homescreen</title> | |
<meta name="apple-mobile-web-app-capable" content="yes"> | |
<meta name="apple-mobile-web-app-title" content="Test name 2"> |
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 RGBToHSL = (r,g,b) => { | |
// Algo http://www.rapidtables.com/convert/color/rgb-to-hsl.htm | |
const [r1,g1,b1] = [r/255, g/255, b/255]; | |
const [cmax, cmin] = [Math.max(r1,g1,b1), Math.min(r1,g1,b1)]; | |
const d = (cmax - cmin); | |
const L = (cmax + cmin) / 2; | |
const S = d == 0 ? 0 : (d / ( 1 - Math.abs(2*L-1))); | |
const H = d == 0 ? 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
const HSLToRBG = (H, S, L) => { | |
// algo http://www.rapidtables.com/convert/color/hsl-to-rgb.htm | |
const C = (1 - Math.abs(2*L - 1)) * S; | |
const X = C * (1 - Math.abs(((H / 60) % 2)-1)); | |
const m = L - C/2; | |
const [r1, g1, b1] = H >= 0 && H < 60 ? [C, X, 0] : | |
H >= 60 && H < 120 ? [X, C, 0] : | |
H >= 120 && H < 180 ? [0, C, X] : | |
H >= 180 && H < 240 ? [0, X, C] : |
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() { | |
var ManifestParser = (function() { | |
'use strict'; | |
var _jsonInput = {}; | |
var _manifest = {}; | |
var _logs = []; | |
var _tips = []; | |
var _success = true; |