Skip to content

Instantly share code, notes, and snippets.

View clue's full-sized avatar

Christian Lück clue

View GitHub Profile
#!/bin/bash
#
# git-mv-with-history -- move/rename file or folder, with history.
#
# Moving a file in git doesn't track history, so the purpose of this
# utility is best explained from the kernel wiki:
#
# Git has a rename command git mv, but that is just for convenience.
# The effect is indistinguishable from removing the file and adding another
# with different name and the same content.
@clue
clue / TimeoutConnector.php
Last active April 6, 2017 12:36
TimeoutConnector skeleton
<?php
namespace React\SocketClient;
use React\SocketClient\ConnectorInterface;
use React\EventLoop\LoopInterface;
use React\Promise\Timer;
class TimeoutConnector implements ConnectorInterface
{
@clue
clue / example.php
Created July 3, 2015 08:32
React\Promise\uncancellable()
$cancellable = new Promise(function () { }, function ($resolve, $reject) { $reject(); });
$uncancellable = uncancellable($cancellable);
assertPending($cancellable);
assertPending($uncancellable);
// this is a NO-OP
$uncancellable->cancel();
assertPending($cancellable);
assertPending($uncancellable);
$retry = function ($request, $next) {
return $next($request)->then(null, function ($error) use ($request, $next) {
// the $next failed. discard $error and retry once again:
return $next($request);
});
};
$runner = new MiddlewareRunner(array(
$retry,
function ($request, $next) {
<?php
$loop = React\EventLoop\Factory::create();
$loop->addSignal(SIGINT, function () use ($loop) {
echo 'CTRL+C caught';
// cleanup...
// cleanup...
$loop->removeSignal(SIGINT);
});
@clue
clue / gist:ed235ad8d50087d098e4de5fd370b25e
Created February 26, 2018 22:47 — forked from that0n3guy/gist:9754047
laptop routeprint and ipconfig all
C:\Users\lappy>ipconfig /all
Windows IP Configuration
Host Name . . . . . . . . . . . . : lappy-PC
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
@clue
clue / 2018-04-13 getting-started-with-reactphp-workshop-phpyorkshire.md
Last active December 16, 2023 12:33
Getting started with ReactPHP – Pushing real-time data to the browser (PHPYorkshire)

Think about "PHP" for a few seconds… What came to mind? It’s very likely you thought about your average product catalog, a blogging platform or how the platform is inferior to things like Node.js. But wait, it’s 2018! What if I told you PHP’s huge ecosystem has way more to offer and PHP is not inferior at all to its evil cousin Node.js?

Hands-on workshop given at PHPYorkshire (2018-04-13)

Getting started with ReactPHP – Pushing real-time data to the browser

In this hands-on tutorial you will learn about the core concepts of async PHP and why you too should care about ReactPHP being a real thing. The workshop has a strong focus on sparking the idea that PHP can be way faster and more versatile than you probably thought. Bring along an open mind and through lots of interesting examples and live demos learn why what sounds crazy at first might soon be a valuable addition in your toolbox.

You’re already familiar with PHP and want to learn what ReactPHP is all about? Then this tutorial is for you! We will