Skip to content

Instantly share code, notes, and snippets.

View ThomasBurleson's full-sized avatar

Thomas Burleson ThomasBurleson

View GitHub Profile

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.

Resolution

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
ThomasBurleson / StoryService.js
Created April 24, 2014 22:57
Using URLLookups with <xxx>Services to centralize all RESTful dataservice urls.
/**
* URLS before prefixing with ENDPOINT
*
* var URLS = { *
* STORY : {
* FIND_ALL : "/clients/{1}/stories.json"
* , LOAD_STORY : "/clients/{1}/stories/{2}.json"
* }
* USER : {
* LOAD_ALL : "clients/{0}/users.json"
'use strict';
var _ = require('underscore');
module.exports = function () {
var proto,
injections = [];
// define constructor function
@ThomasBurleson
ThomasBurleson / UnderstandingClosures.js
Created April 11, 2014 02:49
JavaScript - Qualification Test (Senior) > Closures
function init(list)
{
var result = [ ];
for (var i=0; i<list.length; i++)
{
var item = 'item' + list[i];
result.push( function() {
console.log( item + ' ' + list[i]);
@ThomasBurleson
ThomasBurleson / $QDecorator.js
Created March 23, 2014 15:51
Decorate the AngularJS $q instance to inject spread() and resolve() functionality.
/**
* @author Thomas Burleson
* @date November, 2013
* @copyright 2013 Mindspace LLC.
* @web http://solutionOptimist.com
*
* @description
*
* Used within AngularJS to decorate/enhance the AngularJS `$q` service.
*
@ThomasBurleson
ThomasBurleson / verboseForLoop.js
Last active August 29, 2015 13:57
Demonstration of reducing a messy, verbose `for loop` using functional approach for terse, concise solution.
/**
* Traditional solution: For-loop usage
*/
function buildEpisodes(markers)
{
var result = [],i, newEpisode;
if (markers && markers.length > 0) {
for (i = 0; i < markers.length; i++) {
newEpisode = makeEpisode(markers[i]);
@ThomasBurleson
ThomasBurleson / DelayedMessages.js
Created February 17, 2014 17:29
Example of using promise chains to delay and log messages. Uses Q Promises with setTimeout to create promise-based API delay() function.
/**
* Chain 2 Delay calls together in a non-nesting fashion
*/
function myDelayedMessages()
{
/**
* Delay function using Q promises and setTimeout() internally
*/
var delay = function( duration )
{
@ThomasBurleson
ThomasBurleson / supplant.coffee
Created December 3, 2013 23:33
String building function that support index-based or key-based token substitutions; e.g. supplant( "Hello {firstName} {lastName}", user );
# Make sure the supplant() method is available!
# Now supports dot notation for complex object value substitutions
# e.e. {foo.boo.moo.uff ...}
String::supplant = (o) ->
this.replace /\{([^{}]*)\}/g, (a, b) ->
p = b.split('.')
r = o
# Descend the property chain "b" to resolve the end-chain value
@ThomasBurleson
ThomasBurleson / JMQ.coffee
Last active December 30, 2015 04:58
Javascript Message Queue is a simple topic-based messaging (aka Pub/Sub) construct that also publishes customizable `addListener()`, `removeListener()`, and `announceChange()` APIs.
# ******************************************************************************************************
#
# JMQ - jQuery-based Message Queue
#
# This class provides a simple publish/subscribe mechanism
# using the jQuery v1.7x Callbacks class as the notification engine
# NOTE: here each instance of JMQ() has its `own` topic registry
#
# Copyright (c) 2012 Mindspace
#
@ThomasBurleson
ThomasBurleson / DownloadRatioRule.js
Last active October 31, 2018 19:54
Demonstration of refactor of DownloadRatioRules.js > transform deep nesting of promise chains to an easily-maintained, flattened, sequential chain.
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) {
self.manifestExt.getBandwidth(representation1).then(
function (oneDownBandwidth) {
self.manifestExt.getRepresentationFor(current, data).then(
function (representation2) {