Skip to content

Instantly share code, notes, and snippets.

View haliphax's full-sized avatar
💭
git clone self

haliphax

💭
git clone self
View GitHub Profile
@haliphax
haliphax / Makefile
Last active December 16, 2021 06:33
WordPress plugin reducisaurus Makefile
# WordPress plugin reducisaurus Makefile
# Author: haliphax <https://haliphax.dev>
# current directory - used when zipping
CWD := $(shell pwd)
# get project base name from directory name
PROJ := $(word $(words $(subst /, ,$(CWD))), $(subst /, ,$(CWD)))
# pull version from main project file
VER := $(shell egrep "^Version:" $(PROJ).php | cut -d" " -f2)
@haliphax
haliphax / ko.extenders.scrollFollow.js
Created April 13, 2013 18:15
Auto-scrolling extender for knockout.js observableArray objects
ko.extenders.scrollFollow = function (target, selector) {
target.subscribe(function (newval) {
var el = document.querySelector(selector);
// the scroll bar is all the way down, so we know they want to follow the text
if (el.scrollTop == el.scrollHeight - el.clientHeight) {
// have to push our code outside of this thread since the text hasn't updated yet
setTimeout(function () { el.scrollTop = el.scrollHeight - el.clientHeight; }, 0);
}
});
@haliphax
haliphax / Browsercache.php
Created May 9, 2013 04:08
Browsercache.php - A simple browser-cache-handling library for CodeIgniter
<?php if(! defined('BASEPATH')) exit();
class Browsercache
{
private $ci;
function __construct()
{
$this->ci =& get_instance();
}
@haliphax
haliphax / chud.user.js
Last active January 31, 2020 17:57
CHUD: Caddy Healer for Urban Dead (userscript)
// ==UserScript==
// @name CHUD
// @namespace https://roadha.us
// @author haliphax (https://roadha.us)
// @contributor jimflexx (http://userscripts.org/users/117383)
// @description Caddy Healer for Urban Dead
// @include http://urbandead.com/map.cgi*
// @include http://www.urbandead.com/map.cgi*
// ==/UserScript==
@haliphax
haliphax / udpe.user.js
Last active April 1, 2020 14:47
Urban Dead Profile Expander (userscript)
// ==UserScript==
// @match http://urbandead.com/map.cgi*
// @match http://www.urbandead.com/map.cgi*
// @include http://*urbandead.com/map.cgi*
// @exclude http://*urbandead.com/map.cgi?log*
// @name UD Profile Expander
// @namespace http://userscripts.org/users/72447
// @description (Urban Dead) Shows users' profile information in-game
// ==/UserScript==
@haliphax
haliphax / tvguide-tidy.user.js
Created August 28, 2014 20:05
TV Guide Tidy (userscript)
// ==UserScript==
// @match http://www.tvguide.com/listings/
// @name TV Guide Tidy
// @description Cleans up the TV Guide listings page
// @version 1.0
// ==/UserScript==
window.onload = function(){
var l = document.querySelector(".listings-w");
@haliphax
haliphax / gmcc.user.js
Last active August 29, 2015 14:05
Give Me Coins Condensed (userscript)
// ==UserScript==
// @name Give Me Coins Condensed
// @namespace http://roadha.us
// @version 1.0
// @description Condenses the layout of the give-me-coins.com dashboard
// @include https://give-me-coins.com/pool/dashboard
// @match https://give-me-coins.com/pool/dashboard
// @run-at document-end
// ==/UserScript==
@haliphax
haliphax / udinventory.user.js
Last active March 30, 2020 15:33
UD Inventory (userscript)
// ==UserScript==
// @author haliphax
// @include http://*urbandead.com/map.cgi*
// @exclude http://*urbandead.com/map.cgi?log*
// @name UDInventory
// @namespace https://roadha.us
// @description (Urban Dead) Groups items together in your inventory and squashes mall search
// @version 1.1
// ==/UserScript==
#!/usr/bin/env bash
VERB=enable
KEYBOARD_ID=12
TOUCHPAD_ID=13
[ -z "$(xinput list-props 13 | grep -e 'Device Enabled.*:.*0')" ] && VERB=disable
xinput $VERB $KEYBOARD_ID
xinput $VERB $TOUCHPAD_ID
@haliphax
haliphax / ProperCase.fs
Last active February 28, 2024 18:25
Capitalize a given string using Proper Case (dipping a toe into the F# water)
// capitalizes the first letter of every word in the given string
let properCase (s:string) =
// recursive helper function
let rec helper (s:string) (i:int) (capitalize:bool) (result:string) =
// if we're at the end of the string, return our result
if s.Length - 1 < i then
result
else
// recurse to the next character in the input string
(helper s (i + 1) (s.[i] = ' ') (result +