This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>Website</title> | |
<!-- client router fix for github pages --> | |
<script type="text/javascript"> | |
location.replace(`${location.origin}?client_redirect=${encodeURIComponent(location.href)}`); | |
</script> | |
<!-- client router fix for github pages --> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import toYaml from "./toYaml"; | |
describe("toYaml", () => { | |
test("string", () => { | |
expect(toYaml("Hello World")).toEqual("Hello World\n"); | |
// keywords | |
expect(toYaml("null")).toEqual('"null"\n'); | |
expect(toYaml("true")).toEqual('"true"\n'); | |
expect(toYaml("false")).toEqual('"false"\n'); | |
// escapes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
RED='\033[0;31m' | |
GREEN='\033[0;32m' | |
NC='\033[0m' # No Color | |
installer=`which brew || which yum || which apt-get` | |
which jq >/dev/null || $installer install jq | |
if [ $? -ne 0 ]; then | |
echo -e ${RED} unable to install jq, please run $installer install jq $NC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const obj = { | |
"first_name": "John", | |
"last_name": "Smith", | |
"age": 21, | |
"hobbies": [ "programming", "workout", null, undefined, 24, "\"has double quotes\"" ], | |
"nested": { | |
"arr": [ "one", "two", "three" ], | |
}, | |
"nested_arr": [ | |
"first as string", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const TypeMapping = { | |
bigint: "integer", | |
boolean: "boolean", | |
number: value => (/\.|e/.test(value.toString()) ? "number" : "integer"), | |
string: "string" | |
}; | |
const getType = value => { | |
const type = typeof value; | |
if (typeof TypeMapping[type] === "function") return TypeMapping[type](value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A | |
╭──╮ | |
├──┤ | |
╵ ╵ | |
a | |
╭──┐ | |
╰──┴ | |
B | |
┌─╮ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const c = ((t_mod, t_clr, t_clrm) => (key,txt) => (Array.isArray(key)?key[0]:key).split(' ').reduce((a,k,b,x)=>(x = k.split('.'))&& | |
(a+"\x1b["+(t_mod.hasOwnProperty(x[0])?t_mod[x[0]]:t_clr.hasOwnProperty(x[0])?''+t_clrm[x[1]]+t_clr[x[0]]:'0')+'m'),'') + (txt ? txt + c`` : ''))( | |
{ '': 0, reset: 0, bold: 1, dim: 2, italic: 3, underline: 4, blink: 5, inverse: 7, hidden: 8 }, | |
{ black: 0, red: 1, green: 2, yellow: 3, blue: 4, magenta: 5, cyan: 6, white: 7 }, | |
{ [undefined]: 3, bg: 4, light: 9, bglight: 10 } | |
); | |
console.log(c("black.light", 'some dim text')); | |
console.log(c("yellow red.bg", 'yellow and red background')); | |
console.log(c`red`+ 'template literals supports' + c``); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<nav> | |
<div class="menu"></div> | |
<span class="title">Pure CSS Material Design</span> | |
</nav> | |
<table> | |
<tr> | |
<td style="width:200px"> | |
<input type="text" placeholder="Hint text" /><br/> | |
<input type="text" class="error" placeholder="Error" /><br/> |