Skip to content

Instantly share code, notes, and snippets.

View LachlanArthur's full-sized avatar
🐊

Lachlan Arthur LachlanArthur

🐊
View GitHub Profile
@LachlanArthur
LachlanArthur / gravityforms_select_optgroup.php
Created February 22, 2019 05:54
Add optgroup support to Gravity Forms select fields
<?php
/**
* Add `<optgroup>` support to `<select>` fields.
*
* Create optgroups by adding options with values `optgroup-something`.
* All subsequent options will be in the group.
*
* @param string $choice_markup The current option HTML
* @param array $choice The current choice data
@LachlanArthur
LachlanArthur / ublock
Last active November 20, 2020 01:22
My uBlock Origin Custom Filters
! add exception to EasyList rule to let YouTube track video progress
@@||s.youtube.com/api/stats/watchtime*
www.hackertyper.com###menu
www.engineeringtoolbox.com##.adblo
! 05/12/2018, 17:27:38 All Medium sites - Old
! ##head[prefix*="medium-com"] + body .metabar
! ##head[prefix*="medium-com"] + body .js-followState
@LachlanArthur
LachlanArthur / ansi_colours.ps1
Created November 21, 2018 14:09
Powershell ANSI Colour Variables
$E = [char]0x001b
$CB_Reset = "$E`[0m"
$C_Default = "$E`[39m"
$C_Black = "$E`[30m"
$C_Red = "$E`[31m"
$C_Green = "$E`[32m"
$C_Yellow = "$E`[33m"
$C_Blue = "$E`[34m"
@LachlanArthur
LachlanArthur / !JS Helpers.md
Last active February 24, 2018 16:53
JS Helpers - Simple functions, sane types

JS Helpers

Simple functions, sane types

$() &amp; $$()

$( 'body' );
$$( 'button' );
$$<HTMLInputElement>( 'form#contact input' );
@LachlanArthur
LachlanArthur / !JS Sprintf.md
Last active July 25, 2022 19:55
Simple sprintf in TypeScript using Tagged Template Literals

JS Sprintf

Simple sprintf in JS using Tagged Template Literals

sprintf`There are ${0} monkeys in the ${1}.`( '10', 'tree' );
// > There are 10 monkeys in the tree.

const linkTemplate = sprintf`<a href="${0}" ${2}>${1}</a>`;
linkTemplate('/contact/', 'Contact Us');
linkTemplate('https://example.com', 'Open Preview', 'target="_blank"');
@LachlanArthur
LachlanArthur / Adult Swim Downloader.ps1
Last active August 2, 2017 13:06
Adult Swim Downloader (Requires FFMpeg)
$VideoURL = Read-Host -Prompt 'Adult Swim video page URL'
$Temp = "temp_" + ( $VideoURL -replace '[<>:"/\\|?*]','_' )
New-Item -ItemType Directory -Path "./$($Temp)" -Force | Out-Null
if ( -not ( Test-Path "./$($Temp)/Video_Page.html" ) ) {
"Downloading webpage..." | Write-Host
Invoke-WebRequest $VideoURL -OutFile "./$($Temp)/Video_Page.html"
}
@LachlanArthur
LachlanArthur / datepicker.less
Last active May 11, 2016 08:35
Bootstrap 3 LESS for JQuery UI Datepicker
.ui-datepicker {
margin-bottom: @line-height-computed;
background-color: @panel-bg;
border: 1px solid transparent;
border-radius: @panel-border-radius;
.box-shadow(0 1px 1px rgba(0,0,0,.05));
border-color: @panel-default-border;
a {
border-radius: @border-radius-base;
@LachlanArthur
LachlanArthur / isotope.grid-mode.js
Last active August 29, 2015 14:21
Isotope Grid Mode
/*!
* grid layout mode for Isotope
* based on cellsByRows layout
*/
( function( window ) {
'use strict';
function GridDefinition( LayoutMode ) {

Keybase proof

I hereby claim:

  • I am lachlanarthur on github.
  • I am lachlan (https://keybase.io/lachlan) on keybase.
  • I have a public key whose fingerprint is E818 A2FB 0842 D306 F059 42C9 EA0F 46EF FCCA E2A0

To claim this, I am signing this object: