Skip to content

Instantly share code, notes, and snippets.

View tatemz's full-sized avatar

Tate Barber tatemz

View GitHub Profile
@tatemz
tatemz / docker-wordpress.sh
Last active December 29, 2020 17:25
A quick way to get a WordPress installation up and running with Docker
#!/bin/bash
mkdir wordpress-site && cd wordpress-site
touch docker-compose.yml
cat > docker-compose.yml <<EOL
version: "2"
services:
my-wpdb:
@tatemz
tatemz / docker-wpcli.sh
Last active December 18, 2020 06:59
A quick way to use one-off wp-cli commands with Docker. See Part 1: https://gist.github.com/tatemz/504383c921aa5898c49b82d4ee181362
#!/bin/bash
cd wordpress-site
cat >> docker-compose.yml <<EOL
my-wpcli:
image: tatemz/wp-cli
volumes_from:
- my-wp
links:
@tatemz
tatemz / abstract-multi-singleton-factory.php
Last active July 11, 2019 22:53
Singleton factories for creating unique single and multi instance classes.
<?php
abstract class Multi_Singleton_Factory extends Singleton_Factory {
public static function get_singleton_key( $class, $args ) {
// Create a unique key based on instance-specific information (i.e. classname + args)
return md5( $class . '_' . serialize( $args ) );
}
}
@tatemz
tatemz / example.ts
Created December 29, 2021 16:31
Sample of isomorphic git in Deno
import { encode } from "https://deno.land/std@0.109.0/encoding/base64url.ts";
import { join } from "https://deno.land/std@0.109.0/path/mod.ts";
import fs from "https://deno.land/std@0.109.0/node/fs.ts";
import git from "http://esm.sh/isomorphic-git@1.10.0";
import http from "http://esm.sh/isomorphic-git@1.10.0/http/web";
import { QueryHandler } from "./QueryHandler.ts";
const throwFSError = (e: Error) => {
if (e instanceof Deno.errors.AlreadyExists) {
throw { ...e, code: "EEXIST" };