Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
#BlackLivesMatter

Kyle KyleMit

💭
#BlackLivesMatter
View GitHub Profile
@KyleMit
KyleMit / index.html
Last active Nov 12, 2020
Walker's Algorithm
View index.html
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">
<title>Walkers</title>
</head>
<body>
<header>
@KyleMit
KyleMit / find-index.js
Created Oct 26, 2020
Twitter - Find Index
View find-index.js
let pets = [
{ name: "Ranger", type: "Dog" },
{ name: "Gill", type: "Cat" },
{ name: "Frida", type: "Cat" }
]
let startWithGIndex = pets.findIndex(el => el.name.startsWith("G"))
console.log(nameStartWithGIndex) // 1
@KyleMit
KyleMit / variadic-function.js
Created Oct 26, 2020
Twitter - Variadic Function
View variadic-function.js
let checkValInList = (val, ignoreCase, ...list) => {
return ignoreCase
? list.some(el => el.toLowerCase() === val.toLowerCase())
: list.includes(val)
}
checkValInList("hello", true, "Hi", "Hello", "Howdy") // true
checkValInList("hello", false, "Hi", "Hello", "Howdy") // false
@KyleMit
KyleMit / includes.js
Created Oct 26, 2020
Twitter - Includes
View includes.js
console.log(~"apple".indexOf("a")) // true
console.log("apple".indexOf("a") >= 0) // true
console.log("apple".includes("a")) // true
@KyleMit
KyleMit / autocomplete.html
Created Oct 26, 2020
Twitter - Autocomplete
View autocomplete.html
<div>
<label for="old-pass">Current Password:</label>
<input type="password" id="old-pass" autocomplete="current-password">
</div>
<div>
<label for="new-pass">Choose New Password:</label>
<input type="password" id="new-pass" autocomplete="new-password">
</div>
@KyleMit
KyleMit / barrel-up.js
Created Oct 26, 2020
Twitter - Barrel Up
View barrel-up.js
// index.ts
export { Dog } from 'dog/dog.component.ts';
export { Cat } from 'cat/cat.component.ts';
// module.ts
import { Cat, Dog } from 'index.ts';
@KyleMit
KyleMit / logical-or-assignment-operator.js
Created Oct 26, 2020
Twitter - Logical OR Assignment Operator
View logical-or-assignment-operator.js
let person = { name: "Frida" }
// original
person.city = person.city || "unknown"
// with logical or assignment operator
person.city ||= "unknown"
@KyleMit
KyleMit / customize-vs-code.json
Created Oct 23, 2020
Twitter - Customize VS Code UI
View customize-vs-code.json
{
"customizeUI.stylesheet": {
".editor-actions .codicon-compare-changes": "display: none !important;",
".editor-actions .codicon-open-preview": "display: none !important;",
".editor-actions .codicon-split-horizontal": "display: none !important;",
".editor-actions .codicon-toolbar-more": "display: none !important;"
},
}
@KyleMit
KyleMit / toLocaleDateString.js
Created Oct 23, 2020
Twitter - toLocaleDateString
View toLocaleDateString.js
let dt = new Date(1906, 11, 9)
let lang = navigator.language // i.e. 'en-us'
// "Sunday, December 9, 1906"
dt.toLocaleDateString(lang, {
weekday: 'long',
year: 'numeric',
month: 'long',
day: 'numeric'
})
@KyleMit
KyleMit / chrome-grid.html
Last active Oct 19, 2020
Twitter - Chrome Grid Inspector
View chrome-grid.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Grid Tools</title>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@600&display=swap" rel="stylesheet">
You can’t perform that action at this time.