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'); | |
promise1(2).then(function (d) { | |
return promise2(d) | |
}).then(console.log,console.log) | |
function promise1 (d){ | |
var def = Q.defer(); | |
if(d===1){ | |
def.resolve('resuelto promise1') |
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 send(d){ | |
var p = "\x02"+d+"\x0D";//adds STX y ETX | |
var timeout; | |
var deferred = Q.defer(); | |
serialPort.on('data', function (data) { | |
//console.log('RECEIVED: ' + data ); | |
data=''+data; | |
deferred.resolve(data.trim()) |
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
Here is the puzzle. It is expressed in coffeescript, but you can answer in javascript or coffeescript. | |
Imagine you have a function that accesses a resource asynchronously. However, the resource is not able to handle too many concurrent requests. In order to control the number of concurrent requests, you will need to design a function throttle. | |
- A function throttle takes an asynchronous function and a concurrency limit as its arguments and returns a throttled version: | |
throttledFunction = throttler(asyncFunction, concurrencyLevel) | |
- The asynchronous function will always have as its last argument a callback function, which is called with the result as its only argument. | |
- A resource is "in use" between the time the asynchronous function starts and the time it calls its callback with the result. | |
- If the throttler sees too many calls to the asynchronous function simultaneously, then it queues the extra calls and waits until a callback is c alled before starting a new execution. | |
Please write a "throttler" functio |
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
I did | |
bower install ember-data-sails-adapter --save | |
if I put | |
<script type="text/javascript" src="/bower_components/ember-data-sails-adapter/ember-data-sails-adapter.js"></script> | |
in the index file of the app when I lift the ember server usign ember-cli it throws this error: | |
Remote Address:127.0.0.1:4200 | |
Request URL:http://localhost:4200/bower_components/ember-data-sails-adapter/ember-data-sails-adapter.js | |
Request Method:GET |
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
{ | |
"data": { | |
"fullName": "jose andradez", | |
"hourlyWage": "44", | |
"phoneNumber": "4245" | |
}, | |
"fullName": "", | |
"hourlyWage": 0, | |
"phoneNumber": "", | |
"createdAt": "2014-09-09T16:09:28.391Z", |
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
pet template///////////////////// | |
<h1> | |
{{nombre}} {{color}} | |
</h1> | |
<p>pertenece a: | |
{{dueno.nombre}} {{dueno.apellido}}</p> | |
{{#if editando}} | |
<form role="form"> |
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
in bluebird whats the difference bewteen these two? | |
somepromise(arg) | |
.then(someotherpromise(secondarg)) | |
.then(athirdoption()) | |
.then(undefined,console.log) | |
whats the difference between doing that and doing: |
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 Promise=require('bluebird'); | |
var net= require('net'); | |
//var openedPort=false; | |
//Cas.config; | |
//Cas.client; | |
var Cas = function(args) { | |
this.config=args | |
console.log(this.config) | |
// console.log(config) |
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
//item controller for article | |
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
states: ['borrowed', 'returned'], | |
autoSave: function() { | |
if (!this.get('model.isNew')) { |
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
#!/bin/sh | |
DATE=`/bin/date +%d-%m-%Y-%H:%M:%S` | |
export PGUSER=user | |
export PGPASSWORD=password | |
pg_dump -Fc -b database > /home/saecosoft/Dropbox/pgbackup/respaldo-$DATE.backup | |
OlderNewer