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
import java.io.*; | |
import java.util.jar.*; | |
import java.util.*; | |
public class Test { | |
public static final void main(String[] args) throws Exception { | |
exec("jar cf test.jar Test.java"); | |
print(new JarFile("test.jar")); |
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
path = "c:/*" | |
dos = Dir[path.gsub('/', '\\')] | |
unix = Dir[path] | |
puts "dos: #{dos.inspect}" | |
puts "unix: #{unix.inspect}" |
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
1.9.3 | |
Rehearsal ---------------------------------------------- | |
for n=100 0.450000 0.020000 0.470000 ( 0.457106) | |
for n=500 1.880000 0.020000 1.900000 ( 1.915119) | |
for n=1000 3.770000 0.060000 3.830000 ( 3.823367) | |
for n=5000 18.850000 0.310000 19.160000 ( 19.172096) | |
------------------------------------ total: 25.360000sec |
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
$> strace -e trace=file -f -p `ps -ef | grep java | grep test | awk '{ print $2 }'` 2>&1 | |
.... | |
[pid 30072] stat64("/home/ratnikov/jruby.git/lib/ruby/site_ruby/1.9/openssl.class", 0xcd3fe7ec) = -1 ENOENT (No such file or directory) | |
[pid 30072] stat64("/home/ratnikov/jruby.git/lib/ruby/site_ruby/1.9/openssl.rb", 0xcd3fe7ec) = -1 ENOENT (No such file or directory) | |
[pid 30072] stat64("/home/ratnikov/jruby.git/lib/ruby/site_ruby/shared/openssl.class", 0xcd3fe7ec) = -1 ENOENT (No such file or directory) | |
[pid 30072] stat64("/home/ratnikov/jruby.git/lib/ruby/site_ruby/shared/openssl.rb", 0xcd3fe7ec) = -1 ENOENT (No such file or directory) | |
[pid 30072] stat64("/home/ratnikov/jruby.git/lib/ruby/site_ruby/1.8/openssl.class", 0xcd3fe7ec) = -1 ENOENT (No such file or directory) |
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
puts "sleeping..." | |
sleep 5 | |
puts "woke up!" | |
Gem.post_reset { Gem::Specification.all = [] } | |
Gem.clear_paths | |
require 'net/https' | |
Thread.start { | |
while true do |
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
bash-3.2$ rvm use jruby | |
Using /Users/ratnikov/.rvm/gems/jruby-1.6.5.1 | |
bash-3.2$ ruby --version | |
jruby 1.6.5.1 (ruby-1.9.2-p136) (2011-12-27 1bf37c2) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_29) [darwin-x86_64-java] | |
bash-3.2$ rake test | |
/Users/ratnikov/.rvm/rubies/jruby-1.6.5.1/bin/jruby -w -I"lib:test" -I"/Users/ratnikov/.rvm/gems/jruby-1.6.5.1/gems/rake-0.9.2.2/lib" "/Users/ratnikov/.rvm/gems/jruby-1.6.5.1/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb" "test/abstract/abstract_controller_test.rb" "test/abstract/callbacks_test.rb" "test/abstract/collector_test.rb" "test/abstract/helper_test.rb" "test/abstract/layouts_test.rb" "test/abstract/render_test.rb" "test/abstract/translation_test.rb" "test/assertions/response_assertions_test.rb" "test/controller/action_pack_assertions_test.rb" "test/controller/addresses_render_test.rb" "test/controller/assert_select_test.rb" "test/controller/base_test.rb" "test/controller/caching_test.rb" "test/controller/capture_test.rb" "test/controller/content_type_test.rb" "test/con |
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
def new_list_item_link | |
content_for :action_links do | |
link_to "New #{controller.controller_name.humanize.titleize.singularize}", eval("new_managed_lists_#{controller.controller_name.singularize}_path") | |
end | |
end | |
describe "#new_list_item_link" do | |
before do | |
helper.should_receive(:new_managed_lists_test_path).and_return 'test_path_url' | |
helper.new_list_item_link |
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
package org.jruby.rack; | |
// ... | |
public class RubyFirstRackFilter implements Filter { | |
// ... | |
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) | |
throws IOException, ServletException { | |
RequestCapture reqCapture = new RequestCapture((HttpServletRequest) request); | |
ResponseCapture respCapture = new ResponseCapture((HttpServletResponse) response); |
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
<?xml ...?> | |
<% @posts.each do |post| -%> | |
<post> | |
<title><%= post.title %></title> | |
<content> | |
<%= render :partial => '...' %> | |
</content> | |
</post> | |
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
def client_threshold_reached? | |
self.plan.num_of_clients == self.clients.count | |
end |
NewerOlder