Skip to content

Instantly share code, notes, and snippets.

View tofuninjah's full-sized avatar
🖤

Chung Kang tofuninjah

🖤
View GitHub Profile
@tofuninjah
tofuninjah / .bash_profile
Last active December 17, 2015 23:19
Macbook Pro Retina .bash_profile
export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
# @terminal:
# curl -o ~/.git-prompt.sh \
# https://raw.github.com/git/git/master/contrib/completion/git-prompt.sh
source ~/.git-prompt.sh
@tofuninjah
tofuninjah / gist:10746043
Last active August 29, 2015 13:59
Example of three types of Fixtures in Jasmine
/*
* fragment.html
* <ul class="fragment">
* <li>Add some data.</li>
* </ul>
*/
/*
* read, set (also have sandbox for your convienience, loadFixtures
*/
@tofuninjah
tofuninjah / spies
Last active August 29, 2015 13:59
Jasmine - Spying on a method and callThrough()
/* in root/public/javascripts/scripts.js */
var myObj = {
someMethod: function(){
$.get('someFile.html', function(data){
return data;
});
}
};
/* in root/spec/javascripts/spiesSpec.js */
@tofuninjah
tofuninjah / usbcopy
Last active August 29, 2015 14:01
Copy USBs
#!/bin/bash
SRC="/Users/chungkang/MASTER/"
VRENAME="UH GUIDE"
if [ -d /Volumes/NO\ NAME ]
then
for USB in /Volumes/NO\ NAME*
do
echo "$USB: Starting"
rm -rf "$USB" 2> /dev/null
rsync -azv --rsh=ssh user@example.org:/home/user/www ~/backups/example.org_user/
#The preceding command uses SSH to copy the files in /home/user/www on example.org to a backup directory in your home directory #on your local machine.
@tofuninjah
tofuninjah / kill
Created May 14, 2014 02:07
Group all processes to kill
# get all process with name of 'chrome'
ps -ef | grep chrome
# output something like: 501 13161 2006 0 7:46AM ttys001 0:00.00 grep chrome
# Now Kill it!
kill -9 13161
@tofuninjah
tofuninjah / findandreplace
Created May 14, 2014 02:08
Find and Replace
replace design with dezine.... in all *.htm..
In current directory.
perl -pi -e 's/design/dezine/g' *.htm
ex:
perl -pi -e 's/uhmap.displayShortNames\(this\)\;/ /g' *.php
@tofuninjah
tofuninjah / cakephp-mock-email-helper
Created July 1, 2014 17:44
cakephp mock email helper
http://stackoverflow.com/questions/12712865/use-a-different-email-config-during-unit-testing-in-cakephp
@tofuninjah
tofuninjah / sublime-packages-installed
Last active March 16, 2016 20:45
Sublime Packages and settings that I've installed
// In Preferences: Set to true to removing trailing white space on save
"trim_trailing_white_space_on_save": true,
JSlint
CSSLint
JSONLint
PHPUnit
Stylus
CakePHP
Color Highlighter
@tofuninjah
tofuninjah / git-stuff.txt
Last active August 29, 2015 14:06
global git settings and commands
# Easier to read
git log --graph --oneline
git config --global core.editor "subl -n -w"
git config --global push.default upstream
git config --global merge.conflictstyle diff3
# Have different colors when using git
git config --global color.ui auto