Skip to content

Instantly share code, notes, and snippets.

View markjaquith's full-sized avatar

Mark Jaquith markjaquith

View GitHub Profile
@Hebilicious
Hebilicious / cloudflare-pages-bun.env
Last active April 17, 2025 05:03
Cloudflare Pages and Bun
# Bun is now officially supported and these environments variables are no longer needed. Keeping this gist for legacy purposes.
# SKIP_DEPENDENCY_INSTALL=true
# UNSTABLE_PRE_BUILD=asdf install bun latest && asdf global bun latest && bun i
@mattmc3
mattmc3 / optparsing_demo.zsh
Last active April 16, 2025 01:58
Zsh option parsing example
# Manual opt parsing example
#
# Features:
# - supports short and long flags (ie: -v|--verbose)
# - supports short and long key/value options (ie: -f <file> | --filename <file>)
# - supports short and long key/value options with equals assignment (ie: -f=<file> | --filename=<file>)
# - does NOT support short option chaining (ie: -vh)
# - everything after -- is positional even if it looks like an option (ie: -f)
# - once we hit an arg that isn't an option flag, everything after that is considered positional
function optparsing_demo() {
<?php
/*
Plugin Name: Fix WooCommerce Template Cache
Plugin URI: https://woocommerce.com
Description: This fixes some issues with WC's template caching on sites that use multiple containers, due to the entire path being cached. If the file does not exist, this script uses default WC logic (copy/pasted) to grab the correct templates.
Version: 1.0.0
Author: Julien Melissas
Author URI: https://julienmelissas.com
*/
add_filter('wc_get_template_part', function( $template, $slug, $name ) {
@andreshg112
andreshg112 / OrderByField.php
Last active April 6, 2023 09:25
It can be used for queries like this in MySQL: `SELECT * FROM `plans` ORDER BY FIELD(`interval`, 'day', 'week', 'month', 'year');`
<?php
namespace App\Traits;
/**
* Traits that eases the use of ORDER BY FIELD with an eloquent model.
* https://github.com/laravel/ideas/issues/1066
*/
trait OrderByField
{
@elalemanyo
elalemanyo / README.md
Last active April 12, 2025 20:17
Debug zsh startup time

Debug zsh startup time

  1. Inject profiling code

    At the beginning of your .zshrc add following: zmodload zsh/zprof

    and at the end add: zprof

    This will load zprof mod and display what your shell was doing durung your initialization.

@cloventt
cloventt / 4k_content_on_xbox_one.md
Last active January 26, 2023 00:37
Encoding 8bit 4K Content for Plex and Xbox One X

In anticipation of my shiny new Xbox One X showing up I began buying and ripping 4K UHD Bluray disks, so my Plex media server would have some content on it that could take advantage of my new hardware.

I was pretty dissapointed when I discovered none of it worked very well for me at all. After a lot of trial and error I think I've worked out the situation of 4K media on Xbox One, and how to get your library ready to handle it.

The Setup

My problem is my televsion does not support 10 bit HDR video. I bought it at a very steep discount, and while its a great simple 4K UHD TV, it does not support 10 bit HDR video. The exact model is a Dish TV NZ 55" UHD TV.

I serve my files via Plex from a local server, over gigibit ethernet. On the Xbox I normally use the DLNA option in the Media Player app, but I have also experimented with using the official Plex Xbox One app. I decided I hate using this after some experimenting, and I'll explain

@pbojinov
pbojinov / canada_states_titlecase.json
Last active May 18, 2024 17:28 — forked from mshafrir/states_hash.json
US states & Canadian Provinces in JSON form
[
{
"name": "Alberta",
"abbreviation": "AB"
},
{
"name": "British Columbia",
"abbreviation": "BC"
},
{
@stephenway
stephenway / README.md
Last active June 22, 2024 16:04
BEMIT Cheatsheet
@JamesChevalier
JamesChevalier / mac_utf8_insanity.md
Last active March 25, 2025 09:29
Unicode on Mac is insane. Mac OS X uses NFD while everything else uses NFC. This fixes that.

convmv manpage

Install convmv if you don't have it

sudo apt-get install convmv

Convert all files in a directory from NFD to NFC:

convmv -r -f utf8 -t utf8 --nfc --notest .