This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
-----BEGIN CERTIFICATE----- | |
MIIEFzCCAv+gAwIBAgIBADANBgkqhkiG9w0BAQQFADBqMQswCQYDVQQGEwJkZTEP | |
MA0GA1UECBMGSGVzc2VuMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0eSBM | |
dGQxEzARBgNVBAcTCkRpbGxlbmJ1cmcxEjAQBgNVBAMTCTEyNy4wLjAuMTAeFw0x | |
MjA2MTYyMDE2MDhaFw0yMjA2MTQyMDE2MDhaMGoxCzAJBgNVBAYTAmRlMQ8wDQYD | |
VQQIEwZIZXNzZW4xITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDET | |
MBEGA1UEBxMKRGlsbGVuYnVyZzESMBAGA1UEAxMJMTI3LjAuMC4xMIIBIjANBgkq | |
hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAofA7J9eN5Q8pTrbHOBQC63gB4m6NPNjx | |
NZ302U5VK5SIkT8lYNk/uwY88C93jAgEBjgSk9IcLdzCRIay5UJmf92fSwZS+x+7 | |
V8nQyuMtQ+9uipX5nhFVAj1iGbO92McsuBb9ck1jQuNt5YZW1WsnGivh88vMiKBa |
This file contains hidden or 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 | |
$collection = new RouteCollection; | |
$collection->add('chatRoom', new Route('/demo', array( | |
'_controller' => new ChatRoom | |
, 'allowedOrigins' => 'socketo.me' | |
))); | |
$collection->add('echo', new Route('/echo', array( |
This file contains hidden or 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; | |
} |
This file contains hidden or 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 | |
use Ratchet\MessageComponentInterface; | |
use Ratchet\ConnectionInterface; | |
class MyApp1 implements MessageComponentInterface { | |
public function onOpen(ConnectionInterface $conn) { | |
} | |
public function onMessage(ConnectionInterface $from, $msg) { | |
} |
This file contains hidden or 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); |