Skip to content

Instantly share code, notes, and snippets.

View pachun's full-sized avatar
🎯
Focusing

Nick Pachulski pachun

🎯
Focusing
View GitHub Profile
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
const injectedJavascript = [
"setTimeout(function() {",
" const metaTag = document.createElement('meta');",
" metaTag.setAttribute('name', 'viewport');",
" metaTag.setAttribute('content', 'width=device-width, initial-scale=1');",
" document.getElementsByTagName('head')[0].appendChild(metaTag);",
" setTimeout(function() {",
" const documentSize = { displayedMessageContentHeight: document.body.scrollHeight };",
import { useRef } from "react"
const useRefsWithKeys = <T>(): {
setRefForKey: (key: string) => (element: T) => void
getRefForKey: (key: string) => T
} => {
const ref = useRef<Record<string, T>>({})
const setRefForKey =
(key: string) =>