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 Promise(promise) { | |
if (promise instanceof Promise) { | |
return promise; | |
} else { | |
// this is a new promise chain | |
this.callbacks = []; | |
} | |
} | |
Promise.prototype.then = function(callback_ok, callback_error) { |
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
/* | |
There are four patterns of invocation in JavaScript: | |
- the method invocation pattern | |
- the function invocation pattern | |
- the constructor invocation pattern | |
- the apply invocation pattern | |
The patterns differ in how the bonus parameter this is initialized. |
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
<?php | |
private function flatten($array, $base = "", $div_char = "/") | |
{ | |
$ret = array(); | |
if(is_array($array)) | |
{ | |
foreach($array as $k => $v) | |
{ | |
if(is_array($v)) |
NewerOlder