Skip to content

Instantly share code, notes, and snippets.

View KyleMit's full-sized avatar

Kyle Mitofsky KyleMit

View GitHub Profile
@KyleMit
KyleMit / 12-days.js
Last active February 18, 2020 14:19
12 Days Challenge
let gifts = ["partridge in a pear tree", "turtle doves", "French hens", "calling birds", "gold rings", "geese a-laying", "swans a-swimming", "maids a-milking", "ladies dancing", "lords a-leaping", "pipers piping", "drummers drumming"]
let numLookup = [
{ cardinal: "a", ordinal: "first" },
{ cardinal: "two", ordinal: "second" },
{ cardinal: "three", ordinal: "third" },
{ cardinal: "four", ordinal: "fourth" },
{ cardinal: "five", ordinal: "fifth" },
{ cardinal: "six", ordinal: "sixth" },
{ cardinal: "seven", ordinal: "seventh" },
@KyleMit
KyleMit / IterateObject.md
Created September 3, 2019 00:58
Looping through an object in JavaScript

There's a pretty standard way to manipulate an array and return the slightly transformed contents using .map(), but there's a lot of options when it comes to objects, opening the door to potential confusion. Here's an approach to looping through an object in JS

Let's start with the following object:

let authors = {
    "Kyle": {"description": "Likes Cats"},
    "Brian": {"description": "Automation champion"},
    "Sandra": {"description": "Swiss army knife"}
}
@KyleMit
KyleMit / 11ty-Global-Data.md
Created September 3, 2019 00:58
Using Global Data in 11ty

Using Global Data in 11ty

Any filename you put under _data directory will be globally available to all templates

A template might start with some yaml front matter to give it some [local fontmatter data][1] like this:

title: "First post"
author: Kyle
tags: [Post, Intro]
title about
tags
post

My About Page

@KyleMit
KyleMit / MutateKeyValue.md
Created July 25, 2019 23:27
Mutate Key Value Pairs

Input

var obj = {
	app: "one",
	ban: "house"
}

or

@KyleMit
KyleMit / FlattenArray.md
Last active July 22, 2019 17:38
Flatten Array of Objects

Starting Point

var arr = [
  { name: "height", value:"20" },
  { name: "width",  value:"30" }
]

Target

@KyleMit
KyleMit / app_offline.htm
Created June 28, 2019 20:14
App Redirect
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge;" />
<title>Vital Records Produce Copy has Moved! | VDH</title>
<link rel="icon" type="image/x-icon" href="data:image/png;base64,AAABAAEAQEAAAAEAGAAoMgAAFgAAACgAAABAAAAAgAAAAAEAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAChcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQGhcQG
@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;                                               \
@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 / archive.ps1
Last active August 9, 2024 21:36
Execute Powershell Script on Right Click in Windows Explorer
$path = $args[0]
Add-Type -AssemblyName PresentationFramework
[System.Windows.MessageBox]::Show("Hello $path")