Skip to content

Instantly share code, notes, and snippets.

@PhyrexTsai
PhyrexTsai / BFS on Trees.md
Last active April 23, 2016 17:55
BFS on Trees.md

BFS on Trees

Implement bread-first-search, bfs, on trees of type a

data Tree a = Empty | Node a (Tree a) (Tree a) 
							 deriving Show
bfs :: Tree a -> [a]
bfs x = traverse [x]
traverse :: [Tree a] -> [a]  
traverse [] = []
@PhyrexTsai
PhyrexTsai / Proposition normalization.md
Last active April 23, 2016 18:25
Proposition normalization.md

Proposition normalization

The following datatype represents propositions, as in propositional logic. (e.g., P &Q, Not P, …)

data Proposition = Var String
		  	| F
		  	| T
		  	| Not Proposition
		  	| Proposition :|: Proposition --or
@PhyrexTsai
PhyrexTsai / String editing distance.md
Last active April 23, 2016 17:59
String editing distance.md

String editing distance

Motivation: compute the minimal number of changes needed to transform one string into another. Goal: find “cheapest” sequence of editing steps using operations

  • Change a character
  • Copy a character without change
  • Delete a character
  • Insert a character
  • Kill rest of string (delete to end)
@PhyrexTsai
PhyrexTsai / Simple Recursive functions.md
Last active March 14, 2021 16:50
Simple Recursive functions.md

Simple Recursive functions

Implement the well-known power function in two different new ways. The power function takes two arguments n and k and computes nk. Your implementation only has to work for non-negative integer k. The following is a straightforward implementation of this function:

  power :: Int -> Int -> Int
  power n k | k < 0 = error "power: negative argument"
  power n 0 = 1
  power n k = n * power n (k-1)

You will implement two more ways in this part.

##Checkstyle

Introduce

It is a Intellij plugin, helps you to check your code, import, javadoc etc.
[Checkstyle Intellij plugin] (https://github.com/jshiell/checkstyle-idea)

  • Community Edition (14.1.5)
  • Community Edition (15.0.6)
  • Community Edition (2016.1)

Swagger

Swagger is the world's most popular framework for APIs.
[Swagger] (http://swagger.io/)

Intellij plugin install

Install plugin on Intellij.
Under Intellij Preferences->Plugin->Browse repositories...
Search keyword : Swagger Install it and restart Intellij.

Git

3-way-merge

這邊需要透過在 merge 階段整合部分資訊

--

Fast forward

自己先把所有的改動用 rebase 方式把資料都堆疊上去

Zshell

Install zshell

install zshell

brew install zsh

install auto complete

pragma solidity ^0.4.0;
contract BuyNccuCoin {
function buy () returns (bool) {
// buy coin
// 客戶賣回給銀行
// receiver 這邊要放銀行
NccuBank nccuBank = new NccuBank();
if (nccuBank.check() < msg.value) {