Skip to content

Instantly share code, notes, and snippets.

Martijn van der Ven Zegnat

Block or report user

Report or block Zegnat

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View KnownValetDriver.php
class KnownValetDriver extends BasicValetDriver
public function serves($sitePath, $siteName, $uri)
return is_file($sitePath . '/version.known');
public function isStaticFile($sitePath, $siteName, $uri)
Zegnat / gist:f5c3806c6be0ea5244359833acbf96a3
Created Dec 14, 2017
wget (like my browser) fails to get the file, but cURL does just fine.
View gist:f5c3806c6be0ea5244359833acbf96a3
$ wget
--2017-12-14 17:00:18--
Resolving, 2a04:4e42:14::403
Connecting to||:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2017-12-14 17:00:18 ERROR 404: Not Found.
$ curl -O
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
View LinkExtractor.php
namespace Zegnat\Utilities;
use League\Uri\Schemes\Http;
use League\Uri\Modifiers\Resolve;
use League\Uri\UriException;
class LinkExtractor
View bday.php
// Create a DateTimeImmutable with the date and time to compare to.
// Use your current timezone, or the timezone of your visitor. I am in Sweden.
$now = new DateTimeImmutable('now', new DateTimeZone('Europe/Stockholm'));
// Create the object with your birthday.
$birthday = $now->setTimezone(new DateTimeZone('Europe/Amsterdam')); // Born in the Netherlands
$birthday = $birthday->setDate(1991, 10, 23); // On the 23rd of October, 1991
$birthday = $birthday->setTime(20, 9); // 9 minutes past 8 in the evening
// What year is it?
$currentyear = intval($now->format('Y'));
View pickAnyEncoding.php
table {
border-collapse: collapse;
th, td {
padding: .5em 2em .5em .5em;
border-right: 1px dotted #AAA;
border-bottom: 1px solid #CCC;
th {
Zegnat / custom.css
Last active May 14, 2017
Facebook with PII censored.
View custom.css
/* People’s names. */
span > a[data-hovercard^="/ajax/hovercard/user.php?"], /* poster and shares */
.UFICommentActorName, /* comments */
.UFICommentBody .profileLink /* inside comments */
background-color: currentColor;
/* People’s avatars. */
a[data-hovercard^="/ajax/hovercard/user.php?"] > div > img._s0, /* poster */
Zegnat / Zegnat.Utils.ServerRequestFromGlobals.php
Last active Apr 10, 2017
Construct a PSR-7 ServerRequest through a PSR-17 factory for the current HTTP request.
View Zegnat.Utils.ServerRequestFromGlobals.php
namespace Zegnat\Utils;
use Interop\Http\Factory\ServerRequestFactoryInterface;
use Interop\Http\Factory\StreamFactoryInterface;
use Psr\Http\Message\ServerRequestInterface;
Zegnat / .htaccess
Last active Apr 5, 2017
This emulates in a 2 line .htaccess file. Compatible with any Apache server with mod_alias enabled.
View .htaccess
RedirectMatch 303 /(.+)$!$1
Redirect 303 /
Zegnat / Mail.php
Created Mar 25, 2017
Dirty EmailSenderInterface implementation for Omnimail.
View Mail.php
namespace Zegnat\Omnimail;
use Omnimail\EmailSenderInterface;
use Omnimail\EmailInterface;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
class Mail implements EmailSenderInterface
View codemirror.hrm.js
CodeMirror.defineSimpleMode('human_resource_machine', {
// The start state contains the rules that are intially used
start: [
// Possible header.
token: 'string'
// Comment definition.
You can’t perform that action at this time.