Skip to content

Instantly share code, notes, and snippets.

View jerclarke's full-sized avatar
🌿

Jer Clarke they/them jerclarke

🌿
View GitHub Profile
@jerclarke
jerclarke / Jer-dnd-combat-notes.md
Last active February 3, 2020 14:52
Jer's reference notes on D&D 5e combat

Jer's reference notes on D&D 5e combat

Surprise

  • The DM determines who might be surprised for the first round of combat
  • If neither side tries to be stealthy, they automatically notice each other.
  • Notice check: DM compares the Dexterity (Stealth) checks of anyone hiding with the passive Wisdom (Perception) score of each creature on the opposing side.
  • Any character or monster that doesn't notice a threat is surprised at the start of the encounter.
  • If you're surprised, you can't move or take an action on your first turn of the combat, and you can't take a reaction until that turn ends.
  • A member of a group can be surprised even if the other members aren't.
@jerclarke
jerclarke / Google_OAuth2.php
Last active February 17, 2018 19:40
Google_OAuth2.php from Google Analyticator v.6.4.3 with modifications to fix "Fatal error: Uncaught exception 'Google_AuthException'" See revision history for details on what I changed to fix the error. See this wordpress.org support forum posting about the issue: http://wordpress.org/support/topic/solution-for-fatal-error-uncaught-exception-goo…
<?php
/*
* Copyright 2008 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@jerclarke
jerclarke / wp_admin_post_thumbnail_html_example.php
Created March 1, 2017 15:38
Demo using WP's admin_post_thumbnail_html filter to insert content in featured image metabox
<?php
/**
* Adds a detailed UI to WP's thumbnail HTML markup used in the Feature Image metabox.
*
* Adds a description of featured images, a listing of the formats used by GV and
* previews of how the images will appear in features slider and thumbnails.
*
* Note that $thumbnail_id is only saved when the post is saved. Immediately after the featured image is changed
* this value is updated, but not the postmeta field in the database (nor OUR fields which are tied to it)
* SO:
@jerclarke
jerclarke / love-poem.php
Last active July 25, 2017 02:16
PHP Love Poem
<?php
try_love();
function try_love() {
echo "<div class='this-world'>";
$me = new Lover ( 'Me' );
@jerclarke
jerclarke / fb-ia-transformation-puzzle.html
Created October 17, 2016 18:49
Facebook iA confounding source markup for transformations
<div class="alignright factbox">
FACTBOX!
<h4>H4 IN A FACTBOX</h4>
NORMAL TEXT WITH A <a href="https://test.com">LINK</a> IN FACTBOX.
<ul>
<li>UL &gt; LI IN FACTBOX</li>
<li>SECOND LI JUST IN CASE</li>
</ul>
</div>
@jerclarke
jerclarke / edit-flow-autosave-comments-not-a-real-plugin.php
Created October 6, 2016 20:55
Edit Flow "plugin" (hack) to autosave unsubmitted Editorial Comment text when post is saved
<?php
/**
* EDIT FLOW: wp_insert_post action to autosave "draft" editorial comments in post meta field
*
* Currently (2016-10-06) Edit Flow has no handling of unsubmitted editorial comments in the textarea
* when the post is saved, so saving your post deletes your comment unless you submitted it, which is awful.
*
* This function hooks into wp_insert_post where the value of the textarea is present (but ignored by default)
* and if found, saves the text (and ID of parent comment if it was a specific reply) to a postmeta field
* keyed on the user who saves the post.
<?php
/*
* Simple function to intentionally crash HHVM and trigger our PHP-FPM fallback
*
* For whatever reason having two "default:"" clauses in a switch statement crashes HHVM but not PHP-FPM
* In HHVM error logs it causes: Fatal error: Switch statements may only contain one default: clause in /var/www/sites/monittest/index.php on line XX
*
* This can be used to intentionally trigger a fallback from HHVM to PHP-FPM in our system, which normally happens
* to avoid scripts with rare HHVM bugs from crashing completely to WSOD, and to keep the server mostly working
* if HHVM failed completely, which has happened a couple of times.
@jerclarke
jerclarke / php-error-test.php
Created March 30, 2016 17:41
Simple PHP script to test display of errors including a fix for displaying inline errors in HHVM
<?php
/*
* Test display of errors in HHVM/PHP
*
* In HHVM and often in normal PHP I want to see notices and errors inline to the
* document. This script tests the ability to make errors visible and has a solution
* that so far works in all the modern PHP and HHVM versions I tried.
*/
echo "<h1>Error test document for PHP</h1>";
@jerclarke
jerclarke / google-analyticator.php
Last active December 12, 2015 04:59
Google Analyticator (WordPress Plugin) v6.4.2 main file. Patched to fix saving of array-based settings for roles-that-see-dashboard-widget and roles-excluded-from-tracking. See "Revisions" to see what I changed. NOTE: I edited the plugin version and description to reflect that this is a patched version. You should see the update notice when a ne…
<?php
/*
* Plugin Name: Google Analyticator
* Version: 6.4.2.1.jer
* Plugin URI: http://wordpress.org/extend/plugins/google-analyticator/
* Description: Adds the necessary JavaScript code to enable <a href="http://www.google.com/analytics/">Google's Analytics</a>. After enabling this plugin you need to authenticate with Google, then select your domain and you're set. PATCHED_BY_JEREMY_CLARKE: Fixed issue with array-based options (roles to hide, roles to see dashboard widget) being stomped by overzealous kses filtering.
* Author: Video User Manuals
* Author URI: http://www.videousermanuals.com
* Text Domain: google-analyticator
*/
@jerclarke
jerclarke / gist:1725905
Created February 2, 2012 21:32
Patch to fix checkbox display in Custom Metadata Manager WordPress Plugin
Index: custom_metadata.php
===================================================================
--- custom_metadata.php (revision 499358)
+++ custom_metadata.php (working copy)
@@ -871,12 +871,22 @@
else $field_id = $field_slug;
$readonly_str = ($field->readonly) ? 'readonly="readonly" ' : '';
+