Skip to content

Instantly share code, notes, and snippets.

Avatar
🍖
Hungry Goriya

Matthew Callis MatthewCallis

🍖
Hungry Goriya
View GitHub Profile
@MatthewCallis
MatthewCallis / toc.js
Created Jan 5, 2022
Table of Contents Generator
View toc.js
const tableOfContents = (options) => {
if (!options.element) {
return;
}
const container = options.container ? document.querySelector(options.container) : document.body;
const selectors = options.selectors ? options.selectors.split(',').map((s) => s.trim()) : ['h2', 'h3'];
const tocItems = [];
// Building dict
View docker-compose.yml
version: "3"
services:
# MySQL Database Image
mysql_database:
platform: linux/x86_64 # Required for Apple M1 chip
image: mysql
restart: unless-stopped
env_file: .env
environment:
@MatthewCallis
MatthewCallis / README.md
Created Nov 5, 2021
Simple Local WordPress
View README.md
  1. Install Docker
  2. Create the docker-compose.yml in the empty directory we want to run the blog from
  3. Run docker-compose up -d from the directory we saved the docker-compose.yml
  4. Wait for everything to install and start
  5. Ensure any additional configuration you have in your production WordPress is in your wp-config.php file, but not the database credentials
  6. Replace the installed WordPress wp-content with your own
  7. Ensure your WordPress database is synced with production, phpMyAdmin is installed on http://localhost:8080
  8. You should now have a working local copy of your blog at http://localhost:8000

Instructions modified from Containerizing WordPress with Docker-Compose

View .eslintrc
{
"extends": [
"airbnb",
"plugin:ava/recommended",
"plugin:jsdoc/recommended",
"plugin:node/recommended",
"plugin:optimize-regex/all",
"plugin:ramda/recommended",
"plugin:security/recommended",
"plugin:unicorn/recommended"
@MatthewCallis
MatthewCallis / api.js
Last active Aug 3, 2021
Jest Testing Helpers for React Components with Promises
View api.js
import fetch from 'isomorphic-fetch';
expost const get = async (url, headers = {}) => fetch(url, {
method: 'GET',
headers: {
Accept: 'application/json',
...headers,
},
});
@MatthewCallis
MatthewCallis / country-codes.json
Created Mar 9, 2021
Country Codes & Locale Language Codes as JSON
View country-codes.json
[
{ "title": "Andorra", "value": "AD" },
{ "title": "United Arab Emirates", "value": "AE" },
{ "title": "Afghanistan", "value": "AF" },
{ "title": "Antigua and Barbuda", "value": "AG" },
{ "title": "Anguilla", "value": "AI" },
{ "title": "Albania", "value": "AL" },
{ "title": "Armenia", "value": "AM" },
{ "title": "Angola", "value": "AO" },
{ "title": "Antarctica", "value": "AQ" },
@MatthewCallis
MatthewCallis / deadlines-summary.md
Created Feb 16, 2021
This is a summary of a Clubhouse conversation between several people, but predominantly @shl from Gumroad and @jasonfried from Basecamp.
View deadlines-summary.md
@MatthewCallis
MatthewCallis / flash.md
Last active Jan 12, 2021
Disable Flash EOL Warnings
View flash.md
Disable EOL uninstall warnings:
	Disable auto updates when installing
	Add "EOLUninstallDisable=1" to mmc.cfg in C:\WINDOWS\system32\Macromed\Flash
	(C:\Windows\SysWOW64\Macromed\Flash on 64-bit)

---

Defuse flash player time bomb:
@MatthewCallis
MatthewCallis / wav-checker.js
Last active Jan 19, 2021
Check for broken *.WAV Files
View wav-checker.js
// npm install @uttori/audio-wave
// UTTORI_AUDIOWAV_DEBUG=1 DEBUG=AudioWAV node wav-checker.js
const path = require('path');
const { readdir, readFile } = require('fs').promises;
const { AudioWAV } = require('@uttori/audio-wave');
async function* getFiles(dir) {
const dirents = await readdir(dir, { withFileTypes: true });
for (const dirent of dirents) {
const res = path.resolve(dir, dirent.name);
@MatthewCallis
MatthewCallis / markdown.js
Last active Nov 16, 2020
Generate Markdown HTML Example
View markdown.js
const fs = require('fs');
const MarkdownItRenderer = require('@uttori/plugin-renderer-markdown-it');
const config = {
// Uttori Specific Configuration
uttori: {
// Prefix for relative URLs, useful when the Express app is not at root.
baseUrl: '',
// Good Noodle List, f a domain is not in this list, it is set to 'external nofollow noreferrer'.