Capturing my notes about setting up an Oracle 10g XE / Rails environment for development work. Tested using the following versions, others may work as well:
- Ubuntu 11.04
- Ruby 1.9.2
- Rails 3
- Oracle 10 XE
| public class JsonBuilder | |
| { | |
| private readonly StringBuilder _sb; | |
| private readonly Stack<bool> _hasPreviousProperties; | |
| private bool RequiresComma { get { return _hasPreviousProperties.Count > 0 && _hasPreviousProperties.Peek(); } } | |
| public JsonBuilder() { | |
| _sb = new StringBuilder(); |
| If you want to clone an svn repository with git-svn but don't want it to push all the existing branches, here's what you should do. | |
| * Clone with git-svn using the -T parameter to define your trunk path inside the svnrepo, at the same time instructing it to clone only the trunk: | |
| git svn clone -T trunk http://example.com/PROJECT | |
| * If instead of cloning trunk you just want to clone a certain branch, do the same thing but change the path given to -T: | |
| git svn clone -T branches/somefeature http://example.com/PROJECT |
| git diff --no-prefix | sed -e "s/^diff --git [^[:space:]]*/Index:/" -e "s/^index.*/===================================================================/" --ignore-space-at-eol > changes.patch |
| # This is a short collection of tools that are useful for managing your | |
| # known_hosts file. In this case, I'm using the '-f' flag to specify the | |
| # global known_hosts file because I'll be adding many deploy users on this | |
| # system. Simply omit the -f flag to operate on ~/.ssh/known_hosts | |
| # Add entry for host | |
| ssh-keyscan -H github.com >> /etc/ssh/ssh_known_hosts | |
| # Scan known hosts | |
| ssh-keygen -f /etc/ssh/ssh_known_hosts -F github.com |
| # -*- sh-mode -*- | |
| # | |
| ## ZSH PROMPT | |
| # | |
| # {{{ PROMPT SETTINGS | |
| PROMPT_SUBST=1 # Enable prompt expansion | |
| PROMPT_BANG=1 # Enable ! as history event number | |
| PROMPT_PERCENT=1 # Enable % parameter expansion |
| class FullPaths(argparse.Action): | |
| """Expand user- and relative-paths""" | |
| def __call__(self, parser, namespace, values, option_string=None): | |
| setattr(namespace, self.dest, os.path.abspath(os.path.expanduser(values))) | |
| def is_dir(dirname): | |
| """Checks if a path is an actual directory""" | |
| if not os.path.isdir(dirname): | |
| msg = "{0} is not a directory".format(dirname) | |
| raise argparse.ArgumentTypeError(msg) |
| #include <iostream> | |
| #include <iomanip> | |
| // | |
| // Utilities | |
| // | |
| // RETURNS() is used to avoid writing boilerplate "->decltype(x) { return x; }" phrases. | |
| // | |
| // USAGE: auto function(<arguments>) RETURNS(<some-expression>); | |
| // |