Skip to content

Instantly share code, notes, and snippets.

View nathonius's full-sized avatar
🤖
beep boop

Nathan nathonius

🤖
beep boop
View GitHub Profile
@nathonius
nathonius / Readme.md
Created December 26, 2023 19:08
Obsidian "new note" button snippet

image

@nathonius
nathonius / numbered-headers.css
Created June 25, 2024 21:16
Obsidian.md Numbered Headers (for default theme)
body {
.markdown-source-view.is-live-preview,
.markdown-rendered,
.print {
/* Approximate width of the h1-h6 marker and the fold marker */
--marker-width: -34px;
h1,
h2,
h3,
@nathonius
nathonius / fittext.directive.ts
Created November 17, 2024 03:22
Angular directive to set font size based on an element's container size
import type { OnInit, OnChanges, SimpleChanges } from '@angular/core';
import { ElementRef, Renderer2, Directive, inject, input } from '@angular/core';
import { Subject } from 'rxjs';
import { debounceTime } from 'rxjs/operators';
@Directive({
selector: '[fittext]',
standalone: true,
})
@nathonius
nathonius / 11ty.ts
Last active December 31, 2024 02:29
Tailwind 11ty plugin
interface BeforeEventConfig {
directories: {
input: string;
output: string;
data: string;
includes: string;
inputFile?: string;
inputGlob?: string;
layouts?: string;
};
@nathonius
nathonius / .eleventy.ts
Created December 31, 2024 02:35
11ty preact renderer
import { render } from "preact-render-to-string";
import type { FunctionComponent } from "preact";
export default function (config) {
config.addExtension("11ty.tsx", {
getInstanceFromInputPath: async function (path) {
const module: { default: FunctionComponent } = await import(path);
return module.default;
},
compile: function (component: FunctionComponent) {
@nathonius
nathonius / router-link-status.directive.ts
Created April 30, 2025 04:06
Angular routerLinkStatus directive