Skip to content

Instantly share code, notes, and snippets.

View nfrid's full-sized avatar
👽

Nick Friday nfrid

👽
View GitHub Profile
@nfrid
nfrid / example-usage.ts
Created June 16, 2023 12:41
Typescript helper types for working with nested object keys in dot notation (aka formik ass shit)
interface A {
foo: {
bar: number;
};
hee: {
hoo?: string;
haa?: {
test: number;
}[];
@nfrid
nfrid / dump.lua
Last active June 19, 2022 12:53
lua: dump any value as a formatted string
--- Dump value of a variable in a formatted string
--
--- @param o table Dumpable object
--- @param tbs string|nil Tabulation string, ' ' by default
--- @param tb number|nil Initial tabulation level, 0 by default
--- @return string
local function dump(o, tbs, tb)
tb = tb or 0
tbs = tbs or ' '
if type(o) == 'table' then
@nfrid
nfrid / nvim_format.lua
Last active July 2, 2021 15:56
Easy and cool auto formatter/prettier implementation for neovim's init.lua
Format = function()
vim.api.nvim_command(":w") -- save first
local formatCmds = { -- these are just commands that formatting files next to them 'in-place' for each filetype
lua = 'lua-format --indent-width=2 --spaces-inside-table-braces -i',
go = 'gofmt -w',
javascript = 'prettier -w --loglevel error',
typescript = 'prettier -w --loglevel error',
javascriptreact = 'prettier -w --loglevel error',
typescriptreact = 'prettier -w --loglevel error',