Skip to content

Instantly share code, notes, and snippets.

View nickccm1122's full-sized avatar
🇭🇰
Searching...

Nick Chan nickccm1122

🇭🇰
Searching...
View GitHub Profile
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@nickccm1122
nickccm1122 / mac_installation.sh
Last active April 27, 2023 15:49
Mac installation
#!/bin/bash
# set firmware password
# sudo firmwarepasswd -setpasswd -setmode command
# Disable the Character Accent Menu and Enable Key Repeat
defaults write -g ApplePressAndHoldEnabled false
# Prevent generate .DS_Store
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
@nickccm1122
nickccm1122 / ubuntu_16.04_setup_part_1.sh
Last active November 22, 2017 09:44
run part 1->logout->login-> run part2
add-apt-repository ppa:fkrull/deadsnakes
apt-get update
apt-get install build-essential python2.7
# install git
apt-get install git -y
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.cm commit
git config --global alias.st status
@nickccm1122
nickccm1122 / 6_mar_2018_k8s_workshop_notes.md
Created March 7, 2018 09:46 — forked from foray1010/6_mar_2018_k8s_workshop_notes.md
6 Mar 2018 - Kubernetes (k8s) workshop notes

6 Mar 2018 - Kubernetes (k8s) workshop notes

workshop github guideline: https://github.com/aws-samples/aws-workshop-for-kubernetes

if you wanna follow the guideline, make sure you:

  1. setup cloud9, follow the instructions under the heading: Create AWS Cloud9 Environment
  2. setup Kubernetes multi master cluster, follow the instructions under the heading: Create a Kubernetes Cluster with kops and Kubernetes Cluster Context. Suggest to create a multi-master cluster as the examples will be easier to follow.

Concepts

  1. Pod
@nickccm1122
nickccm1122 / .awless_autocompletion
Last active March 9, 2019 06:56
awless autocompletion clone
__awless_bash_source() {
alias shopt=':'
alias _expand=_bash_expand
alias _complete=_bash_comp
emulate -L sh
setopt kshglob noshglob braceexpand
source "$@"
}
__awless_type() {
@nickccm1122
nickccm1122 / my-alias.sh
Last active July 21, 2019 11:05
My zsh aliases setting
#!/usr/bin/sh
# check if the alias exists
# TODO: need to excape string input in the 2nd arg
setalias() {
if alias $1 2>/dev/null; then
cmd="$1='$2'"
eval "alias $cmd"
else
echo "$1 has been set alias..."

Understanding Immutable.Record

Functional programming principles and with it immutable data are changing the way we write frontend applications. If the recent de-facto frontend stack of React and Redux feels like it goes perfectly together with immutable data, that's because it's specifically designed for that.

There's several interesting implementations of immutable data for JavaScript, but here I'll be focusing on Facebook's own Immutable.js, and specifically on one of its lesser known features, Records.

Why Records?

Immutable.js provides a beautiful, Clojure-inspired API for dealing with abstract Collections and Sequences, and several concrete data structur

@nickccm1122
nickccm1122 / createCarRecord.js
Last active February 21, 2019 03:30
Create Nested Immutable Record with full type support
// @flow strict
/**
* Purpose: convert object
* {
* name: 'Andrew',
* email: 'andrew@gmail.com',
* car: {
* type: 'Ford',
* cost: 10,
@nickccm1122
nickccm1122 / nodemon.json
Created March 5, 2019 15:27
nodemon.json
{
"restartable": "rs",
"verbose": true,
"env": {
"NODE_ENV": "development"
},
"ext": "js,json,yaml,yml",
"ignore": [
"**/__fixtures__/**",
"**/__mocks__/**",
@nickccm1122
nickccm1122 / .gitconfig
Created March 17, 2019 17:10 — forked from pksunkara/config
Sample of git config file (Example .gitconfig)
[user]
name = Pavan Kumar Sunkara
email = pavan.sss1991@gmail.com
username = pksunkara
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[sendemail]
smtpencryption = tls