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
function delay(ms) { | |
var d = Promise.defer(); | |
setTimeout(function() { | |
d.resolve(); | |
}, ms); | |
return d.promise; | |
} | |
/* ACLARACION: NO usar en produccion, codigo de prueba de concepto, no tiene tests, | |
nisiquiera se testeo a fondo manualmente */ |
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
var q = require("q"); | |
// crea una promise, que se resuelve despues de 1 segundo | |
var prm = q.async(function*(name) { | |
console.log("promise " + name + " started"); | |
yield q.delay(1000); | |
console.log("promise " + name + " resolved"); |
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
var q = require("q"); | |
// crea una promise, que se resuelve despues de 1 segundo | |
var prm = function(name) { | |
console.log("promise " + name + " started"); | |
return q.delay(1000) | |
.then(function() { | |
console.log("promise " + name + " resolved"); |
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
<html> | |
<head> | |
<style> | |
.overlay { | |
position: absolute; | |
top: 0; | |
width: 100%; | |
height: 100%; | |
} |
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
<html> | |
<head> | |
<style> | |
.overlay { | |
position: absolute; | |
top: 0; | |
width: 100%; | |
height: 100%; | |
} |
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
var z1 = function(array, value) { | |
console.log(value); | |
value++; | |
array[value%15](array,value); | |
}; | |
var print = function(str) { | |
return function(array, value){ | |
console.log(str); | |
value++; | |
array[value%15](array,value); |
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
var z1 = function(value) { | |
console.log(value); | |
}; | |
var print = function(str) { | |
return function(){ | |
console.log(str); | |
}; | |
}; | |
var fizz = print("Fizz"); | |
var buzz = print("Buzz"); |
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
return Q.Promise(function(resolve, reject) { | |
return request.post(options, function(err, response, body){ | |
if (err){ reject(err) } | |
resolve(body); | |
}); | |
}); | |
return Q.nfcall(function(options, cb) { | |
return request.post(options, function(err, response, body) { | |
cb(err, body); |
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
'use strict'; | |
/* Controllers */ | |
var phonecatApp = angular.module('phonecatApp', []); | |
var uppercaseAllAttributes = function(x) { | |
var ret = {}; | |
for (var k in x) { | |
var value = x[k]; |
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
<!doctype html> | |
<html lang="en" ng-app="phonecatApp"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Google Phone Gallery</title> | |
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css"> | |
<link rel="stylesheet" href="css/app.css"> | |
<script src="bower_components/angular/angular.js"></script> | |
<script src="js/controllers.js"></script> | |
</head> |
NewerOlder