Skip to content

Instantly share code, notes, and snippets.

View danielr1996's full-sized avatar
🥷

Daniel Richter danielr1996

🥷
View GitHub Profile
@danielr1996
danielr1996 / .zshrc
Created September 22, 2023 22:55
kubemerge
alias kubemerge='kubectl konfig merge $(gfind ~/.kube -mindepth 1 -path ~/.kube/cache -prune -o -not -name config -not -name kubectx -printf "%p ") > ~/.kube/config && chmod 600 ~/.kube/config'
@danielr1996
danielr1996 / kind-with-registry.sh
Last active September 19, 2023 02:17
curl https://... | bash -s -- <clustername>
#!/bin/sh
set -o errexit
# 1. Create registry container unless it already exists
reg_name='kind-registry'
reg_port='5001'
if [ "$(docker inspect -f '{{.State.Running}}' "${reg_name}" 2>/dev/null || true)" != 'true' ]; then
docker run \
-d --restart=always -p "127.0.0.1:${reg_port}:5000" --name "${reg_name}" \
registry:2
@danielr1996
danielr1996 / export.ts
Created December 1, 2022 19:55
export.ts
export constant = 'constant'
@danielr1996
danielr1996 / autoexec.cfg
Last active October 5, 2022 12:55
autoexec.cfg
//////////////////
// Key Bindings //
//////////////////
//┏━━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┓
//┃ Num ┃ / ┃ * ┃ - ┃
//┃━━━━━━━━━╉━━━━━━━╉━━━━━━━╉━━━━━━━┨
//┃ 7 ┃ 8 ┃ 9 ┃ + ┃
//┃━━━━━━━━━╉━━━━━━━╉━━━━━━━┨ ┃
//┃ Galil ┃ 5 ┃ 6 ┃ + ┃
//┃━━━━━━━━━╉━━━━━━━╉━━━━━━━╉━━━━━━━┨
@danielr1996
danielr1996 / useExternal.spec.ts
Last active September 6, 2022 14:07
Test React hook which uses another hook
import {useExternal} from "./useExternal";
const useInternal = jest.spyOn(require('./useInternal'), 'useInternal')
useInternal.mockReturnValue(2)
test('useExternal', ()=>{
const actual = useExternal()
const expected = 4
expect(actual).toBe(expected)
})
@danielr1996
danielr1996 / scale.scss
Created February 14, 2022 15:49
Dynamic scale for sass
//https://stackoverflow.com/questions/58069059/dynamic-spacing-classes-with-sass
@function fibonacci($n){
@if $n == 0{
@return 0;
} @else if $n == 1 or $n == 2{
@return 1;
}
@return fibonacci($n - 1) + fibonacci($n - 2);
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.