Skip to content

Instantly share code, notes, and snippets.

View wongjiahau's full-sized avatar

WJH wongjiahau

  • Malaysia
View GitHub Profile
@wongjiahau
wongjiahau / Main.hs
Created February 15, 2019 05:17
TeachingHaskell-Exercise 1-Answer
data Shape
= Circle Float
| Square Float
| Rectangle Float Float
| Null
deriving (Show)
main :: IO ()
main = do
-- Read contents from shape.txt
@wongjiahau
wongjiahau / main.hs
Created February 14, 2019 10:36
Simple Type Inference System in Haskell
import qualified Data.Map.Strict as Map
import Data.List
-- This implementation is based on https://medium.com/@dhruvrajvanshi/type-inference-for-beginners-part-1-3e0a5be98a4b
data Expression
= EInt
Int -- value
| EVar
String -- name
@wongjiahau
wongjiahau / shape.txt
Created February 13, 2019 07:39
Data of shapes
NULL
Circle 5
Rectangle 3 4
Circle 3
Rectangle 8 1
Square 5
NULL
Rectangle 6 0
NULL
Square 8
@wongjiahau
wongjiahau / hi.ts
Created December 11, 2018 07:00
aeon admin portal endpoint
import { Endpoint } from "../../src/lib/DiloServer";
/**
* Common response code
* 401 - Request body error
* 500 - Internal server error
*/
const LIST_OF_PERMISSIONS = {
"1100": true, // User management
@wongjiahau
wongjiahau / exercise.js
Last active December 5, 2018 04:06
Filter Map Reduce Exercise
let xs = [1,2,3,4,5,6,7,8,9,10]
// Q1. Take only the number that is more than 5
// Q2. Multiply each number by 5
// Q3. Add all numbers together
let people = [
replace with : (String , String , String) -> String
x replace y with z =
'a List :> nil
'a List :> 'a head ; 'a
x = 1 head ; 1 ; 2 ; 3 ; 4
@wongjiahau
wongjiahau / react-native-practical-4-answer (async storage)
Last active September 20, 2018 09:57
React Native Async Storage Example
import React, { Component } from "react";
import {
AsyncStorage,
View,
TextInput,
Picker,
Text,
Button
} from "react-native";
git init
npm init
mkdir ts
cd ts
tsc --init
tslint --init
touch app.ts
[data-tippy][data-tippy-pos]::after,[data-tippy][data-tippy-pos]::before{top:auto;left:auto;margin-top:auto;transform:none}:root{--background-color:#000;--color:#fff;--timing:150ms}[data-tippy]{position:relative}[data-tippy]::after,[data-tippy]::before{position:absolute;display:block;opacity:0;font-family:sans-serif;transform:translate(-50%,0);transform-origin:top;top:100%;left:50%;pointer-events:none}[data-tippy]::before{content:attr(data-tippy);color:var(--color);font-size:14px;background-color:var(--background-color);z-index:1;padding:3px 6px;border-radius:3px;white-space:nowrap;margin-top:10px;font-weight:400}[data-tippy]::after{content:'';border:5px solid transparent;border-bottom-color:var(--background-color)}[data-tippy]:hover::after,[data-tippy]:hover::before{transform:translate(-50%,0);opacity:1}[data-tippy][data-tippy-pos]::after{border-bottom-color:transparent}[data-tippy][data-tippy-pos=up]::after,[data-tippy][data-tippy-pos=up]::before,[data-tippy][data-tippy-pos=down]::after,[data-tippy][data-ti
@wongjiahau
wongjiahau / gist:557defb6dfeff811cc446759bd11f536
Last active October 15, 2017 14:53
My gitconfig file (gitrc)
[http]
sslCAInfo = C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
[diff "astextplain"]
textconv = astextplain
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %
required = true
process = git-lfs filter-process
[credential]