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 | |
namespace MyNamespace; | |
use Ratchet\MessageComponentInterface; | |
use Ratchet\ConnectionInterface; | |
class AccountedExceptions MessageComponentInterface { | |
protected $_app; | |
public function __construct($app) { | |
$this->_app = $app; |
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/bash | |
SCRIPT=$(pwd)/$(dirname $0)/filter-repo.sh | |
$SCRIPT "event-loop" EventLoop | |
$SCRIPT stream Stream | |
$SCRIPT cache Cache | |
$SCRIPT dns Dns | |
$SCRIPT http Http | |
$SCRIPT "http-client" HttpClient |
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 | |
class ExceptionFactory implements ExceptionFactoryInterface { | |
public function __invoke($msg = '') { | |
return new \Exception($msg); | |
} | |
} |
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
Language | |
- In the function strpos which comes first: the haystack or the needle? | |
haystack, needle | |
- What does the acronym "SPL" stand for? | |
Standard PHP Library | |
- Aside from inheriting these via genes, they're also good for horizontal code re-use | |
Traits | |
- Your only hope of implementing this interface is via Iterator or IteratorAggregate | |
Traversable | |
- SplStack and SplQueue both extend this common base class |
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 sub = new Rx.Subject(); | |
var obs = sub.distinctUntilChanged(); // This is what I want | |
function module1(sub) { | |
sub.subscribe(console.log.bind(console)); | |
sub.onNext('hello'); | |
} |
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
Rx.Observable.prototype.changes = function(deleteObs, keySelector) { | |
var source = this; | |
return new Rx.AnonymousObservable(function(observer) { | |
var store = new Map; | |
return new Rx.CompositeDisposable( | |
deleteObs.subscribe(function(key) { | |
var last = store.get(key); | |
store.delete(key); |
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 | |
/** | |
* The method that is being tested | |
*/ | |
public function generateKeyNumber($key) { | |
// If there are no spaces, reject | |
if (0 === substr_count($key, ' ')) { | |
return ''; | |
} |
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
SET FOREIGN_KEY_CHECKS = 0; | |
TRUNCATE TABLE `table1`; | |
TRUNCATE TABLE `table2`; | |
SET FOREIGN_KEY_CHECKS = 1; |
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 | |
require __DIR__.'/vendor/autoload.php'; | |
error_reporting(E_ALL | E_STRICT); | |
ini_set('display_errors', 1); | |
//$loop = new React\EventLoop\StreamSelectLoop(); | |
$loop = new React\EventLoop\LibEventLoop(); | |
$socket = new React\Socket\Server($loop); |
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 | |
namespace Ratchet\Server; | |
use Ratchet\ConnectionInterface; | |
class UvConnection implements ConnectionInterface { | |
private $client; | |
public function __construct($client) { | |
$this->client = $client; | |
} |
OlderNewer