moved to https://aaronparecki.com/2017/08/15/11/eclipse-day-trip
This file contains hidden or 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 | |
header('Access-Control-Allow-Origin: *'); | |
header('Access-Control-Allow-Headers: Authorization'); | |
if(isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'text/plain') !== false) { | |
$format = 'text'; | |
} else { | |
header('Content-Type: application/json'); | |
$format = 'json'; | |
} |
This file contains hidden or 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
{ | |
"type": [ | |
"h-entry" | |
], | |
"properties": { | |
"published": [ | |
"2017-01-01 12:00:00" | |
], | |
"checkin": [{ | |
"type": [ |
This file contains hidden or 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 | |
class Stardate { | |
# Ported from https://github.com/pioz/stardate/blob/master/lib/stardate.rb | |
private static $year_0 = 2323; | |
private static $year_duration = 365.2425; | |
public static function date_to_stardate($date) { | |
# days since the beginning of the year |
This file contains hidden or 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
require 'jwe' | |
# Set your password and email address | |
key = Digest::SHA256.digest('p455w0rd!') | |
payload = 'aaron@parecki.com' | |
# Create the JWE string | |
encrypted = JWE.encrypt(payload, key, alg:'dir') | |
# Put the resulting string on your website: |
This file contains hidden or 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
body { | |
color: #212121; | |
font-family: "Helvetica Neue", "Calibri Light", Roboto, sans-serif; | |
-webkit-font-smoothing: antialiased; | |
-moz-osx-font-smoothing: grayscale; | |
letter-spacing: 0.02em; | |
} |
This file contains hidden or 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 | |
if(!isset($_GET['url'])) { | |
?> | |
<form action="" method="get"> | |
<input type="url" name="url"> | |
<input type="submit" value="Go"> | |
</form> | |
<? | |
die(); | |
} |
This file contains hidden or 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 addParagraphIDs() { | |
$("section").each(function(){ | |
var section_id = $(this).attr("id"); | |
var counter = 1; | |
$(this).find("p").each(function(){ | |
var paragraph_id = section_id + "-p-" + counter; | |
counter++; | |
$(this).attr("id", paragraph_id); | |
}); | |
var counter = 1; |
This file contains hidden or 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
// https://github.com/indieweb/php-mf2/blob/master/Mf2/Parser.php | |
require_once 'Mf2/Parser.php'; | |
$parsed = Mf2\parse(file_get_contents('issues-webmention.html')); | |
$authors = []; | |
foreach($parsed['items'][0]['children'] as $comment) { | |
$author = strtolower($comment['properties']['author'][0]); | |
if(!in_array($author, $authors)) |
This file contains hidden or 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> | |
<!-- aaronpk/micropub.rocks --> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<!-- jquery-2.1.1.min.js --> | |
<script type="text/javascript"> | |
/*! jQuery v2.1.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ |