Skip to content

Instantly share code, notes, and snippets.

View strlns's full-sized avatar
😌

Moritz Rehbach strlns

😌
View GitHub Profile
@strlns
strlns / karabiner.json
Created April 17, 2023 15:17
Karabiner Elements with config for MS Sculpt keyboard + Default profile for laptop use
{
"global": {
"ask_for_confirmation_before_quitting": true,
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false,
"unsafe_ui": false
},
"profiles": [
{
@strlns
strlns / .htaccess
Created March 26, 2023 12:30
.htaccess to serve markdown files with proper encoding (if the server doesn't)
# Rationale: My shared hosting at netcup serves UTF-8-encoded markdown files
# with Mojibake (especially important for Chromium which opens them directly as plaintext)
#
# MIME-Type text/markdown is new but pretty standard and well supported.
#
<IfModule mod_headers.c>
<Files "*.md">
Header set Content-Type 'text/markdown; charset=utf-8'
</Files>
</IfModule>
@strlns
strlns / .htaccess
Last active March 20, 2023 00:20
Apache RewriteEngine simple reminder (Apache 2.4+)
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
# OR has a HIGHER precedence than the implicit AND of subsequent RewriteCond directives.
RewriteCond %{REQUEST_URI} !/app/assets/.*
# Disallow everything below /app/
RewriteCond %{REQUEST_URI} /app/.* [OR]
# Disallow dotfiles
RewriteCond %{REQUEST_URI} /\..*
RewriteRule ^.* - [F,L]
@strlns
strlns / App.tsx
Last active March 12, 2023 21:51
createBrowserRouter with Intellisense suggestions / exhaustive union types for route IDs
import { RouterProvider } from "react-router";
import { createBrowserRouter } from "react-router-dom";
import { routes } from "routes";
function App() {
//...
const router = createBrowserRouter(routes);
/**
* What is this?
*
* fetch Wrapper for GET requests in React: Cache responses that don't change during the sessionStorage lifecycle
* (see https://beta.reactjs.org/learn/you-might-not-need-an-effect#fetching-data)
*
* If you have to deal with complicated requests, don't use this, use a more complete solution,
* e.g. @tanstack/react-query
* This is only usable for read-only queries to an API
* which returns static results during the page lifecycle.