Skip to content

Instantly share code, notes, and snippets.

View shaenr's full-sized avatar

s shaenr

View GitHub Profile
@shaenr
shaenr / srColorApp.js
Last active February 23, 2022 07:23
A vanilla JavaScript approach to the module pattern that tries not to polute the global namespace.
(function ColorAppClass(w, d) {
// Author: shaenr.github.com
// License: GNU General Public License 3.0
// A vanilla JavaScript approach to the module design pattern, tries to not pollute the namespace.
// Use at your own risk; most likely you should be doing ES6 stuff or whatever.
// But... you know... maybe in some cases...
// ...you shouldn't be.
@shaenr
shaenr / modifyDiscordClient.js
Last active September 4, 2021 00:10
Prototype to modify discord client by toggling elements that are in the way.
// Prototype to modify discord client by toggling elements that are in the way.
// TestUsage: 1) paste the entire code into the devtools console, accessed
// by CTRL + SHIFT + I. (at your own risk :P)
// 2) Select the main chat screen you want to keep open.
// 3) Use "l33t_t0g" button to toggle the elements off and on.
// 3) You can also use `window.toggleShowHide()` from the console if
// button is not working.
// 4) reset any problems by pressing F5 from the dev tools window
// or simply restart discord if necessary.
@shaenr
shaenr / robustcsvreader.py
Created February 2, 2021 17:41
Robust CSVReader
import codecs
import csv
from typing import List, Optional
class CSVReader:
def __init__(self, fn: str):
self.filename = fn
self.fields = None
self.data = []
@shaenr
shaenr / smwcentral-fix.js
Created January 3, 2021 21:45
Simple fix for smwcentral.net design choices
// GIST: This is a simple, if not complete, fix that gets rid of some of the most difficult elements.
// on smwcentral.net from the client side. It should be loaded into a userscripts extention and
// configured to execute on every page load.
// Remove BG Image
let body = document.querySelector('body')
body.style.background = '#000000'
// Remove misc clutter
@shaenr
shaenr / deepdict.py
Created December 8, 2019 09:10
Write out dict paths to deeper data from elaborate json using dot notation...
def get_value(d, key_str):
for key in key_str.split('.'):
d = d[key]
return d
content = {'html_data': {'footer':{'elements': []}}}
result = get_value(content, 'html_data.footer.elements')