Skip to content

Instantly share code, notes, and snippets.

View tmillr's full-sized avatar
👋
Looking for work!

Tyler Miller tmillr

👋
Looking for work!
View GitHub Profile
@tmillr
tmillr / computed-class-or-function-names.js
Last active March 10, 2021 03:07
Computed Class or Function Names in Javascript (Without "eval" or "Function" Constructor)
/**
* NOTE:
* Just now realized this is achievable via `Object.defineProperty` and then passing the function you want to
* rename (or change the 'name' property of)... can't believe I didn't realize there was such a simple solution!
*/
/*
* Introduction
*
* Creating a named function is easy enough: */ function fName() {} /*.
@tmillr
tmillr / deployfs
Last active July 21, 2022 14:56
Deploy a local filesystem to a remote host
#!/usr/bin/env sh
# Author: Tyler Miller (@tmillr) ([email protected])
# Mount a local directory to a remote destination (give a remote host access
# to a local directory via sshfs via sftp). Requires mkfifo on local host.
# Requires sshfs to be installed in PATH on remote host. Might not work on
# Windows.
# Environment Variables
@tmillr
tmillr / license-help.md
Last active July 28, 2022 19:02
License and Copyright Notice Help

After some modest preliminary research of my own, here are my opinions and what I have learned so far.

These are merely my own personal notes based upon what I've gathered thus far; I am not an expert on these matters so do take everything written here with a grain of salt.

Open Source/Free Software Licenses

First, anything published publicy should have a license (particularly and especially published software).

But why?

@tmillr
tmillr / winhl.lua
Last active August 5, 2024 07:15
How to set or update the `winhl` option in Neovim (properly)
---Sets `winhl` without clobbering any existing mappings (i.e. of highlight groups not
---in `mappings`). Currently only supports setting `winhl` locally (which is likely what
---you want if the mappings are buffer-specific).
---@param win integer window to set the mappings on; use `0` for the current window
---@param mappings table<string, string|false>|false table of mappings to set (or clear if `false`)
local function set_winhl(win, mappings)
api.nvim_win_call(win == 0 and api.nvim_get_current_win() or win, function()
if not mappings then
-- Clear local mappings and use global values.
vim.opt_local.winhl = nil
@tmillr
tmillr / resolve_conflict.lua
Last active September 14, 2024 09:21
Auto-resolve merge conflict (neovim)
---Automatically resolves a conflict line-by-line.
---@param buf? integer
local function resolve_conflict(buf)
buf = buf or api.nvim_get_current_buf()
---@param buf integer
---@param regex string|vim.regex
---@param start integer line to start searching from
---@param backwards? boolean search backwards
---@return integer? lnum