Skip to content

Instantly share code, notes, and snippets.

View natterstefan's full-sized avatar
🟨
getting things done 💪🏻

Stefan Natter natterstefan

🟨
getting things done 💪🏻
View GitHub Profile
@natterstefan
natterstefan / backup.sh
Created May 1, 2019 05:41
Raspberry Pi | Backup and Sync Pi-hole and UniFi data from a Raspberry Pi to Google Drive
#!/bin/bash
# create backup folders (if they do not exist yet)
mkdir -p ~/backups
mkdir -p ~/backups/unifi
mkdir -p ~/backups/pihole
# backup pi-hole
(cd ~/backups/pihole && pihole -a teleporter)
@natterstefan
natterstefan / README.md
Last active November 30, 2022 14:57
Typescript | Infere Types from PropTypes

Infer Types from PropTypes

Result

image

image

Limitations

@natterstefan
natterstefan / README.md
Last active September 23, 2022 02:42
Storybook | Tailwind in Next.js App with Webpack@5

Storybook | Tailwind in Next.js App with Webpack@5

Installation

# install storybook dependencies
yarn add @storybook/addon-actions @storybook/addon-essentials @storybook/react -D
yarn add @storybook/addon-postcss@latest -D

# install webpack5 dependency
@natterstefan
natterstefan / README.md
Last active September 2, 2022 07:16
react-i18next and TS2589: Type instantiation is excessively deep and possibly infinite.

react-i18next and TS2589: Type instantiation is excessively deep and possibly infinite.

visitors

The patch works both with tsc and next build, as described in the comments of the patch.

Inspired by

@natterstefan
natterstefan / usePrevious.ts
Created August 30, 2022 11:07
React | usePrevious hook
/**
* inspired by
* @see https://codesandbox.io/s/use-previous-hook-persistent-with-matcher-hujqez?file=/src/hooks.tsx:0-1069
* @see https://www.developerway.com/posts/implementing-advanced-use-previous-hook
* @see https://usehooks.com/usePrevious/
*/
import { useRef, useEffect } from 'react'
export const usePrevious = <TValue>(value: TValue) => {
const ref = useRef<TValue>()
@natterstefan
natterstefan / README.md
Last active October 29, 2021 09:06
EditorJS | Inline-Tool-Link (Custom)

Editor.js - Custom Inline Tool "Link"

This is our custom implementation of the Inline Tool "Link" with a target and title attribute.

alt

--> used and tested with @editorjs/editorjs@2.17.0

Related Issues

@natterstefan
natterstefan / .eslintrc.json
Last active September 20, 2021 19:43
.eslintrc Example
{
"extends": "airbnb",
"parser": "babel-eslint",
"env": {
"browser": false,
"node": true,
"es6": true,
"mocha": false
},
"parserOptions": {
@natterstefan
natterstefan / README.md
Last active September 17, 2021 12:44
How to track content statistics for Facebook Instant Articles with Google Analytics

Track Facebook Instant Articles with Google Analytics

The *.html example assumes you have integrated the tracking code as an iframe in the instant articles feed.

<figure class="op-tracker">
    <iframe src="https://www.example.com/fia-google-analytics-tracking.html"></iframe>
</figure>
@natterstefan
natterstefan / README.md
Last active May 7, 2021 07:23
Visual Studio Code Setting | Semantic Token Color Customisation

Visual Studio Code Setting | Semantic Token Color Customisation

visitors

Example

image

Related Tweets