Skip to content

Instantly share code, notes, and snippets.

View brandonkal's full-sized avatar

Brandon Kalinowski brandonkal

View GitHub Profile
@brandonkal
brandonkal / keybase.md
Created June 8, 2018 05:15
Keybase Proof

Keybase proof

I hereby claim:

  • I am brandonkal on github.
  • I am brandonkal (https://keybase.io/brandonkal) on keybase.
  • I have a public key ASCOZCot8RJfPnviADzY6dP_lYm3tK2rGXoMjS0rPtJeCQo

To claim this, I am signing this object:

@brandonkal
brandonkal / ansible-rm-files-not-whitelisted.yml
Created July 28, 2018 22:49
ansible-rm-files-not-whitelisted
---
- name: Delete files from directory not in whitelist
hosts: localhost
gather_facts: false
vars:
whitelist:
- a
- b
- c
tasks:
@brandonkal
brandonkal / submodule-add
Created August 5, 2018 08:08
Useful Git Scripts
#!/bin/bash
# Adds desired submodule to project at location and performs a shallow clone,
# Then it performs a sparse checkout with the files specified
set -e
usage() {
echo
echo "usage: submodule-add https://gitremote.git vendor/mod"
echo "Optionally you can pass desired files and folders to checkout as additional arguments..."
echo "e.g. submodule-add https://remoterepo.git submodule importantdir docker-compose.yml"
@brandonkal
brandonkal / markdown-reference.md
Last active April 10, 2021 18:36
Markdown Styling Reference for Gatsby

NOTE: This "post" is based on Markdown Cheatsheet and is meant to test styling of Gatsby Sites.

This is intended as a quick reference and showcase. For more complete info, see John Gruber's original spec and the Github-flavored Markdown info page.

This cheatsheet is specifically Markdown Here's [^1] version of Github-flavored Markdown. This differs slightly in styling and syntax from what Github uses, so what you see below might vary a little from what you get in a Markdown Here email, but it should be pretty close [^2]. This paragraph has two footnotes for testing.

You can play around with Markdown on our live demo page.

(If you're not a Markdown Here user, check out the Markdown Cheatsheet that is not specific to MDH. But, really, you should also use Markdown H

@brandonkal
brandonkal / code-extensions.sh
Last active January 24, 2022 22:34
Get VSCode set up with all the required extensions
#!/usr/bin/env bash
# How to run this file
# 1. Download file
# 2. In terminal navigate to folder containing this file.
# 3. chmod +x code-extensions.sh
# 4. ./code-extensions.sh
######################################
# Everything below this line will execute by running the script
######################################
@brandonkal
brandonkal / sVim.rc
Last active May 4, 2019 00:48
sVim Settings
let blacklists = ["*://youtube.com*", "*://mail.google.com/*"]
set smoothscroll
" Match my customized Saka Key bindings
map "a" createTabbedHint
unmap "ctrl+shift+f"
map "shift+a" createForegroundHint
unmap "g i"
map "shift+f i" goToInput
{
"activeProfiles": {
"General": "power",
"Keybindings": "Brandon",
"Appearance": "default",
"Blacklist": "default"
},
"profiles": {
"General": {
"power keep focus": {
@brandonkal
brandonkal / ts-string.ts
Last active June 18, 2019 18:59
Typescript Return type from compiled string
import ts from 'typescript'
import fs from 'fs'
import path from 'path'
function transform(
contents: string,
libSource: string,
compilerOptions: ts.CompilerOptions = {}
) {
if (!compilerOptions.target) {
@brandonkal
brandonkal / useInitialMeasure.tsx
Created August 19, 2019 11:04
useMeasure Hooks
import React from 'react'
export interface Size {
width: number
height: number
}
export function useInitialMeasure(ref: React.RefObject<HTMLElement | null>) {
const [bounds, setBounds] = React.useState<Size>({
width: 0,
@brandonkal
brandonkal / go.ts
Created November 29, 2019 06:26
Go -- simplified async error handling in Typescript
export type PromiseType<T extends Promise<any>> = T extends Promise<infer U>
? U
: never
export type Arguments<T> = T extends (...args: infer U) => infer R ? U : never
export type ReplaceReturn<T, TNewReturn> = (...a: Arguments<T>) => TNewReturn
type Fn = (...args: any[]) => any
export type Go<E extends Error, T extends Fn> = {