Skip to content

Instantly share code, notes, and snippets.


Chris Boden cboden

View GitHub Profile
cboden / proxy.php
Created Apr 3, 2017
Connect to a WS server forward msgs to self WS server
View proxy.php
use Ratchet\ConnectionInterface;
require __DIR__ . '/vendor/autoload.php';
class Proxy implements \Ratchet\MessageComponentInterface {
private $clients;
public function __construct() {
$this->clients = new \SplObjectStorage;
View autobahn.js
/** @license MIT License (c) 2011,2012 Copyright Tavendo GmbH. */
* AutobahnJS -
* A lightweight implementation of
* WAMP (The WebSocket Application Messaging Protocol) -
* Provides asynchronous RPC/PubSub over WebSocket.
View multiple
curl http://localhost:5984/mydb/aSpecificDocId
// Take properties from aSpecificDocId which are keys for the following query
curl http://localhost:5984/mydb/_all_docs?keys=["docIdA","docIdB","docIdC","docIdD","docIdE"]
cboden /
Created Mar 30, 2016
Bash CouchDB shortcut function
couch() {
curl -s "${@:2}"$1 | json_pp
View Disposable.php
interface Disposable {
public function dispose();
View Rx.changes.js
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);
View gist:0d21983e82ab0fb26c20
var sub = new Rx.Subject();
var obs = sub.distinctUntilChanged(); // This is what I want
function module1(sub) {
cboden / gist:43bff1f920a4b2603f1a
Created Jun 18, 2015
LdnPHP Trivia June 17th, 2015
View gist:43bff1f920a4b2603f1a
- 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
- Your only hope of implementing this interface is via Iterator or IteratorAggregate
- SplStack and SplQueue both extend this common base class
cboden / factory.php
Last active Aug 29, 2015
View factory.php
class ExceptionFactory implements ExceptionFactoryInterface {
public function __invoke($msg = '') {
return new \Exception($msg);
SCRIPT=$(pwd)/$(dirname $0)/
$SCRIPT "event-loop" EventLoop
$SCRIPT stream Stream
$SCRIPT cache Cache
$SCRIPT dns Dns
$SCRIPT http Http
$SCRIPT "http-client" HttpClient
You can’t perform that action at this time.