Skip to content

Instantly share code, notes, and snippets.

@44100hertz
44100hertz / fiveRules.md
Last active May 31, 2025 05:53
Five Practices for Clean Lua

Five Practices for Clean Lua

Having written tens of thousands of lines of Lua as well as several other langs, I have created guidelines for readable, maintainable, and even portable code.

I'm striving for a sanity that is very rare in the field of programming, that of simplicity. If you're using Lua on purpose, that should be appealing. Even if you're not using Lua, these ideas translate to Javascript and on some level any other language. In fact, following this paradigm makes your code more portable to C, to Rust, and to purely functional languages.

Even if it is not easy to adapt to this paradigm, by using it many headaches disappear. Good code is a narrow path. I can guide you to that path, but you must still walk it.

This article is inspired in part by this Gleam blog post, All you need is data and functions.

{config, pkgs, ...}:
{
# Enable Nginx
services.nginx = {
enable = true;
# Use recommended settings
recommendedGzipSettings = true;
recommendedOptimisation = true;
@theprojectsomething
theprojectsomething / Firefox Pretty Tree Style Tab.md
Last active May 27, 2025 00:40
Tree Style Tab: Sliding sidebar / pinned + active tabs

Firefox pretty sliding sidebar / pinned / active tab theme for Tree Style Tab

Features

  • Auto-sliding draw for TST
  • Leaves 'pinned' and 'active' tabs visible in standard browser chrome
  • Leaves 'last-active' tabs visible for 3 minutes after becoming inactive
  • Where an active tab is pinned, leaves 'last-active' tab (x1) visible for 1hr

tree-style-tabs-theme

@Treeki
Treeki / TurnipPrices.cpp
Last active May 25, 2025 06:02
AC:NH turnip price calculator
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
// munged from https://github.com/simontime/Resead
namespace sead
{
class Random
{
@morajabi
morajabi / useRect.js
Created February 18, 2019 14:35
useRect — getBoundingClientRect() React Hook with resize handler
import { useLayoutEffect, useCallback, useState } from 'react'
export const useRect = (ref) => {
const [rect, setRect] = useState(getRect(ref ? ref.current : null))
const handleResize = useCallback(() => {
if (!ref.current) {
return
}
@MIvanchev
MIvanchev / article.md
Last active May 24, 2025 14:52
Ever wondered what it takes to run Windows software on ARM? Then this article might be for you!
@maiermic
maiermic / variance.md
Last active October 16, 2024 23:10
Description of the four kinds of variance: covariance, contravariance, invariance and bivariance.

Variance

The term variance describes how subtyping between higher kinded types is related to subtyping relations of their type arguments.

Higher Kinded Types

A higher kinded type composes type arguments to a new type. I use square bracket notation to define a higher kinded type:

C[T] // The higher kinded type `C` composes type argument `T` to a new type `C[T]`.

The same works with multiple type arguments:

@jart
jart / ordinary.c
Created December 28, 2015 16:38
Perfectly Ordinary C
/**//*
*//** This is perfectly ordinary C
**//*
*//** cc -std=c99 lol.c
**//* ./a.out justine 31
*//**/
#include <stdio.h>
#include <stdlib.h>
@0XDE57
0XDE57 / config.md
Last active May 29, 2025 11:46
Firefox about:config privacy settings

ABOUT

about:config settings to harden the Firefox browser. Privacy and performance enhancements.
To change these settings type 'about:config' in the url bar. Then search the setting you would like to change and modify the value. Some settings may break certain websites from functioning and rendering normally. Some settings may also make firefox unstable. I am not liable for any damages/loss of data.

Not all these changes are necessary and will be dependent upon your usage and hardware. Do some research on settings if you don't understand what they do. These settings are best combined with your standard privacy extensions (HTTPS Everywhere No longer required: Enable HTTPS-Only Mode, NoScript/Request Policy, uBlock origin, agent spoofing, Privacy Badger etc), and all plugins set to "Ask To Activate".

@nolanlawson
nolanlawson / rant.md
Last active March 1, 2023 23:34
Misconceptions about PouchDB

Misconceptions about PouchDB

A quick rant.

  1. PouchDB is slow, because it doesn't use bare-metal IndexedDB

OK, first off I want to point out the CanIUse table for IndexedDB. Go ahead, look at it. I'll wait.