Skip to content

Instantly share code, notes, and snippets.

View williamn's full-sized avatar

William williamn

  • Jakarta, Indonesia
View GitHub Profile
@williamn
williamn / .bashrc
Created November 29, 2011 08:10
Command line feedback from rvm and git
# http://collectiveidea.com/blog/archives/2011/08/02/command-line-feedback-from-rvm-and-git/
#
export PS1="\[\033[01;34m\]\$(~/.rvm/bin/rvm-prompt) \[\033[01;32m\]\w\[\033[00;33m\]\$(__git_ps1 \" (%s)\") \[\033[01;36m\]\n$\[\033[00m\] "
@williamn
williamn / install-gem-mysql.bat
Created January 3, 2012 10:36
Install gem mysql on Windows
gem install mysql --platform=ruby -- --with-mysql-include=C:\xampplite\mysql\include --with-mysql-lib=C:\xampplite\mysql\lib\opt
@williamn
williamn / .screenrc
Created February 1, 2012 08:47
Screen configuration
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c %{g}]'
shell -${SHELL}
screen -t shell1 0
screen -t shell2 1
@williamn
williamn / .gitconfig
Created May 23, 2012 01:17 — forked from josegonzalez/.gitconfig
~/.gitconfig
[user]
name = MY_NAME
email = MY_EMAIL_ADDRESS
[git-tmbundle]
gitnub-path = /Applications/GitNub.app
gitx-path = /Applications/GitX.app
show-diff-check = yes
[github]
user = GITUB_USER
token = GITHUB_TOKEN
@williamn
williamn / devise.id.yml
Created May 23, 2012 06:30 — forked from yulrizka/devise.id.yml
Devise translation for Bahasa Indonesia
id:
errors:
messages:
not_found: "tidak ditemukan"
already_confirmed: "sudah di konfirmasi"
not_locked: "tidak dikunci"
devise:
failure:
unauthenticated: 'Anda harus mendaftar atau sign in sebelum melanjutkan .'
@williamn
williamn / gist:2894205
Created June 8, 2012 07:24 — forked from JonathanTron/gist:361875
Steps to mirror a Git repository
# go to your repository
cd my_project
# check your existing remote
git remote -v
# origin [email protected]:my_project.git (fetch)
# origin [email protected]:my_project.git (push)
# Add a new remote, a github.com private repository for example
# the --mirror flag is what's different from a simple new remote
#!/usr/bin/env perl
# Finds duplicate adjacent words.
use strict ;
my $DupCount = 0 ;
if (!@ARGV) {
print "usage: $0 <file> ...\n" ;
@williamn
williamn / .bash_profile
Created October 2, 2012 07:10
dot files
PATH="/usr/local/bin:$PATH"
if [ -f `brew --prefix`/etc/bash_completion.d/git-prompt.sh ]; then source `brew --prefix`/etc/bash_completion.d/git-prompt.sh; fi # for Git completion
export PS1="\[\033[01;34m\]\$(rbenv version-name) \[\033[01;32m\]\w\[\033[01;35m\]\$(__git_ps1 \" (%s)\") \[\033[01;36m\]\$\[\033[00m\] "
@williamn
williamn / MyCustomHelper.php
Created October 20, 2012 06:01
CakePHP - avoid HTML tags in your helper
<?php
class MyCustomHelper extends AppHelper {
public function sayMessage($name) {
$view = new View;
return $view->element('path/to/element', array('name' => $name));
}
}
@williamn
williamn / itertools_example.py
Created February 1, 2013 23:32
Along with the collections library python also has a library called itertools which has really cool efficient solutions to problems. One is finding all combinations. This will tell us all the different ways the teams can play each other.
from itertools import combinations
teams = ["Packers", "49ers", "Ravens", "Patriots"]
for game in combinations(teams, 2):
print game
# => ('Packers', '49ers')
# => ('Packers', 'Ravens')
# => ('Packers', 'Patriots')
# => ('49ers', 'Ravens')