I hereby claim:
- I am hsubra89 on github.
- I am hsubra89 (https://keybase.io/hsubra89) on keybase.
- I have a public key ASAiMU3u6GAuRHRSby5JkE5zjLipWEwUmSDIEDujZKAXago
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
<html> | |
<body> | |
<script src="./test-app.js"></script> | |
</body> | |
</html> |
var q = require('q'); | |
// Sample Async Function | |
function asyncFunction(data, cb) { | |
setTimeout(function() { | |
// call cb with error | |
cb(new Error('Error')); | |
// Or call with success | |
cb(null, {status: 'true'}); | |
}, 100); |
var allTheXmlsYay = []; | |
function getXML(url) { | |
var d = $q.defer(); | |
d3.xml(url, 'image/svg+xml' function(xml) { | |
// If error variable is present | |
// if(err) d.reject(err); | |
d.resolve(xml); |
var addScript = function(url,success){ | |
var script = document.createElement('script'); | |
script.src = url; | |
var head = document.getElementsByTagName('head')[0], done=false; | |
script.onload = script.onreadystatechange = function(){ | |
if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) { | |
done=true; | |
success(); |
var emitter = require("events").EventEmitter; | |
var eInstance = new emitter(); | |
function Component() { | |
// Component's Constructor Section (can do custom stuff) | |
} | |
// Component prototype inhertits emitter prototype instance. | |
Component.prototype = Object.create(eInstance); |
function a(text) { | |
console.log(text); | |
} | |
/********************************* Callback style ****************************/ | |
setTimeout(function() { | |
var text = "Hello World"; | |
// Calling the next function using its reference // cb style | |
a(text); | |
// call next function in the chain |
app.controller('someController', ['$scope', '$q', 'd3Service', function($scope, $q, d3Service) { | |
var promises = [d3Service.d3(), | |
Restangular.one('images/Example PDF.svg').get(), | |
Restangular.one("Job", $scope.jobID).one("Costing")]; | |
$q.all(promises) | |
.then(function(data) { | |