This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require 'nokogiri' | |
| src =<<EOD | |
| <wrapper xmlns="ns" xmlns:extra="extra"> | |
| <record xml:id="r1"> | |
| <field>aaa</field> | |
| <field extra:type="second">bbb</field> | |
| </record> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| digraph G { | |
| label = "Enterprise" | |
| rankdir = "TB"; | |
| node [ shape="Mrecord" ] | |
| edge [ color="#555555"; dir="back"] | |
| subgraph cluster_1 { | |
| label = "Region: 1" | |
| color = "#000000" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [alias] | |
| st = status | |
| br = branch | |
| co = checkout | |
| cat = show | |
| #origin = !sh -c 'git remote add -t ${2:-master} -m ${2:-master} ${1:-origin} ${0}' | |
| prune = fetch --prune | |
| #amend keeping the same comment | |
| amend = !git log -n 1 --pretty=tformat:%s%n%n%b | git commit -F - --amend | |
| # add file to .gitignore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| create table windowing_example (id int, counter int); | |
| -- id is the common component of the rows | |
| -- counter is the timestamp / other id where ordering is introduced | |
| insert into windowing_example(id, counter) values | |
| (1, 1), | |
| (1, 2), | |
| (1, 3), | |
| (1, 4), | |
| (1, 5), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "benchmark" | |
| require 'erb' | |
| d=Time.now | |
| Benchmark.bm(20) do |x| | |
| # the ultimate, but still can't figure out how to generate something that can be interpolated | |
| x.report("n - str") { 100_000.times { | |
| "abc #{d.hour < 10 ? '0' : ''}#{d.hour} #{d.min < 10 ? '0' : ''}#{d.min} cdef" | |
| } } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Create a file: config/torquebox_remote.rb | |
| TorqueBox::RemoteDeploy.configure do | |
| torquebox_home "/usr/local/torquebox" | |
| jruby_home "/usr/local/jruby" | |
| hostname "10.0.3.50" | |
| #port "22" | |
| user "deployer" | |
| key "#{ENV['HOME']}/.ssh/deployer_rsa" | |
| #sudo true | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #aptitude (/ search, + install, gg - go) | |
| contents | |
| apt-file list $* | |
| install | |
| apt-get install | |
| upgrade | |
| apt-get upgrade | |
| remove | |
| apt-get --purge remove $* | |
| list installed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| brew install nginx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # thanks from: http://aaroncrane.co.uk/2009/03/git_branch_prompt/ | |
| function find_git_branch { | |
| local dir=. head | |
| git_dir=${PWD} | |
| until [ "$dir" -ef / ]; do | |
| if [ -f "$dir/.git/HEAD" ]; then | |
| head=$(< "$dir/.git/HEAD") | |
| if [[ $head == ref:\ refs/heads/* ]]; then | |
| git_branch="${head#*/*/}" | |
| elif [[ $head != '' ]]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| From bef595dbdbde5725b8d49242b10a400db38134d1 Mon Sep 17 00:00:00 2001 | |
| From: Ben Zack <[email protected]> | |
| Date: Mon, 11 Jul 2011 15:42:24 -0400 | |
| Subject: [PATCH] Added levenshtein distance for determining database name | |
| from branch name | |
| --- | |
| Gemfile | 1 + | |
| Gemfile.lock | 2 ++ | |
| lib/devdb.rb | 18 ++++++++++++++++++ |