Joined September 2012
·

Jim Greenleaf

Human Being at Viresco LLC
·
New York
·
·
·

Posted to Promise Chains with Node.js over 1 year ago

@sunnyfrancis - see the last example. It shows how to do exactly what you're trying to do.

Hey @costea_90, that sounds interesting - would you mind posting a codepen/jsfiddle demonstrating your method?

Excellent @nchudleigh, I'm glad they were helpful!

Following up on this, I loved the keys in ST3, but I found myself missing them in other applications so I ended up using Keyboard Maestro to set Vim shortcuts (and more) on browsers, email, IRC, etc. No doubt there's a Linux program that can do this too.

Posted to Promise Chains with Node.js over 1 year ago

Thanks @steveinatorx, I'm glad the chain pattern was helpful!

Posted to Promise Chains with Node.js over 1 year ago

@sally-yang-jing-ou, haha it's ok - I got eight emails for your comment, but only one comment appears in the thread so I think you discovered a Coderwall bug :)

As for returning a promise, it doesn't seem like _.bind is what's expecting the promise, but each of the .then() functions likely is.

If you're using Q you could do something like this: http://pastebin.com/G2iGrxmt

If you're using a different promise library, the deferred calls would change, but the principle would be the same.

Posted to Promise Chains with Node.js over 1 year ago

Hello @sally-yang-jing-ou

Could you give a little more detail on what you're trying to accomplish? Do you need to assemble a promise chain within the for loop, or return a promise afterward, or maybe resolve one afterward?

Posted to Vim movement in iTerm2 over 1 year ago

@ricobl, I didn't know about vi mode in bash! That's pretty cool. I might use that in combination with my new control-key movement since I should learn more vim shortcuts.

For now I ended up setting more shortcuts with Keyboard Maestro so I can toggle between split terminals and tabs, and scroll up and down in the buffer.

Posted to Promise Chains with Node.js over 1 year ago

Hey @sandesh27

It seems like you're on the right track there. You could create a new var deferred = Q.defer(); before calling User.findOne, then you could call deferred.resolve() or deferred.reject() inside the error and success conditions. Just make sure to use the deferred.promise in your flow.

Posted to Star Ratings in CSS & UTF8 over 1 year ago

@veganoo - I'd look into the meta tag which is being set on that page: <meta content='IE=EmulateIE7' http-equiv='X-UA-Compatible'/>. If that tag works in IE11 (which it appears to) then it would render without support for the :before pseudo-element necessary to fill in the stars.

Posted to Star Ratings in CSS & UTF8 over 1 year ago

@veganoo - strange... it works in IE8+ for me. Did you work out what's going on in IE11?

Posted to Promise Chains with Node.js over 1 year ago

That's a cool way to do it, @futbolpal - I assume that deferred would be resolved within the_async_function?

Posted to Promise Chains with Node.js over 1 year ago

Thanks @fkiller - I'm glad to help!

Posted to CSS does Math over 1 year ago

@fredylg What does work in IE8? ;)

Posted to CSS does Math over 1 year ago

@paranoida Thanks. Updated with compatibility details!

Posted to Promise Chains with Node.js over 1 year ago

@n1k0 You may be right. I'll leave that as an exercise to the reader ;)

Posted to Promise Chains with Node.js over 1 year ago

@n1k0 Great point! That's much easier to read and avoids the need to create additional closures. I updated the examples with this.

Posted to Promise Chains with Node.js over 1 year ago

@damienklinnert Thanks! I'm glad it was helpful :)

Achievements
1,842 Karma
251,675 Total ProTip Views