Skip to content

Instantly share code, notes, and snippets.

View TrevorJTClarke's full-sized avatar
🙈

Trevor Clarke TrevorJTClarke

🙈
View GitHub Profile
@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");
}
// 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 / 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
@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 / 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:'
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 / deploy_with_ebcli3_on_circleci.md
Last active March 9, 2017 00:45 — forked from RobertoSchneiders/deploy_with_ebcli3_on_circleci.md
Settings to deploy to AWS Elastic Beanstalk on CircleCi (EB Cli 3)

Configure the deploy of AWS Elastic Beanstalk through CircleCI.

Configure Environments Variables

On Project Settings > Environment Variables add this keys:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
    The aws user must have the right permissions. This can be hard, maybe, this can help you.

Confirm Build Environment:

@TrevorJTClarke
TrevorJTClarke / BlueSmirf: Bluetooth Notes
Created January 20, 2017 00:07
BlueSmirf: Bluetooth Notes - How I got data passthrough working
Reference Doc: https://cdn.sparkfun.com/assets/1/e/e/5/d/5217b297757b7fd3748b4567.pdf
Initial Setup Doc: https://learn.sparkfun.com/tutorials/using-the-bluesmirf#example-code-using-command-mode
Final Setup: (Data Passthrough settings)
$$$ Type this within 60 sec of turning modem on. You get a "CMD" response.
+ This turns on echo so you see what you are typing.
SU,96 This sets 9600 baud to Uno.
ST,255 This disables that pesky 60 sec timer.
--- This ends the command session.
0xcfF015fAa7ADeE7D013dB4A3AA6e34a5a51F0EBE
@TrevorJTClarke
TrevorJTClarke / user.sol
Last active November 1, 2017 19:14
User with some skillz & endorsed by other users, solidity contract style!
pragma solidity ^0.4.15;
contract User {
// Name of the contract
string public userName;
uint public skillsTotal = 0;
address owner;
// Used to keep track of skills