Skip to content

Instantly share code, notes, and snippets.

View ThomasBurleson's full-sized avatar

Thomas Burleson ThomasBurleson

View GitHub Profile
@ThomasBurleson
ThomasBurleson / pr.md
Created November 13, 2016 13:15 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

import {Injectable} from 'angular2/core';
import {Http, Headers} from 'angular2/http';
import {SessionModel} from './global/session';
@Injectable()
export class AuthenticatedHttpClient {
constructor(private http: Http, private session:SessionModel) { }
createAuthorizationHeader() {
return {
var GithubAPI = require('github');
var child_process = require('child_process');
var github = new GithubAPI({
version: '3.0.0',
});
github.authenticate({
type: "oauth",
username: 'DevVersion-Bot',
@ThomasBurleson
ThomasBurleson / gist:2f37d55c98780dd2a367
Created February 7, 2016 12:21 — forked from rootscity/gist:fcf909f5820407a67c8e
angular-material modal drag directive
// Usage
//
//<md-dialog rc-drag="md-toolbar" ng-cloak>
// <form>
// <md-toolbar>
// ...
// </md-toolbar>
// <md-dialog-content>
// ...
// </md-dialog-content>
@ThomasBurleson
ThomasBurleson / MediaQueryWatcher.js
Last active October 6, 2015 00:14
AngularJS MediaQueryWatcher service (es6) that supports subscribers to mediaQuery change notifications.
/**
* Service that manages subscriptions to mediaQuery changes.
* Subscribers will be notified of initialize, enter, and leave changes
* via ::attach() callback functions.
*
* @code:
*
* let self = $scope,
* layout_sm = "screen and (min-width:0px) and (max-width:599px)",
@ThomasBurleson
ThomasBurleson / flexBox.md
Last active April 26, 2017 09:59
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;  }

Understanding the Team Commit Process

The Angular Material team has a very specific process for change commits.

Our commit process is intentionally restrictive to support the rapid iterations and manage change complexity within Angular Material. Angular Material uses a "Pull Request" process to allow team leaders opportunities to maintain code reviews, ensure sanity checks, encourage coding standards, and provide feedbackto the developer.

General Rules

  • Please do not commit directly to master; unless explicitly authorized by the Team Leadership
  • Team developers should fork the repository and work on fixes, features, or enhancements on their own fork.
@ThomasBurleson
ThomasBurleson / BarChart.js
Last active October 9, 2019 15:13
Reusable Chart component for D3 - using prototypes and factories
(function() {
// Based on article @ http://www.toptal.com/d3-js/towards-reusable-d3-js-charts
// Publish a factory method for Chart instances
// @usage:
// var runningChart = BarChart.instanceOf( {barPadding : 2 } );
// var weatherChart = BarChart.instanceOf()
// .fillColor('coral');
window.BarChart = {
@ThomasBurleson
ThomasBurleson / layout.js
Last active August 29, 2015 14:27
ngMaterial Layout Directives used to create Layout class selectors instead of attribute selectors
(function () {
'use strict';
angular.module('material.layouts', ['material.core'])
// Attribute directives with optional value(s)
.directive('layout' , attribute_withValue('layout' , true) )
.directive('layoutSm' , attribute_withValue('layout-sm' , true) )

Moving to ES6 from CoffeeScript

I fell in love with CoffeeScript a couple of years ago. Javascript has always seemed something of an interesting curiosity to me and I was happy to see the meteoric rise of Node.js, but coming from a background of Python I really preferred a cleaner syntax.

In any fast moving community it is inevitable that things will change, and so today we see a big shift toward ES6, the new version of Javascript. It incorporates a handful of the nicer features from CoffeeScript and is usable today through tools like Babel. Here are some of my thoughts and issues on moving away from CoffeeScript in favor of ES6.

While reading I suggest keeping open a tab to Babel's learning ES6 page. The examples there are great.

Punctuation

Holy punctuation, Batman! Say goodbye to your whitespace and hello to parenthesis, curly braces, and semicolons again. Even with the advanced ES6 syntax you'll find yourself writing a lot more punctuatio