Skip to content

Instantly share code, notes, and snippets.

@kai101
kai101 / readme.md
Last active March 2, 2018 04:18
Fix certbot braking updates for early 2018

Install certbot

sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install python-certbot-nginx
sudo certbot --authenticator standalone --installer nginx -d www.example.com --pre-hook "service nginx stop;sleep 5;" --post-hook "service nginx start;sleep 5;"

Auto renew cronjob

@kai101
kai101 / setup.md
Last active April 5, 2018 04:07
How to setup a new Mac 2018

MAC setup

This is a simple flows for setting up mac.

Homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

iTerm2

brew cask install iterm2

@kai101
kai101 / express_path_cheatsheat.MD
Created November 20, 2018 03:05
How to set Express Route Path?

How to set Express Route Path?

Express path is a powerfull tools to form simple RESTFULL to complex routing for HTTP request. This document will try to capture all usefull express path.

Common

User ID with numeric number

// example: http://example.com/user/331
'/user/:id(\\d+)'
@kai101
kai101 / hard.md
Last active January 10, 2019 15:23
Problem set

Collection of problem occur along development

  • Redux store with generic reusable component binding.

    • Five generic components with handles to dispatch action.
    • how does reducer know which which component should receive the new action state.
  • Learnt performance impact of redundant rendering when redux refresh.

    • Have more small component connect with store rather than a few giant component connect with store
    • Reduce rerender of many component when one of the reducer change when many small component connected with store.
  • Need flatter architecture for redux to work.
@kai101
kai101 / rect_cool_effect.js
Created February 9, 2019 10:47
this is a cool effects from a website. the variable does not make sense but should in most website.
(function() {
function a(a, b, c) {
return a.getAttribute(b) || c
}
function b(a) {
return document.getElementsByTagName(a)
}
function c() {