This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (win, doc) { | |
'use strict'; | |
if (!doc.querySelectorAll || !win.Intl || !win.Intl.RelativeTimeFormat) { | |
// doesn't cut the mustard. | |
return; | |
} | |
var rtf = new Intl.RelativeTimeFormat('en', { | |
localeMatcher: 'best fit', | |
numeric: 'always', | |
style: 'long' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<title>Sectioning Content test</title> | |
<h1>This is an h1</h1> | |
<p>That h1 is the heading for the body (a sectioning root).</p> | |
<div> | |
<h1>This is another h1</h1> | |
<p>That h1 is inside a div so it is no different than the first h1.</p> | |
</div> | |
<section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function curlURL($url) { | |
$return = array(); | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_VERBOSE, 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Pass a string of text into the function to convert @@ usernames. */ | |
function autoLinkMastodonUsernames($string) { | |
return preg_replace( | |
'/@?\b([A-Za-zŽžÀ-ÿ0-9._%+-]+)@([A-Za-zŽžÀ-ÿ0-9.-]+\.[A-Za-zŽžÀ-ÿ]{2,})\b/i', | |
'<a href="https://$2/@$1">$0</a>', | |
$string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.body.addEventListener('click', function(event) { | |
var target = event.target.closest('a[href]'); | |
if (!target) return; | |
var href = encodeURIComponent(target.getAttribute('href')); | |
if (!href.startsWith('http')) return | |
if (href.includes('archive.org')) return | |
var url = `/redirect.php?url=${href}`; | |
if (target.closest('.h-entry') && target.closest('.h-entry').querySelector('time.dt-published[datetime]')) { | |
var date = encodeURIComponent(target.closest('.h-entry').querySelector('time.dt-published').getAttribute('datetime')); | |
url += `&date=${date}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication | |
// http://creativecommons.org/publicdomain/zero/1.0/ | |
(function (win, doc) { | |
// Cut the mustard. | |
if (!win.localStorage) return; | |
// You should probably use a more specific selector than this. | |
var textarea = doc.querySelector('textarea'); | |
// The key for the key/value pair in localStorage is the current URL. | |
var key = win.location.href; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Check that the request is coming from my site. | |
if (!isset($_SERVER['HTTP_REFERER']) || !stristr(strtolower($_SERVER['HTTP_REFERER']), strtolower($_SERVER['SERVER_NAME']))) { | |
http_response_code(403); | |
exit; | |
} | |
// There has to be a URL provided in the query string. | |
if (!isset($_GET['url'])) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% set cssupdate = '20150309' %} | |
{% if _cookie.csscached == cssupdate %} | |
<link rel="stylesheet" href="/css/global-min.{{ cssupdate }}.css"> | |
{% else %} | |
<style> | |
{% include 'global/critical.css' %} | |
</style> | |
<script> | |
(function (win, doc) { | |
'use strict'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication | |
// http://creativecommons.org/publicdomain/zero/1.0/ | |
(function (win, doc) { | |
'use strict'; | |
if (!doc.querySelectorAll || !win.addEventListener) { | |
// doesn't cut the mustard. | |
return; | |
} | |
var toggles = doc.querySelectorAll('[aria-controls]'); | |
var togglecount = toggles.length; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication | |
# http://creativecommons.org/publicdomain/zero/1.0/ | |
if (!isset($_POST['source']) || !isset($_POST['target'])) { | |
header($_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request'); | |
exit; | |
} |