Skip to content

Instantly share code, notes, and snippets.

View chall8908's full-sized avatar

Chris Hall chall8908

View GitHub Profile
@chall8908
chall8908 / dark-mode-toggle.js
Last active September 17, 2021 07:37
Rocket.Chat Dark Mode
// Toggleable dark mode for those of us that care about that kind of thing.
const toggleButton = '<button class="sidebar__toolbar-button rc-tooltip rc-tooltip--down js-button" aria-label="Toggle Dark Mode">D</button>';
function addDarkModeToggle() {
const sidebarToolbar = $('.sidebar__toolbar');
// wait for the sidebar toolbar to be visible
// this will also be false if the toolbar doesn't exist yet
if(!sidebarToolbar.is(':visible')) {
setTimeout(addDarkModeToggle, 250);
@chall8908
chall8908 / footnote-tooltip.js
Created December 25, 2018 00:11
FIMFic POC Footnote Tooltip
(function () {
const popupBackgroundColor = '#efefef';
const popupTextColor = '#333';
const popupBorderColor = '#aaa';
function gogoGadgetFootnotePopup() {
const footnotes = document.querySelectorAll('.footnote');
footnotes.forEach(node => {
node.addEventListener('mouseenter', displayFootnotePopup);
node.addEventListener('mouseleave', destroyFootnotePopup);
@chall8908
chall8908 / swap-caps-for-control.ps1
Created April 29, 2017 02:48
Small script to swap Caps Lock and Control (with "automatic" privilege escalation)
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit }
$hexified = "00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00".Split(',') | % { "0x$_"};
$kbLayout = 'HKLM:\System\CurrentControlSet\Control\Keyboard Layout';
New-ItemProperty -Path $kbLayout -Name "Scancode Map" -PropertyType Binary -Value ([byte[]]$hexified);