Skip to content

Instantly share code, notes, and snippets.

View chrisaldrich's full-sized avatar

Chris Aldrich chrisaldrich

View GitHub Profile
@chrisaldrich
chrisaldrich / Hypothesidian.js
Last active May 16, 2023 17:54 — forked from TfTHacker/Hypothesidian.js
Hypothes.is - retrieve your annotations into Obsidian (for templater plugin)
<%*
/*
# Hypothes.idian a templater script for retrieving annotations from Hypothes.is
Dev: RoamHacker https://twitter.com/roamhacker
# Prerequisites:
+ Templater plugin by https://github.com/SilentVoid13/Templater
+ Free Hypothes.is developer token from: https://hypothes.is/account/developer
+ This script will prompt you for his token and save it to a file called "hypothesis config.md"
+ This file store your configuration and can be located any where in your vault.
@chrisaldrich
chrisaldrich / gist:d3b63ca50964328bd72b876a748866d2
Last active October 4, 2020 01:50
Adding default image to the Jetpack Related Posts if none exists
/* Adding default image to the Jetpack Related Posts if none exists */
function jeherve_custom_image( $media, $post_id, $args ) {
if ( $media ) {
return $media;
} else {
$permalink = get_permalink( $post_id );
$url = apply_filters( 'jetpack_photon_url', 'https://example.com/photo.jpg' );
return array( array(
'type' => 'image',
@chrisaldrich
chrisaldrich / kind-annotation.php
Created September 11, 2020 00:47
My annotation template to be put into a sub-folder called `kind_views` in one's theme/child theme
<?php
/*
* Annotation Template
*
*/
$mf2_post = new MF2_Post( get_the_ID() );
$cite = $mf2_post->fetch();
if ( ! $cite ) {
return;
@chrisaldrich
chrisaldrich / mp failure.md
Created July 25, 2020 21:18
Micropub failure message after update

Micropub Response Below is the response from your Micropub endpoint. This may contain helpful information that can be used to troubleshoot the issue.

HTTP/1.1 403 Forbidden Content-Type: application/json; charset=UTF-8 Transfer-Encoding: chunked Connection: keep-alive Keep-Alive: timeout=15 Date: Sat, 25 Jul 2020 21:18:00 GMT Server: Apache

@chrisaldrich
chrisaldrich / acquisition-kind.php
Last active January 20, 2020 21:33 — forked from dshanske/kind-register.php
Post Kinds Acquisition custom plugin
<?php
/**
* Plugin Name: Register Post Kind - Acquisition
* Plugin URI: https://boffosocko.com
* Description: Register Acquisition Post Kind
* Version: 0.1
* Author: Chris Aldrich and David Shanske
* Author URI: https://boffosocko.com
* Text Domain:
* Domain Path:
@chrisaldrich
chrisaldrich / Monocle fail using 47a9
Created April 30, 2019 02:18
Monocle fail with 47a9
Error
There was a problem trying to load the channels from your Microsub endpoint.
Microsub endpoint: https://aperture.p3k.io/microsub/16
Your website: https://boffosocko.com/
The endpoint returned the following response.
{
"code": 403,
"header": "HTTP/1.1 403 Forbidden\r\nServer: nginx/1.14.0\r\nContent-Type: application/json\r\nTransfer-Encoding: chunked\r\nConnection: keep-alive\r\nX-Powered-By: PHP/7.2.7-1+ubuntu16.04.1+deb.sury.org+1\r\nCache-Control: no-cache, private\r\nDate: Tue, 30 Apr 2019 02:15:57 GMT",
@chrisaldrich
chrisaldrich / IndieAuth tool
Created April 22, 2019 23:20
IndieAuth tool
Test Authorization Headers
URL of this page
https://boffosocko.com/wp-content/plugins/indieauth/authdiag.php
Run Test
Summary Results
$_SERVER['HTTP_AUTHORIZATION'] is unavailable on this server. You may need to change some configurations to get tools working.
$_SERVER['REDIRECT_HTTP_AUTHORIZATION'] is available on this server! This can be used as a fallback for $_SERVER['HTTP_AUTHORIZATION'].
Tools may use getallheaders(), but the authorization header was not found there.
@chrisaldrich
chrisaldrich / ApertureError
Created April 22, 2019 23:11
Error response from Aperture
Error
There was a problem trying to load the channels from your Microsub endpoint.
Microsub endpoint: https://aperture.p3k.io/microsub/16
Your website: https://boffosocko.com/
The endpoint returned the following response.
{
"code": 403,
"header": "HTTP/1.1 403 Forbidden\r\nServer: nginx/1.14.0\r\nContent-Type: application/json\r\nTransfer-Encoding: chunked\r\nConnection: keep-alive\r\nX-Powered-By: PHP/7.2.7-1+ubuntu16.04.1+deb.sury.org+1\r\nCache-Control: no-cache, private\r\nDate: Mon, 22 Apr 2019 23:10:18 GMT",
@chrisaldrich
chrisaldrich / OYS micropub error
Created August 25, 2018 19:02
Micropub errors for OYS 8-25-18 (using master branch from 2018-08-24 ef76125)
[25-Aug-2018 18:42:04 UTC] Micropub Error: 403 forbidden - Unauthorized
[25-Aug-2018 18:42:04 UTC] REST request: /micropub/1.0/endpoint: {"type":["h-entry"],"properties":{"published":["2018-08-24T17:44:13-07:00"],"syndication":["https:\/\/www.swarmapp.com\/user\/11479\/checkin\/5b80a65de0c0c9002c0c8589"],"content":["Being lazy for dinner tonight."],"photo":["https:\/\/igx.4sqi.net\/img\/general\/original\/11479_Z5VSLqOla8M3LhlRo_7QKUXeiGvaufQM1NTUYg32Dp0.jpg"],"checkin":[{"type":["h-card"],"properties":{"name":["Gerrish Grill"],"url":["https:\/\/foursquare.com\/v\/5b66159f2db4a9002ce66d2b"],"latitude":[34.1745],"longitude":[-118.09457],"locality":["Pasadena"],"region":["CA"],"country-name":["United States"],"postal-code":["91107"]},"value":"https:\/\/foursquare.com\/v\/5b66159f2db4a9002ce66d2b"}],"location":[{"type":["h-adr"],"properties":{"latitude":[34.1745],"longitude":[-118.09457],"locality":["Pasadena"],"region":["CA"],"country-name":["United States"],"postal-code":["91107"]}}]}}(Header Absent)
[25-Aug-2
@chrisaldrich
chrisaldrich / monocle-error.txt
Created August 15, 2018 05:02
monocle error
Error
There was a problem trying to load the channels from your Microsub endpoint.
Microsub endpoint: https://aperture.p3k.io/microsub/16
Your website: https://boffosocko.com/
The endpoint returned the following response.
{
"code": 403,
"header": "HTTP/1.1 403 Forbidden\r\nServer: nginx/1.14.0\r\nContent-Type: application/json\r\nTransfer-Encoding: chunked\r\nConnection: keep-alive\r\nX-Powered-By: PHP/7.2.7-1+ubuntu16.04.1+deb.sury.org+1\r\nCache-Control: no-cache, private\r\nDate: Wed, 15 Aug 2018 04:59:01 GMT",