Skip to content

Instantly share code, notes, and snippets.

View AmrAbdulrahman's full-sized avatar

Amr Abdulrahman AmrAbdulrahman

View GitHub Profile
async1()
.then(function(inputsFromAsync1) {
return async2();
})
.then(function(inputsFromAsync2) {
return async3();
})
.then(function(inputsFromAsync3) {
return async4();
})
function asyncSayHiTo(name) {
// define a defer
// defer is the context of the ASYNC operation
var defer = q.defer();
// make an async operation
setTimeout(function() {
// this should run after the function already terminated
// and returned a promise
async1(function() {
// do some stuff
async2(function(inputsFromAsync1) {
// do stuff that depends on inputsFromAsync1
async3(function(inputsFromAsync2) {
// do stuff that depends on inputsFromAsync2
async4(function(inputsFromAsync3) {
@AmrAbdulrahman
AmrAbdulrahman / promises-example.js
Last active January 26, 2016 10:18
sample desc
function func5() {} // depends on the results of async4() and
function async4() {} // depends on the results of async3() and
function async3() {} // depends on async2()
function async2() {} // depends on async1()
goog.provide('sgo.manager.directives.port');
sgo.manager.directives.port = function() {
function link(scope, element, attrs, ctrl) {
var minPortValue = 0,
maxPortValue = 65535;
function validate(value) {
var isValid = true;
npm ERR! Error: EROFS, symlink '../strip-ansi/cli.js'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>
npm ERR! System Linux 3.13.0-32-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /home/amr/Awingu/smc-ui
npm ERR! node -v v0.10.25