Traditional callbacks:
asyncObject.method(function(){
//TODO: stuff
});
Binding the scope to currentObject
Traditional callbacks:
asyncObject.method(function(){
//TODO: stuff
});
Binding the scope to currentObject
<?php | |
/** | |
* @author: Daniel Aranda - https://gist.github.com/daniel-aranda | |
* | |
* Implements an array utility to return an array without a given element. | |
* | |
* Usage example: | |
* | |
* $array = [1, 2, 3, 4, 5]; | |
* print_r( array_without($array, 3) ); |
#INSTRUCTIONS | |
Those instructions would move the Laravel Cache component into a desired repo, given a specific tag | |
1. Go to any folder that you desire, for example: /tmp/splitter/ | |
2. Run: git clone git@github.com:daniel-aranda/PHP-Git-Component-Splitter.git | |
3. Run: composer update | |
4. Copy from this gist "splitter.config.json" and put on your cloned folder under bin. | |
5. Run: php bin/daniel-splitter.php --tag v5.0.0 | |
/** | |
* Mocking a PHP native function is a trivial(and a headache) topic around PHPUnit | |
* I figured a way and wanted to share it, threat the functions as | |
* Closure dependencies. | |
**/ | |
class SomeClass{ | |
private $sleep; |
#Daniel Aranda aliases | |
#This is thinking for me as shortcut of the commands I use more, I do not mind to share it public to | |
#bring ideas. | |
#Git status short version and include the current branch name | |
alias gs="git status -s -b" | |
#Git add to stage all modified files also deleted files | |
alias gadd="git add . && git add -u .;" |
<?php | |
function test_fwrite($file, $total){ | |
$time_start = microtime(true); | |
if( file_exists($file) ){ | |
unlink($file); | |
} | |
$fp = fopen($file, 'a'); |