Skip to content

Instantly share code, notes, and snippets.

View ThomasBurleson's full-sized avatar

Thomas Burleson ThomasBurleson

View GitHub Profile
@ThomasBurleson
ThomasBurleson / examples.js
Created March 27, 2015 19:00
Code improvements using ternary operators
// Classic solution
function getLabel () {
//-- if label provided, then send label
if (attr.label) return attr.label;
//-- otherwise, we have to search for the `md-tab-label` element
var label = element.find('md-tab-label');
if (label.length) return label.html();
//-- otherwise, we have no label.
return element.html();
}
@ThomasBurleson
ThomasBurleson / AsyncProgramming_Exercise35.js
Last active August 29, 2015 14:19
Exercise 35: Traditional Nested Async calls before rewritten with Promises or Observables
function(window, $, showMovieLists, showError) {
var error,
configDone,
movieLists,
queueList,
windowLoaded,
outputDisplayed,
errorHandler = function() {
// Otherwise show the error.
error = "There was a connectivity error";

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

@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) )
@ThomasBurleson
ThomasBurleson / ItemRendererFactory.as
Created February 11, 2011 17:14
Flex - Refactoring of UIClassFactory
////////////////////////////////////////////////////////////////////////////////
//
// Copyright 2009 Farata Systems LLC
// All Rights Reserved.
//
// NOTICE: Farata Systems permits you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////
@ThomasBurleson
ThomasBurleson / gist:890676
Created March 28, 2011 15:37
BabelFx - Use of XML to dynamically build MenuBar solution.
<?xml version="1.0" encoding="utf-8"?>
<mx:MenuBar
labelField="@label"
dataProvider="{ _menuDataProvider.menuitem }"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300">
<fx:Script>
<![CDATA[
public function set main(items:Array) :void { updateMenu( _menuDataProvider.menuitem, items); }
@ThomasBurleson
ThomasBurleson / gist:891377
Created March 28, 2011 21:58
Flex ItemRenderers - global data usages
<?xml version="1.0" encoding="utf-8"?>
<mx:DataGrid width="100%" height="100%"
xmlns:mx="http://www.adobe.com/2006/mxml" >
<mx:Script>
<![CDATA[
/**
* Array of localized, marker labels
*/
public var availableMarkers : Array = [ ];
@ThomasBurleson
ThomasBurleson / gist:925645
Created April 18, 2011 16:22
Swiz Metadata XML - Adapted for use in FB4 SWCs
<?xml version="1.0" encoding="utf-8"?>
<annotations version="1.0">
<metadata name="Dispatcher" description="Used to request injection of the root Swiz dispatcher (default) or the dispatcher for containing Swiz instance." >
<context name="variable" />
<context name="setter" />
<attribute name="scope" type="String" defaultValue="global" required="false" values="global,local," hint="string" />
</metadata>
@ThomasBurleson
ThomasBurleson / gist:972665
Created May 14, 2011 21:38
AS3 Functional Programming to Convert String list to BitFlags
"properties,size,displayList"
.split(",")
.map( function ( item:String, index:int, array:Array ):uint {
switch( StringUtil.trim( item ) )
{
case "displaylist": return InvalidationFlags.DISPLAY_LIST;
case "size" : return InvalidationFlags.SIZE;
case "properties" : return InvalidationFlags.PROPERTIES;
default : throw new Error( "Unsupported invalidation option specified." );
}

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.