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
#define SPIRV_INLINE inline | |
struct int3 | |
{ | |
int x; | |
int y; | |
int z; | |
}; | |
struct float4 |
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
#version 450 | |
#extension GL_ARB_separate_shader_objects : enable | |
#define WORKER_SIZE 16 | |
#define WORKGROUP_SIZE 4 | |
layout (local_size_x = WORKGROUP_SIZE, local_size_y = WORKGROUP_SIZE, local_size_z = 1 ) in; | |
struct Pixel{ | |
vec4 value; |
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
// Uses getUserMedia to record audio from microphone, compresses it to mp3, and throws it away. | |
// You should change the last step to e.g. pushing the audio to a server over a WebSocket. | |
// This script uses lame.js for mp3 encoding | |
// https://github.com/zhuker/lamejs | |
var audioDataCallback = function(encodedData, originalData) { | |
console.log("Encoded " + encodedData.byteLength + " bytes. Original: " + originalData.byteLength); | |
}; |
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
var pngCompress = function(buffer) { | |
var canvas = document.createElement('canvas'); | |
canvas.width = Math.min(Math.ceil((buffer.byteLength+6) / 3), 16384); | |
canvas.height = Math.ceil((buffer.byteLength+6) / (3*canvas.width)); | |
var ctx = canvas.getContext('2d'); | |
var id = ctx.getImageData(0, 0, canvas.width, canvas.height); | |
var u32 = new Uint32Array(1); | |
var u8 = new Uint8Array(u32.buffer); | |
u32[0] = buffer.byteLength; | |
var src = new Uint8Array(buffer); |
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
<html> | |
<body> | |
<script> | |
var QRDecoder = function(imageData) { | |
this.imageData = imageData; | |
this.imageBits = new Int8Array(QRDecoder.MAX_SIZE * QRDecoder.MAX_SIZE); | |
this.decodedBits = new Uint8Array( (QRDecoder.MAX_SIZE * QRDecoder.MAX_SIZE) >> 3 ); | |
this.size = -1; | |
this.ecc = -1; |
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
vec3 lightPos_ = vec3( | |
-cos(iGlobalTime*0.1)*-8.5, | |
3.5+sin(iGlobalTime*0.05)*3.0, | |
-(sin(iGlobalTime*0.1)*4.0-5.4) | |
); | |
vec3 bgLight = normalize(lightPos_); | |
vec3 lightPos = bgLight * 9999.0; | |
vec3 sun = vec3(5.0, 3.5, 2.0)*4.0; |
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
#music { | |
opacity: 0; | |
transition: 1s; | |
position: absolute; | |
left: 10px; | |
bottom: 10px; | |
color: white; | |
height: 46px; | |
width: 300px; | |
} |
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
/* | |
Released under the MIT License. | |
*/ | |
@media print | |
@page | |
margin 0 | |
padding 0 | |
body |
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
<html> | |
<body> | |
<h1 contenteditable id="title"></h1> | |
<input id="edit"> | |
<script src="model.js"></script> | |
<script> | |
var m = new Model(); | |
m.sync('greeting', document.getElementById('edit'), 'value'); | |
m.sync('greeting', document.getElementById('title'), 'innerText'); |
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
var diff = function(beforeStr, afterStr) { | |
var i,j,prefixLen=0; | |
var before = beforeStr ? beforeStr.split(/ /) : []; | |
var after = afterStr ? afterStr.split(/ /) : []; | |
var arr = []; | |
for (i=0, j=0; i<before.length && j<after.length; i++, j++) { | |
if (before[i] === after[j]) { | |
prefixLen++; | |
} else { | |
if (prefixLen) { |