Skip to content

Instantly share code, notes, and snippets.

View elisherer's full-sized avatar
🤘
Making magic happen!

Eli Sherer elisherer

🤘
Making magic happen!
View GitHub Profile
@elisherer
elisherer / aws-sso-login.sh
Created May 12, 2022 13:05 — forked from aharonha/aws-sso-login.sh
Login to aws sso and create credentials file
#! /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
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",
@elisherer
elisherer / jsonschema.js
Created May 9, 2020 20:29
JSON Schema parsing
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);
@elisherer
elisherer / font.txt
Created April 14, 2019 08:30
ASCII Font based on unicode box drawing
A
╭──╮
├──┤
╵ ╵
a
╭──┐
╰──┴
B
┌─╮
@elisherer
elisherer / colorizing-node.js
Last active November 22, 2018 11:16
Add some color to your node script without adding a library
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``);
@elisherer
elisherer / SassMeister-input-HTML.html
Created January 20, 2016 20:44
Generated by SassMeister.com.
<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/>