Skip to content

Instantly share code, notes, and snippets.

View tdhsmith's full-sized avatar

t d h smith tdhsmith

View GitHub Profile
@tdhsmith
tdhsmith / chronicle_template.tex
Created September 16, 2020 23:32
Pathfinder 2e Chronicle Generator
\documentclass[]{article}
\usepackage{wallpaper, array}
\usepackage{calc}
\usepackage{etoolbox}
\usepackage{tikz}
\usetikzlibrary{patterns}
\usetikzlibrary{calc}
\usepackage[absolute,overlay]{textpos}
@tdhsmith
tdhsmith / OLGS_CA_game_inventory_hack.user.js
Created October 18, 2017 16:53
Very rough userscript to expose exact inventory data on Canadian games retailers BGB and 401G
// ==UserScript==
// @match https://store.401games.ca/*
// @match https://www.boardgamebliss.com/*
// ==/UserScript==
const is401 = document.location.host.indexOf("401") > -1;
function getProduct() {
try {
if (is401) {
const wrapper = document.getElementById("ProductJson-product-template");
@tdhsmith
tdhsmith / sever.js
Last active January 18, 2017 17:44
websocket-monitor opcode test server
const http = require('http');
const WebSocket = require('ws');
// you'll need to npm install ws (tested on v1.1.1, which was the default as of this writing)
const wss = new WebSocket.Server({
port: 3001
});
wss.on('error', console.error);
wss.on('listening', () => console.log("* WS server ready"));
@tdhsmith
tdhsmith / GC-solver-4.js
Created October 4, 2016 02:43 — forked from anonymous/GC-solver-4.js
Thrown-together solver for a geocaching puzzle
var magic = ["equals(caret(175.4, 203.9), caret(gt(37.8, 16.3), 19.5))",
"equals(equals(caret(gt(88.7, 66.4), 101.5), caret(72.3, 39.5)), 37.8)",
"equals(equals(equals(caret(22009.9, 10101.8), 7228.7), 368.7), gt(4138488.0, 4020319.0))",
"equals(caret(2066.8, 668.8), caret(12.9, gt(122.1, 8.4)))",
"equals(equals(caret(9999.9, 10375.2), caret(777.7, 37.9)), gt(96.8, 33.0))",
"equals(equals(equals(caret(98765.7, 3777.5), 667.7), 268.3), caret(586728.2, 412841.8))"];
// unambiguous "caret(22009.9, 10101.8) = 7228.7 = 368.7 = gt(4138488.0, 4020319.0)", ?
// "(98765.7 ^ 3777.5) = 667.7 = 268.3 = (586728.2 ^ 412841.8)" ?
@tdhsmith
tdhsmith / RequiredXorRuleProvider.php
Last active February 10, 2021 18:41
Laravel Validator rule extension for 'required_xor'
<?php
namespace App\Providers;
use Illuminate\Support\Arr;
use Illuminate\Support\ServiceProvider;
use InvalidArgumentException;
use Validator;
class RequiredXorRuleProvider extends ServiceProvider
{
@tdhsmith
tdhsmith / jwtauth_user_refs.dot
Last active February 10, 2016 22:37
Simplified flow for default user model interactions in JWTAuth
# http://www.graphviz.org/content/cluster
digraph G {
rankdir = LR;
splines = line;
subgraph cluster_package {
subgraph cluster_0 {
color=blue;
node [style=filled];
label = "JWT";
@tdhsmith
tdhsmith / pre-commit
Created November 17, 2015 20:07
Git pre-commit username check
#!/bin/bash
if [[ -z "$(git config user.name)" ]]; then
echo "Git username must be defined to commit!"
echo "(Are you running inside Vagrant/Homestead?)"
echo
exit 1
fi
@tdhsmith
tdhsmith / index.js
Last active November 16, 2015 20:23
Usemin Generic Steps
'use strict';
var path = require('path');
// a generic flow step where each file is processed independently
// from the inDir to the outDir (this doesn't have a 'last case')
// (borrowed from the default uglify task)
exports.independentFlow = function (context, block) {
var config = {files: []};
context.inFiles.forEach(function (filename) {
var infile = path.join(context.inDir, filename);
@tdhsmith
tdhsmith / index.html
Last active February 5, 2016 18:34
JWTAuth Token Flow Diagram
<html>
<head>
<title>Token Diagram for tymon/jwt</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
@tdhsmith
tdhsmith / dabblet.css
Last active August 29, 2015 14:27
Nth-of-type and compound selectors demo
/**
* Nth-of-type and compound selectors demo
*/
p.third:nth-of-type(3) {
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
}