Skip to content

Instantly share code, notes, and snippets.

View bosconian-dynamics's full-sized avatar
🥓
Forever cooking breakfast

Adam Bosco bosconian-dynamics

🥓
Forever cooking breakfast
  • Denver, CO
View GitHub Profile
const {getAppropriateEcmaVersionForBrowserslist} = require('browserslist-generator');
const WORDPRESS_BROWSERLIST_URL = 'https://raw.githubusercontent.com/WordPress/gutenberg/refs/heads/trunk/packages/browserslist-config/index.js';
const BROWSERSLIST_URL_BASE = 'https://browserl.ist/?q=';
async function getWordPressBrowserlistQueries() {
const res = await fetch(WORDPRESS_BROWSERLIST_URL);
const text = await res.text();
const queries = [...text.matchAll(/^\s*'([^']+)',?\s*$/gm)].map(([, query]) => query);
var data = [];
var current_year = (new Date()).getFullYear();
var $rows = document.querySelectorAll('table.rpt>tbody>tr');
var node = document.createElement( 'td' );
node.innerHTML = '<div>Work Period</div>';
$rows[0].appendChild( node );
node = document.createElement( 'td' );
node.innerHTML = '<div>Work Day</div>';
$rows[0].appendChild( node );
@bosconian-dynamics
bosconian-dynamics / webpack.config.path-names.js
Created June 18, 2021 01:25
Webpack 4 Configurations to Build Multiple Gutenberg Blocks using @wordpress/scripts (see https://wordpress.stackexchange.com/q/390282/25324)
const path = require( 'path' );
const config = require( '@wordpress/scripts/config/webpack.config.js' );
const resolveSource = ( ...path_parts ) => path.resolve( process.cwd(), 'src', ...path_parts );
const resolveBlockEntry = ( name ) => resolveSource( 'blocks', name, 'index.js' );
config.entry = {
'blocks/foo/index': resolveBlockEntry( 'foo' ),
'blocks/bar/index': resolveBlockEntry( 'bar' ),
@bosconian-dynamics
bosconian-dynamics / bff-ia-sort-golf.js
Last active July 29, 2020 02:40
Sort the Battlefield Friends playlist on Internet Archive
/**
* Golfed version of bff-ia-sort.js.
* Same functionality formatted as a shortened one-liner for execution in a browser's address bar.
* Can be saved and executed as a bookmarklet - save the following as a bookmark's URL, and click
* the bookmark when viewing https://archive.org/details/Battlefield_Friends/
**/
javascript:{((j,p,x,y,z,s=j.getPlaylist().map(i=>i.title.includes('Take The Objective')?{...i,s:3,e:6}:([x,y,z]=i.title.match(/(\d)\s*Ep?\s*(\d+)/),{...i,s:p(y),e:p(z)})).sort((a,b)=>a.s>b.s?1:a.s<b.s?-1:a.e>b.e?1:a.e<b.e?-1:0))=>($('#jw6__list a').each((i,e)=>$(e).find('.ttl').text(s[i].title)),j.load(s)))(jwplayer(),parseInt)}
@bosconian-dynamics
bosconian-dynamics / class.js
Last active October 31, 2017 22:42
Basic class framework for hackmud. Inheritance is implemented by copying property data and binding methods in lieu of creating prototype chains
function() {
if( #FMCL )
return #G.class
// Opinionated deep clone/merge. Copies the right-most primative into target
const deepMerge = ( target, ...sources ) => {
if( !sources.length )
return target
let obs = []
@bosconian-dynamics
bosconian-dynamics / IntegerGenerator.js
Created April 24, 2017 04:06
First stab at producing up to 2^64 unique integers in a pseudo-random order without collisions
import math from 'mathjs'
math.config({
number: 'BigNumber',
precision: 64
})
/**
* IntegerGenerator
*
@bosconian-dynamics
bosconian-dynamics / MNswprUI.js
Created December 1, 2016 03:10
Makes the AliceBot MNswpr lock interactive. Click to toggle a reveal operation on a cell, Ctrl+click to toggle a flag operation
class MNswprUI {
constructor( baseArgs = "" ) {
this.dOMObserver = new MutationObserver( this.processDOMMutations.bind( this ) )
this.$input = document.getElementsByClassName("channel-textarea-inner")[0]
this.$input = this.$input.getElementsByTagName("textarea")[0]
this.baseArgs = baseArgs
this.dOMObserver.observe( document.getElementsByClassName("messages")[0], { childList: true, subtree: true } )
}
parse() {
@bosconian-dynamics
bosconian-dynamics / AliceBotCT1.js
Last active April 30, 2024 16:49
Automated cracker for Hackmud Discord's AliceBot tier-1 lock simulations
class AliceBotCT1 {
constructor( httpHeaders ) {
this.alicebotMacro = "!alicebot.out_4l1c3b"
this.discordClient = new DiscordClient( httpHeaders.authorization, httpHeaders.cookie, httpHeaders.superProperties )
this.lockArgs = null
this.latency = {
process: {
start: null,
value: 0
},
@bosconian-dynamics
bosconian-dynamics / win10-spotlight-thief.ps1
Created April 26, 2016 23:57
A simple PowerShell script that copies images from the Windows 10 Spotlight cache to the user's Pictures directory. By default, skips images less than 180 kb in size. Works well as a Windows scheduled task
$cacheDir = "$($env:LOCALAPPDATA)\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets"
$destDir = "$($env:HOME)\Pictures\Spotlight"
$lastSync = 0
$sizeThreshold = 184320
function Read-CacheFiles {
Get-ChildItem $cacheDir
}
function Read-CopiedFiles {
@bosconian-dynamics
bosconian-dynamics / ProBoards_forumLabels.js
Created February 5, 2016 21:50
Quick and dirty utility to copy and paste ProBoards board-labels in the administrative front-end.
var forumLabels = {
labels: {},
insertionIndex: 0,
copy: function() {
var labels = this.labels = [];
$('div.list.ui-autoform').children().each( function() {
var name = $(this).find( 'input.tl-name-input' ).val();
if( '' == name )