Skip to content

Instantly share code, notes, and snippets.

View philipjkim's full-sized avatar

Soo Philip Jason Kim philipjkim

View GitHub Profile
@philipjkim
philipjkim / PlusSpec.scala
Created July 9, 2012 14:17
Specs2 sample which is runnable in Eclipse JUnit
import org.junit.runner.RunWith
import org.specs2.mutable.Specification
import org.specs2.runner.JUnitRunner
@RunWith(classOf[JUnitRunner])
class PlusSpec extends Specification {
"plus operator" should {
"return sum of two numbers" in {
5 must equalTo(2 + 3)
}
@philipjkim
philipjkim / IntegrationTests.java
Created July 11, 2012 00:55
Test class for executing all integration tests (unit tests excluded)
import org.junit.extensions.cpsuite.ClasspathSuite;
import org.junit.extensions.cpsuite.ClasspathSuite.ClassnameFilters;
import org.junit.runner.RunWith;
@RunWith(ClasspathSuite.class)
@ClassnameFilters({".*IntegrationTest"})
public class IntegrationTests {
}
@philipjkim
philipjkim / test.js
Created July 23, 2012 13:31
Simple nodeunit example
exports.addition = function(test){
test.same(2 + 3, 5);
test.done();
};
@philipjkim
philipjkim / gist:3224895
Created August 1, 2012 08:17
Check if an object is an array
var isArray = function(o){
return Object.prototype.toString.call(o) === '[object Array]';
};
console.log(isArray(['Soo', 'Philip', 'Kim'])); // true
console.log(isArray({first: 'Soo', middle: 'Philip', last: 'Kim'})); // false
@philipjkim
philipjkim / Cakefile
Created August 3, 2012 07:55
Cakefile Skeleton
{exec} = require 'child_process'
task 'test', ->
cmd = 'ls'
options = '-lrt'
exec "#{cmd} #{options}", (err, stdout, stderr) ->
console.log err if err
console.log stdout
@philipjkim
philipjkim / test_couchbaseclient.rb
Created August 8, 2012 05:57
Simple set/get test using Ruby Couchbase client
require 'couchbase'
c = Couchbase.connect(:hostname => 'hostname',
:port => 8091,
:pool => 'default',
:bucket => 'bucket',
:username => 'bucket',
:password => 'password')
c.run do |conn|
@philipjkim
philipjkim / ssh_without_password.rb
Created September 11, 2012 08:09
Enables SSH connection without password authentication
#!/usr/bin/env ruby -w
unless ARGV[0]
puts 'Please input USERNAME@HOSTNAME for the argument.'
exit
end
pwd = `echo ~`.strip
key_file = "#{pwd}/.ssh/id_rsa.pub"
unless File.exists?(key_file)
[user]
name = Soo P.J. Kim
email = [email protected]
[color]
branch = auto
diff = auto
interactive = auto
status = auto
[core]
editor = /usr/bin/vim
@philipjkim
philipjkim / .bash_profile
Last active December 16, 2015 08:49
bash profile (customized prompt with git info.)
alias ll='ls -alG'
source /Users/pj/.rvm/scripts/rvm
source ~/.git-prompt.sh
GIT_PS1_SHOWDIRTYSTATE="true"
GIT_PS1_SHOWUNTRACKEDFILES="true"
GIT_PS1_SHOWUPSTREAM="verbose"
PS1='$(__git_ps1 " (%s) ")\[\033[35m\]\t\[\033[m\]-\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\n\$ '
export TERM=xterm-256color
export SVN_EDITOR=/usr/bin/vim
@philipjkim
philipjkim / gist:6112150
Last active December 20, 2015 09:59
Slight color changes to aussiegeek.zsh-theme in oh-my-zsh
PROMPT='$FG[254][$FG[026]%t$FG[254]]$FG[035]%n@%~$(git_prompt_info)$FG[208]$(rvm_prompt_info)$reset_color
$ '
# git theming
ZSH_THEME_GIT_PROMPT_PREFIX="$FG[255]("
ZSH_THEME_GIT_PROMPT_SUFFIX=")"
ZSH_THEME_GIT_PROMPT_CLEAN="✔"
ZSH_THEME_GIT_PROMPT_DIRTY="✗"