Skip to content

Instantly share code, notes, and snippets.

View ShonFrazier's full-sized avatar
🔹

Shon Frazier ShonFrazier

🔹
View GitHub Profile
@ShonFrazier
ShonFrazier / postgres-nanoid.sql
Created December 29, 2022 22:25 — forked from coreybutler/postgres-nanoid.sql
PostgreSQL NANOID
CREATE FUNCTION "nanoid"("size" int4 DEFAULT 21)
RETURNS text
LANGUAGE plpgsql
STABLE
AS
$$
DECLARE
id text := '';
i int := 0;
urlAlphabet char(64) := 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_0123456789';
@ShonFrazier
ShonFrazier / API.md
Last active October 29, 2022 16:53 — forked from iros/API.md
Documenting your REST API

Service Name

Title


<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

@ShonFrazier
ShonFrazier / # emscripten - 2021-01-11_15-26-17.txt
Created January 11, 2021 20:47
emscripten on macOS 10.15.7 - Homebrew build logs
Homebrew build logs for emscripten on macOS 10.15.7
Build date: 2021-01-11 15:26:17
@ShonFrazier
ShonFrazier / Package.swift
Last active November 4, 2017 23:59
Not finding 'SwiftKueryPostgreSQL' with building
// swift-tools-version:4.0
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "GameMaster",
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
@ShonFrazier
ShonFrazier / realpath
Created November 18, 2016 20:07
Get the real absolute path behind a symlink
#!/bin/bash
realpath() {
path=`readlink $0`
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}
realpath "$0"
@ShonFrazier
ShonFrazier / le-cert-renew.fish
Last active September 24, 2016 21:26
Renew a Let's Encrypt cert within a week of expiration. Run weekly. Or Daily.
#!/bin/fish
# Get dates in seconds since epoch
set -x EXPIRES (date --date=(cat /etc/letsencrypt/live/api.fyrestead.com/cert.pem | openssl x509 -noout -enddate | awk -F "=" '{print $2}') +%s)
set -x TODAY (date +%s)
set -x SPAN (expr $EXPIRES - $TODAY)
# if the span is <= seven days ...
if test $SPAN -le 604800
# renew the cert
@ShonFrazier
ShonFrazier / HandleURI.swift
Last active September 15, 2016 01:50 — forked from anonymous/HandleURI.swift
Handle URIs with custom schemes on macOS
// After your application launches, register to handle Apple Events
func applicationDidFinishLaunching(_ aNotification: Notification)
{
let appleEventManager = NSAppleEventManager.shared()
appleEventManager.setEventHandler(self,
andSelector: #selector(AppDelegate.handleGetURLEvent(_:withReplyEvent:)),
forEventClass: AEEventClass(kInternetEventClass),
andEventID: AEEventID(kAEGetURL))
}
@ShonFrazier
ShonFrazier / Error.txt
Created August 1, 2016 12:41
Swift playgrounds error on iOS 10b3
Error: Contents/Sources/Scene.swift:73: cannot call value of non-function type 'Bundle'
Error: Contents/Sources/AccessibilityExtensions.swift:36: cannot call value of non-function type 'NotificationCenter'
Error: Contents/Sources/AccessibilityExtensions.swift:40: cannot call value of non-function type 'NotificationCenter'
Warning: Contents/Sources/AccessibilityExtensions.swift:44: 'asynchronously(group:qos:flags:execute:)' is deprecated: replaced by instance method 'DispatchQueue.async(group:qos:flags:execute:)'
Error: Contents/Sources/Actor.swift:404: cannot call value of non-function type 'Bool'
Error: Contents/Sources/ActorType.swift:27: cannot call value of non-function type 'FileManager'
Error: Contents/Sources/ActorType.swift:30: cannot call value of non-function type 'Bundle'
Error: Contents/Sources/ActorType.swift:34: cannot call value of non-function type 'Bundle'
Error: Contents/Sources/AnimationComponent.swift:108: method does not override any method from its superclass
Error: Contents/Sources/Anim
@ShonFrazier
ShonFrazier / PocoUUIDWrap.cpp
Last active May 29, 2017 13:43
Poco - Wrapping UUIDGenerator and UUID classes in C-friendly code
#include "PocoUUIDWrap.h"
#include <Poco/UUID.h>
#include <Poco/UUIDGenerator.h>
using Poco::UUID;
using Poco::UUIDGenerator;
PocoUUID *PocoUUIDCreate(void)
{
~> brew install class-dump
==> Downloading https://github.com/nygard/class-dump/archive/3.5.tar.gz
Already downloaded: /Library/Caches/Homebrew/class-dump-3.5.tar.gz
==> xcodebuild -configuration Release SYMROOT=build PREFIX=/usr/local/Cellar/class-dump/3.5 ONLY_ACTIVE_ARCH=YES
Last 15 lines from /Users/shon/Library/Logs/Homebrew/class-dump/01.xcodebuild:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch x86_64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=gnu99 -fobjc-arc -gmodules -Wno-trigraphs -fpascal-strings -Os -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-implicit-atomic-properties -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wshadow -Wno-four-char-constants -Wno-conversion -Wconstant