Skip to content

Instantly share code, notes, and snippets.

View ben196888's full-sized avatar

Ben Liu ben196888

  • Agoda
  • Bangkok
View GitHub Profile
@ben196888
ben196888 / fullstack.md
Created September 10, 2023 03:19
Fullstack @ Openstartervillage

Coding

Common

  • git

Client side

  • javascript + react (in progress)
  • typescript
@ben196888
ben196888 / cheatsheet.md
Last active September 7, 2023 09:47
Typescript to Scala cheatsheet

Scala cheatsheet for typescript developers

Variable

// typescript
const str: string = ""
let count: number = 0
@ben196888
ben196888 / Bangkok.md
Last active March 14, 2023 09:40
Bangkok recommendation

Bangkok

Stay

Riverside

  • Hilton
  • Anantara Riverside Bangkok Resort

MRT/BTS junction

Dinner

Prepare all the food in Jae standard - no 5 heaty vegetables.

Egg and milk is eligible.

Seperate the 5 heaty vegetable on the side if the dish includes any.

Please serve all dishes at once, except the dessert. The dessert will be ordered at the site.

Abu learning plan

Client side project deployment

CI

Lint + Unit test on Gitlab

CD

const SCALE = 1000;
const rounds = 10;
// Standard Normal variate using Box-Muller transform.
function randn_bm() {
let u = 0, v = 0;
while(u === 0) u = Math.random(); //Converting [0,1) to (0,1)
while(v === 0) v = Math.random();
let num = Math.sqrt( -2.0 * Math.log( u ) ) * Math.cos( 2.0 * Math.PI * v );
num = num / 10.0 + 0.5; // Translate to 0 -> 1

Promise Expression

A String expression of the Promise chain.

Promise Methods

Mapping promise methods to a string expression.

Criteria

Pipeline would always pass the result to the down stream.

#!/bin/bash
set -euo pipefail
# Install nodejs and npm
curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -
sudo yum install -y -q nodejs
# Install yarn
curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
sudo rpm --import https://dl.yarnpkg.com/rpm/pubkey.gpg