Skip to content

Instantly share code, notes, and snippets.

View Zegnat's full-sized avatar

Martijn van der Ven Zegnat

View GitHub Profile
@Zegnat
Zegnat / custom.css
Last active May 14, 2017 08:21
Facebook with PII censored.
/* 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 April 10, 2017 22:40
Construct a PSR-7 ServerRequest through a PSR-17 factory for the current HTTP request.
<?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 March 25, 2017 15:15
Dirty EmailSenderInterface implementation for Omnimail.
<?php
namespace Zegnat\Omnimail;
use Omnimail\EmailSenderInterface;
use Omnimail\EmailInterface;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
class Mail implements EmailSenderInterface
{
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.
{
/* 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; }
@Zegnat
Zegnat / test.txt
Last active December 21, 2016 07:57
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?
@Zegnat
Zegnat / QBool.php
Created August 22, 2016 12:14
For when you need a quantum boolean that is true only some percent of the time.
<?php
namespace Zegnat;
class QBool
{
public $chance;
public $scale;
public function __construct($chance)
@@ -70,16 +70,16 @@
});
// enter key submits form
- $items.on('enterKeyDown', function onEnterKeyDown(e) {
+ $widget.on('enterKeyDown', function onEnterKeyDown(e) {
$form.submit();
});
// spacebar triggers 'check' event
$('.my_answers').each(function(){if(/(\d+), \d+, \1\)/.test(this.getAttribute('onclick')))this.style.backgroundColor='green'});
@Zegnat
Zegnat / kendo-filter.json
Last active August 26, 2022 23:26
JSON Schema for validating JSON representations of Kendo filters.
{
"$schema": "http:\/\/json-schema.org\/draft-04\/schema#",
"definitions": {
"filter": {
"oneOf": [
{
"type": "object",
"properties": {
"field": {
"type": "string",