Skip to content

Instantly share code, notes, and snippets.

View MunifTanjim's full-sized avatar
🧐
What's happening?

Munif Tanjim MunifTanjim

🧐
What's happening?
View GitHub Profile
@MunifTanjim
MunifTanjim / heirline-profiler.lua
Last active December 27, 2022 17:56
Neovim Statusline
local mod = {}
local result = {
statusline = {},
tabline = {},
winbar = {},
}
local heirline = require("heirline")
local heirline_eval_statusline = heirline.eval_statusline
@MunifTanjim
MunifTanjim / .config--hammerspoon--.nvimrc.lua
Last active August 24, 2022 16:23
Neovim - Project Local Config with exrc.nvim
require("config.lsp.custom").patch_lsp_settings("sumneko_lua", function(settings)
settings.Lua.diagnostics.globals = { "hs", "spoon" }
settings.Lua.workspace.library = {}
local hammerspoon_emmpylua_annotations = vim.fn.expand("~/.config/hammerspoon/Spoons/EmmyLua.spoon/annotations")
if vim.fn.isdirectory(hammerspoon_emmpylua_annotations) == 1 then
table.insert(settings.Lua.workspace.library, hammerspoon_emmpylua_annotations)
end
@MunifTanjim
MunifTanjim / nvm.plugin.sh
Created November 21, 2021 11:16
NVM Lazy Loading
export NVM_DIR="${HOME}/.local/share/nvm"
PATH="./node_modules/.bin:${PATH}"
if [ -d "${NVM_DIR}" ]; then
__node_global_bins=("nvm" "node" $(find ${NVM_DIR}/versions/node -maxdepth 3 -path '*/bin/*' -type l -print0 2>/dev/null | xargs -0 -n1 basename | sort | uniq))
__init_nvm() {
unset -f ${__node_global_bins[@]} >/dev/null 2>&1
unset __node_global_bins
@MunifTanjim
MunifTanjim / nui_lsp.lua
Last active January 31, 2023 00:48
Neovim LSP Rename with nui.nvim
local Input = require("nui.input")
local event = require("nui.utils.autocmd").event
local function nui_lsp_rename()
local curr_name = vim.fn.expand("<cword>")
local params = vim.lsp.util.make_position_params()
local function on_submit(new_name)
if not new_name or #new_name == 0 or curr_name == new_name then
@MunifTanjim
MunifTanjim / carbon.now.sh-gruvbox_dark.json
Created June 8, 2021 22:13
carbon.now.sh - gruvbox dark
{
"custom": true,
"id": "gruvbox_dark",
"name": "Gruvbox Dark",
"highlights": {
"attribute": "#d79921",
"background": "#1d2021",
"comment": "#a89984",
"definition": "#fbf1c7",
"keyword": "#fb4934",
@MunifTanjim
MunifTanjim / VSCode-Neovim-Keybindings.md
Last active November 28, 2023 20:11
VSCode Keyboard Shortcuts to use with vscode-neovim
@MunifTanjim
MunifTanjim / node-oidc-provider-database-schema-postgresql.sql
Created September 28, 2020 17:23
Node OIDC Provider - Database Schema (PostgreSQL)
begin;
create function on_update_timestamp_trigger()
returns trigger as $$
begin
new."updated_at" = current_timestamp;
return new;
end;
$$ language 'plpgsql';
@MunifTanjim
MunifTanjim / setup-from-github-release
Created July 31, 2020 15:14
Setup from Github Release
#!/usr/bin/env bash
set -euo pipefail
command_exists() {
type "${1}" >/dev/null 2>&1
}
select_github_release() {
local -r repo="${1}"
@MunifTanjim
MunifTanjim / str.sh
Created May 31, 2020 00:27
Shell Helpers
function str_repeat() {
local -r str="$1"
local -r n="$2"
echo "$(printf '%*s' "${n}" | tr ' ' "${str}")"
}
function str_box() {
local -r str="$1"
local -r str_len=$(( 4 + ${#str} ))
const testArr = [
/* 0 */ 0,
/* 1 */ 1,
/* 2 */ 0,
/* 3 */ -3,
/* 4 */ 1,
/* 5 */ 3,
/* 6 */ 4,
/* 7 */ 0,
/* 8 */ 1,