Skip to content

Instantly share code, notes, and snippets.

View sjones6's full-sized avatar

Spencer Jones sjones6

View GitHub Profile
@sjones6
sjones6 / render-aws-backup.ts
Created March 24, 2021 03:21
backup pg database to aws
import { spawn, execSync } from 'child_process';
import through2 from 'through2';
import fs from 'fs';
import * as AWS from 'aws-sdk';
function spawnPgDump(pgDumpPath, args, env) {
if (!fs.existsSync(pgDumpPath)) {
throw new Error('pg_dump not found at ' + pgDumpPath);
}
@sjones6
sjones6 / tailwind-darkmode-toggle.html
Last active October 23, 2022 14:15
A darkmode toggle using tailwindcss
<div class="w-14 h-8">
<input type="checkbox" id="dark-mode-toggle" class="hidden" onchange="document.documentElement.classList.toggle('dark')" />
<label for="dark-mode-toggle" class="w-full h-full bg-gray-800 dark:bg-white rounded-full p-1 flex justify-between cursor-pointer">
<span class="inline dark:hidden">🌞</span>
<span class="w-6 h-6 rounded-full bg-white dark:bg-gray-800 block float-right dark:float-left"></span>
<span class="hidden dark:inline">🌛</span>
</label>
</div>
@sjones6
sjones6 / circleci_merge_target_branch.md
Created August 2, 2018 19:34
How to Merge Target Branch in CircleCI Job

Problem statement: you want to make sure that the PR branch is up-to-date with the target branch before running your CI job against it.

As a secondary concern, you don't want to run the job if there are conflicts with the target branch.

Solution:

# setup the github user
git config --global user.email $( git log --format='%ae' $CIRCLE_SHA1^! )
git config --global user.name $( git log --format='%an' $CIRCLE_SHA1^! )