Skip to content

Instantly share code, notes, and snippets.


Jonny MacEachern jonnymaceachern

View GitHub Profile
jonnymaceachern /
Created Feb 1, 2021
JPG to PNG batch convert using ImageMagick
for i in *.png ; do convert "$i" "${i%.*}.jpg" ; done
jonnymaceachern / _show-bootstrap-breakpoints.scss
Last active Jan 6, 2021
Always display current breakpoint using Bootstrap 4's media breakpoint SCSS variables
View _show-bootstrap-breakpoints.scss
body {
&:after {
content: "< #{map-get($grid-breakpoints, sm)} (xs)";
position: fixed;
z-index: 99999;
padding: 2px 15px;
bottom: 0;
left: 0;
border-top-right-radius: 5px;
background: blue;
jonnymaceachern / editor.php
Created Feb 25, 2020 — forked from justinwhall/gist:1997780
PHP: WordPress | tinyMCE editor style dropdown menu
View editor.php
* Filter TinyMCE Buttons
* Here we are filtering the TinyMCE buttons and adding a button
* to it. In this case, we are looking to add a style select
* box (button) which is referenced as "styleselect". In this
* example we are looking to add the select box to the second
* row of the visual editor, as defined by the number 2 in the
jonnymaceachern / list.twig
Created Feb 18, 2020
Twig macro for converting list to sentence-like string (e.g. ["apples", "bananas, "carrots] becomes "apples, bananas, and carrots")
View list.twig
{# Loop through all items in a list, comma-separate them, but use "and" before the last item
e.g. ["apples", "bananas, "carrots] becomes "apples, bananas, and carrots" #}
{% macro to_sentence(items) %}
{% for item in items %}
{# First item #}
{% if loop.first %}
<span>{{ item }}{% if items|length > 2 %},{% endif %}</span>
{% else %}
jonnymaceachern / mobile-resize-check.js
Created Sep 4, 2015
A resize event is triggered when a mobile browsers address bar drops down (when changing directions in a scroll). This will let you check for only width resizes. From
View mobile-resize-check.js
var width = $(window).width();
if($(this).width() != width){
width = $(this).width();
// your code
jonnymaceachern / php.json
Last active Feb 14, 2020
VS Code php snippets
View php.json
"Dump variable": {
"prefix": "pr",
"body": [
"echo '<pre>';",
"echo '</pre>';"
jonnymaceachern / scss.json
Created Jan 21, 2020
VS Code snippets for SCSS files
View scss.json
"@include media-breakpoint-only(xs)": {
"description": "Bootstrap media query for 'xs' only",
"prefix": "=xs",
"body": [
"@include media-breakpoint-only(xs) {",
View twig.json
"Dump variable": {
"prefix": "dump",
"body": [
View gist:6026c8c04497909b8196c3e031f026b4
### Keybase proof
I hereby claim:
* I am jonnymaceachern on github.
* I am jonnymaceachern ( on keybase.
* I have a public key whose fingerprint is 6A78 AA59 B2AD 89D9 C60D 0EB3 73C0 1EBB 9860 CAA3
To claim this, I am signing this object:
jonnymaceachern /
Created Aug 28, 2019
Batch convert mp4 to webm using ffmpeg
for i in *.mp4;
do name=`echo "$i" | cut -d'.' -f1`
echo "$name"
ffmpeg -i "$i" -acodec libvorbis -aq 5 -ac 2 -qmax 25 -threads 2 "${name}.webm"