This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const url = 'https://sandbox.joeworkman.net/cms-data/blog/store/_blog.json'; | |
const res = await fetch(url); | |
const json = await res.text(); | |
const posts = Object.values(JSON.parse(json).post).filter(post => !post.draft); | |
const winner = posts[Math.floor(Math.random()*posts.length)]; | |
return winner; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set('display_errors', '0'); | |
function returnError($msg) | |
{ | |
header('HTTP/1.1 500 Internal Server Error'); | |
header('Content-Type: application/json; charset=UTF-8'); | |
die(json_encode(array('message' => trim(strip_tags($msg)), 'code' => 500, 'post' => $_POST))); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm() { | |
pnpm_folders=(/dev/repo1 /dev/repo2) | |
if printf '%s\n' "${pnpm_folders[@]}" | grep `pwd` ; then | |
pnpm $@ | |
else | |
npm $@ | |
fi | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Brett Terpstra 2019/Joe Workman 2020 | |
# This script adds the ability to increment/decrement display brightness | |
# levels to the nriley/brightness CLI (Copyright (c) 2014-2019, Nicholas Riley) | |
# Requires CLI installation: `brew install brightness` | |
# See https://github.com/nriley/brightness | |
CMD = "/usr/local/bin/brightness" | |
# Display usage and exit | |
def usage(code) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script crossorigin="anonymous" src="https://polyfill.io/v3/polyfill.min.js?features=es6%2Ces7%2Ces5%2Cdefault"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
rwfolder=~/Library/Mobile\ Documents/com\~apple\~CloudDocs/RapidWeaver | |
cd "$rwfolder" | |
stacks=Stacks.rapidweaverplugin | |
plist=$stacks/Contents/Info.plist | |
version=`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "$plist" | cut -f1 -d.` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getMeta(metaName) { | |
const metas = document.getElementsByTagName('meta'); | |
for (let i = 0; i < metas.length; i++) { | |
if (metas[i].getAttribute('property') === metaName) { | |
return metas[i].getAttribute('content'); | |
} | |
} | |
return ''; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/zsh | |
if [ "$#" -ne 2 ]; then | |
echo "Usage: $0 OLD_VERSION NEW_VERSION" >&2 | |
exit 1 | |
fi | |
export OLD=$1 | |
export NEW=$2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
rm -r /home/username/websites/total-cms.com/cms-data/ | |
cp -r /home/username/websites/total-cms.com/cms-data-template/ /home/username/websites/total-cms.com/cms-data/ |
NewerOlder