Skip to content

Instantly share code, notes, and snippets.

.push() Add elements to end of an array
const num = [ "a", "b" ];
num.push("c");
// => 3
num;
// [ "a", "b", "c"]
@dannylee8
dannylee8 / fetch.json
Created November 24, 2019 23:21
VS Code Snippet Example
"Fetch-headers": {
"prefix": ["fetch headers", "feh", "header"],
"body": [ "const HEADERS = {",
"\t\"content-type\": \"application/json\",",
"\t\"accept\" : \"application/json\"",
"}"],
"description": "Fetch HEADERS const."
},
"Fetch-update-patch": {
"prefix": ["fetch update patch", "feu", "fep"],
@dannylee8
dannylee8 / original.js
Created November 24, 2019 23:25
VS Code Snippet sample 2
const HEADERS = {
"content-type": "application/json",
"accept" : "application/json"
}
function doFetch (myObject, id) {
fetch(`${SITE}/${id}`, {
method: "PATCH"
headers: HEADERS
body: JSON.stringify({
@dannylee8
dannylee8 / .gitignore_global
Created March 4, 2020 01:48
Sample .gitignore_global
# An example global gitignore file
#
# Place a copy if this at ~/.gitignore_global
# Run `git config --global core.excludesfile ~/.gitignore_global`
# Compiled source #
###################
*.com
*.class
*.dll
@dannylee8
dannylee8 / .gitconfig
Last active March 6, 2020 02:34
.gitconfig
[core]
whitespace=fix,-indent-with-non-tab,trailing-space,cr-at-eol
editor = code --wait
excludesFile = /Users/dannylee/.gitignore
[alias]
aa = add --all
ak = !git add -A && git commit -m
ai = add --interactive
amend = commit -a --amend
@dannylee8
dannylee8 / gotham.md
Last active March 16, 2020 12:44 — forked from mfd/ gotham.md
Gotham font
https://cdn.rawgit.com/mfd/f3d96ec7f0e8f034cc22ea73b3797b59/raw/856f1dbb8d807aabceb80b6d4f94b464df461b3e/gotham.css

<link rel="https://cdn.rawgit.com/mfd/f3d96ec7f0e8f034cc22ea73b3797b59/raw/856f1dbb8d807aabceb80b6d4f94b464df461b3e/gotham.css">

@dannylee8
dannylee8 / git-cheatsheet
Created March 27, 2020 05:33
git-cheatsheet
## Initial configuration
$ git config --global user.name "<your name>"
Sets the user name which will be credited with commit transactions.
$ git config --global user.email "<email addie>"
Sets the email address which will be attached to the commit transactions.
@dannylee8
dannylee8 / VsCode prettier
Created April 9, 2020 01:02
VsCode prettier settings for .vscode/setting.json
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
{
"order": {
"id": 450789469,
"email": "bob.norman@hostmail.com",
"closed_at": null,
"created_at": "2008-01-10T11:00:00-05:00",
"updated_at": "2008-01-10T11:00:00-05:00",
"number": 1,
"note": null,
"token": "b1946ac92492d2347c6235b4d2611184",
@dannylee8
dannylee8 / memoize fn
Created April 11, 2020 04:09
memoize fn
function memoize(fn) {
const cache = {};
return function (...args) {
if (cache[args]) {
return cache[args];
}
const result = fn.apply(this, args);
cache[args] = result;