Skip to content

Instantly share code, notes, and snippets.


Thomas Burleson ThomasBurleson

View GitHub Profile
ThomasBurleson / DownloadRatioRule.js
Last active Oct 31, 2018
Demonstration of refactor of DownloadRatioRules.js > transform deep nesting of promise chains to an easily-maintained, flattened, sequential chain.
View DownloadRatioRule.js
if (downloadRatio < 1.0) {
self.debug.log("Download ratio is poor.");
if (current > 0) {
self.debug.log("We are not at the lowest bitrate, so switch down.");
self.manifestExt.getRepresentationFor(current - 1, data).then(
function (representation1) {
function (oneDownBandwidth) {
self.manifestExt.getRepresentationFor(current, data).then(
function (representation2) {
ThomasBurleson / PeopleListControllerSpec.js
Last active Aug 8, 2018
When using Karma, RequireJS, and AngularJS... demonstrate how Promise(s) callbacks are not auto-triggered when testing with Karma/Jasmine tests. Here we use a Controller and PeopleService with an API that returns Promises. While our mock service resolves the promise, we did that in the context of our test which is `outside` the AngularJS world. …
View PeopleListControllerSpec.js
(function( describe ){
"use strict";
* Demonstration of how to properly use Jasmine testing with AngularJS promise-based services.
* NOTE: based on the origina version from Jim Lavin's
* FIXED: Igor Minar fixed this on 8/22/2013. Check with v1.2.x master branch of AngularJS
ThomasBurleson / REST
Last active Aug 8, 2018
Demonstration of classic REST service anti-pattern

Typical coding example for a sequence of asynchronous REST calls:

function update(ev, updateDiff) {
  // get current event from Back End
  return scheduleService.getEvent( {
    // send updates to Back end
    return scheduleService.editEvent(, event.version, updateDiff).then(function(evt) {
 var pack = findAircraftPackById(;

Recording a Great Coding Screencast

The Screen

First and foremost a coding screencast is about the code, and we need to make sure it looks great. There are a few aspects to this that help ensure that is the case.


720p is the target resolution. In pixel terms this is 1280x720. We've gotten the best results when we record at 2560x1440 in a HiDPI (pixel double) mode, giving an effective visible resolution of 1280x720, but extremely crisp. This resolution is achievable on 27" monitors and retina MBPs.

ThomasBurleson / AuthenticationModule.js
Created May 16, 2014
AngularJS SPA example of using a Session model with Authenticator service
View AuthenticationModule.js
* AngularJS SPA Sample using Authenticator service with Session model
* @author Thomas Burleson
(function( angular ){
"use strict";

ES6 Curry Function

const curry = (fn, ...cache) => (...args) => {
  const all = cache.concat(args);
  return all.length >= fn.length ? fn(...all) : curry(fn, ...all);


View gist:072c194a8142d93154b480bd0c17d96a
# remove local tag
git tag -d tagname-123
# remove remote tag
git push origin :refs/tags/tagname-123
# delete multiple tags by patterns
for tag in $(git tag -l '[production|tusur]*'); do git tag -d $tag; git push origin :refs/tags/$tag; done
ThomasBurleson / memoizers.js
Last active Aug 27, 2017
Memoization functions with timeouts and call-once options...
View memoizers.js
;(function(root) {
'use strict';
// A 32-bit checksum of a string.
if(!String.prototype.checksum) {
String.prototype.checksum = checksum;
// Publish the functions to the `root` package
ThomasBurleson / gist:1034340
Created Jun 19, 2011
Popup Behavior used as Swiz Popup
View gist:1034340
* Using Popup Behavior with Swiz and registerWindow()
* Source is available on GitHub project: Flex-Extensions
<?xml version="1.0" encoding="utf-8"?>
ThomasBurleson /
Last active Apr 26, 2017
Angular Material - FlexBox styles for Layout features
[flex] { 
  box-sizing: border-box;

[flex]           { flex: 1;         } // == { flex: 1 1 0%; }
[flex="grow"]    { flex: 1 1 100%;  }
[flex="initial"] { flex: 0 1 auto;  }
[flex="auto"]    { flex: 1 1 auto;  }
[flex="none"]    { flex: 0 0 auto;  }