Skip to content

Instantly share code, notes, and snippets.

@tjogin
tjogin / README.md
Created September 5, 2011 06:56 — forked from rodrigorm/README.md
Configuration file to use PHP with Ruby rack

Installation

First you need php-cgi, i used brew with Formula below:

$ curl -O https://raw.github.com/gist/1194269/7ae1709453a8a19ce9c030bf41d544dd08d96d85/php.rb
$ mv php.rb `brew --prefix`/Library/Formula
$ brew install php --with-mysql

Second, install this ruby gems:

// containers vs components, a component cannot use anything not passed in via props,
// and can only communicate via callbacks passed via props
// Approach: one provider per data
<GameDataProvider gameId={this.props.gameId}>
{gameData =>
<GameProvider gameId={this.props.gameId}>
{game =>
<ServerListContainer query={this.props.query}>
{servers =>
@tjogin
tjogin / rackup.ru
Created June 9, 2011 06:00
Simple rack server
class Server
@@mime_types = { :txt => 'text/plain', :js => 'application/x-javascript', :css => 'text/css' }
def call(env)
file = file_name env["REQUEST_PATH"]
if File.exists? file
[200, { 'Content-Type' => mime_type_for_file(file) }, [ File.read(file) ] ]
else
[404, { 'Content-Type' => 'text/html' }, []]
end
@tjogin
tjogin / colors.sh
Created June 8, 2011 17:30
Bash colors
DULL=0
BRIGHT=1
FG_BLACK=30
FG_RED=31
FG_GREEN=32
FG_YELLOW=33
FG_BLUE=34
FG_VIOLET=35
FG_CYAN=36
@tjogin
tjogin / .git-completion.sh
Created June 8, 2011 17:31
Bash git completion
#!bash
#
# bash completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
@tjogin
tjogin / .bash_profile
Created June 8, 2011 17:30
.bash_profile
source ~/.bashrc
source ~/.git-completion.sh
source ~/.colors.sh
GIT_PS1_SHOWDIRTYSTATE=1
if [ "\$(type -t __git_ps1)" ]; then
#PS1="\h:\w \$(__git_ps1 '(%s)')$"
GIT_BRANCH="${BRIGHT_CYAN}\$(__git_ps1 '(${CYAN}%s${BRIGHT_CYAN})')${NORMAL}"
PS1="${WHITE}\h:\w $GIT_BRANCH \$ ${RESET}"