Skip to content

Instantly share code, notes, and snippets.

@handcoding
handcoding / base62.js
Created May 13, 2024 16:07 — forked from droduit/base62.js
JS encode / decode base62
// Source : https://lowrey.me/encoding-decoding-base-62-in-es6-javascript/
const base62 = {
charset: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''),
encode: integer => {
if (integer === 0) {
return 0;
}
let s = [];
while (integer > 0) {
@handcoding
handcoding / knownAnswersTallyList.js
Created April 6, 2024 15:42
NY Times’ Spelling Bee answers in order of frequency (as of April 2024)
var knownAnwsersTallyList = [
{
index: 0,
word: "noon",
wordLength: 4,
uniqueLettersCount: 2,
tally: 175
},
{
index: 1,
@handcoding
handcoding / Ashley’s Light Fader.yaml
Last active November 13, 2024 07:34
This script for Home Assistant will fade a lamp over time with your choice of easing, including varieties of ease-in, ease-out, and ease-in-out.
alias: Ashley’s Light Fader
description: >
Fades a lamp over time. If you have any questions or comments about this
script, feel free to tweet Ashley Bischoff at @FriendlyAshley. Released under
the Apache 2.0 license. (v2.0)
fields:
light:
name: 💡 Light
description: entity_id of the lamp.
selector:
@handcoding
handcoding / keymap.c
Created February 25, 2021 02:35
Ashley’s keymap.c for her Preonic / Nyquist
/* Copyright 2015-2017 Jack Humbert
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@handcoding
handcoding / init.lua
Created July 11, 2020 17:46
Hammerspoon lua file to remap Excel’s keyboard shortcuts to make them more Mac like
local UP = hs.keycodes.map['up']
local DOWN = hs.keycodes.map['down']
local LEFT = hs.keycodes.map['left']
local RIGHT = hs.keycodes.map['right']
local RETURN = hs.keycodes.map['return']
function hasCmd(event)
local flags = event:getFlags()
return flags.cmd and not (flags.alt or flags.ctrl or flags.shift)
end
@handcoding
handcoding / private.xml
Created July 9, 2020 22:37
Excel keyboard shortcut remappings to make it more Mac like (via Karabiner classic)
<item>
<name>Excel: Command+Left and Command+Right to move within cells</name>
<appendix>For some reason, Excel wants you to use Home (and presumably End) to move to the beginning or end of a line within a cell, which is bogus.</appendix>
<appendix>This also remaps Command+Up and Command+Down so that they move the cursor to the top or bottom of the current cell.</appendix>
<identifier>private.excel_fix_command_arrow_keys</identifier>
<only>EXCEL</only>
<windowname_only>Excel_Window</windowname_only>
<uielementrole_only>AXTextArea, AXTextField</uielementrole_only>
@handcoding
handcoding / private.xml
Last active January 4, 2017 09:57
Ashley’s private.xml file for Karabiner to make Excel 2016’s and Word 2016’s keyboard shortcuts be more Mac-like (and also Skype)
<?xml version="1.0"?>
<root>
<!--
If you have any questions about these bits (or any suggestions for improvements), feel free to tweet me at @handcoding.
- Ashley
-->
<appdef>
<appname>SKYPE</appname>
<equal>com.skype.skype</equal>
</appdef>