View deltaPack.js
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);
View jsdecode.html
<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;
View sky.frag
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;
View scplayer.css
#music {
opacity: 0;
transition: 1s;
position: absolute;
left: 10px;
bottom: 10px;
color: white;
height: 46px;
width: 300px;
}
View print.styl
/*
Released under the MIT License.
*/
@media print
@page
margin 0
padding 0
body
View index.html
<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');
View some_kind_of_diff.js
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) {
View eventmon.js
var logEvents = function(el) {
Object.getOwnPropertyNames(el).join(" ").match(/\bon\S+/g).forEach(function(n){el[n]=function(e){console.log(e.type,e)}});
}
View changelist.js
var ChangeList = {};
if (typeof module !== 'undefined') {
module.exports = ChangeList;
}
// Creates a new change list struct.
//
ChangeList.create = function(type) {
var type = type || ChangeList.Object;
View my_bucket_put
#!/usr/bin/ruby
# USAGE: my_bucket_put FILE_1 [FILE_N...]
# Uploads $local_path_for_bucket/FILE_1 to my_bucket/FILE_1
# This script has very little configuration to keep it simple (and serve my limited needs).
# Create a pre-configured copy of this for all your buckets. Or add command line flags.
#
# Change this to your bucket name
bucketname = "my_bucket"