This file contains 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/ruby | |
require 'rubygems' | |
require 'nokogiri' | |
require 'builder' | |
# Specify xpath patterns for the different input formats | |
formats = { | |
'/people/person' => { | |
:first => 'first_name', |
This file contains 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
class Action | |
attr_accessor :name, :terms, :code | |
def initialize name | |
@name = name | |
@terms = [] | |
end | |
def setup attribute, *args | |
case attribute |
This file contains 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 'time' | |
class BusinessHours | |
def initialize opening, closing | |
@hours = Hash.new( [opening, Time.parse(closing)-Time.parse(opening)] ) | |
end | |
def calculate_deadline interval, drop_off | |
target = seconds_before_closing( time = Time.parse(drop_off) ) |
This file contains 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
class GameOfLife | |
attr_accessor :state, :height, :width, :rules | |
def initialize options={} | |
self.rules = options[:rules] || [ [0,0,0,1,0,0,0,0,0], [0,0,1,1,0,0,0,0,0] ] | |
self.height = options[:size] || options[:height] || 10 | |
self.width = options[:size] || options[:width] || 10 | |
self.state = options[:seed] || grid { rand(2) } |
This file contains 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 e5fa08b75ef35a54f8decc49e49d9de0502fe561 Mon Sep 17 00:00:00 2001 | |
From: Tanzeeb Khalili <[email protected]> | |
Date: Sun, 5 Jun 2011 22:43:21 -0400 | |
Subject: [PATCH 1/2] fixed URI.join specs | |
--- | |
lib/uri/common.rb | 2 +- | |
lib/uri/generic.rb | 1 + | |
2 files changed, 2 insertions(+), 1 deletions(-) |
This file contains 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 bash -ex | |
id=$RANDOM | |
start_dir=`pwd` | |
work_dir=tmp | |
REDIS_SERVICE=rediscloud | |
CONFIG_PLAN=30mb | |
DATA_PLAN=30mb |
This file contains 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
export AUTH=`uaac contexts | grep access_token | sed "s/[ \t]*access_token:/Bearer/"` |
This file contains 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 bash | |
set -e | |
echo "Running tests" | |
echo "Changes in helloworld-go" | |
pushd docs/serving/samples/helloworld-go | |
git --no-pager diff . | |
popd |
This file contains 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
eval "$(starship init zsh)" | |
function _cursor_block() { echo -ne '\e[1 q' } | |
function _cursor_bar() { echo -ne '\e[3 q' } | |
function _cursor_beam() { echo -ne '\e[5 q' } | |
function zle-keymap-select zle-line-init | |
{ | |
case $KEYMAP in | |
vicmd) _cursor_block;; |