Skip to content

Instantly share code, notes, and snippets.

View midned's full-sized avatar
🏠
Working from home

Álvaro C midned

🏠
Working from home
  • Vitech
  • Montevideo
View GitHub Profile
<?php
// http client making a request to github api
require __DIR__.'/../vendor/autoload.php';
$loop = React\EventLoop\Factory::create();
$client = new React\Http\Client($loop);
$request = $client->request('GET', 'https://api.github.com/repos/react-php/react/commits');
@midned
midned / gist:5887752
Last active December 19, 2015 03:08
Event listening with #swag
Node.prototype.on = Node.prototype.addEventListener;
Node.prototype.off = Node.prototype.removeEventListener;
var elem = document.getElementById('some-element');
function yolo(){
console.log('yolo');
}
elem.on('click', yolo);
@midned
midned / Signal.cpp
Created March 14, 2015 23:16
c++ signals
#include <vector>
#include <functional>
#include "Signal.h"
template<typename ...Arguments>
void Signal<Arguments...>::connect(std::function<void (Arguments...)> listener) {
listeners.push_back(listener);
}