Skip to content

Instantly share code, notes, and snippets.

View ihower's full-sized avatar
🎯
Focusing

Wen-Tien Chang ihower

🎯
Focusing
View GitHub Profile
# http://blog.orangeapple.tw/posts/what-is-computational-thinking/
# 設計一個「從0開始慢慢找出X」的流程 (設計演算法),如下:
# 1. 先寫下“輸入=17”、“答案=0”、“位數=1”
# 2. 把“答案”乘以自己,看看有沒有超過“輸入”:
# 2-1. 是:將“答案”減“位數”,跳到第3步
# 2-2. 否:將“答案”加“位數”,跳回第2步
# 3. 看看“答案”乘上“答案”的結果與“輸入”是否相差0.1以內:
# 3-1. 是:跳到第4步
# 3-2. 否:將“位數”除以10,跳回第2步
@ihower
ihower / gist:593611ffa5cedc6d8409
Created April 15, 2015 04:42
ruby rename files
target = "@2x"
Dir.glob("*.png").sort.each do |entry|
if File.basename(entry, File.extname(entry)).include?(target)
newEntry = entry.gsub(target, "")
File.rename( entry, newEntry )
puts "Rename from " + entry + " to " + newEntry
end
end
class Parent
def hi(name)
puts "I'm parent"
puts "Hi, #{name}"
end
end
class Child < Parent
def hi
@ihower
ihower / gist:dec41671245eceff56d1
Last active November 7, 2016 06:20
.bash_profile
alias stree='/Applications/SourceTree.app/Contents/Resources/stree'
alias subl="'/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl'"
function parse_git_dirty {
if [[ $(git status 2> /dev/null | tail -n1) == "nothing to commit, working directory clean" ]]; then
echo "✔ "
else
echo "✘ "
fi
}
@ihower
ihower / gist:96c787ec6870fa54a826
Last active December 11, 2015 11:11
~/.bash_profile
export LC_ALL=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8
export LANG=en-US
export EDITOR=vim
PATH=$HOME/bin:$HOME/.rvm/bin:/usr/local/bin:$PATH # Add RVM to PATH for scripting
function git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return;
[user]
name = Wen-Tien Chang
email = ihower@gmail.com
[alias]
co = checkout
ci = commit
st = status
br = branch -v
rt = reset --hard
l = log --pretty=oneline --abbrev-commit --graph --decorate
<!DOCTYPE html>
<html ng-app>
<head>
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet" type="text/css" />
<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
@ihower
ihower / gist:442a6d6fd968534996b8
Last active April 1, 2021 12:21
ALPHA Camp Web Development Bootcamp #3 Syllabus (draft)
alias s="subl3"
alias x="exit"
export LC_ALL=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8
export LANG='en-US'
export EDITOR="subl"
export GOPATH="/Users/ihower/code/go"
@ihower
ihower / gist:7160400
Last active December 26, 2015 13:39
require 'casting'
require 'benchmark'
require 'delegate'
module Greeter
def hello
%{hello from #{self}}
end
end