Skip to content

Instantly share code, notes, and snippets.


John Johnston troutcolor

View GitHub Profile
troutcolor / via-indie-web-bookmarklet
Last active Jan 4, 2021
Book marklet from ChristAldrich, updated to copy to clip.
View via-indie-web-bookmarklet
javascript:(function(){let text = "";if (window.getSelection() != '') {text = window.getSelection().toString() + '\n';}var tocopy = '<p><small><cite class="h-cite via"><abbr title="via">ᔥ</abbr> <span class="p-author h-card">"' + text + '"</span> in <a class="u-url p-name" href="' + location.href + '" target="_blank" rel="noopener noreferrer" >' + document.title + '</a> (<time class="dt-published">' + document.lastModified + '</time>)</cite></small></p>';;d=document;d.body.appendChild(Object.assign(d.createElement('textarea'),{value:tocopy})).select();d.execCommand('copy');})()
troutcolor / Notes-Export-to-HTML.scpt
Last active Sep 16, 2019
Export a folder to html with page breaks for printing. Used as a starter.
View Notes-Export-to-HTML.scpt
set htmltop to "<!doctype html>
<html lang=\"en\">
<meta charset=\"utf-8\">
<title>Notes Export</title>
@media print {
hr {
page-break-after: always;
troutcolor /
Last active Feb 10, 2019
AppleScript Get your favourites from find photos and make thumbnail grid needs JSON Helper and an app token from your account
* Inspired by smokey
* url for thubnail from @smokey too
* html Thumbnail image griid from favs
* NEEDS JSON Helper free from
* Needs a App token from
* updated to use cloudimage you need a token from iin CLOUDIMAGETOKEN below.
troutcolor / OnThisDay.php
Last active Feb 1, 2019
simple shortcode plugin to display posts from the current day. I put it in a folder onthisday inside my plugins folder. Then make a page and add [onthisday] NB thewre are a few problems with thiis, use instead.
View OnThisDay.php
There are some problems with this, use instead.
* Plugin Name: OnThisDay
* Description: shortcode for posts on the current day
* Version: 0.1
* Author: John Johnston
* Mostly borrowed from
troutcolor / feed-microcast.php
Created Aug 6, 2018
WordPress RSS feed template for my microcast
View feed-microcast.php
* RSS2 Feed Template for displaying RSS2 Posts feed.
* Modified for microcast
* Based on template found
$numposts = 50; // number of posts in feed
$posts = query_posts('showposts='.$numposts.'&cat=652');
troutcolor / downloadWordPressMedia.scpt
Created Jun 2, 2018
downloads media from WordPress site using AppleScript and the REST API
View downloadWordPressMedia.scpt
--needs json helper for apple script Free from mac app store
set downloadfolder to POSIX path of (choose folder with prompt "Please select an output folder:")
set pagecountstart to 1
set pagecountmax to 1
set perpage to 10 --MAX =100
set blogurl to "FILL-IN-THE-URL"
troutcolor / pinboardToLinks.scpt
Created Oct 20, 2017
An appleScript that pulls recent links from pinboard, make a html list from the and opens in BBEdit ready to edit and post to blog. lins in the description beginning with > are made into blockquotes.
View pinboardToLinks.scpt
troutcolor / quicknote.js
Created Sep 24, 2017
Make a new browser window where you can type. I run from bookmarket or via FastScripts
View quicknote.js'data:text/html, %3Chtml%20contenteditable%3E%3Cstyle%3E%2A%7Bfont-size%3A20px%7D%3C%2Fstyle%3E','_blank')
//'data:text/html, <html contenteditable><style>*{font-size:20px}</style>','_blank')
troutcolor / boos-to-blog.scpt
Last active Sep 14, 2017
After downloading the json of a set of boos via the audioboo api and downloading and re-uploading the associated mp3s this AppleScript creates posts on my blog for all of the mp3s using the descriptions, dates tags etc from AudioBoo(m)
View boos-to-blog.scpt
--mp3s have been downloaded and then uploaded to a folder on the web
--I could not manage to create enclosures on blog posts with AppleScript
global myBlogUsername, myBlogPass, myBlogPass, boonote, mp3uploadfolder, boojson
set myBlogUsername to "USERNAME"
set myBlogPass to "PASSWORD"
set boonote to "<em>This audio file was orginally posted to AudioBoo(m) with the mobile app. It has been downloaded and posted here since audioboom no longer supports free accounts.</em>"
set mp3uploadfolder to ""
set boojson to (read POSIX file "Users/john/Desktop/audioboom/johnjohnston.json")
troutcolor / downloadboos.scpt
Last active Sep 9, 2017
AppleScript to download mp3s with particular tag from AudioBoom. Also save json with post info to file
View downloadboos.scpt
set downloadfolder to "/Users/john/Desktop/audioboom/edutalk/"
--so this next bit could be a loop but doing it manual was not much of a hassle
set pagecount to 9
set tag to "edutalk"
set itemcount to 100
tell application "JSON Helper"
set bURL to "" & tag & "/audio_clips?page[items]=" & itemcount & "&page[number]=" & pagecount
set boos to fetch JSON from bURL
set myFile to open for access "Macintosh HD:Users:john:Desktop:audioboom:edutalk_" & pagecount & ".json" with write permission