Skip to content

Instantly share code, notes, and snippets.

Branches

Long life

  • master
  • dev

Short life

  • Release branch
alias j10="export JAVA_HOME=`/usr/libexec/java_home -v 10`; java -version"
alias j9="export JAVA_HOME=`/usr/libexec/java_home -v 9`; java -version"
alias j8="export JAVA_HOME=`/usr/libexec/java_home -v 1.8`; java -version"
alias j7="export JAVA_HOME=`/usr/libexec/java_home -v 1.7`; java -version"
@franzwong
franzwong / main.md
Last active July 1, 2018 04:40
Interesting question
  • Joe Celko's SQL for Smarties, 5th Edition

    Chapter 32.1 - Finding Subregions of Size (n)

  • Finding the maximum contiguous sum in an array

sudo openssl req -x509 -nodes \
-days 365 \
-newkey rsa:2048 \
-keyout /etc/ssl/mydomain_com.key \
-out /etc/ssl/mydomain_com.crt \
-subj '/CN=mydomain.com'
@franzwong
franzwong / Sample.elm
Created July 8, 2018 05:34
Send HTTP request with Elm
module Sample exposing (..)
import Html exposing (Html, input, button, div, text, program)
import Html.Events exposing (onInput, onClick)
import Http exposing (post, jsonBody)
import Json.Encode as Encode exposing (..)
import Json.Decode as Decode exposing (Decoder, int, string)
import Json.Decode.Pipeline exposing (decode, required)
import Debug exposing (log)
@franzwong
franzwong / proxy.md
Created July 9, 2018 06:16
Set proxy in mac

Turn on

networksetup -setwebproxy Wi-Fi my-proxy.com 8080
networksetup -setsecurewebproxy Wi-Fi my-proxy.com 8080

Turn off

@franzwong
franzwong / aws-setup.md
Last active October 25, 2018 07:45
Setup aws env

Prerequisite

brew install jq

Setup

# Configuration
@franzwong
franzwong / index.html
Last active November 5, 2018 08:33
Layout
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="build/style.css">
</head>
<body>
<div class="container">
<header class="header">
</header>
<div class="body">
@franzwong
franzwong / head.js
Created November 26, 2018 13:25
Js unit test
function head(x) {
if (typeof x === 'string' && x.length > 0) {
return x.charAt(0)
} else if (Array.isArray(x) && x.length > 0) {
return x[0]
}
return null
}
module.exports = {
@franzwong
franzwong / maybe.js
Created November 26, 2018 13:26
Js Maybe type
const VALUE = Symbol('Value');
class Container {
constructor(x) {
this[VALUE] = x
}
map(f) {
return f(this[VALUE]);
}