Skip to content

Instantly share code, notes, and snippets.

View sterlingwes's full-sized avatar
🍉

Wes Johnson sterlingwes

🍉
View GitHub Profile
@sterlingwes
sterlingwes / ngx_http_autoindex_module.c
Created August 28, 2012 01:06
Nginx Module: Autoindex in JSON Format
/*
* Copyright (C) Igor Sysoev
* Copyright (C) Nginx, Inc.
* Borrowed from: Zed A. Shaw
* Background: http://serverfault.com/questions/123529/how-can-i-get-json-from-nginx-autoindex
*/
#include <ngx_config.h>
@sterlingwes
sterlingwes / webplatform.js
Created March 6, 2013 05:30
BlackBerry WebWorks Native Javascript Wrapper exposed at platform:///webplatform.js by webviews
(function () {
/*
Copyright 2012 Research In Motion Limited.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@sterlingwes
sterlingwes / StorytimeParser.js
Last active December 31, 2015 23:00
WIP Parser for Storytime Data
var DEFAULT_UNITS = 'hours'
var HOURS_FROM_MILLISECONDS = 3600000
var MINUTES_FROM_MILLISECONDS = HOURS_FROM_MILLISECONDS / 60
var m = require('moment')
/*
* allows for manipulating the raw data stored by Storytime
*
* filepath (string) - expects a json file relative to the execution context
@sterlingwes
sterlingwes / keybase.md
Created February 8, 2016 17:49
keybase.md

Keybase proof

I hereby claim:

  • I am sterlingwes on github.
  • I am sterlingwes (https://keybase.io/sterlingwes) on keybase.
  • I have a public key whose fingerprint is 85ED 9BAF 923C 814E A02C 2775 F61C 0CD9 87CB D962

To claim this, I am signing this object:

@sterlingwes
sterlingwes / README.md
Created January 5, 2017 16:53
Convert video to optimized GIF with libav (avconv)

Prerequisites

  • avconv
  • gifsicle

If you're on Ubuntu:

  • apt-get install gifsicle libav-tools

Command

@sterlingwes
sterlingwes / loaderHook.js
Last active May 2, 2017 16:04
webpack server side rendering with file loader (ie: require()'d images)
const fs = require('fs')
const utils = require('loader-utils')
const defaultOptions = {
extensions: ['.png', '.jpg'],
filePrefix: 'img/img-',
hashLength: 6
}
module.exports = function (options) {
@sterlingwes
sterlingwes / loadertest.html
Created May 10, 2017 14:53
Three.js OBJ Loader test
<html>
<head>
<script src="node_modules/three/build/three.js"></script>
<script src="node_modules/three/examples/js/loaders/OBJLoader.js"></script>
</head>
<body>
<script>
const model = 'https://s3.amazonaws.com/areo-dev-wjohnson/v1/worlds/a42d78b1-a28a-4d7b-b64e-c1512ea9bac4/models/a4cd6444-fa12-4edf-aba5-8aa72e693bc6-m'
fetch(model)
.then(response => response.blob())
@sterlingwes
sterlingwes / PerformanceTimer.js
Created May 10, 2017 16:01
Performance timing with window.performance
const perf = window.performance
class PerformanceTimer {
constructor (name) {
this.name = name
this.markStart = `${name}-start`
this.markStop = `${name}-stop`
}
start () {
@sterlingwes
sterlingwes / javascript.json
Created July 28, 2017 14:38
React VS Code Snippets
{
/*
// Place your snippets for JavaScript here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [