Skip to content

Instantly share code, notes, and snippets.

View jthurteau's full-sized avatar

John Troy Hurteau jthurteau

View GitHub Profile
@jthurteau
jthurteau / geet.md
Created February 24, 2025 02:46
What if tweets, yeets, skeets, or whatever we're calling them now could be better?

Crawl out through the burnout... slowly, but surely. I'm working through my backlog, including navigating how social media might actually work (effectively) for me.

@jthurteau
jthurteau / catalog_sitemap.xml
Last active March 17, 2024 23:46
Sitemap for Popetech to test NC State University Libraries pages
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<!-- https://www.sitemaps.org/protocol.html -->
<url><loc>https://catalog.lib.ncsu.edu/</loc><changefreq>always</changefreq></url>
<url><loc>https://catalog.lib.ncsu.edu/catalog/advanced</loc><changefreq>always</changefreq></url>
<url><loc>https://catalog.lib.ncsu.edu/?search_field=all_fields&q=co-design</loc><changefreq>always</changefreq></url>
<url><loc>https://catalog.lib.ncsu.edu/?page=2&q=co-design&search_field=all_fields</loc><changefreq>always</changefreq></url>
<url><loc>https://catalog.lib.ncsu.edu/trln?q=co-design&search_field=all_fields</loc><changefreq>always</changefreq></url>
<url><loc>https://catalog.lib.ncsu.edu/?f%5Bphysical_media_f%5D%5B%5D=Print&f%5Bresource_type_f%5D%5B%5D=Book&f%5Bsubject_topical_f%5D%5B%5D=Social+aspects&q=co-design&search_field=all_fields</loc><changefreq>always</changefreq></url>
@jthurteau
jthurteau / x_reservations_per_y_days.php
Created August 28, 2023 13:20
30 (X) Reservations in 30 (Y) Days Algorithm
<?php
function checkUserBookingRules($bookingData, $username)
{
/* $bookingData is a new or modified booking request */
$existingBooking = key_exists('code', $bookingData) ? $bookingData['code'] : null;
/* ... other rule checks ... */
$startWindow = /* $Y days before booking date */;
$windowLength = /* (2 * $Y) + how far out the user can book + 2 extra days */;
$spanDayBookings = $this->getUserBookings($username, $startWindow, $windowLength);
body { background-color: rgba(0, 0, 0, 0); margin: 0px auto; overflow: hidden; }
.chat-line__message {font-weight:800; font-size:20px; color:#fff;}
.chat-line__status {font-weight:800; font-size:20px; color:#fff;}
.simplebar-scroll-content {background-color:#000;}
@jthurteau
jthurteau / Vagrantfile
Last active November 26, 2022 19:54
Vagrant with MrRogers
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'resolv'
require_relative 'puppet/mr_rogers'
# project settings
app_name = 'APPLICATION_NAME_HERE'
org_name = 'ORG_NAME_HERE'
realm_mode = false
puppet_stack = "#{org_name}-apache-php-#{app_name}"
@jthurteau
jthurteau / Vagrantfile
Last active February 14, 2019 18:04
Base Vagrant/Puppet Setup
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'resolv'
realm_mode = true
realm_key = 'KEY_HERE'
rhel_org = 'YOUR_ORG'
app_name = 'APP_NAME'
puppet_stack = 'apache-python-postgres'
vagrant_guest_path = '/vagrant'
@jthurteau
jthurteau / example.js
Last active August 26, 2016 02:00
Testing for DST
var dst = function(){
var timeZone = 'EDT';
function dstDetect(dateStamp){
if (typeof(dateStamp) == 'undefined') {
var now = new Date();
dateStamp = now.getTime();
}
var timeObject = new Date(dateStamp);
var month = timeObject.getMonth();
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
@jthurteau
jthurteau / An_example.php
Last active August 22, 2016 02:24
pattern examples
// example of how this would get called:
// during bootstrap:
// configuration specifies a "Messenger" resource with property enabled as true/false
class Bootstrap {
protected function _initMessenger($config){
Messenger_Root::init($config); // values from config are strings, hence the Saf_Filter_Truthy::filter call in ::init
}
}
/*
* start by getting the event data from EMS we've mapped the following values into an array
*
* 'id' => BookingID from EMS
* 'fullStart' => TimeEventStart from EMS converted to a timestamp
* 'fullEnd' => TimeEventEnd from EMS converted to a timestamp
* 'now' => current time time()
* 'title' => EventName from EMS
* 'location' => some combination of building/floor/room name
* 'description' => optional content from elsewhere with more in-depth detail