Skip to content

Instantly share code, notes, and snippets.

View getify's full-sized avatar
💭
Just coding

Kyle Simpson getify

💭
Just coding
View GitHub Profile
@getify
getify / INFO.md
Last active October 1, 2024 13:58
AutoHotKeys (AHK) script for cycling active focus between a selected ("recorded") set of open windows

Download Icon: https://jumpshare.com/v/T5yuKIP3Zc6Rr29GH5ye

How To Use

  1. While focused on an open window (like a browser or editor), hit the "record" hotkey (default: win+ctrl+shift+?) to add an app to the focus cycle list. Tooltips will pop up notifying you of recorded apps, or if there's an issue recording.

  2. To cycle forward through recorded apps, use the "cycle forward" hotkey (default: win+ctrl+shift+>), or click the system-tray icon, or click the menu Item "Cycle Apps" menu item.

  3. To cycle backward, use the "cycle backward" hotkey (default: win+ctrl+shift+<).

@getify
getify / monads-and-friends.md
Created July 16, 2020 19:38
Monads and Friends...

Monads and Friends...

Over the last 24-48 hours, I've fielded quite a flurry of tweets related to a couple of threads I posted recently. Upon reflection on the feedback, especially the negative stuff, I decided to write this blog post to clarify a few things about my background on the topic, what I was trying to say, what I've done so far, and what I'm hoping to do (and learn!) in the future.

It's a bit of a lengthy read, but if you find you've got the time, I hope you'll read it.

To be clear, the feedback has been on a broad spectrum. A lot of it was actually quite positive, people thanking me and appreciating my continued efforts to try to make dev topics approachable. As a matter of fact, over the years, I've received boat loads of such positive feedback, and I'm tremendously grateful that I've had a helpful impact on so many lives.

But some of it veered decidedly the other direction. I'm deliberately not linking to it, because I don't want to either amplify or gang up on those folks. I'm offended an

@getify
getify / 1.js
Last active June 7, 2020 18:44
native JS async-iterator event stream
async function main() {
var btn = document.getElementById("my-button");
// eventStream here is a native JS async iterator
var eventStream = onEvent(btn)("click");
// this is the key thing: we can use a `for-await..of` loop
// to consume the async-iterator
for await (let evt of eventStream) {
console.log("click!");
@getify
getify / 1.js
Last active August 18, 2020 06:22
in JS, exploring async (promise-based) Haskell-style `do`-block syntax for the IO monad Demo: https://codepen.io/getify/pen/abvjRRK?editors=0011
// setup all the utilities to be used
var delay = (ms,cancel = new AbortController()) => {
var pr = new Promise(res => {
var intv = setTimeout(res,ms);
cancel.signal.addEventListener("abort",() => { clearTimeout(intv); res(); });
});
pr.abort = () => cancel.abort();
return pr;
};
@getify
getify / MicDevice.ahk
Last active June 18, 2020 15:33
AutoHotKeys (AHK) script for toggling my mic's muting Demo: https://gyazo.com/07ac569f5e5225f7cd32c34701ca00db Icons: https://jumpshare.com/b/5xatZXpaIdIV1BaP9aET
#include VA.ahk
SwitchMicDevice(micName) {
return VA_SetDefaultEndpoint(micName,1)
}
GetMicDeviceID(micName) {
Loop
{
deviceIDPtr := GetMicDevice(A_Index)

Keybase proof

I hereby claim:

  • I am getify on github.
  • I am getify (https://keybase.io/getify) on keybase.
  • I have a public key ASCMGyYZgzXV7OoA4Aw_DzSwADaqpyFN2enUhGeeAbxaZgo

To claim this, I am signing this object:

@getify
getify / 1.js
Last active March 28, 2020 14:59
illustrating the hook/stale-closure problem
function SomeCounter() {
const [ counter, updateCounter ] = useState(0);
useEffect(function listening(){
const btn = document.getElementById("increment-counter-btn");
btn.addEventListener("click",onClick);
},[]);
useEffect(function logger(){
// this logger() is updated each time `counter` changes, so
@getify
getify / 1.js
Last active September 19, 2019 08:56
quick sketch of CAF
btn.addEventListener("send-btn",onSend);
send = CAF(send);
var prevSend = Promise.resolve();
function onSend(evt) {
prevSend.finally(function f(){
prevSend = send(
CAF.timeout(1000,"send took too long."),
{ some: "data" }
)
@getify
getify / 1.js
Last active September 13, 2019 04:25
microtask queue got me singin' the blues
// VERSION 1 -- broken
async function *main() {
yield ready;
}
var resolve1;
var resolve2;
var ready = new Promise(function c(res){
resolve1 = res;
@getify
getify / 1.js
Last active August 26, 2019 16:15
Scheduler (debouncing + throttling) | https://codepen.io/getify/pen/LYPbmYG?editors=0012
// NOTE: To see this demo: https://codepen.io/getify/pen/LYPbmYG?editors=0012
var counter = 1;
function printMessage() {
console.log(`message ${counter++}`);
}
var schedule = Scheduler(/* debounceMinimum = */50,/* throttleMaximum = */500);