Skip to content

Instantly share code, notes, and snippets.

View KyleMit's full-sized avatar

Kyle Mitofsky KyleMit

View GitHub Profile
@KyleMit
KyleMit / CodeBlocks.md
Last active June 9, 2021 03:36
Code Blocks & Syntax Highlighting
@KyleMit
KyleMit / cloudSettings
Last active November 26, 2022 21:24
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-04-12T13:23:41.875Z","extensionVersion":"v3.4.3"}
@KyleMit
KyleMit / .bashrc
Created January 14, 2019 00:30
Custom Bash Prompt
# PS1 special characters
UserName="\u" # the username of the current user
HostShort="\h" # the hostname up to the first `.'
WorkingDirectory="\w" # the current working directory
HostFull="\H" # the hostname
JobCount="\j" # the number of jobs currently managed by the shell
DeviceName="\l" # the basename of the shell's terminal device name
NewLine="\n" # newline
Return="\r" # carriage return
@KyleMit
KyleMit / GitLog.md
Created January 28, 2019 14:09
Fun Git Logs

Color Formatted:

$ git log --no-merges --shortstat --author="Kyle Mitofsky" --date=format:'%m/%d %I:%M %p' --pretty="@%C(yellow)%h %C(green)%cn %C(cyan)%cd %C(reset)- %<(50,trunc)%s"

One Line:

$ git log --no-merges --shortstat --author="Kyle Mitofsky" --date=format:'%m/%d %I:%M %p' --pretty="@%C(yellow)%h %C(green)%cn %C(cyan)%cd %C(reset)- %<(50,trunc)%s" | tr "\n" " "  |  tr "@" "\n" |  sed -r 's/ insertions?| deletions?|[0-9]* files? changed,//g'
@KyleMit
KyleMit / SarcasmPerf.md
Last active June 9, 2021 03:32
sArCasM cAsInG

Here's the challenge

Produce a function which takes in some text and produces a string that alternates between upper and lower casing between every character

Step 2 - Eek out the best possible perf

Step 3 - Find an ice bucket, fill it with coffee, and drink it while you're coding

Before we lean too heavily on performance, two disclaimers:

@KyleMit
KyleMit / Array without IndexOf.js
Last active April 6, 2019 02:37
String Characters - Group & Count
var myString = "aaAbbcdeffff".toUpperCase()
// potential bucket for one of every letter
var letters = [] // ex. ["a", "b", "c", "d"]
var counts = [] // ex. [3, 2, 1, 1]
// loop through every letter in string
for (i=0; i < myString.length; i++) {
var char = myString[i]
@KyleMit
KyleMit / navigate_sections.js
Created April 19, 2019 05:27
Page Navigation
var chaperRegex = /(chapter)(\d{1,2})(-)(\d{1,2})/
function LoadNextSection() {
// build next section address
var nextSectionUrl = window.location.href.replace(chaperRegex,
function(match, first, chapter, second, section) {
var nextSection = +section+1 // increment
if (nextSection < 10) nextSection = "0" + nextSection; // pad with 0
return first + chapter + second + nextSection;
});
@KyleMit
KyleMit / archive.ps1
Last active February 25, 2024 14:25
Execute Powershell Script on Right Click in Windows Explorer
$path = $args[0]
Add-Type -AssemblyName PresentationFramework
[System.Windows.MessageBox]::Show("Hello $path")
@KyleMit
KyleMit / app_offline.htm
Last active June 9, 2021 03:38
Offline
<!DOCTYPE html>
<html>
<head>
<title>VRIMS Offline | Vermont Department of Health</title>
<style type="text/css">
html {
background: #fffdef;
}
body {
display: flex;
@KyleMit
KyleMit / GitPair.md
Last active June 13, 2019 17:09
Git Pair Alias

Git Pair Alias

Pair Programming is great - here's a way to make it greater with easy way to toggle on mutliple attribution for each a commit.

Add this alias to your global .gitconfig file (git config --global --edit)

[alias]
    pair = "!f() {                                                           \
                local name=$1;                                               \