This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List myList = new List(); | |
StreamController controller = new StreamController(); | |
controller.stream.listen((_) | |
{ | |
print("data: $_"); | |
}); | |
controller.add("sup"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt) { | |
// Project configuration. | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
jshint: { | |
all: ["Gruntfile.js"] | |
}, | |
jscs: { | |
src: "*.js", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('logging', ['ngResource']) | |
.factory('Logger', function($log) | |
{ | |
var Logger = { | |
enabled: true, | |
_consoleObject: $log, | |
_console: function(type, first, second) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Why? For production level stack traces for a variety of devices. | |
factory("StacktraceService", | |
function($window) | |
{ | |
// [jwarden 2014] NOTE: She's a global method based on stacktrace.js, but if we change her, | |
// we can just change the method. | |
return({ | |
printStackTrace: printStackTrace | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('com.servicelayer', []) | |
.constant("ServicesLocator", | |
{ | |
// *** dev *** | |
DOMAIN: "https://", | |
SOME_SERVICE: "someservice", | |
ANOTHER_SERVICE: "another/service", | |
// *** dev *** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('interceptor', | |
["com.servicelayer"], | |
function($q, ErrorService) | |
{ | |
return { | |
response: function (response) { | |
// do something on success | |
if(response.headers()['content-type'] === "application/json; charset=utf-8"){ | |
//TODO: check for error codes and delegate to error handler service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
factory('ErrorService', | |
function($injector, $window, ServicesLocator, StacktraceService, Debounce, Logger) | |
{ | |
var $http = null; | |
var ErrorService = { | |
log: function(exception, cause) | |
{ | |
if($http == null) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('com.servicelayer.errors', | |
['ngResource', 'logging']) | |
.config(['$provide', function($provide) | |
{ | |
$provide.decorator('$exceptionHandler', function($delegate, ErrorService) | |
{ | |
return function(exception, cause) | |
{ | |
$delegate(exception, cause); | |
ErrorService.log(exception, cause); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// assuming user JSON object comes back with role; I don't care if y'all encrypt/hash it | |
$scope.user = null; | |
$http.post("some/auth", {credentials}) | |
.success(function(data, status, headers, config) | |
{ | |
/* | |
// JSON looks like | |
{ | |
data: { | |
user: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
karma: { | |
options: { | |
configFile: 'karma.configuration.js' | |
}, | |
unit: { | |
runnerPort: 9101, | |
background: true, | |
port: 9877 | |
}, | |
continuous: { |