Skip to content

Instantly share code, notes, and snippets.

View aldrichtr's full-sized avatar

Tim Aldrich aldrichtr

View GitHub Profile
@aldrichtr
aldrichtr / OutputToOutputWindow.js
Created November 3, 2024 22:18 — forked from exceedsystem/OutputToOutputWindow.js
An example of 'Output to output window' macro for VSCodeMacros extension
// [VSCode Macros] extension
// https://marketplace.visualstudio.com/items?itemName=EXCEEDSYSTEM.vscode-macros
// License:MIT
const vscode = require('vscode');
// Create an output window for this macro
if (global.phee7Bie === undefined) {
// Store the output channel in the global variable for nodeJS
// ※The variable name 'phee7Bie' just means a unique global variable of this macro in the node JS
global.phee7Bie = {

A metatable can be defined like

local t = setmetatable({}, {
  __tostring = function() return 'custom tostring behavior!' end
})

Here are the metamethods that you can define, and their behavior

Operators

@aldrichtr
aldrichtr / playground.rs
Last active July 25, 2024 17:49 — forked from anonymous/playground.rs
Function overloading paradigm in rust
struct SomeStruct;
impl SomeStruct {
fn new(ctor: MixedInts) {
match ctor {
_ => println!("Match arms can construct the type in different ways"),
}
}
}
@aldrichtr
aldrichtr / @@INTRO.md
Created June 30, 2024 13:11 — forked from abstraction/@@INTRO.md
My use of Taskwarrior

Getting Started

My Usage

I've been using this for several years now, so here are some of the ways I have set it up to be most productive. See my taskrc below for implementation details.

In general, I've had the most success by keeping lists of tasks short and to the point, avoiding the anxiety of seeing 100 tasks and feeling like I'm going to drown.

@aldrichtr
aldrichtr / Test-QualityCode.ps1
Created May 28, 2024 23:23 — forked from belotn/Test-QualityCode.ps1
Script to check formatting and best practice before committing
######################################################################
# SCRIPT: Test-CodeQuality.ps1 #
######################################################################
# Purpose #
# Script to check formatting and best practice before committing #
######################################################################
# Author : Nicolas #
######################################################################
# ChangeLog #
# 20201026 - Initial Release #
@aldrichtr
aldrichtr / VIMBinding.ps1
Created May 28, 2024 23:20 — forked from belotn/VIMBinding.ps1
KeyHandler and function for some VI text manipulation ci, ca, di and da in #Powershell #PSReadLine
Set-PSReadLineKeyHandler -Chord "c,i" -ViMode Command -ScriptBlock { VIChangeInnerBlock }
Set-PSReadLineKeyHandler -Chord "c,a" -ViMode Command -ScriptBlock { VIChangeOuterBlock }
Set-PSReadLineKeyHandler -Chord "d,i" -ViMode Command -ScriptBlock { VIDeleteInnerBlock }
Set-PSReadLineKeyHandler -Chord "d,a" -ViMode Command -ScriptBlock { VIDeleteOuterBlock }
Set-PSReadLineKeyHandler -Chord "c,s" -ViMode Command -ScriptBlock { VIChangeSurround }
Set-PSReadLineKeyHandler -Chord "d,s" -ViMode Command -ScriptBlock { VIDeleteSurround }
Set-PSReadLineKeyHandler -Chord "Ctrl+a" -ViMode Command `
-ScriptBlock { VIIncrement $args[0] $args[1] }
Set-PSReadLineKeyHandler -Chord "Ctrl+x" -ViMode Command `
-ScriptBlock { VIDecrement $args[0] $args[1] }
@aldrichtr
aldrichtr / poco.psd1
Created May 20, 2024 20:51
Succinct organized PowerShell Manifest layout
# I really like the way this is laid out
# https://github.com/aldrichtr/poco/blob/master/src/ps1/poco.psd1
@{
## Module Info
ModuleVersion = '1.2.0'
Description = "Interactive filtering command based on peco"
GUID = 'fcdcab47-0505-4ba8-b845-538effc1d88e'
# HelpInfoURI = ''
## Module Components
@aldrichtr
aldrichtr / coc.lua
Created May 7, 2024 20:28 — forked from dinhmai74/coc.lua
cocnvim
local M = {
"neoclide/coc.nvim",
branch = "master",
build = "yarn install --frozen-lockfile",
}
M.config = function()
-- Some servers have issues with backup files, see #649
vim.opt.backup = false
vim.opt.writebackup = false
// vscode-keybindings for navigation with I/J/K/L and additional functionality with surrounding characters
// Place your key bindings in this file to overwrite the defaults
// ALT + I/J/K/L: up/left/down/right
// ALT + SHIFT + I/J/K/L: mark text up/left/down/right
// CTRL + J/L: send cursor to start/end of line
// CTRL + ALT + J/L: send cursor to start/end of word
// CTRL + ALT + U/O: send cursor to "wordPartLeft"/"wordPartRight"
// CTRL + ALT + SHIFT + U/O: mark from cursor to "wordPartLeft"/"wordPartRight"
// CTRL + ALT + Y: got to declaration
@aldrichtr
aldrichtr / F7History.ps1
Created March 12, 2024 01:02 — forked from tig/F7History.ps1
Use F7 as "Show Command History" in Powershell
# See https://github.com/gui-cs/F7Hisoty which replaces this