Skip to content

Instantly share code, notes, and snippets.

Why was my charger missing when I left carrier. It was in the picture mom showed me
Why was the cable to my other charger missing when I left carrier
Why was my puffco missing when I left carrier. It was sitting on top of the microwave if it were still in the garage it would show up on bluetooth. I left it on top of the microwave and didn't bring it with me to carrier
Why was my puffco missing when I left carrier I left it on top of the microwave and if it were still here it would show up on bluetooth
Why were my anxiety meds missing in the medication you give me
@Brettm12345
Brettm12345 / useDiscount.ts
Created September 12, 2021 19:16
Discount Provider With fp-ts
import {AllDiscountsQuery, useAllDiscountsQuery} from '../../generated/graphql';
import * as A from 'fp-ts/Array';
import * as O from 'fp-ts/Option';
import {flow, pipe} from 'fp-ts/function';
import constate from 'constate';
import {ApolloError} from '@apollo/client';
type ProductType = 'variant' | 'product';
type Discount<
@Brettm12345
Brettm12345 / AuthApolloProvider.tsx
Created September 12, 2021 18:21
Apollo Provider with Auth and FP-TS
import {
ApolloLink,
ApolloProvider,
ApolloClient,
InMemoryCache,
HttpLink,
split,
FetchResult,
} from '@apollo/client';
import {BatchHttpLink} from '@apollo/client/link/batch-http';
@Brettm12345
Brettm12345 / sk-hoogle.sh
Created February 11, 2020 16:42
Fuzzy search through hoogle
#! /usr/bin/env nix-shell
#! nix-shell -i sh -p hoogle skim
sk -i -c "hoogle -q --count=50 '{}'" --preview="hoogle -i '{1..2}'" --cmd-prompt="hoogle> "
@Brettm12345
Brettm12345 / nixos-option.sh
Last active February 4, 2021 13:30
nixos-option with fzf
#! /usr/bin/env nix-shell
#! nix-shell -i sh -p jq fzf
OPTION_CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/nixos-options.json"
test -f "$OPTION_CACHE" || {
echo "Building cache..."
cp "$(export NIXPKGS_ALLOW_UNFREE=1; nix-build -Q --no-out-link '<nixpkgs/nixos/release.nix>' -A options)/share/doc/nixos/options.json" "$OPTION_CACHE"
}
OPTION=$(jq -r 'keys | join("\n")' "$OPTION_CACHE" | fzf --height "60%" --preview 'nixos-option {}')
@Brettm12345
Brettm12345 / nix-install.sh
Last active February 10, 2020 05:14
Nixos package install script with FZF
#! /usr/bin/env nix-shell
#! nix-shell -i sh -p jq awk fzf
PKG=$(nix search "$1" --json \
| jq -r '. | to_entries | map("\(.key)|\(.value.version)|\(.value.description)") | join("\n")' \
| awk -F "|" '{ printf "\033[34m%-40s \033[32m%-20s \033[0m%s\n", $1, $2, $3 }' \
| fzf \
| awk '{ print $1 }'
)
@Brettm12345
Brettm12345 / Css.purs
Created January 25, 2020 23:47
Purescript tailwind css parser
module Css
( parseName, parseClass
) where
import Prelude
import Control.Alt ((<|>))
import Data.Array as Array
import Data.Char.Unicode (toUpper)
import Data.List (elem, many)
import Data.Maybe (Maybe, fromMaybe, isNothing)
@Brettm12345
Brettm12345 / localStorage.ts
Last active December 18, 2019 08:42
Safe localStorage with fp-ts for ssr applications
import * as ls from 'fp-ts-local-storage'
import { io } from 'fp-ts/lib/IO'
import { none } from 'fp-ts/lib/Option'
import { fold } from 'fp-ts/lib/boolean'
import { constVoid, flow } from 'fp-ts/lib/function'
import { curry } from 'ramda'
const isBrowser = io.of(typeof localStorage === "undefined");
const foldIo = curry(
@Brettm12345
Brettm12345 / Windows.hs
Created December 6, 2019 06:31
WIndow keybinds
module Bind.Keys.Windows
( windows
)
where
import XMonad.Actions.Promote ( promote )
import Bind.Keys.Internal ( Keymap
, subKeys
, zipKeys
, directionKeys
, directions
@Brettm12345
Brettm12345 / internal.hs
Created December 6, 2019 06:29
Internal Keymaps
module Bind.Keys.Internal where
import XMonad ( XConfig
, KeyMask
, X
, KeySym
, mod4Mask
, xK_Super_L
)
import XMonad.Util.NamedActions ( addName