Skip to content

Instantly share code, notes, and snippets.

View ldong's full-sized avatar
❤️
Love & Peace

Alan Dong ldong

❤️
Love & Peace
  • Sunnyvale, CA
View GitHub Profile

Coding Conventions

JavaScript

Language

Strict Mode

  • The first line of every file should be 'use strict';. If the file contains a shebang, strict mode should be enabled on the second line.
  • The strict mode directive should be followed by a blank line.
let horse = {age : 10}

function horseAge(str, age){

    const ageStr = age > 5 ? 'old' : 'young';
    return `${str[0]} ${ageStr} at ${age} years`;
}

horseAge`This hourse is ${horse.age}`
@ldong
ldong / vimrc_2018
Created August 18, 2018 01:02
2018 Vimrc
" ==============================================================================
" Author: Alan Dong
" Version: 0.3.5
" Last Modified Date: 8/17/2018
" Description: My Vim Configuration file
" ==============================================================================
" set shell for bash as default
set shell=/bin/bash
@ldong
ldong / zshrc.txt
Created April 29, 2018 04:04
zshrc
# Path to your oh-my-zsh installation.
export ZSH=~/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
# Uncomment the following line to use case-sensitive completion.
@ldong
ldong / cidr.py
Created April 5, 2018 04:17 — forked from lordkebab/cidr.py
Python script to calculate CIDR values
""" Calculate the subnet mask, its binary representation, number of host and
network bits, and the total number of hosts for a given CIDR address.
Usage: python cidr.py [cidr]
Notes: Pipe the command to jq to pretty print the JSON. Python 2 or 3 compatible.
Examples:
python cidr.py 10.0.0.0/24
python cidr.py 172.0.0.0/16 | jq
"""
from __future__ import print_function
@ldong
ldong / README.md
Created March 29, 2018 06:49 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.

OP: @leonardofed founder @ plainflow.


Zip excluding specific directories

Exclude .git file and node_modules directory

$ zip -r9 [target_file] [source_file] -x *.git* node_modules/\*

Exclude .git file and files in node_modules directory, but keep node_modules directory

$ zip -r9 [target_file] [source_file] -x *.git* node_modules/**\*
@ldong
ldong / Alphabets.txt
Created March 21, 2018 07:45
Alphabets
Apple
Boy
Cat
Dog
Egg Elephant
Friend Fish
Girl
Hi Hat
India Ice Cream
Judy
@ldong
ldong / Ember_Expand_Properties_Benchmark_RESULTS.md
Created February 25, 2018 06:57 — forked from nickiaconis/RESULTS.md
Expand Properties Benchmark

$ node index.js
status quo x 183,314 ops/sec ±7.01% (81 runs sampled)
comma fix x 88,004 ops/sec ±5.18% (81 runs sampled)
alternate fix x 88,608 ops/sec ±4.89% (84 runs sampled)
regex match fix x 36,670 ops/sec ±5.04% (83 runs sampled)
iteration fix x 175,519 ops/sec ±5.20% (84 runs sampled)
nested x 88,474 ops/sec ±3.91% (82 runs sampled)

@ldong
ldong / SQL_Syntax.md
Last active February 13, 2018 07:27
SQL Syntax