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
  • Glenwood Springs, CO
View GitHub Profile
@bosconian-dynamics
bosconian-dynamics / abbreviate.php
Last active March 2, 2020 04:45
PHP function to calculate an alphanumeric abbreviation for a string based on capitalization and length. Useful for generating semi-unique (but still human-interpretable) identifiers from things like class or plugin names.
<?php
/**
* PHP function to calculate an alphanumeric abbreviation for a string based on capitalization and
* length. Useful for generating semi-unique (but still human-interpretable) identifiers from things
* like class or plugin names.
*
* PHP version 5
*
* LICENSE: GPL v3 - Look it up!
*
@bosconian-dynamics
bosconian-dynamics / Expand Shortened URL
Last active January 3, 2016 09:19
JavaScript function to expand virtually any shortened/masked URL using the LongURL.com API v2. If a callback is passed the request will execute asynchronously, otherwise the function will block until a response has been received. Uses the "longURLAPICall()" function from http://gist.github.com/KuroTsuto/8447974
expandShortenedURL = function( str_shortenedURL, fn_callback ) {
if( str_shortenedURL.indexOf( "http://" ) < 0 )
str_shortenedURL = "http://" + str_shortenedURL;
return longURLAPICall( "expand", { title: 1, url: str_shortenedURL }, fn_callback );
};
@bosconian-dynamics
bosconian-dynamics / Generate Shortened URL RegEx Using LongURL.org API
Last active January 3, 2016 10:09
A couple functions using the LongURL API v2 to generate a regular expression string to match virtually any shortened URL, resulting in something similar to http://gist.github.com/KuroTsuto/8448070
// Grab the shortened URL services from api.longurl.org/v2/services, generate a regex pattern for all
function generateShortenedURLRegEx( fn_callback ) {
longURLAPICall( "services", {}, function( data ) {
var regExString = "(?:https?:\\/\\/)?(?:";
var serviceCount = 0;
var regExp;
for( var service in data ) {
if( data.hasOwnProperty( service ) ) {
if( service.charAt( service.length - 1 ) == '.' )
@bosconian-dynamics
bosconian-dynamics / Shortened URL RegEx
Last active July 10, 2018 21:46
Regular expression to match shortened/masked URLs generated from LongURL.org's api via the JavaScript functions at http://gist.github.com/KuroTsuto/8447974
/(?:https?:\/\/)?(?:(?:0rz\.tw)|(?:1link\.in)|(?:1url\.com)|(?:2\.gp)|(?:2big\.at)|(?:2tu\.us)|(?:3\.ly)|(?:307\.to)|(?:4ms\.me)|(?:4sq\.com)|(?:4url\.cc)|(?:6url\.com)|(?:7\.ly)|(?:a\.gg)|(?:a\.nf)|(?:aa\.cx)|(?:abcurl\.net)|(?:ad\.vu)|(?:adf\.ly)|(?:adjix\.com)|(?:afx\.cc)|(?:all\.fuseurl.com)|(?:alturl\.com)|(?:amzn\.to)|(?:ar\.gy)|(?:arst\.ch)|(?:atu\.ca)|(?:azc\.cc)|(?:b23\.ru)|(?:b2l\.me)|(?:bacn\.me)|(?:bcool\.bz)|(?:binged\.it)|(?:bit\.ly)|(?:bizj\.us)|(?:bloat\.me)|(?:bravo\.ly)|(?:bsa\.ly)|(?:budurl\.com)|(?:canurl\.com)|(?:chilp\.it)|(?:chzb\.gr)|(?:cl\.lk)|(?:cl\.ly)|(?:clck\.ru)|(?:cli\.gs)|(?:cliccami\.info)|(?:clickthru\.ca)|(?:clop\.in)|(?:conta\.cc)|(?:cort\.as)|(?:cot\.ag)|(?:crks\.me)|(?:ctvr\.us)|(?:cutt\.us)|(?:dai\.ly)|(?:decenturl\.com)|(?:dfl8\.me)|(?:digbig\.com)|(?:digg\.com)|(?:disq\.us)|(?:dld\.bz)|(?:dlvr\.it)|(?:do\.my)|(?:doiop\.com)|(?:dopen\.us)|(?:easyuri\.com)|(?:easyurl\.net)|(?:eepurl\.com)|(?:eweri\.com)|(?:fa\.by)|(?:fav\.me)|(?:fb\.me)|(?:fbshare\.me)|(?:ff\.im)|(?:fff\
@bosconian-dynamics
bosconian-dynamics / breadcrumb.php
Created April 10, 2014 23:09
WordPress breadcrumb template
<?php
/**
* Breadcrumb PluginComponent template.
*
* @TODO: this is an incredibly hackish template and should likely be killed with fire, rebuilt.
* @TODO: all breadcrumbs involving date and time functions need to have a configurable format
* @TODO: support for internationalization
*
* @var string $containerElement
* @var string $containerClass
@bosconian-dynamics
bosconian-dynamics / Gruntfile.js
Created June 25, 2014 23:57
Custom Grunt task to concatenate a primary LESS file with a color-scheme LESS file with an unknown (but conventional) name, then compile the resulting LESS. See https://gist.github.com/stephenharris/2b5a178296b4cd46e778
var path = require( 'path' );
var fs = require( 'fs' );
module.exports = function( grunt ) {
// Initialize Grunt configuration
grunt.initConfig({
colourScheme: { // Default configuration for the colourScheme task
paths: { // Relative path parts. All paths but 'root' are relative to 'root'
root: 'assets/css', // Relative to Grunt's process.cwd()
lessCore: 'less', // Directory containing the core LESS file
@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 )
@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 / 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 / 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() {