Skip to content

Instantly share code, notes, and snippets.

View n4bb12's full-sized avatar

Abraham Schilling n4bb12

View GitHub Profile
@n4bb12
n4bb12 / Dockerfile
Last active November 2, 2018 07:44
Extend Verdaccio Docker Image
FROM verdaccio/verdaccio
RUN yarn add verdaccio-github-oauth-ui
ADD config.yaml /verdaccio/conf/config.yaml
@n4bb12
n4bb12 / msys.sh
Created July 30, 2020 12:29
Turn off POSIX-to-Windows path mangling
# Turn off POSIX-to-Windows path mangling
# https://github.com/git-for-windows/build-extra/blob/master/ReleaseNotes.md#new-features-61
export MSYS_NO_PATHCONV=1
@n4bb12
n4bb12 / CLI.sh
Last active January 27, 2024 15:58
Bash-based CLI template
#
# This makes the above functions work as CLI commands.
#
if [ -n "$1" ] && (type $1 2>&1) | grep -i function > /dev/null; then
$@
else
echo "Unknown command: $1"
commands=$(compgen -A function | tr '\n' ' ')
echo "All commands: $commands"
exit 1
@n4bb12
n4bb12 / .gitignore
Last active March 22, 2023 12:46
yarn-3.sh
# yarn
# https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
slugify () {
echo "$@" | iconv -c -t ascii//TRANSLIT | sed -E 's/[~^]+//g' | sed -E 's/[^a-zA-Z0-9]+/-/g' | sed -E 's/^-+|-+$//g' | tr A-Z a-z
}
@n4bb12
n4bb12 / kind
Last active January 16, 2023 05:15
Notes for using `kind`
# kind
- Install go — https://go.dev/doc/install
- Install kubectl — https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/
- Install kind — https://kind.sigs.k8s.io/docs/user/quick-start/#installing-from-release-binaries
```
kind create cluster --name playground
kind get clusters
kubectl cluster-info --context kind-playground
@n4bb12
n4bb12 / ResetButton.tsx
Last active January 16, 2023 05:14
Simple React localization pattern
export const ResetButtonExample: FC = () => {
const T = useLocalizedText({ de, en })
return (
<button>{T.reset}</button>
)
}
const de = {
reset: "Zurücksetzen",
@n4bb12
n4bb12 / download.ts
Last active January 16, 2023 05:12
Download a in-memory content with a specific file type
export function download({
filename,
content,
contentType,
}: {
content: string
contentType: string
filename: string
}) {
const a = document.createElement("a")
@n4bb12
n4bb12 / serverComponent.ts
Last active May 3, 2023 21:50
Next.js 13 async server component wrapper
import { ReactElement } from "react";
export type RenderResult<P> = ReactElement<P, any> | null;
export function serverComponent<P = {}>(fn: (props: P) => RenderResult<P> | Promise<RenderResult<P>>) {
return fn as unknown as (props: P) => RenderResult<P>;
}
// or
@n4bb12
n4bb12 / awesome-tech.md
Last active February 18, 2023 15:10
Awesome Tech