Skip to content

Instantly share code, notes, and snippets.

View TrevorJTClarke's full-sized avatar
🙈

Trevor Clarke TrevorJTClarke

🙈
View GitHub Profile
var child_process = require('child_process'),
http = require('http');
url = require('url'),
ffmpeg = null;
var livestream = function (req, resp) {
// For live streaming, create a fragmented MP4 file with empty moov (no seeking possible).
var input = 'udp://225.1.1.1:8208';
@TrevorJTClarke
TrevorJTClarke / Ionic Deploy Shell
Created October 3, 2016 20:46
Auto Deploy to ionic, once tests pass with your favorite CI!
#!/bin/bash
# Author: @trevorjtclarke
# Initialize a deployment based on your environment
deployEnv='dev'
branch=`git rev-parse --abbrev-ref HEAD`
message=`git log -1 --pretty=%B`
versionstring=`grep 'version":[^"]*"' package.json`
version='-'
emoji=':clap:'
@TrevorJTClarke
TrevorJTClarke / _time_long.scss
Last active July 6, 2016 22:28
A module for displaying time in a verbose manner
// time-long
// a component for verbal timestamps
time-long {
display: block;
position: relative;
svg {
fill: grey;
display: inline-block;
vertical-align: top;
@TrevorJTClarke
TrevorJTClarke / MutationObserver
Created July 6, 2016 21:07
A quick reminder example of MutationObserver
/**
* MutationObserver Example
*
* A quick reminder for later use
*/
// prolly do this?
window.MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver
// Patterns
// --------------------------------------------------
// The following are take directly from:
// http://lea.verou.me/css3patterns/#
//
// Made into mixins for ease of use!
// Example: @include pt-shippo(#foo, 80px);
@TrevorJTClarke
TrevorJTClarke / jwtparser.js
Created March 4, 2016 10:00 — forked from katowulf/jwtparser.js
Deconstruct a JWT token for Firebase
// Helper function to extract claims from a JWT. Does *not* verify the
// validity of the token.
// credits: https://github.com/firebase/angularFire/blob/master/angularFire.js#L370
// polyfill window.atob() for IE8: https://github.com/davidchambers/Base64.js
// or really fast Base64 by Fred Palmer: https://code.google.com/p/javascriptbase64/
function deconstructJWT(token) {
var segments = token.split(".");
if (!segments instanceof Array || segments.length !== 3) {
throw new Error("Invalid JWT");
}
@TrevorJTClarke
TrevorJTClarke / sitespeed.io to cvs
Created January 21, 2016 22:21
Extract your sitespeed.io results into importable cvs
var all = $('a[data-html="true"]');
var done = [];
$.each(all, function(idx, item){
var fin = $(item).parent().parent()[0].innerText.split('\n');
var first = fin[0] + ';';
var second = fin[1].split(' (')[0] + ';';
var third = fin[1].split(' (')[1].replace(')', '') + '\n';
var i = first + second + third;
done.push(i);
});
@TrevorJTClarke
TrevorJTClarke / css selection
Created December 11, 2015 22:41
quick ::selection styling
::-moz-selection { background: yellow; }
::selection { background: yellow; }
@TrevorJTClarke
TrevorJTClarke / basicServiceWorker.js
Created November 11, 2015 23:14 — forked from adactio/basicServiceWorker.js
A basic Service Worker, for use on, say, a blog.
'use strict';
// Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
// http://creativecommons.org/publicdomain/zero/1.0/
(function() {
// Update 'version' if you need to refresh the cache
var staticCacheName = 'static';
var version = 'v1::';