Skip to content

Instantly share code, notes, and snippets.

View codingmatty's full-sized avatar
🦈
Daddy shark, doo doo doo doo doo doo

Matthew Jacobs codingmatty

🦈
Daddy shark, doo doo doo doo doo doo
View GitHub Profile
@codingmatty
codingmatty / dokku-setup.sh
Last active April 27, 2024 20:57
Reference for setting up an application with Dokku
# These lines only need to be ran once:
dokku plugin:install postgres
dokku letsencrypt:set --global email <your-email@email.com>
dokku letsencrypt:cron-job --add
# This script is meant to be used as a reference to setup an application with a postgres database pointing to a git repository with a Dockerfile
dokku apps:create linkwarden
dokku postgres:create linkwarden-db
dokku postgres:link linkwarden-db linkwarden
@codingmatty
codingmatty / dokku-setup.sh
Created April 27, 2024 20:20
Reference for setting up an application with Dokku
# These lines only need to be ran once:
dokku plugin:install postgres
dokku letsencrypt:set --global email <your-email@email.com>
dokku letsencrypt:cron-job --add
# This script is meant to be used as a reference to setup an application with a postgres database pointing to a git repository with a Dockerfile
dokku apps:create linkwarden
dokku postgres:create linkwarden-db
dokku postgres:link linkwarden-db linkwarden
@codingmatty
codingmatty / commands.sh
Last active January 16, 2022 15:21
AWS Glacier Vault Prepare for Deletion
## This file is not meant to be run
## It's just a list of commands to use
# Command variables that will be reused
AWS_GLACIER_VAULT_NAME=
AWS_ACCOUNT_ID=
AWS_REGION=
# Hydrate vault
aws glacier initiate-job --vault-name $AWS_GLACIER_VAULT_NAME --account-id $AWS_ACCOUNT_ID --job-parameters '{"Type": "inventory-retrieval"}'
@codingmatty
codingmatty / generateDescriptions.ts
Created May 14, 2021 14:56
TS: Enum to Runtime Descriptions
function generateDescriptions<
T extends Record<K, V>,
K extends keyof T,
V extends number | string
>(e: T): Record<V, K> {
return (Object.values(e) as (keyof typeof e)[]).reduce((result, key) => {
return {
...result,
[e[key]]: key,
// If you want to format, you'll need to change the return value to be Record<V, string>
import { useEffect, useState } from 'react';
/**
* Usage:
*
* const {response, error, loading} = useFetch({ url, ...options }, deps);
*/
export default function useFetch(
{
url,
@codingmatty
codingmatty / check-repo.sh
Last active March 22, 2019 17:27
Check to make sure you are on a clean master branch
#!/bin/bash
if [ -n "$(git status --porcelain)" ]; then
echo "Aborting! Branch is unclean.";
exit 1
elif [ "$(git rev-parse --abbrev-ref HEAD)" != "master" ]; then
echo "Aborting! Not on master branch.";
exit 1;
elif [ "$(g rev-list master...origin/master)" != "" ]; then
echo "Aborting! Master branch not in sync with origin.";
@codingmatty
codingmatty / registerNext.js
Created February 21, 2019 13:41
Next in Express example
const next = require('next');
const pathToRegexp = require('path-to-regexp');
const { parse } = require('url');
module.exports = async function registerNextApp(nextOptions) {
const nextApp = next(nextOptions);
const requestHandler = nextApp.getRequestHandler();
try {
await nextApp.prepare();
@codingmatty
codingmatty / states.js
Created February 28, 2017 14:17
List of states and helper functions
const states = [
{ name: 'Arizona', code: 'AZ' },
{ name: 'Alabama', code: 'AL' },
{ name: 'Alaska', code: 'AK' },
{ name: 'Arkansas', code: 'AR' },
{ name: 'California', code: 'CA' },
{ name: 'Colorado', code: 'CO' },
{ name: 'Connecticut', code: 'CT' },
{ name: 'Delaware', code: 'DE' },
{ name: 'Florida', code: 'FL' },
@codingmatty
codingmatty / countries.js
Created February 28, 2017 14:14
List of countries and helper functions
const countries = [
{ name: 'Afghanistan', code: 'AF' },
{ name: 'Åland Islands', code: 'AX' },
{ name: 'Albania', code: 'AL' },
{ name: 'Algeria', code: 'DZ' },
{ name: 'American Samoa', code: 'AS' },
{ name: 'AndorrA', code: 'AD' },
{ name: 'Angola', code: 'AO' },
{ name: 'Anguilla', code: 'AI' },
{ name: 'Antarctica', code: 'AQ' },

Keybase proof

I hereby claim:

  • I am codingmatty on github.
  • I am majacobs (https://keybase.io/majacobs) on keybase.
  • I have a public key whose fingerprint is FD46 DC55 F778 6338 A554 C732 4D5D F45E A5C1 1358

To claim this, I am signing this object: