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 Hash | |
def +(another) | |
h = self.clone | |
another.each do |k, v| | |
if h.has_key? k | |
h[k] += v | |
else | |
h[k] = v | |
end | |
end |
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
> a = true; | |
?> b = false; | |
?> x = a and b; | |
?> x | |
=> true |
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 'rubygems' | |
require 'sinatra' | |
require File.join(File.dirname(__FILE__), '..', 'lib', 'rakismet.rb') | |
get '/' do | |
%{<html><head><title>Rakismet</title></head><body> | |
<form action="/posts" method="post"> | |
<label for="comment_author">author</author> |
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
moved to https://github.com/ml/rack-contrib/blob/master/lib/rack/contrib/superlogger.rb |
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
DataMapper.setup(:default, :adapter => 'mysql', :database => "test", :username => "root") | |
DataMapper.setup(:dual, :adapter => "dual", :default => repository(:default), :redis => {:db => 1}) | |
class DualAdapter < AbstractAdapter | |
def create(query) | |
@default.create query | |
end | |
def read(query) | |
query = simplify(query) if simplify_applies?(query) |
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
Warning: You should upgrade to Xcode 3.1.4 | |
==> Build Environment | |
PATH: /Users/lotus/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin:/usr/X11/bin | |
CFLAGS: -O3 -march=nocona -mfpmath=sse -w -pipe | |
MAKEFLAGS: -j2 | |
CC: /usr/bin/cc | |
CXX: /usr/bin/c++ | |
==> Downloading http://google-perftools.googlecode.com/files/google-perftools-1.4.tar.gz | |
File already downloaded and cached to /Library/Caches/Homebrew | |
/usr/bin/tar xf /Library/Caches/Homebrew/google-perftools-1.4.tar.gz |
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
Warning: You should upgrade to Xcode 3.1.4 | |
==> Build Environment | |
PATH: /Users/lotus/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin:/usr/X11/bin | |
CFLAGS: -O3 -march=nocona -mfpmath=sse -w -pipe | |
MAKEFLAGS: -j2 | |
CC: /usr/bin/cc | |
CXX: /usr/bin/c++ | |
==> Downloading http://google-perftools.googlecode.com/files/google-perftools-1.4.tar.gz | |
File already downloaded and cached to /Library/Caches/Homebrew | |
/usr/bin/tar xf /Library/Caches/Homebrew/google-perftools-1.4.tar.gz |
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
$ racksh 14:17 | |
Rack::Shell v0.9.7 started in development environment. | |
irb(main):001:0> /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/racksh-0.9.7/bin/racksh:22:in `wait': Interrupt | |
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/racksh-0.9.7/bin/racksh:22 | |
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/racksh-0.9.7/bin/racksh:16:in `loop' | |
from /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/racksh-0.9.7/bin/racksh:16 | |
from /opt/ruby-enterprise/bin/racksh:19:in `load' | |
from /opt/ruby-enterprise/bin/racksh:19 |
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
$ sudo /etc/init.d/redis start | |
mlotkowski@blip-redis-1c:/var/redis/blip/current$ ./redis-cli info | grep used_memory | |
used_memory:1549176 | |
used_memory_human:1.48M | |
mlotkowski@blip-redis-1c:/var/redis/blip/current$ grep Vm /proc/`cat /var/run/redis.pid`/status | |
VmPeak: 10560 kB | |
VmSize: 10432 kB | |
VmLck: 0 kB | |
VmHWM: 2240 kB | |
VmRSS: 2236 kB |
OlderNewer