Skip to content

Instantly share code, notes, and snippets.

View hmans's full-sized avatar
🚀
Let's go!

Hendrik Mans hmans

🚀
Let's go!
View GitHub Profile
@hmans
hmans / .gitattributes
Last active March 2, 2023 19:03
Git configuration for Godot 4.0
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf
# 3D models
*.3dm filter=lfs diff=lfs merge=lfs -text
*.3ds filter=lfs diff=lfs merge=lfs -text
*.blend filter=lfs diff=lfs merge=lfs -text
*.c4d filter=lfs diff=lfs merge=lfs -text
*.collada filter=lfs diff=lfs merge=lfs -text
*.dae filter=lfs diff=lfs merge=lfs -text
@hmans
hmans / mastodon_bookmarklet.md
Last active December 22, 2022 03:11
Mastodon Follow/Interact Bookmarklet

Mastodon Follow/Interact Bookmarklet

All desktop browsers (I think/hope) support bookmarklets -- bookmarks that contain JavaScript code which is run when you select them. This bookmarklet makes it easier to follow users or interact with toots from other Mastodon instances by passing their URLs back to your home instance, where you can then follow/interact with them normally.

The bookmarklet:

javascript:var host="mastodon.social";if(document.location.hostname==host){alert("Already on your own instance!")}else{document.location=("https://"+host+"/authorize_interaction?uri="+encodeURIComponent(document.location))}
@hmans
hmans / og_images.tmpl.tsx
Created November 12, 2022 14:46
Automatic OpenGraph Images for Lume
import { render } from "https://deno.land/x/resvg_wasm@0.2.0/mod.ts";
import { Page, PageData } from "lume/core.ts";
import satori, { SatoriOptions } from "npm:satori";
/* We never want our beautiful PNGs to have a layout :-) */
export const layout = undefined;
/* Load fonts. We can't use variable fonts unfortunately. */
const inter = await Deno.readFile("./src/fonts/Inter-Regular.ttf");
const interBold = await Deno.readFile("./src/fonts/Inter-Bold.ttf");
import { useFrame } from "@react-three/fiber"
import { useRef } from "react"
/* TODO: Extract this into hmans/things or similar */
export function useFrameEffect<T>(
dependencyCallback: () => T,
callback: (args: T) => void,
renderPriority = 0
) {
title summary
This is the Title
This is a summary

Test Post

Moooo

@hmans
hmans / LensDirtShader.js
Last active March 20, 2022 19:44
Lens Dirt Shader for Three.js
/* A simple lens dirt texture shader for Three.js. Grab a lens dirt texture,
plug it into the tDirt uniform, and watch things get diirrtttttaayyyyeee.
Like, really dirty. It can get very confusing if your monitor also has
fingerprints, believe me.
- hendrik@mans.de 🚀 */
export const LensDirtShader = {
uniforms: {
tDiffuse: { value: null },
@hmans
hmans / ManagedInstancedMesh.ts
Last active January 12, 2021 11:41
Managed Instanced Mesh API
import * as THREE from "three"
export type Instance = {
object: THREE.Object3D
color?: THREE.Color
index: number
data: any
}
/* Our ManagedInstancedMesh class that we can use with just plain old Three.js */
@hmans
hmans / .editorconfig
Created August 13, 2020 10:04
Unity ♥️ Git
root = true
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = tab
indent_size = 4
trim_trailing_whitespace = true
@hmans
hmans / BobTheBuilder.cs
Last active April 19, 2023 04:37
A basic pipeline for performing headless Unity builds for multiple platforms at once.
/* This needs to live in a folder named "Editor", or it won't work. Doesn't have to be named
"BobTheBuilder", though. Name it whatever you want! */
using System;
using UnityEditor;
using UnityEngine;
public class BobTheBuilder
{
/* List of scenes to include in the build */
@hmans
hmans / application.html.slim
Created March 27, 2020 10:59
Rails 6.0 Slim Application Layout
doctype html
html
head
title My App
meta name="viewport" content="width=device-width, initial-scale=1.0"
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload'
= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload'
= csrf_meta_tags
= csp_meta_tag