Skip to content

Instantly share code, notes, and snippets.

View danpoynor's full-sized avatar
Howdy World!

Dan Poynor danpoynor

Howdy World!
View GitHub Profile
@danpoynor
danpoynor / regenerate-thumbnails.js
Created June 20, 2023 16:03 — forked from daveyjones/regenerate-thumbnails.js
Insanely fast multi-core Node.js script for generating (or regenerating) custom WordPress image sizes (e.g. thumbnails) for very large media libraries
// Your server must have wp-cli installed (http://wp-cli.org/)
var async = require("async");
var exec = require("child_process").exec;
var cores = 32; // Adjust the number of cores to match your environment
var total = 0;
var finished = 0;
var q = async.queue(function(task, callback) {
@danpoynor
danpoynor / gist:03b2f2e2c06d73fe558e15b79700398f
Created December 17, 2021 17:45
VS Code Todo Tree code tag color settings
"todo-tree.regex.regex" : "(\/\/|#|<!--|;|\/\\*|^|^\\s*(-|\\d+.))\\s*($TAGS)",
"todo-tree.highlights.useColourScheme" : true,
"todo-tree.regex.enableMultiLine" : true,
"todo-tree.general.tags" : [
"BUG",
"!!!",
"HACK",
"FIXME",
"XXX",
"RFE",
@danpoynor
danpoynor / uses-for-css-custom-properties.md
Last active August 8, 2021 22:14
Ways to use CSS Custom Properties

Uses for CSS Custom Properties

Example code using CSS Custom Properties.


Globally scoped variable

:root {
@danpoynor
danpoynor / subsection-first-last.html
Created August 18, 2020 11:46
Get the first and last page in a Hugo subsection
{{ $subcat := (where .Site.Pages ".Params.section_title" "clients").ByTitle }}
{{ $firstItem := index $subcat 0 }}
{{ $lastItem := index $subcat (sub (len $subcat) 1) }}
<p>
First: {{ $firstItem.Title }}
<br>
Last: {{ $lastItem.Title }}
</p>
@danpoynor
danpoynor / $: git
Last active July 1, 2020 20:07
Git command to revert a file in the current working branch to the original version in master
git checkout origin/master -- path/to/file.cshtml
@danpoynor
danpoynor / .gitignore
Last active January 30, 2022 16:44
Starter .gitignore for my projects. Mostly from https://github.com/github/gitignore
# for various projects
dist/
build/
builds/
built/
out/
public/
*.min.js
*-min.js