Skip to content

Instantly share code, notes, and snippets.

View OldStarchy's full-sized avatar

Nick OldStarchy

  • Australia
  • 13:12 (UTC +10:30)
View GitHub Profile
OldStarchy / media_mouse.ahk
Created October 19, 2023 00:31
AutoHotkey for controlling media with ctrl+mouse buttons
View media_mouse.ahk
#Requires AutoHotkey v2.0
; On ctrl+middle click, send media play/pause
^MButton::SendInput "{Media_Play_Pause}"
; on ctrl+mb5, send media next
^XButton2::SendInput "{Media_Next}"
; on ctrl+mb4, send media prev
^XButton1::SendInput "{Media_Prev}"
OldStarchy / PageController.php
Last active February 14, 2020 02:26
Sync fonts to the assets dir so relative links in combined CSS will work
View PageController.php
use SilverStripe\CMS\Controllers\ContentController;
use SilverStripe\Core\Flushable;
use SilverStripe\Core\Path;
use SilverStripe\View\Requirements;
use SilverStripe\View\ThemeResourceLoader;
class PageController extends ContentController implements Flushable
OldStarchy / purgeTemp.js
Last active February 13, 2020 00:50
Delete files in a directory that are more than 7 days old and optionally create a file named with a warning message.
View purgeTemp.js
const fs = require('fs');
const path = require('path');
/* Config */
const days = 7;
const protectedFileName = `items older than ${days} day${
days == 1 ? '' : 's'
} are automatically deleted`;
const shouldCreateProtectedFile = true;
OldStarchy / .php_cs
Created April 27, 2018 05:35
php-cs-fixer config
View .php_cs
// Get more info and examples by running "php-cs-fixer describe rule_name"
$fixer = PhpCsFixer\Config::create()
'@PSR2' => true,
* Each line of multi-line DocComments must have an asterisk [PSR-5] and must
OldStarchy / parse_query_string.php
Last active June 8, 2023 03:23
Similar to parse_str but don't mangle parameters with dots or spaces
View parse_query_string.php
* Similar to parse_str, parses a query string and returns the resulting array.
* Does not replace '.' and ' ' with underscores.
* @param string $string
* @return array