Skip to content

Instantly share code, notes, and snippets.

// get a list of all compendium
game.packs.keys();
// Select the pack you're workign with
const pack = game.packs.get('world.items5e');
// Use this to get all the content of the pack
pack.getContent();
// Build a data object of all the information you want to update.
@BradKriss
BradKriss / aws-filesystem-permissions.json
Created May 17, 2018 20:24
Permissions needed for Laravels File Storage
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:ListAllMyBuckets",
"s3:GetBucketLocation"
],
@BradKriss
BradKriss / TagManager.js
Created April 9, 2018 13:16
JS Class for firing GTM Events
window.TagManager = new class {
fireDomEvent(name, event) {
window.dataLayer.push({
'event': 'gtm.' + name,
'gtm.element': event.target,
'gtm.elementClasses': event.target.className || '',
'gtm.elementId': event.target.id || '',
'gtm.elementTarget': event.target.target || '',
'gtm.elementUrl': event.target.href || event.target.action || '',
@BradKriss
BradKriss / iframe.html
Created November 17, 2017 13:17
Full page iframe, with full scroll. Basically looks like you're on a different page than you are.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Brad Kriss</title>
<style type="text/css">
body, html
{
margin: 0; padding: 0; height: 100%; overflow: hidden;
}
@BradKriss
BradKriss / Tracking.php
Last active October 5, 2016 13:41
Cake Tracking Middleware for Laravel
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\Input;
class Tracking
{
public $linkVars = [
@BradKriss
BradKriss / MandrillSender.php
Last active April 30, 2016 14:15
What a difference a year makes
<?php namespace App\Http\Controllers\Email;
use App\Contracts\Email\Emailer;
use App\Contracts\Email\EmailMessage;
use App\EmailTemplate;
use App\Http\Controllers\Controller;
class MandrillSender extends Controller implements Emailer
{
@BradKriss
BradKriss / index.html
Last active August 29, 2015 14:04
Yes no toggle - mono
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-default btn-yn-toggle">
<input type="radio" name="priRes" id="#" value="1"> yes
</label>
<label class="btn btn-default btn-yn-toggle">
<input type="radio" name="priRes" id="#" value="0"> no
</label>
</div>
@BradKriss
BradKriss / NumberOnlyInput.js
Created August 5, 2014 17:31
Force number only input, while retaining copy, paste, select, backspace, delete, left & right arrows
$(document).ready(function() {
$(".number").keydown(function(event) {
// Allow only tab, backspace, delete, left-right arrows, and select, copy & paste combos
var evtobj = window.event? event : e;
if ( event.keyCode == 37 || event.keyCode == 39 || event.keyCode == 46 || event.keyCode == 8 || event.keyCode == 9 || evtobj.ctrlKey && (evtobj.keyCode == 65 || evtobj.keyCode == 88 || evtobj.keyCode == 67 || evtobj.keyCode == 86)) {
// let it happen, don't do anything
}
else {
// Ensure that it is a number and stop the keypress
if (evtobj.shiftKey || event.keyCode < 48 || (event.keyCode > 57 && (event.keyCode < 96 || event.keyCode > 105) )) {