Skip to content

Instantly share code, notes, and snippets.

@kpman
kpman / week-2.md
Last active March 7, 2017 13:39 — forked from chentsulin/week-2.md
Week 2 - After class

Week 2

Homework Assignment

繳交方式

  • Deadline: 10/12 中午 12:00
  • 把檔案寄至 chentsulin@gmail.com,標題寫 [作業二/ 電機X XXX] (如果你已經會用 github 也可以寄 repo 連結過來)

1. 寫一個判斷並回傳型別的 function getType

@kpman
kpman / product.js
Created August 28, 2016 05:09 — forked from cybercase/product.js
Python-like itertools.product function in javascript
function product() {
var args = Array.prototype.slice.call(arguments); // makes array from arguments
return args.reduce(function tl (accumulator, value) {
var tmp = [];
accumulator.forEach(function (a0) {
value.forEach(function (a1) {
tmp.push(a0.concat(a1));
});
});
return tmp;
@kpman
kpman / current-dir-in-iterm-tab-title.sh
Last active May 7, 2018 19:54 — forked from phette23/current-dir-in-iterm-tab-title.sh
Set the iTerm tab title to the current directory, not full path.
# put this in your .bash_profile
if [ $ITERM_SESSION_ID ]; then
export PROMPT_COMMAND='echo -ne "\033];${PWD##*/}\007"; ':"$PROMPT_COMMAND";
fi
###########################
# ~/.zshrc
precmd() {
# sets the tab title to current dir