Skip to content

Instantly share code, notes, and snippets.

@khalidx
khalidx / node-typescript-esm.md
Last active July 3, 2024 18:04
A Node + TypeScript + ts-node + ESM experience that works.

The experience of using Node.JS with TypeScript, ts-node, and ESM is horrible.

There are countless guides of how to integrate them, but none of them seem to work.

Here's what worked for me.

Just add the following files and run npm run dev. You'll be good to go!

package.json

@huytd
huytd / wordle.md
Last active May 16, 2024 20:39
Wordle in less than 50 lines of Bash

image

How to use:

./wordle.sh

Or try the unlimit mode:

@glued
glued / golf.js
Last active January 9, 2022 02:35
Gas Pump Golf Perfect score (https://gaspumpgolf.github.io/)
// 1. https://gaspumpgolf.github.io/
// 2. Click play
// 3. Open console
// 4. Paste code and press enter
const down = new MouseEvent("mousedown", { bubbles: true, cancelable: true, view: window });
const up = new MouseEvent("mouseup", { bubbles: true, cancelable: true, view: window });
const btn = document.querySelector('#content > button');
const target = document.querySelector('#content > p:nth-child(3) > mark > strong');
const sale = document.querySelector('#content > p:nth-child(5) > strong');
const observer = new MutationObserver((val)=>{
@binji
binji / LICENSE
Last active May 27, 2024 00:44
pokegb.cc w/o macros
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
@prof3ssorSt3v3
prof3ssorSt3v3 / app.js
Created February 25, 2021 15:23
IndexedDB Part 7 - Using Indexes and KeyRanges
import { uid } from './uid.js';
import { state } from './data.js';
//https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase
const IDB = (function init() {
let db = null;
let objectStore = null;
let DBOpenReq = indexedDB.open('WhiskeyDB', 4);
@ityonemo
ityonemo / test.md
Last active June 13, 2024 09:10
Zig in 30 minutes

A half-hour to learn Zig

This is inspired by https://fasterthanli.me/blog/2020/a-half-hour-to-learn-rust/

Basics

the command zig run my_code.zig will compile and immediately run your Zig program. Each of these cells contains a zig program that you can try to run (some of them contain compile-time errors that you can comment out to play with)

@vsoch
vsoch / decorators.py
Created December 3, 2020 20:01
An example for how to customize login-required (in this case, to use a session based token instead)
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.shortcuts import render, resolve_url
from myapp.settings import cfg
from myapp import settings
from urllib.parse import urlparse
import uuid
def login_is_required(
@gullyn
gullyn / flappy.html
Last active May 4, 2024 15:35
Flappy bird in 205 bytes (improved!)
<body onload=z=c.getContext`2d`,setInterval(`c.width=W=150,Y<W&&P<Y&Y<P+E|9<p?z.fillText(S++${Y=`,9,9|z.fillRect(p`}*0,Y-=--M${Y+Y},P+E,9,W),P))):p=M=Y=S=6,p=p-6||(P=S%E,W)`,E=49) onclick=M=9><canvas id=c>
@deebs67
deebs67 / ARMlite.md
Last active March 2, 2024 02:03
ARMlite simulator

ARMlite simulator

The ARMlite simulator is a web-based simulator of a 32-bit 'ARM-like' processor and Instruction Set Architecture (ISA), developed by Peter Higginson and Richard Pawson for teaching Computer Science (CS) principles and Assembly Language. It is targetted particularly towards the AQA A-level computing syllabus. It is exceptionally user-friendly and fast, and great fun to experiment with!

Free online student textbook on the topic:
[1] Richard Pawson (with Peter Higginson), Computer Science from the Metal Up - Assembly Language Programming, v1.0.0, 2020
https://peterhigginson.co.uk/ARMlite/Assembly%20Language%20-%20Student%20version.pdf

Online simulator for the ARMlite ISA here:
https://www.peterhigginson.co.uk/ARMlite/

@skeeto
skeeto / mazelog-2016-09.c
Last active November 8, 2021 15:00
Mazelog Monthly Challenge Solvers
#include <stdio.h>
static char game[8][8] = {
"nbrnnnnr",
"rbnn n n",
"bnnnrbb ",
"rnrkknnb",
"rbrkk n ",
"bnn r n",
"nnnnn bn",