Skip to content

Instantly share code, notes, and snippets.

@SamuelNittala
SamuelNittala / ahk
Created December 10, 2023 13:25
AutoHotKey Script for liking ytmusic song
/*
Requirements:
1. Install YTMusic PWA
2. Install https://chromewebstore.google.com/detail/youtube-like-dislike-shor/fdkpkpelkkdkjhpacficichkfifijipc
*/
#+::
SetTitleMatchMode, 2
if WinExist("YouTube Music")
WinActivate
Send, {+}
@SamuelNittala
SamuelNittala / insert_sort_rec.js
Last active July 2, 2023 01:50
insertion sort recursive
// inserts the element at index i into the correct position,
// [0..i-1] must be sorted
function insert_rec(l, i) {
if (i == 0) return l;
else {
if (l[i] < l[i - 1]) {
return compare_rec(
[...l.slice(0, i - 1), l[i], l[i - 1], ...l.slice(i + 1)],
i - 1
const facts = [
['m', 3.28, 'ft'],
['m', 100, 'cm'],
['ft', 12, 'in'],
['hr', 60, 'min'],
['min', 60, 'sec'],
];
const construct_graph = (facts) => {
const graph = {};
@SamuelNittala
SamuelNittala / palindrome.ts
Created June 4, 2023 18:19
type-level palindrome
type FirstCharacter<T extends string> = T extends `${infer first}${infer rest}`
? first
: T;
type LastCharacter<T extends string> = T extends `${infer first}${infer rest}`
? rest extends ''
? first
: LastCharacter<rest>
: T;
@SamuelNittala
SamuelNittala / machine.js
Created December 22, 2022 13:51
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@SamuelNittala
SamuelNittala / index.html
Last active December 15, 2020 03:00
Starwars Trivia Clock.
<div class="main">
<h1 id="title"> Star Clock Trivia</h1>
<h1 id="clock"></h1>
<div class='info'>
<h2 id="trivia"><span id="name"></span><span id="eyes"></span></h2>
</div>
</div>
@SamuelNittala
SamuelNittala / Fibonacci Finder
Created July 10, 2019 18:19
Fibonacci Finder
Fibonacci Finder
----------------
A [Pen](https://codepen.io/bumchik/pen/pXGajw) by [Samuel Nittala](https://codepen.io/bumchik) on [CodePen](https://codepen.io).
[License](https://codepen.io/bumchik/pen/pXGajw/license).