Skip to content

Instantly share code, notes, and snippets.

View chichunchen's full-sized avatar

Chi-Chun, Chen chichunchen

  • HPE/Cray
  • Minnesota
View GitHub Profile
@chichunchen
chichunchen / Basketball ScoreBox
Created September 20, 2014 13:12
Basketball-Box Database association
team.rb
class Team < ActiveRecord::Base
validates :name, :presence => true
has_many :players
has_many :games
end
----------------------------------------------------
@chichunchen
chichunchen / sublime text 3 tweak
Last active August 29, 2015 14:07
sublime text 3 called in mac terminal
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/sublime
# Environment: MacOSX 10.9, 10.10 & SublimeText3 Build3065
@chichunchen
chichunchen / .bash_profile
Last active August 29, 2015 14:07
Bash Profile in my mac
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
# --------------------------
In the Terminal, use:
- Shift + Fn Up for PageUp,
- Shift + Fn Down for PageDown,
- Shift + Fn Left for Home,
- Shift + Fn Right for End
" 補齊括弧
" 語法
" inoremap triger_char mapping_str
" 映射指令 觸發字元 映射字串
"
" 註:<LEFT> 為向右鍵字元
inoremap ( ()<LEFT> "小括號補齊,並將輸入游標左移一個字元
inoremap [ []<LEFT> "中括號補齊,並將輸入游標左移一個字元
inoremap { {}<LEFT> "大括號補齊,並將輸入游標左移一個字元
@chichunchen
chichunchen / .tmux.conf
Last active August 29, 2015 14:07
Tmux Configuration
set -g default-terminal "screen-256color"
# Our .tmux.conf file
# Setting the prefix from C-b to C-a
# START:prefix
# END:prefix
# Free the original Ctrl-b prefix keybinding
# START:unbind
unbind C-b
# END:unbind
@chichunchen
chichunchen / .vimrc
Last active August 29, 2015 14:07
Vim configuration
" Version:
" 5.0 - 29/05/12 15:43:36
"
" Blog_post:
" http://amix.dk/blog/post/19691#The-ultimate-Vim-configuration-on-Github
"
" Awesome_version:
" Get this config, nice color schemes and lots of plugins!
"
" Install the awesome version from:
@chichunchen
chichunchen / qt_config
Last active August 29, 2015 14:07
C++ notes
// qt confit in yosemite
Qt/5.3/clang_64/mkspecs
vim qdevice.pri: macosx10.10
Compiling:
Pthread:
In Mac: g++ -o name name.c (the same as non-pthread program)
In Ubuntu: g++ -o name name.c -lpthread
OpenMP:
@chichunchen
chichunchen / dyc_arr.cpp
Created November 4, 2014 08:41
C++ dynamic allocate
int* a = NULL; // Pointer to int, initialize to nothing.
int n; // Size needed for array
cin >> n; // Read in the size
a = new int[n]; // Allocate n ints and save ptr in a.
for (int i=0; i<n; i++) {
a[i] = 0; // Initialize all elements to zero.
}
. . . // Use a as a normal array
delete [] a; // When done, free memory pointed to by a.
a = NULL; // Clear a to prevent using invalid memory reference.