Skip to content

Instantly share code, notes, and snippets.

View pachun's full-sized avatar
🎯
Focusing

Nicholas Pachulski pachun

🎯
Focusing
View GitHub Profile
-- Vim split hotkeys
vim.keymap.set("n", "<leader>d|", "<C-w>v", { desc = "Split window vertically" })
vim.keymap.set("n", "<leader>d_", "<C-w>s", { desc = "Split window horizontally" })
-- <leader>+ toggles maximizing the current pane, like tmux
_G.toggle_session = function()
local session_file = "/tmp/vim_session_" .. vim.fn.getpid() .. ".vim"
if vim.fn.filereadable(session_file) == 1 then
vim.cmd("silent! source " .. session_file)
vim.fn.delete(session_file)
-- Rename tmux window when nvim opens
if vim.fn.exists("$TMUX") == 1 then
local function rename_tmux_tab()
local cwd = vim.fn.fnamemodify(vim.fn.getcwd(), ":t")
vim.fn.system('tmux rename-window "' .. cwd .. '"')
end
local function reset_tmux_tab()
vim.fn.system("tmux set-window-option automatic-rename on")
end
import type { Config } from "jest"
import * as fsPromises from "fs/promises"
const setupFilesAfterEnv = async (): Promise<string[]> => {
const setupFilesAfterEnvPath = "./tests/helpers/jest/setupFilesAfterEnv/"
return (await fsPromises.readdir(`${setupFilesAfterEnvPath}`)).map(
fileName => `${setupFilesAfterEnvPath}/${fileName}`,
)
}
local function filename()
return vim.fn.expand("%:p")
end
local function line_number()
return vim.api.nvim_win_get_cursor(0)[1]
end
local function current_directory()
return vim.fn.getcwd()
-- Change the Diagnostic symbols in the sign column (gutter)
-- (not in youtube nvim video)
local signs = { Error = "", Warn = "", Hint = "󰠠", Info = "" }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon .. " ", texthl = hl, numhl = "" })
end
-- Change the diagnostic symbols by the error message
vim.diagnostic.config({
brew install telnet
telnet towel.blinkenlights.nl
import React from "react"
import * as ReactNative from "react-native"
import * as RNTL from "@testing-library/react-native"
const formatCompleteOrPartialPhoneNumber = (
phoneNumberDigits: string,
): string => {
if (phoneNumberDigits.length < 4) {
return phoneNumberDigits
} else if (phoneNumberDigits.length < 7) {
const ingredients = [
'Absinthe',
'Agave Syrup',
'Amaretto Liqueur',
'Amaro Liqueur',
'Angostura Bitters',
'Aperol',
'Apple',
'Apple Brandy',
'Applejack',
import React from "react"
import {
AsyncStorage,
FlatList,
KeyboardAvoidingView,
TextInput,
TouchableOpacity,
Vibration,
View,
} from "react-native"
@pachun
pachun / gist:e2b0ffa1fe827fedb242830f2e98e7bb
Last active April 1, 2024 21:29
Copy a Postgres Heroku database locally
$ heroku pg:backups:capture -a too-many-men-api
$ heroku pg:backups:download -a too-many-men-api
$ pg_restore -c -d too_many_men_api_development latest.dump