Skip to content

Instantly share code, notes, and snippets.

View georgestephanis's full-sized avatar

George Stephanis georgestephanis

View GitHub Profile
<?php
/**
* This code's purpose is to ensure that any clones of a
* site hosted on Atomic are run safely so that processes
* meant to happen only on production (emailing customers,
* api calls, cron jobs, etc) are properly removed and that
* Safety Net is appropriately configured.
*/
$cached_ATOMIC_SITE_ID = get_option( 'team51_ATOMIC_SITE_ID' );
@georgestephanis
georgestephanis / fourletters.php
Last active October 23, 2023 10:05
Implementation of Four Letters Word Game from BJ Homer's flash talk at Division Meetup
<?php
define( 'DICT_FILE', '/usr/share/dict/words' );
$allwords = file_get_contents( DICT_FILE );
$qty = preg_match_all( '/^\w{4}$/m', $allwords, $matches );
echo "\r\n\e[32mLoaded \e[37m{$qty}\e[32m four-letter words in from \e[37m" . DICT_FILE . "\e[32m ...\r\n\e[0m";
$fourletter = $matches[0];
@georgestephanis
georgestephanis / datasheets.html
Last active April 11, 2023 14:42
An initial attempt at creating a css framework for rendering 40k 10th ed datasheets in credit-card sized references.
<!DOCTYPE html>
<html lang="en">
<head>
<title>40k Datacard Testing</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="datacard">
<header>
<h2>Terminator Squad</h2>
@georgestephanis
georgestephanis / slack-afk-automator.php
Created November 21, 2022 16:22
don't forget to add in the bearer token on line 23
<?php
function set_myself_afk() {
$tz = date('I') ? 'EST' : 'EDT';
$expiration = strtotime( "+1 Weekday 9am {$tz}" );
$weekday = array(
'status_text' => 'AFK for the evening.',
'status_emoji' => ':family:',
'status_expiration' => $expiration,
<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE muclient>
<muclient>
<plugin name="LotJ_Race_Exporter" author="@Daljo" id="d75f227c34fe0f9af2f20f66" language="Lua" purpose="Export race data." requires="4.73" version="0.1" save_state="y">
<description trim="y">
<![CDATA[
-- Race Scraper / Exporter --
]]>
@georgestephanis
georgestephanis / LotJ_Cargo_Scraper.xml
Last active May 28, 2022 03:10
LotJ Cargo Analysis Plugin for Mushclient
<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE muclient>
<muclient>
<plugin name="LotJ_Cargo_Scraper" author="@Daljo" id="e95b128bc53345a4a39b29b4" language="Lua" purpose="Scrape cargo data." requires="4.73" version="0.1" save_state="y">
<description trim="y">
<![CDATA[
-- Cargo Scraper / Exporter --
]]>
@georgestephanis
georgestephanis / external-links-new-tab.js
Last active February 1, 2022 16:33
Tiny WordPress plugin for how to force external links to open in a new tab.
<?php
/**
* A colophon-generating method for WordPress Special Projects Sites.
*
* team51_credits( 'separator= | ' );
*
* @param array $args {
* Optional. An array of arguments.
*
// ==UserScript==
// @name OGLAF Keyboard Navigation
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Add left/right arrow keyboard navigation.
// @author You
// @match https://www.oglaf.com/*
// @icon https://static.oglaf.com/favicon.png
// @grant none
// ==/UserScript==
<?php
// Plugin name: Jetpack Infinite Scroll for Single Posts
/**
* Infinite scroll needs to be filtered to function on non-archive pages.
*/
function jisfsp_archive_supported( $supported, $settings ) {
if ( is_singular( 'post' ) ) {
return true;