Skip to content

Instantly share code, notes, and snippets.

@rendall
rendall / randomEnglish.ts
Created July 28, 2023 09:30
Random English Sentence Generator
/*
Output:
You believe a rumor.
She respects rules.
He greets a guest.
He considers a plan.
I count calories.
It considers a proposal.
She kicks a bucket.
*/
@rendall
rendall / randomFinnish.ts
Created July 28, 2023 09:26
Randomly Generated Finnish Sentence - Satunnaisesti Generoitu Suomalainen Lause
export const chooseRandomElement = <T>(array: T[]) => array[Math.floor(Math.random() * array.length)]
export const generateRandomFinnishSentence = () => {
type Subject = "minä" | "sinä" | "hän" | "me" | "te" | "he"
const verbAssociationTuples: [string, string[]][] = [
[
"aloittaa",
["opinnot", "projektin", "työt", "harjoituksen", "kokouksen", "urheiluharrastuksen"],
],
@rendall
rendall / gist:b91b14144111915cd842713d41a653dd
Created July 6, 2023 09:31
Full Stack Development Course User’s Manual v1
# Full Stack Development Course User’s Manual
Welcome to the Full Stack Development Course! This course is designed to equip you with the knowledge and skills to build comprehensive full stack software projects. You'll learn how to make informed decisions, work effectively in teams, and explore new territories of knowledge. This manual lays out what to expect from the course and how the final score is determined. If anything is unclear, please ask!
# Course Principles
These principles guide class decisions and evaluations.
**Process: **Focus on _how_ decisions are made to improve the decisions themselves.
@rendall
rendall / three-dice-rolls
Created April 6, 2023 06:20
These are all 216 possible outcomes when rolling 3 dice, with each sum in parenthesis
(3) ⚀ ⚀ ⚀
(4) ⚀ ⚀ ⚁
(4) ⚀ ⚁ ⚀
(4) ⚁ ⚀ ⚀
(5) ⚀ ⚀ ⚂
(5) ⚀ ⚁ ⚁
(5) ⚀ ⚂ ⚀
(5) ⚁ ⚀ ⚁
(5) ⚁ ⚁ ⚀
(5) ⚂ ⚀ ⚀
@rendall
rendall / .vimrc
Created February 11, 2022 13:08
.vimrc
set hlsearch " highlight all search results
set ignorecase " do case insensitive search
set incsearch " show incremental search results as you type
set number relativenumber " display hybrid relative line numbers
set nobackup
set nowritebackup
set noundofile
set noswapfile " disable swap file
" https://swordandsignals.com/2020/12/13/5-lines-in-vimrc.html
" https://lee-phillips.org/badvim/
const curry = (fn, ...initialArgs) => (...args) => fn(...initialArgs, ...args);
// const add = (a, b) => a + b;
// const add5 = curry(add, 5);
// const result = add5(1) // 6
// https://programming-idioms.org/idiom/37/currying
/**
* Creates a debounced function that delays invoking the provided
* function until after `wait` milliseconds have elapsed since the
* last time the debounced function was invoked. Typically used to
* run an expensive or async function after user interaction.
*
* @template T The type of the function to debounce.
* @param {T} func The function to debounce.
* @param {number} [wait=250] The number of milliseconds to delay.
* @returns {(...args: Parameters<T>) => void} Returns the new debounced function.
@rendall
rendall / machine.js
Created March 13, 2021 17:52
Generated by XState Viz: https://xstate.js.org/viz
const questMachine = Machine({
id: 'quest',
initial: 'start',
context: {
look: "This is an open field west of a white house, with a boarded front door. There is a small mailbox here. A rubber mat saying 'Welcome to Zork!' lies by the door."
},
states: {
start: {
entry: assign({ look: (context, event) => context.look = 'The mailbox is closed.' }),
on: {
@rendall
rendall / night-owl.json
Last active February 19, 2021 08:26
Night-owl theme for VSCode terminal
/*
This applies to VSCode *terminal* (not the editor) the color settings
for Sarah Drasner's "Night Owl" VSCode color theme:
https://github.com/sdras/night-owl-vscode-theme
Instructions:
1. CTRL+SHIFT+P and type Preferences: Open Settings (JSON)
2. In the JSON file add the entry below (or modify it if it already exists)
3. Save it! That's all! Open your terminal (CTRL+`) and check it out!
@rendall
rendall / apiPromise.ts
Last active October 18, 2020 17:32
API Promise replaces node-fetch
import * as dotenv from "dotenv"
import * as http from "https"
import { IncomingMessage, ClientRequest } from "http"
dotenv.config()
const API_KEY = process.env.API_KEY
const API_HOST = process.env.API_HOST
const API_PATH = process.env.API_PATH
const TIMEOUT_MS = 5000