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
class ProgressBar | |
attr_reader :format | |
attr_reader :length | |
attr_reader :period | |
attr_reader :char | |
attr_reader :io | |
def initialize(format, options={}) | |
options = { | |
:length => 7, |
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
assert_status_equal () { | |
expected=$1; actual=$2; lineno=$3 | |
if [ $actual -ne $expected ] | |
then | |
echo "[$0:$lineno] exit status $actual (expected $expected)" | |
exit 1 | |
fi | |
} |
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 'rubygems' | |
require 'fileutils' | |
require 'active_record' | |
# >ruby active_record_example.rb | |
# a | |
# b | |
# a.b | |
# x | |
# y |
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 'fileutils' | |
dir = File.expand_path('../mtime', __FILE__) | |
file = "#{dir}/file.txt" | |
format = "%5s:%-20s %s" | |
FileUtils.rm_rf(dir) | |
FileUtils.mkdir_p(dir) | |
puts format % [:dir, "mkdir", File.mtime(dir)] |
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
list: | |
- name: Adobe Systems | |
name2: Adobe Systems Inc. | |
url: http://www.adobe.com | |
symbol: ADBE | |
price: 39.26 | |
change: 0.13 | |
ratio: 0.33 | |
- name: Advanced Micro Devices | |
name2: Advanced Micro Devices Inc. |
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
#!/bin/bash | |
# | |
# Public-Key Encryption and Decryption | |
# * http://www.openssl.org/ | |
# * http://barelyenough.org/blog/2008/04/fun-with-public-keys/ | |
# | |
# Mac OS X 10.6.4 | |
# OpenSSL 0.9.8l 5 Nov 2009 | |
# Generate keys |
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
# Two ENV variables control the 'gem' command: | |
# | |
# GEM_HOME: the single path to a gem dir where gems are installed | |
# GEM_PATH: a standard PATH to gem dirs where gems are found | |
# | |
# A gem directory is a directory that holds gems. The 'gem' command will lay | |
# out and utilize the following structure: | |
# | |
# bin # installed bin scripts | |
# cache # .gem files ex: cache/gem_name.gem |
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
# Post a tempview | |
curl -X POST http://127.0.0.1:5984/database/_temp_view -H "Content-Type: application/json" -T _temp_view.json |
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
The configuration order - Rails 2.3.3. | |
1. config/preinitializer.rb | |
2. config/environment.rb | |
3. config/environments/#{RAILS_ENV}.rb | |
4. plugin initialization | |
5. gem initialization | |
6. config/initializer/*.rb | |
7. all after_initialize blocks, in the order they were defined in (so same order as above) | |
8. any junk left below the Rails::Initializer.run call/block in environment.rb |
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
I have observed a bug in PATH on 'rvm use' where an extra ' :' is added, | |
preventing discovery of executables along that last path. Without the debug | |
info the relevant commmands and output are: | |
% echo $PATH | |
/Users/Simon/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin:/usr/local/instantclient-10.2 | |
% rvm use 1.8.6@chiangs --create | |
Using /Users/Simon/.rvm/gems/ruby-1.8.6-p399 with gemset chiangs | |
% echo $PATH | |
/Users/Simon/.rvm/gems/ruby-1.8.6-p399@chiangs/bin:/Users/Simon/.rvm/gems/ruby-1.8.6-p399@global/bin:/Users/Simon/.rvm/rubies/ruby-1.8.6-p399/bin:/Users/Simon/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin:/usr/local/instantclient-10.2 : |