Skip to content

Instantly share code, notes, and snippets.

View russmatney's full-sized avatar

Russell Matney russmatney

View GitHub Profile
@russmatney
russmatney / measure-and-sort-localStorage-keys.js
Last active November 18, 2025 15:58 — forked from amitmerchant1990/console.js
Calculate used localStorage size for a website
let entries = [];
let totalSize = 0;
// Collect all localStorage entries with their sizes
for (let key in localStorage) {
if (localStorage.hasOwnProperty(key)) {
let keySize = new Blob([key]).size; // Size of the key
let valueSize = new Blob([localStorage[key]]).size; // Size of the value
let totalEntrySize = keySize + valueSize;
totalSize += totalEntrySize;
@russmatney
russmatney / fill-local-storage.js
Created November 18, 2025 15:55
Fill local storage to test your app's behavior when it is full
// Fill localStorage to capacity using a single key for easy cleanup
const TEST_KEY = '__fill_test';
let currentData = '';
let chunkSize = 1024 * 1024; // Start with 1MB chunks
let totalSize = 0;
let iterations = 0;
console.log('Starting to fill localStorage...');
console.log(`Using key: ${TEST_KEY}`);
@russmatney
russmatney / .github-workflows-itch_build_and_deploy.yaml
Last active August 19, 2025 18:13
Unity build and deploy via game-ci on github actions
name: Build and Deploy for WebGL ItchIo
on:
workflow_dispatch: {}
push:
branches:
- deploy
jobs:
buildWebGL:
@russmatney
russmatney / build_and_deploy_to_itch.yml
Last active July 17, 2024 16:20
Build and Deploy Unity WebGL to Itch
# .github/workflows/build_and_deploy_to_itch.yml
name: Build and Deploy for WebGL ItchIo
on:
workflow_dispatch: {}
push:
branches:
- deploy
jobs:
@russmatney
russmatney / bb.edn
Created July 11, 2024 14:29
Daily Moon Phase Discord Post via Babashka and Github Actions
{:paths ["bb"]
:tasks
{:requires ([moon-phases])
post-moon-phase
(moon-phases/fetch-and-post-moon-phase
{:rapid-api/key (System/getenv "RAPIDAPI_KEY")
:discord/webhook-url (or (first *command-line-args*)
(System/getenv "DISCORD_WEBHOOK_URL"))})}}
@russmatney
russmatney / django_filter_grouping_impl.py
Created November 30, 2021 21:36
Django-filters group nested queries impl
class GroupFilter:
"""
The work here is largely cherry-picked from this unmerged django-filters PR:
https://github.com/carltongibson/django-filter/pull/1167/files
"""
def __init__(self, filter_names):
self.filter_names = filter_names
def set_parent(self, parent):
@russmatney
russmatney / +css-classes-backend.el
Created March 29, 2020 22:03
Company backend for css classes. Parses classnames from a hard-coded css file.
;;; ~/dotfiles/emacs/.doom.d/+css-classes-backend.el -*- lexical-binding: t; -*-
(require 'cl-lib)
(require 's)
(defmacro comment (&rest _)
"Comment out one or more s-expressions."
nil)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
overExamples :: IO ()
overExamples = do
let fitz = Pet (PetName "Fitz")
let bob = User (UserName "bob") 0 (Just fitz) HM.empty
print "Bob scores a point. Way to go, Bob."
-- These all print bob with a score incremented by 1.
print $ bob & score %~ (\sc -> sc + 1)
print $ bob & score %~ (+1)
print $ over score (+1) bob
hasn'tExample :: IO ()
hasn'tExample = do
let bob = User (UserName "bob") 42 Nothing HM.empty
print "Hasn't bob gold in his inventory?"
print $ hasn't (inventory . ix "gold") bob
-- True
-- As in, "Yes, he doesn't."
-- | A lens from a User to Text.
--
-- Written quite explicitly with getter and setter helper functions to expose
-- Lens's nature.
userName :: Lens' User UserName
userName = lens getter setter
where
getter user = _userName user
setter user newName = user { _userName = newName }