| Description | Link |
|---|---|
| Home | https://home.bluesnap.com |
| Developer Hub | https://developers.bluesnap.com |
| Authentication | https://developers.bluesnap.com/docs/authentication |
| Payment API | https://developers.bluesnap.com/v8976-JSON/docs |
Contents:
| Description | Link |
|---|---|
| Home | https://home.bluesnap.com |
| Developer Hub | https://developers.bluesnap.com |
| Authentication | https://developers.bluesnap.com/docs/authentication |
| Payment API | https://developers.bluesnap.com/v8976-JSON/docs |
Contents:
Contents:
More:
| import ( | |
| "fmt" | |
| "strings" | |
| "regexp" | |
| ) | |
| var matchFirstCap = regexp.MustCompile("(.)([A-Z][a-z]+)") | |
| var matchAllCap = regexp.MustCompile("([a-z0-9])([A-Z])") |
This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.
Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:
getTweetsFor("domenic", function (err, results) {
// the rest of your code goes here.For fun, let's say you are programming in a language that doesn't allow variable assignments and you still want to make a recursive function. Although you can't assign variables, you can use functions (and enclosed function arguments). Can you make a function recursive without calling it by name?
Lets try implementing the factorial function. First with a function calling itself by name, then with a funtion that never calls itself by name
Here is the implementation of factorial that calls itself by name. It's a simple recursive function
| var net = require('net') | |
| var sock = net.connect(1337) | |
| process.stdin.pipe(sock) | |
| sock.pipe(process.stdout) | |
| sock.on('connect', function () { | |
| process.stdin.resume(); | |
| process.stdin.setRawMode(true) |
| // (c) copyright unscriptable.com / John Hann | |
| // License MIT | |
| // For more robust promises, see https://github.com/briancavalier/when.js. | |
| function Promise () { | |
| this._thens = []; | |
| } | |
| Promise.prototype = { |