Skip to content

Instantly share code, notes, and snippets.

View ThomasBurleson's full-sized avatar

Thomas Burleson ThomasBurleson

View GitHub Profile
@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";
@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 / sideNavDemo.html
Created March 1, 2015 13:56
Demonstration of how the SideNav component requires the Angular Material app to be defined/used.
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Material Test</title>
<link rel="stylesheet" href="https://rawgit.com/angular/bower-material/master/angular-material.css"/>
</head>
<body layout="column" ng-app="starterApp">
<md-toolbar layout="row">
@ThomasBurleson
ThomasBurleson / memoizers.js
Last active August 27, 2017 21:15
Memoization functions with timeouts and call-once options...
;(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
ThomasBurleson / docSearcher.js
Last active August 29, 2015 14:10
Enhanced version of `docSearcher` webWorker discussed in Pete Darwin's blog [AngularJS Docs Performance](http://www.bacondarwin.co.uk/angularjs-docs-performance/)
angular.module('search', [])
.service('docsSearch', ['$q','$rootScope','$timeout','NG_PAGES',BackgroundSearchService]);
/**
* Document search service that uses Web Workers to index
* and search in the background.
*/
function BackgroundSearchService($q, $rootScope, $timeout, NG_PAGES) {
console.log('Using WebWorker Search Index');

##Introducing ngAria

A new feature released in Angular 1.3.0 is the accessibility module: ngAria. As someone involved in with the development of this community-driven module, I thought it might be helpful to introduce ngAria. I'll also explain what the module can’t do and what issues you must consider when building accessible, single-page web applications with AngularJS.

The goal of ngAria is to improve Angular's default accessibility by enabling common ARIA attributes for directives. Using ngAria is as simple as requiring the ngAria module in your application. ngAria hooks silently hooks into standard AngularJS directives and quietly injects accessibility support into your application at runtime.

The list of supported directive attributes is currently limited; but we are identifying other ways the module can improve accessibility by default. To explain the current state

function unkMH(req, res) {
var allowHeaders;
if (req.method.toLowerCase() === 'options') {
allowHeaders = ['Accept', 'Accept-Version', 'Content-Type', 'Api-Version', 'Authorization'];
if (res.methods.indexOf('OPTIONS') === -1) {
res.methods.push('OPTIONS');
}
res.header('Access-Control-Allow-Credentials', true);
res.header('Access-Control-Allow-Headers', allowHeaders.join(', '));
@ThomasBurleson
ThomasBurleson / angular-searchBoxDirective.html
Created May 24, 2014 13:23
Sample of using AngularJS MySearchboxDirective. This demonstrates some fixes for the example demonstrated in the slides http://slides.com/djsmith/deep-dive-into-custom-directives
<!DOCTYPE html>
<html>
<head>
<style>
body {
margin-left : 15px;
margin-top: 15px;
}
input {
@ThomasBurleson
ThomasBurleson / AuthenticationModule.js
Created May 16, 2014 16:29
AngularJS SPA example of using a Session model with Authenticator service
/**
* AngularJS SPA Sample using Authenticator service with Session model
*
* @author Thomas Burleson
*
*/
(function( angular ){
"use strict";
/**
@ThomasBurleson
ThomasBurleson / PromisePathways.js
Last active August 29, 2015 14:01
Example use of module pattern and angular.module() usage to easily group classes by context... without using AMD.
(function( angular, supplant ) {
"use strict";
angular.module( "Pathways", [ ] )
/**
* Loader for topology data models
*/
.service( "nodeLoader", function NodeLoader( $http )
{