Skip to content

Instantly share code, notes, and snippets.

View roylee0704's full-sized avatar
🧘‍♂️

roylee0704

🧘‍♂️
  • Bangkok, Thailand
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@roylee0704
roylee0704 / docker-compose.yml
Last active September 23, 2020 04:56
1. Setup Terraform Backends
version: "3.8"
services:
# service name to run in docker-compose command
terraform:
image: hashicorp/terraform:0.13.3
# map all files under host dir './aws' to container dir '/infra'
volumes:
- ./aws:/infra
@roylee0704
roylee0704 / machine.js
Last active July 30, 2020 10:48
Generated by XState Viz: https://xstate.js.org/viz
const daikinMachine = Machine({
id: 'daikin',
initial: 'AwaitingPayment',
context: {
retries: 0
},
states: {
AwaitingPayment: {
on : {
RECEIVE_PAYMENT: 'Open'
error 7/22/20, 05:04 - [IPay88Api] {
"exchangeId": "cc002e71-8501-468b-8992-90f772dd975b",
"root": {
"Envelope": {
"Body": {
"Fault": {
"faultcode": "a:DeserializationFailed",
"faultstring": {
"attributes": {
"xml:lang": "en-US"
@roylee0704
roylee0704 / 📊 Weekly development breakdown
Last active April 13, 2024 00:13
📊 Weekly development breakdown
TypeScript 7 hrs 7 mins ███████████████░░░░░░ 71.6%
SQL 1 hr 8 mins ██▍░░░░░░░░░░░░░░░░░░ 11.4%
Other 30 mins █░░░░░░░░░░░░░░░░░░░░ 5.1%
JSON 28 mins ▉░░░░░░░░░░░░░░░░░░░░ 4.8%
Python 26 mins ▉░░░░░░░░░░░░░░░░░░░░ 4.5%
@roylee0704
roylee0704 / html2pdf.js
Created July 5, 2020 14:31 — forked from antfu/html2pdf.js
HTML to PDF
import puppeteer from 'puppeteer'
import fs from 'fs'
async function buildPDF(htmlString) {
const browser = await puppeteer.launch({ headless: true })
const page = await browser.newPage();
await page.setContent(htmlString, { waitUntil: 'networkidle0' })
const pdf = await page.pdf({
format: 'A4',
displayHeaderFooter: false,
@roylee0704
roylee0704 / shipping-rate.dto.ts
Created March 29, 2020 05:09
shipping rate result
import { Field, ObjectType } from 'type-graphql';
@ObjectType('ShippingRate', {
description:
'A shipping rate to be applied to an order.',
})
export class ShippingRateDto {
@Field({
description: 'The name of the carrier, which customers see at checkout',
@roylee0704
roylee0704 / malaysia.ts
Created March 22, 2020 09:32
proposal: countries/states under countries dir
import { Country } from './country.interface';
import { State } from './state.interface';
export class Malaysia implements Country {
constructor(public readonly code = 'MY', public readonly name = 'Malaysia', public readonly states: State[] = [
new Perlis(),
new Kedah(),
new Penang(),
new Kelantan(),
new Terengganu(),
@roylee0704
roylee0704 / carriers.js
Created March 22, 2020 09:19
proposal: data-structure of carrier providers
export const carriers = [
{
name: 'Ninja Van',
code: 'ninja_van',
services: [
{
name: 'Standard Delivery',
code: 'ninja_standard_delivery',
zones: [
{
"data": {
"item1": {
"inventoryLevel": {
"available": 25
},
"userErrors": []
},
"item2": {
"inventoryLevel": {