Skip to content

Instantly share code, notes, and snippets.

@gglnx
gglnx / gist:1391586
Created November 24, 2011 15:30
Add or remove trailing slash of the current URL
<?php
/**
* Add or remove trailing slash of the current URL
*/
function correctTrailingSlash($base = "/", $trainlingSlash = false) {
// Load the URI data
$redirect = false;
$requestUri = $_SERVER["REQUEST_URI"];
$queryString = $_SERVER["QUERY_STRING"];
$serverName = $_SERVER["SERVER_NAME"];
@gglnx
gglnx / custom-post-type-rewrite.php
Last active December 15, 2015 07:19
Changes the permalink for a custom post type
<?php
/**
* Plugin Name: Custom URIs for Podlove Publisher
* Description: Changes the URIs for the episode custom post type of the Podlove Publisher
* Author: Dennis Morhardt
* Version: 1.0
* Author URI: http://www.dennismorhardt.de/
*/
/**
<?php
/**
* Generate podcast feeds
*/
function generate_podcast_feed() {
global $wp_query, $post;
// Get audio type
$type = $wp_query->query_vars["feed"];
@gglnx
gglnx / keybase.md
Created April 13, 2014 15:34
keybase.io

Keybase proof

I hereby claim:

  • I am gglnx on github.
  • I am gglnx (https://keybase.io/gglnx) on keybase.
  • I have a public key whose fingerprint is 0E93 19B2 5961 4D98 D6B6 8C3A 8A02 0086 0264 A73D

To claim this, I am signing this object:

Verifying I am +gglnx on my passcard. https://onename.com/gglnx
@gglnx
gglnx / state-of-https-everywhere-1.md
Last active January 29, 2016 17:14
State of HTTPS Everywhere, Ausgabe 1 (29.01.2016)

Hallo ressourcenmangel,

Als Beauftragter für „Euch wegen fehlenden SSL in den Hintern treten“ ein paar Updates zu HTTPS Everywhere:

Ab April: Geolocation API in Chrome nur noch über HTTPS

Wie bereits bei WebRTC (Chrome 47) [0] wird nun auch die Geolocation API für Non-HTTPS-Requests blockiert [1]. Die API funktioniert, liefert aber keine Daten mehr zurück. Die Änderung gilt ab Chrome 50, welcher für den 19. April erwartet wird [2]. Auch die neue Brotli-Encoding-Algorthymus (findet Verwendung in WOFF 2.0) gibt es nur per SSL bald [3]. Weitere Features folgen, der Standard dafür heißt: Privileged Contexts (Powerful features) [4].

@gglnx
gglnx / README.md
Last active August 29, 2016 13:06
Static polyfill generator

Static polyfill generator

@gglnx
gglnx / index.md
Last active March 17, 2018 00:21
Informationssammlung zur Umsetzung der EU-Richtlinie 2016/2102

Informationssammlung zur Umsetzung der EU-Richtlinie 2016/2102

Richtlinie (EU) 2016/2102 des Europäischen Parlaments und des Rates vom 26. Oktober 2016 über den barrierefreien Zugang zu den Websites und mobilen Anwendungen öffentlicher Stellen

Deadlines (§12 Abs. 3 EU/2016/2102)

  • Webseiten, die vorm 23. September 2018 veröffentlicht wurden: 23. September 2020
  • Webseiten, die nach dem 23. September 2018 veröffentlicht wurden: 23. September 2019
  • Mobile Applikationen: 23. Juni 2021
@gglnx
gglnx / get-unicode-range-from-string.js
Created March 18, 2019 16:29
Get unicode-range (CSS) from string
const multirange = require('multi-integer-range').multirange;
// Helpers
const trimLeadingZero = (str) => str[0] === '0' ? str.slice(str.lastIndexOf('0') + 1) : str;
const formatCodePoint = (...values) => `U+${values.map(trimLeadingZero).map(s => s.toString(16)).join('-')}`;
const uniqs = (arrArg) => arrArg.filter((elem, pos, arr) => arr.indexOf(elem) == pos);
// String for translate
const string = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~¢£¥¨©«®´¸»ÄÖÜßäöüˆ˚˜–—‘’‚“”„…‹›€™';
@gglnx
gglnx / extract-chapters-from-m4a-as-psc.js
Created March 18, 2019 16:32
Extract chapter marks from M4A/MP4 files as Podlove Simple Chapters
#!/usr/bin/env node
'use strict';
const cheerio = require('cheerio');
const child_process = require('child_process');
const fs = require('fs');
const meow = require('meow');
const MP4Box = require('mp4box');
const path = require('path');
const tmp = require('tmp');
const groupBy = require('lodash.groupby');