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 LinkExtractor.php
<?php
declare(strict_types=1);
namespace Zegnat\Utilities;
use League\Uri\Schemes\Http;
use League\Uri\Modifiers\Resolve;
use League\Uri\UriException;
class LinkExtractor
@Zegnat
Zegnat / README.md
Last active Jan 30, 2019
Generate Magic login URL for Micropub endpoints
View README.md

Generate Magic login URL for Micropub endpoints

To make Micropub requests, the specification requires a Bearer token. Many current Micropub clients force the user to go through IndieAuth to obtain this, which means you need to have the required authorization and token endpoints set-up before getting started with Micropub.

The file token-provider.php implements the happy path for the IndieAuth dance resulting in providing the Micropub client with whatever token the user has provided.

Why

raziellight on IRC was trying to get the Micropub client Omnibear to work, and that required him to figure out how to set-up IndieAuth from scratch. I think this is way too big of an investment for getting started with Micropub. It was time to cut out the middle man (or protocol, in this case

View bday.php
<?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
<style>
table {
border-collapse: collapse;
}
th, td {
padding: .5em 2em .5em .5em;
border-right: 1px dotted #AAA;
border-bottom: 1px solid #CCC;
}
th {
@Zegnat
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 / 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
<?php
declare(strict_types=1);
namespace Zegnat\Utils;
use Interop\Http\Factory\ServerRequestFactoryInterface;
use Interop\Http\Factory\StreamFactoryInterface;
use Psr\Http\Message\ServerRequestInterface;
@Zegnat
Zegnat / Mail.php
Created Mar 25, 2017
Dirty EmailSenderInterface implementation for Omnimail.
View Mail.php
<?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.
{
regex: /^-- HUMAN RESOURCE MACHINE PROGRAM --$/,
token: 'string'
},
// Comment definition.
{
View hreflang-flags.css
/* Show flags on links to a different language than your entry: */
.h-entry:not([lang|="nl"]) a[hreflang|="nl"]::after { content: ' 🇳🇱'; }
.h-entry:not([lang|="en"]) a[hreflang|="en"]::after { content: ' 🇬🇧'; }
/* You can overwrite on a regional basis: */
.h-entry:not([lang|="en"]) a[hreflang="en-US"]::after { content: ' 🇺🇸'; }
/* Then remove flags for your default language: */
.h-entry:not([lang]) a[hreflang|="en"]::after { content: none; }
View test.txt
Restults from https://kartikprabhu.com/static/demo/selection-encodeURI.html on Windows 10 Pro.
---
Internet Explorer 11
Version: 11.576.14373.0
non-breaking space? Let's try UTF non-breaking space in decimal or non-breaking space in hex?
non-breaking%20space?%20Let's%20try%20UTF%20non-breaking%20space%20in%20decimal%20or%20non-breaking%20space%20in%20hex?
You can’t perform that action at this time.