Skip to content

Instantly share code, notes, and snippets.

@bennyng
bennyng / Dockerfile
Created March 10, 2021 05:47
Dockerfile for go http serving static html built by svelte
# stage 0 - build html
FROM node:14.4-alpine AS html
WORKDIR /app
COPY ./package-lock.json ./package.json ./
RUN npm ci
COPY . .
RUN npm run build
@bennyng
bennyng / go_http_embed_static.go
Last active March 10, 2021 09:18
simple go http serving embedded static assets
package main
import (
"embed"
"log"
"net/http"
)
//go:embed _app/* font/* img/*
//go:embed favicon.ico
@bennyng
bennyng / Dockerfile
Created May 24, 2020 07:09
Dockerfile for NestJS (non optimized)
FROM node:13.14-alpine
WORKDIR /usr/src/app
COPY yarn.lock ./
COPY package.json ./
RUN yarn install --frozen-lockfile
COPY . .
@bennyng
bennyng / Dockerfile
Created May 24, 2020 07:08
Dockerfile for NestJS (optimized with multi-stage)
# build image - create nest production build
FROM node:13.14-alpine AS build
WORKDIR /app
COPY yarn.lock package.json ./
RUN yarn install --frozen-lockfile
COPY . .
@bennyng
bennyng / main.dart.js
Created September 14, 2019 07:31
Flutter web main.dart.js
(function() {
var _currentDirectory = (function () {
var _url;
var lines = new Error().stack.split('\n');
function lookupUrl() {
if (lines.length > 2) {
var match = lines[1].match(/^\s+at (.+):\d+:\d+$/);
// Chrome.
if (match) return match[1];
// Chrome nested eval case.
@bennyng
bennyng / paydollar_prc_src_messages.rb
Created October 30, 2013 09:20
Paydollar documentation is rubbish. even copy and paste from the documentation does not work. hope that it is useful to anyone of you dealing with Paydollar responses. Enjoy ~
ALL_PRC_SRC_MESSAGES = {
"1"=> {
"01"=> "Bank Decline",
"02"=> "Bank Decline",
"03"=> "Other",
"04"=> "Other",
"05"=> "Bank Decline",
"12"=> "Other",
"13"=> "Other",
"14"=> "Input Error",