Skip to content

Instantly share code, notes, and snippets.

View JeffreyPalmer's full-sized avatar

Jeffrey Palmer JeffreyPalmer

View GitHub Profile
@JeffreyPalmer
JeffreyPalmer / figure.html
Created August 10, 2023 21:00 — forked from georgeblck/figure.html
Drop-in replacement for Hugo figure shortcode with img srcset support
{{/*
- Change viewport sizes, lazy-loading,async & width,alt,link,caption in the shortcode call
- Hardcode sizes in this file
- If an image should not be resized or changed - e.g. because it is low quality -
simply dont put it in the page bundle but in /static
Example call: {{<figure src="image.jpg" alt="Alt Text" viewport="(max-width:720px) 80vw, (max-width: 1260px) 40vw, 30vw">}}
figure with auto-resizing, webp-conversion and srcset v2021-06-27
@JeffreyPalmer
JeffreyPalmer / export.ts
Last active December 2, 2022 18:27
Using dekapng to export a tiled version of an image
////////////////////////////////////////////////////////////////////////////////
// example of writing an RGBA png
////////////////////////////////////////////////////////////////////////////////
// TODO: Define the contract that this expects the draw function to adhere to
// - it should clear the screen if necessary
// - it should render to completion
// - it should be given a clean random state
//
// For this example, RenderContext contains a PicoGL App instance, which
// contains a WebGL context.
@JeffreyPalmer
JeffreyPalmer / savePreviousFxhashesInLocalStorage.html
Last active November 29, 2022 18:51
Code to save fxhash hashes in local browser storage
<!DOCTYPE html>
<html lang="en">
<head>
<script>
// Put the following code into your index.html
// Store previous hashes
const storedKeys = JSON.parse(localStorage.getItem('fxhashes')) || [];
if (!storedKeys.includes(fxhash)) {
storedKeys.length >= 10 && storedKeys.shift();
@JeffreyPalmer
JeffreyPalmer / plotswap.md
Last active November 7, 2022 19:47 — forked from tgk/plotswap.md
Plot swap

Plotswap November 2022

This is an attempt at sharing plotting files and try our hands on files from other eager plot enthusiasts out there!

The (suggested) format is pretty simple: below is the list of participants in order. Each participant picks a file from the next name after their own on the list and plots it. The participants are also free to do some of the other plots, but this format ensures that everyone both tries their hand on plotting work by someone else and has one of their own works plotted.

Once a plot is done please post it on Mastodon and tag the other participants. Use the hashtag #plotswap (thanks @tca@masto.pt!)

Each partiticipant can list (up to) three pieces we can pick from under their name. We will stick with SVGs for now as that seems to be the common format we all use.

@JeffreyPalmer
JeffreyPalmer / flycheck-eglot.el
Created August 27, 2022 18:36 — forked from zw963/flycheck-eglot.el
flycheck works with eglot (Stolen from doom)
(defvar-local +lsp--flycheck-eglot--current-errors nil)
(defun +lsp--flycheck-eglot-init (checker callback)
"CHECKER is the checker (eglot).
CALLBACK is the function that we need to call when we are done, on all the errors."
(eglot-flymake-backend #'+lsp--flycheck-eglot--on-diagnostics)
(funcall callback 'finished +lsp--flycheck-eglot--current-errors))
(defun +lsp--flycheck-eglot--on-diagnostics (diags &rest _)
(cl-labels
@JeffreyPalmer
JeffreyPalmer / git-top-trailers
Created May 27, 2021 23:42 — forked from felipec/git-top-trailers
git-top-trailers
#!/usr/bin/env ruby
ROLES_REGEX = /^([^ \t\n\[\]\(\):]+): ([^<>]+) <(\S+?)>$/
$roles = Hash.new(0)
log_args = [ '--no-merges', '--format=%b%x00' ]
IO.popen(%w[git log] + log_args + ARGV) do |pipe|
pipe.each("\0\n", chomp: true) do |commit|
trailer = commit.scrub.split("\n\n").last
### Keybase proof
I hereby claim:
* I am jeffreypalmer on github.
* I am jeffpalmer (https://keybase.io/jeffpalmer) on keybase.
* I have a public key ASAHjmbojYmgL_QQJ2WKo-sv2vz8-TmkU3nQuKHT6gwDYQo
To claim this, I am signing this object: