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 / feed-me.opml
Created September 14, 2024 22:03
OPML file generated from the links collected by TPGi’s Ricky Onsman: https://www.tpgi.com/feed-me/
<opml version="1.0">
<head>
<title>Feed Me! – RSS Links for Digital Accessibility People</title>
<dateCreated>Tue, 13 Aug 2024 21:29:52 GMT</dateCreated>
<ownerName>Ricky Onsman</ownerName>
<ownerId>https://www.tpgi.com/author/ronsman/</ownerId>
</head>
<body>
<outline type="folder" text="People who write regularly about digital accessibility, from highly technical articles to broader think pieces.">
<outline type="rss" text="Adrian Roselli" xmlUrl="https://adrianroselli.com/feed" />
GET http://localhost:7331/test
An unhandler error occured: TypeError: /Users/martijn/Source/thumbswise/src/routes/test.tsx: Duplicate declaration "createRouteData"
> 1 | import { createRouteData, useRouteData } from "solid-start";
| ^^^^^^^^^^^^^^^
2 | import { createServerData$ } from "solid-start/server";
3 |
4 | export function routeData() {
@Zegnat
Zegnat / index.php
Created September 4, 2022 12:14
IndieAuth Ticket Auth testing page, created July 2021
<?php declare(strict_types = 1);
define('MINTOKEN_CURL_TIMEOUT', 4);
define('MINTOKEN_SQLITE_PATH', 'tokens.db'); // Created with schema.sql
// Support functions. Mostly stripped from other projects.
if (!file_exists(MINTOKEN_SQLITE_PATH)) {
header('HTTP/1.1 500 Internal Server Error');
header('Content-Type: text/plain;charset=UTF-8');
exit('The token endpoint is not ready for use.');
@Zegnat
Zegnat / GeminiStreamWrapper.php
Created August 15, 2021 19:20
Add gemini:// support for file_get_contents(). Will turn into proper repo with Composer support later.
<?php declare(strict_types=1);
namespace Zegnat\Gemini;
/**
* @see https://www.php.net/manual/en/class.streamwrapper.php
*/
final class GeminiStreamWrapper {
/** @var resource $context if a stream context was provided it will be set here, even before __construct */
public $context;
@Zegnat
Zegnat / background.js
Created January 6, 2021 16:57
Swapping between two browser context menus depending on the amount of selected tabs.
let single = true
const menus = {
single: browser.menus.create({
contexts: ['tab'],
title: '&Close Tab'
}),
selection: browser.menus.create({
contexts: ['tab'],
title: '&Close Tabs',
@Zegnat
Zegnat / yt.html
Last active November 8, 2020 19:55
I keep forgetting how I can do sleek YouTube embeds. Here is one from a project. Still tweaking.
<!--
Embedded Youtube player that combines:
* https://jameshfisher.com/2017/08/30/how-do-i-make-a-full-width-iframe/
* https://css-tricks.com/lazy-load-embedded-youtube-videos/
* https://stackoverflow.com/a/42555610/3225372
* https://web.dev/iframe-lazy-loading/
* https://github.com/paulirish/lite-youtube-embed/blob/a927d63781883088c185cb69a0baade52732ab3e/src/lite-yt-embed.js#L28
Other things I am still thinking of adding:
* https://www.maxlaumeister.com/articles/hide-related-videos-in-youtube-embeds/
-->
@Zegnat
Zegnat / cal.php
Created November 5, 2020 15:23
Quicky to plain text calendar generation
<?php
$tz = new DateTimeZone('UTC');
$now = (new DateTimeImmutable('now', $tz))->setTime(12, 0, 0, 0);
$start = filter_input(INPUT_GET, 'start', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '@\d{4,}-\d\d-\d\d@']]);
$end = filter_input(INPUT_GET, 'end', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '@\d{4,}-\d\d-\d\d@']]);
if (
is_string($start) &&
($startParts = array_map('intval', explode('-', $start))) &&
@Zegnat
Zegnat / README.md
Last active March 14, 2019 12:44
Simple script for accessing the contents of an encrypted andOTP backup.

andOTP Decrypt

Simple script for accessing the contents of an encrypted andOTP backup. As long as Sodium is available this does not require any dependencies outside of PHP.

This was written as a replacement for [asmw/andOTP-decrypt][], which I found a little annoying to get going and depends on several external packages. (Hold! Was PHP easier than Python here? Oh my!)

Usage

To decrypt and write to a JSON file:

@Zegnat
Zegnat / Innertext.php
Last active October 19, 2018 08:33
🏃🐉 Run. Here be dragons.
<?php
declare(strict_types=1);
namespace Zegnat\Innertext;
class Innertext
{
const LF = "\n";
const CRLF = "\r\n";
@Zegnat
Zegnat / authdiag.php
Last active August 7, 2018 15:50
Upload to a web server on an accessible path. Navigate to it in the browser. Copy the URL from the address bar and paste it in the form. Run the test to see if your server gets Authorization headers!
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
$auth = filter_input(
INPUT_POST,
'auth',
FILTER_VALIDATE_REGEXP,
array('options' => array('regexp' => '@^authtest_\d+$@'))