Skip to content

Instantly share code, notes, and snippets.

View u01jmg3's full-sized avatar
🔷
Coding Hard

Jonathan Goode u01jmg3

🔷
Coding Hard
View GitHub Profile
@u01jmg3
u01jmg3 / ecs.php
Last active July 18, 2024 12:47
[] => array()
<?php
declare(strict_types=1);
use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;
return ECSConfig::configure()
->withConfiguredRule(ArraySyntaxFixer::class,
array('syntax' => 'long')
@u01jmg3
u01jmg3 / stylelint.txt
Created February 21, 2023 15:17
Stylelint v15 Deprecation Warnings - Switch to Prettier
block-closing-brace-empty-line-before
block-closing-brace-newline-after
block-closing-brace-newline-before
block-closing-brace-space-after
block-closing-brace-space-before
block-opening-brace-newline-after
block-opening-brace-newline-before
block-opening-brace-space-after
block-opening-brace-space-before
color-hex-case
@u01jmg3
u01jmg3 / n++_killer.bat
Created April 30, 2021 08:38
On Windows kill hung background Notepad++ processes
@ECHO off
FOR /F "tokens=2" %%K IN ('
tasklist /FI "ImageName eq notepad++.exe" /FI "Status eq Not Responding" /FO LIST ^| findstr /B "PID:"
') DO (
:: Check for number
SET "var="&for /f "delims=0123456789" %%i in ("%%K") do set var=%%i
IF NOT DEFINED var (
:: https://processhacker.sourceforge.io/
@u01jmg3
u01jmg3 / .htaccess
Last active March 30, 2023 13:28
Maintenance Mode
<IfModule mod_rewrite.c>
RewriteEngine On
<IfModule mod_env.c>
# Scheduled Maintenance
RewriteRule ^ - [E=MAINTENANCE_DATE:False]
RewriteCond %{TIME_YEAR}%{TIME_MON}%{TIME_DAY} 20230509 [OR]
RewriteCond %{TIME_YEAR}%{TIME_MON}%{TIME_DAY} 20230523 [OR]
RewriteCond %{TIME_YEAR}%{TIME_MON}%{TIME_DAY} 20230613 [OR]
RewriteCond %{TIME_YEAR}%{TIME_MON}%{TIME_DAY} 20230627 [OR]
@u01jmg3
u01jmg3 / Now Playing.ahk
Created June 10, 2020 14:58
AutoHotkey - speak aloud the currently playing track 🗣
#Persistent
#SingleInstance, Force
#NoEnv
If ProcessExist("wmplayer.exe")
wmp := new RemoteWMP
!4:: ; Alt+4
SpeakAloudTrack(wmp)
Return
@u01jmg3
u01jmg3 / bluetooth.ps
Created May 17, 2020 09:52
Windows Powershell Script to Toggle Bluetooth On or Off
[CmdletBinding()] Param (
[Parameter()][ValidateSet('On', 'Off')][string]$BluetoothStatus
)
If ((Get-Service bthserv).Status -eq 'Stopped') { Start-Service bthserv }
Add-Type -AssemblyName System.Runtime.WindowsRuntime
$asTaskGeneric = ([System.WindowsRuntimeSystemExtensions].GetMethods() | ? { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and $_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`1' })[0]
Function Await($WinRtTask, $ResultType) {
$asTask = $asTaskGeneric.MakeGenericMethod($ResultType)
$netTask = $asTask.Invoke($null, @($WinRtTask))
$netTask.Wait(-1) | Out-Null
@u01jmg3
u01jmg3 / mp3tag.txt
Last active May 28, 2020 21:40
Mp3tag
// Tag → Filename
$replace($caps(%artist%),', ', & ,Ft,feat.,Vs,vs.) - ''$caps($replace($lower($replace(%title%,'',’)''),' (original mix)',,extended ,, mix, remix,' (',''' (','(','[',')',']',']''',']',' [mix]',,' [remix]',),''' [')
@u01jmg3
u01jmg3 / datatables.paging.js
Created April 27, 2020 13:34
DataTable Pager - Numbers with Ellipses - 1 ... 4 5 6 ... 50 Previous Next
$.fn.DataTable.ext.pager.numbersWithEllipses = function (page, pages) {
if (pages === 1) {
return [];
}
var numbers = [],
buttons = 3,
withEllipses = true;
var range = function (len, start) {
@u01jmg3
u01jmg3 / questions.txt
Last active April 17, 2020 19:25
Quiz Questions
GEOGRAPHY
1. Which US state has the longest coastline? (Alaska)
2. How many timezones are there in China? (1)
3. What is the capital of Switzerland? (Bern)
4. What is the largest island in the world? (Greenland)
5. Which country is the largest producer of coffee? (Brazil)
6. What is the national sport of Canada? (Lacrosse)
7. What country spans all four hemispheres? (Kiribati)
8. What is the most northerly capital city in the world? (Reykjavik)
9. What country has three capital cities? (South Africa)
@u01jmg3
u01jmg3 / string-differences.php
Created January 30, 2020 12:06
Highlight string differences using `<del>` and `<ins>`
<?php
/**
* Generate two arrays:
* Values array: a list of elements as they appear in the diff
* Mask array: 0: unchanged, -1: removed, 1: added
*
* @param string $from
* @param string $to
* @return array