autocmd BufWritePre * :%s/\s\+$//e
(add-hook 'before-save-hook 'delete-trailing-whitespace)
module IncludeMe;end | |
module BehindTheScenes;end | |
# Include IncludeMe in a module | |
module One | |
include IncludeMe | |
end | |
# Add an ancestor to IncludeMe | |
module IncludeMe |
puts "ruby version: #{RUBY_VERSION}" | |
pass = 0 | |
proc do |@x| | |
pass += 1 | |
puts "proc pass number #{pass}" | |
@x = 3 if pass == 1 | |
puts "proc x is: #{@x}" | |
redo if pass != 2 |
x,y,z = "X ", "Y ", "Z " | |
[x,y,z].each_with_index do |str, i| | |
str << str[0,1] | |
p str | |
redo if i == 1 | |
end |
本拠> bin/rbx ../sorting.rb | |
Rehearsal --------------------------------------------- | |
merge: 2.448515 0.000000 2.448515 ( 2.448516) | |
nocopy: 0.896591 0.000000 0.896591 ( 0.896639) | |
------------------------------------ total: 3.345106sec | |
user system total real | |
merge: 0.855341 0.000000 0.855341 ( 0.855353) | |
nocopy: 0.569976 0.000000 0.569976 ( 0.569993) |
### running this code: http://gist.github.com/234170 | |
### jruby trunk from last week | |
> jruby sorting.rb | |
Rehearsal --------------------------------------------- | |
merge: 1.070000 0.000000 1.070000 ( 1.070000) | |
nocopy: 0.730000 0.000000 0.730000 ( 0.730000) | |
------------------------------------ total: 1.800000sec | |
user system total real |
#!/usr/bin/env ruby | |
require 'time' | |
require 'benchmark' | |
class Thing | |
attr_accessor :timestamp | |
def initialize(timestamp) | |
@timestamp = timestamp | |
end |
Process: vm [69331] | |
Path: /Users/wilson/code/rbx/vm/vm | |
Identifier: vm | |
Version: ??? (???) | |
Code Type: X86-64 (Native) | |
Parent Process: ruby [68208] | |
Date/Time: 2009-11-06 16:44:22.851 -0500 | |
OS Version: Mac OS X 10.6.1 (10B504) | |
Report Version: 6 |
# Run the bundler directly instead of relying on Rake to do it | |
if ARGV.any? {|task_name| task_name =~ /^gems:bundle$/} | |
system "gem bundle" | |
end | |
require(File.join(File.dirname(__FILE__), 'config', 'boot')) | |
require 'rake' | |
require 'rake/testtask' | |
require 'rake/rdoctask' |
--- | |
gem: --no-ri --no-rdoc | |
:benchmark: false | |
:backtrace: true | |
:update_sources: true | |
:verbose: really | |
:sources: | |
- http://gemcutter.org | |
- http://gems.rubyforge.org | |
- http://gems.github.com |