Skip to content

Instantly share code, notes, and snippets.

View kirkegaard's full-sized avatar

Christian Kirkegaard kirkegaard

View GitHub Profile
@kirkegaard
kirkegaard / guess.js
Last active April 5, 2024 21:41
Name this decent modder. A guessing game in node
const readline = require('node:readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
const HIDDEN_CHAR = "_";
const words = [
@kirkegaard
kirkegaard / scrollable.html
Created January 4, 2024 20:06
Horizontal scrollable container with fadeout
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<div class="container">
const canvas = document.querySelector('#canvas');
const ctx = canvas.getContext('2d');
let windowWidth = window.innerWidth;
let windowHeight = window.innerHeight;
const onResize = () => {
canvas.width = windowWidth = window.innerWidth;
canvas.height = windowHeight = window.innerHeight;
};
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Typeout</title>
<style>
body, html {
margin: 0;
padding: 0px;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>
const endpoint = "https://api.covid19api.com/world/total";
const fetchData = async () => {
@kirkegaard
kirkegaard / imgur.sh
Created December 30, 2020 02:58
Upload images to imgur from cli and save it in paste buffer
imgur() {
res=$(curl -sSF image=@$1 https://api.imgur.com/3/upload |jq -r '.data.link')
echo $res |pbcopy
echo $res
}
// Canvas things
const canvas = document.querySelector("#snow");
const ctx = canvas.getContext("2d");
let ctxLayers = [];
let ctxHeight = 0;
let ctxWidth = 0;
// FPS things
const FPS = 60;
const FPS_TIME = (1000 / 60) * (60 / FPS) - (1000 / 60) * 0.5;
const getWeekNumber = (date) => {
const pd = new Date(date);
const sj = new Date(pd.getFullYear(), 0, 1);
const wk = Math.ceil((((pd - sj) / 86400000) + sj.getDay() + 1) / 7);
return wk;
}
console.log(
getWeekNumber('2020-01-01'),
getWeekNumber('2020-01-14'),
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>hader georgehale</title>
<style>
tr:nth-last-child(9) { opacity: 0.9; }
tr:nth-last-child(8) { opacity: 0.8; }
tr:nth-last-child(7) { opacity: 0.7; }
tr:nth-last-child(6) { opacity: 0.6; }
import math
import struct
import wave
import sys
w = wave.open(sys.argv[1], 'rb')
sum = 0
value = 0;
delta = 0;
amps = []