Skip to content

Instantly share code, notes, and snippets.

View kelunik's full-sized avatar

Niklas Keller kelunik

View GitHub Profile
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <linux/input.h>
#include <string.h>
#include <stdio.h>
static const char *evval[3] = {
"RELEASED",
@kelunik
kelunik / remove-w3schools-from-google-search.user.js
Created December 9, 2014 13:52
Remove w3schools.com from Google Search results
// ==UserScript==
// @name Remove w3schools.com from Google
// @namespace https://www.kelunik.com
// @include https://www.google.com/*
// @include https://www.google.de/*
// @version 1
// @grant none
// ==/UserScript==
function forEach(list, callback) {
@kelunik
kelunik / Driver.php
Created December 22, 2016 10:53
Strict types sadness demo.
<?php
interface Driver {
public function set(callable $callback);
public function invoke($foo);
}
<?php
class DriverA implements Driver {
private $callback;
@kelunik
kelunik / php-parameter-variance.md
Last active November 14, 2016 15:43
PHP Parameter Variance
@kelunik
kelunik / github-default-issue-list.userscript.js
Created September 22, 2016 10:36
GitHub Default Issue List
// ==UserScript==
// @name GitHub Default Issue List
// @namespace http://tampermonkey.net/
// @version 0.1
// @description GitHub Default Issue List
// @author Niklas Keller <me@kelunik.com>
// @match https://github.com/*
// @grant none
// ==/UserScript==
@kelunik
kelunik / README.md
Created August 14, 2016 14:30
Documentation Management System

I plan to write a new documentation system, because I couldn't find any system that suites my / our needs at amphp. It has to support multiple packages and their various versions (at least major.minor, bugfix versions will just update the current version). Furthermore, there needs to be support for tutorial series. It's planned to build these from markdown files in ./doc currently.

But we can write as much documentation as we like, the key point is that it must be usable for those that really need the documentation to learn how things work. So I'm asking you here. As a new user of a framework / library / package, what's your preference?

  • What do you need in a documentation system?
  • What is your preferred way for navigation?
  • What should tutorial series look like?

And two more questions if you want to publish your own documentation:

Async\Awaitable

The goal of this specification is to define an Awaitable interface for interoperability in PHP.

An Awaitable represents the eventual result of an asynchronous operation. The primary way of interacting with an Awaitable is through its when method, which registers a callback to receive either an Awaitable's eventual value or the reason why the Awaitable has failed. They're basically the same as a Promise in JavaScript's Promises/A+ specification, but the interaction with them is different as the following paragraphs show.

This specification defines an interoperable Awaitable interface for PHP, focussing on its when method. This is required for interoperable co-routines, which can be implemented in PHP using generators. Further methods like a watch method for progress updates are out of scope of this specification. The name Awaitable works well if PHP is extended later to support await and is also alraedy [used in HHVM](htt

@kelunik
kelunik / setup.sh
Last active March 10, 2016 11:32
X1C Install
#!/bin/bash
# re-run as root if necessary
if [[ $EUID -ne 0 ]]; then
sudo ./$0
exit
fi
# apt-get install -y acpi
@kelunik
kelunik / travis-ip-ranges.txt
Created November 23, 2015 17:16
Travis IP Ranges
The IP addresses depend on what environment they run in.
For jobs running on the container-based infrastructure, the range is 54.172.141.90/32 for .com and 52.0.240.122/32 for .org.
For jobs running on the legacy Linux infrastructure, the ranges are 199.91.168.0/22, 199.182.120.0/22 and 173.247.96.0/19. These are the ranges of our infrastructure provider, so they may also include hosts that do not belong to Travis CI.
For jobs running on our Mac infrastructure, the ranges are 162.222.72.0/21 (this range also belongs to our infrastructure provider and may contain non-Travis CI hosts) and 208.78.110.192/27.
Please do note that these ranges can change in the future.
@kelunik
kelunik / Dockerfile
Last active August 29, 2015 14:28
Docker PHP 7
FROM ubuntu:14.04
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y wget
RUN apt-get install -y unzip
RUN apt-get install -y gcc
RUN apt-get install -y make
RUN apt-get install -y autoconf
RUN apt-get install -y bison