Skip to content

Instantly share code, notes, and snippets.

Making stuff

John Morton johnfmorton

Making stuff
View GitHub Profile
johnfmorton / fm-proxy-pdf-viewer.php
Created April 29, 2023 19:21
A proxy script to retrieve a PDF on a FileMaker server
View fm-proxy-pdf-viewer.php
// Referenced in blog post, Learning the FileMaker Data API by trial and error.
// Sample URL hitting this proxy:
// This is a preflight request, so send the CORS headers
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
johnfmorton / contract-numerical-formatting-style.css
Last active April 17, 2023 18:23
Format ordered lists in contract format. 1 > 1.1 > 1.1.a
View contract-numerical-formatting-style.css
ol {
list-style-type: none;
counter-reset: custom-counter;
ol li {
counter-increment: custom-counter;
ol li::before {
johnfmorton /
Created February 28, 2023 12:20
Keybase proof

Keybase proof

I hereby claim:

  • I am johnfmorton on github.
  • I am johnmorton ( on keybase.
  • I have a public key ASDu_0vG5Qiy-9cd2ilRG_Ykj1cFsrOxNLWZ5aiNYh1ZSQo

To claim this, I am signing this object:

johnfmorton / clipboard.ts
Created December 28, 2022 19:15 — forked from max10rogerio/clipboard.ts
Example Copy to Clipboard with Typescript
View clipboard.ts
* Interface CopyToClipboard params
interface ICopyToClipboard {
/** HTML reference identifier ```<div id="foo"></div>``` */
target?: string;
/** String value */
value?: string;
johnfmorton / Module.php
Created October 19, 2022 18:31
Craft CMS 4.x SHA512 filter for use in a module
View Module.php
namespace modules;
use modules\TwigFilterSha512;
use Craft;
* Custom module class.
* This class will be available throughout the system via:
johnfmorton / intersection-observer-example.js
Created April 22, 2022 14:00
Simple example of an IntersectionObserver
View intersection-observer-example.js
// get all .blade elements
let bladeElements = document.querySelectorAll('.blade');
function handleIntersection(entries) { => {
if (entry.isIntersecting) {'blade--active');
} else {'blade--active');
johnfmorton / proxy-for-partytown.php
Last active January 30, 2022 20:02
Simple proxy with php for use with Partytown
View proxy-for-partytown.php
* About this script:
* This proxy was built with PartyTown.js in mind.
* Partytown is a lazy-loaded library to help relocate resource intensive scripts into a
* web worker, and off of the main thread.
* Many third-party scripts already provide the correct CORS headers, but not all do.
* For services that do not add the correct headers, then a reverse proxy to another domain must be used in order to provide the CORS headers.
* see:
johnfmorton / ambient-video-play-on-enter.js
Last active January 18, 2022 14:52
Play an ambient video (muted inlin
View ambient-video-play-on-enter.js
var ambientVideo = document.getElementById("ambientVideo");
// in HTML page
<video muted playsinline id='abientVideo'>
<source src="my-video-file.webm" type="video/webm">
johnfmorton / picture-tag-helper-snippet.html
Created May 18, 2021 14:10
Picture tag helper snippet
View picture-tag-helper-snippet.html
<!-- Revised snippet based on -->
<!-- load avif if supported -->
<source type="image/avif"
srcset="image-100x200.avif 100w,
image-200x400.avif 200w"
(max-width: 768px) calc(100vw - 3em),
(max-width: 1376px) calc(50vw - 8em),
johnfmorton /
Last active September 5, 2022 08:40 - Used on Arcustech to deploy a Craft CMS site
# This script is used to deploy a Craft CMS site on an Arcustech server
# It will clone the git main branch from a private repo into
# a 'deployments' directory and them create symlinks for the
# static assets: .env, and 3 directories of assets.
# It then does a composer install of the Craft site.
# The scripts in the composer file are like this:
# These scripts update Craft, clear caches, etc.
# Finally, it will symlink the web directory in the newly downloaded files
# to the public folder which is the one used by Arcustech