Skip to content

Instantly share code, notes, and snippets.

View boushley's full-sized avatar

Aaron Boushley boushley

  • Songtradr
  • Seattle, WA
View GitHub Profile
@boushley
boushley / gist:5471599
Last active May 17, 2019 09:11
A JavaScript UTF-8 decoding function for ArrayBuffers. Credit for most of the heavy lifting goes to "bob" http://ciaranj.blogspot.com/2007/11/utf8-characters-encoding-in-javascript.html
function decodeUtf8(arrayBuffer) {
var result = "";
var i = 0;
var c = 0;
var c1 = 0;
var c2 = 0;
var data = new Uint8Array(arrayBuffer);
// If we have a BOM skip it
@boushley
boushley / MockVideoElement.js
Created January 6, 2016 17:37
Mock Video Element for use with dash.js -- Not quite complete but gets the basics functional
function createMockVideoElement() {
"use strict";
var video = {};
video.__mock_listeners = {};
video.__mock_progress = function(toProgress) {
var endProgressAt = video.currentTime + toProgress;
video.__mock_fire_event('play');
@boushley
boushley / isobmff-mp4.grammar
Last active August 9, 2018 23:01
ISO BMFF - MP4 Grammar for Synalyze It
<?xml version="1.0" encoding="UTF-8"?>
<ufwb version="1.17">
<grammar name="ISOBMFF MP4" start="id:8" fileextension="mp4" uti="public.mpeg-4">
<structure name="Atom" id="9" length="Size" extends="id:10">
<number name="Size" id="11" fillcolor="68D6FB" type="integer" length="4">
<description>Atom Size</description>
</number>
<number name="Type" mustmatch="yes" id="12" fillcolor="FF7B7A" type="integer" length="4" display="hex">
<description>Atom Type</description>
</number>
@boushley
boushley / dllBootstrapPlugin.js
Created May 15, 2017 20:19
Boostrap Webpack DLL Chunk
// This plugin modifies the generated webpack code to execute a module within the DLL bundle in addition to preserving
// the default behavior of exporting the webpack require function
class DllBootstrapPlugin {
constructor(options) {
this.options = options || {}
}
apply(compiler) {
compiler.plugin('compilation', (compilation) => {
compilation.mainTemplate.plugin('startup', (source, chunk) => {
@boushley
boushley / test-node-server.js
Created March 1, 2016 21:32
Example KOA Server to serve static files
var fs = require('fs');
var koa = require('koa');
var r = require('koa-route');
var bodyParser = require('koa-bodyparser');
var app = koa();
app.use(function *(next){
var start = new Date;
yield next;
var ms = new Date - start;
@boushley
boushley / dash-init-wait-time-calculation.js
Created January 16, 2016 00:15
An example of how you could calculate wait time without modifying or extending dash.js
(function(){
var videoElement = document.querySelector("#videoPlayer");
var url = "http://dash.edgesuite.net/envivio/Envivio-dash2/manifest.mpd";
var player = MediaPlayer().create();
player.initialize(videoElement, url, true);
var waitTimeStart;
videoElement.addEventListener('waiting', function() {
// If a second stream stalls keep the oldest start time
if (!waitTimeStart) {
@boushley
boushley / gist:6324152
Last active December 21, 2015 15:08
IAM Policy which allows for basic ElasticBeanstalk usage.
{
"Statement": [
{
"Effect": "Allow",
"Action": [
"elasticbeanstalk:*",
"ec2:*",
"elasticloadbalancing:*",
"cloudformation:*",
"autoscaling:*",
@boushley
boushley / Console Commands
Last active September 22, 2015 22:43
JAWS Environment Variables
# List JAWS environment variables
# jaws env list [stage] [region]
jaws env list dev us-west-2 # This will show all environment variables for the stage `dev` in us-west-2
# Set an environment variable
# jaws env set [stage] [region] [key] [value]
jaws env set dev us-west-2 MY_ENV_VAR somevalue # This sets the environment variable `MY_ENV_VAR` to `somevalue` for the dev stage in us-west-2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Contact PLAYBOOK | Your Phoenix Family Fun Guide! Helping you find kid-Friendly activites, events, outings for families that are educational and fun for kids of all ages, serving the West Valley of Phoenix, AZ</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="description" content="Phoenix Family Fun Guide to activites, outings, educational trips, dance lessons that are educational and fun serving the Valley of the Sun in Phoenix Arizona, our phoenix kids directory serving Peoria, AZ and Glendale, AZ, Surprise, AZ, and Scottsdale, AZ" />
@boushley
boushley / keybase.md
Created October 27, 2014 16:46
keybase.md

Keybase proof

I hereby claim:

  • I am boushley on github.
  • I am boushley (https://keybase.io/boushley) on keybase.
  • I have a public key whose fingerprint is DD4A ABD8 6F6C 5F8C 3675 29F2 8008 8EA6 F2C8 408D

To claim this, I am signing this object: