Skip to content

Instantly share code, notes, and snippets.

View kafaichoi's full-sized avatar
🍃

KaFai kafaichoi

🍃
View GitHub Profile
@kafaichoi
kafaichoi / js-tips.md
Last active May 30, 2017 06:16
JS Tips
// Using proxy in redux action.
const types = {
  FETCH_FILE_REQUEST: 'fetch_file_request',
  FETCH_FILE_SUCCESS: 'fetch_file_success',
  FETCH_FILE_FAIL: 'fetch_file_fail'
}

const typeValidator = {
 get(obj, prop) {
It's consisted of encoder and decoder.
Encoders(Autoencoders) are networks(unsuperprised learning, feed-forward), which try to reconstruct their own input
(reproduct input as output). You construct the network so that it reduces the input size by using one or more hidden layers,
until it reaches a reasonably small hidden layer in the middle. As a result your data has been compressed (encoded) into
a few variables. From this hidden representation the network tries to reconstruct (decode) the input again.
In order to do a good job at reconstructing the input the network has to learn a good representation of the data in
the middle hidden layer. This can be useful for dimensionality reduction, or for generating new “synthetic” data
from a given hidden representation.
stack install hakyll
hakyll-init my-site
cd my-site
stack init  # creates stack.yaml file based on my-site.cabal
stack build
stack exec site build #create _site(HTML&asset, ready to be deployed), _cache(used by Hakyll)

stack exec site watch # preview and now go to localhost:8000
@kafaichoi
kafaichoi / haskell-programming-book-note.md
Last active August 6, 2017 10:00
Haskell Programming

Ch14 Testing

Unit Testing & Propoerty Testing

Property Testing

Propety tests test the formal propoerties of programs.

Ch15 Monoid

In Haskell, we recognize abstract pattern in code which have well-defined, lawful representation in math. These abstractions is described as algebra, by which we mean operations and the set(the type they operate on) they operate over.

## Way of presenting idea
- Flowcharts
- Pseudocode
- Math Model
## Complexity
Time Complexity.
Memory Complexity
## Strategy
@kafaichoi
kafaichoi / note-elixir-otp-abstraciton.md
Created August 16, 2017 05:10
Note on Elixir New OTP Abstraction

Process

Process is the concurrency primitive in ErlangVM To have State, we need server process which basically a recursive function call to keep it alive.

Agent

Simple wrapper around state. Keep state.

{:ok, agent} = Agent.start_link fn -> [] end
- install kerl
- install wxmac `brew install wxmac`
- add ~/.kerlrc `echo "KERL_CONFIGURE_OPTIONS="--disable-debug --without-javac --enable-shared-zlib --with-ssl=/usr/local/opt/openssl --enable-hipe --enable-smp-support --enable-threads --enable-kernel-poll --with-wx"" > ~/.kerlrc`
- kerl build 20.0 20.0
- kerl install 20.0 ~/erlang/erlang_20_0
- add this `~/erlang/erlang_20_0` to ~/.zshrc
@kafaichoi
kafaichoi / elixir-phoenix-note.md
Last active August 25, 2017 10:19
Elixir Phoenix Note

Elixir = Ruby + Erlang + Clojure

Ruby: Developer Happiness Erlang: OTP Powerful Clojure: One of the best designed language. Elixir: Programmer focused, functional but pragmatic, standard toolset

Elixir Design priniciples

  1. Phoenix is not our application. Phoenix 1.3 is just web interface.
  2. Embrace state outside of the database. process holding state. OK to have stateful server
  3. If it's concurrent, extract it into an OTP application.
@kafaichoi
kafaichoi / learning-clojure.md
Created September 14, 2017 06:38
Learning Clojure

Ring

  • Adapater Http Request -> Ring Request Ring Resposne -> Http Response
  • Handler Ring Request -> Http Response Basically clojure function
(defn handler [req]
  {:status: 200