forked from jruby/jruby
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Setup .gitattributes for eol normalization"
This commit is overly eager on fixing the existing files' EOLs. I also have reservations about enforcing EOL rules, and would like to discuss it a little further. This reverts commit b111911.
- Loading branch information
Showing
59 changed files
with
4,434 additions
and
4,448 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
# The Computer Language Shootout | ||
# http://shootout.alioth.debian.org/ | ||
# contributed by Pavel Valodzka | ||
|
||
def nsieve(m) | ||
is_prime = Array.new(m, true) | ||
count = 0 | ||
2.upto(m){|i| | ||
if is_prime[i] | ||
(2 * i).step(m, i){|v| | ||
is_prime[v] = false | ||
} | ||
count += 1 | ||
end | ||
} | ||
return count | ||
end | ||
|
||
n = (ARGV[0] || 2).to_i | ||
n = 2 if (n < 2) | ||
|
||
3.times {|t| | ||
m = (1<<n-t)*10000 | ||
printf("Primes up to %8d%9d\n", m, nsieve(m)) | ||
|
||
def nsieve(m) | ||
is_prime = Array.new(m, true) | ||
count = 0 | ||
2.upto(m){|i| | ||
if is_prime[i] | ||
(2 * i).step(m, i){|v| | ||
is_prime[v] = false | ||
} | ||
count += 1 | ||
end | ||
} | ||
return count | ||
end | ||
|
||
n = (ARGV[0] || 2).to_i | ||
n = 2 if (n < 2) | ||
|
||
3.times {|t| | ||
m = (1<<n-t)*10000 | ||
printf("Primes up to %8d%9d\n", m, nsieve(m)) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
#!/usr/bin/ruby | ||
# -*- mode: ruby -*- | ||
# $Id: regexmatch.ruby,v 1.2 2005-05-17 05:20:31 bfulgham Exp $ | ||
# http://shootout.alioth.debian.org/ | ||
# modified by: Jon-Carlos Rivera | ||
|
||
re = Regexp.new( | ||
'(?:^|[^\d\(])' + # must be preceeded by non-digit | ||
'(?:\((\d\d\d)\)|(\d\d\d))' + # match 1 or 2: area code is 3 digits | ||
'[ ]' + # area code followed by one space | ||
'(\d\d\d)' + # match 3: prefix of 3 digits | ||
'[ -]' + # separator is either space or dash | ||
'(\d\d\d\d)' + # match 4: last 4 digits | ||
'\D' # must be followed by a non-digit | ||
) | ||
|
||
num = Integer(ARGV[0] || 1) | ||
|
||
phones = STDIN.readlines | ||
|
||
phonenum, count = "", 0 | ||
|
||
(1..num).each do |iter| | ||
phones.each do |line| | ||
if line =~ re | ||
phonenum = "(#{($1 || $2)}) #{$3}-#{$4}"; | ||
if iter == num | ||
count += 1 | ||
puts "#{count}: #{phonenum}" | ||
end | ||
end | ||
end | ||
end | ||
#!/usr/bin/ruby | ||
# -*- mode: ruby -*- | ||
# $Id: regexmatch.ruby,v 1.2 2005-05-17 05:20:31 bfulgham Exp $ | ||
# http://shootout.alioth.debian.org/ | ||
# modified by: Jon-Carlos Rivera | ||
|
||
re = Regexp.new( | ||
'(?:^|[^\d\(])' + # must be preceeded by non-digit | ||
'(?:\((\d\d\d)\)|(\d\d\d))' + # match 1 or 2: area code is 3 digits | ||
'[ ]' + # area code followed by one space | ||
'(\d\d\d)' + # match 3: prefix of 3 digits | ||
'[ -]' + # separator is either space or dash | ||
'(\d\d\d\d)' + # match 4: last 4 digits | ||
'\D' # must be followed by a non-digit | ||
) | ||
|
||
num = Integer(ARGV[0] || 1) | ||
|
||
phones = STDIN.readlines | ||
|
||
phonenum, count = "", 0 | ||
|
||
(1..num).each do |iter| | ||
phones.each do |line| | ||
if line =~ re | ||
phonenum = "(#{($1 || $2)}) #{$3}-#{$4}"; | ||
if iter == num | ||
count += 1 | ||
puts "#{count}: #{phonenum}" | ||
end | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# The Computer Language Benchmarks Game | ||
# http://shootout.alioth.debian.org/ | ||
# contributed by Pavel Valodzka | ||
|
||
|
||
puts STDIN.inject(0){|a,v| a + v.to_i } |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
# | ||
# Create many HTML strings with ERB. | ||
# | ||
|
||
require 'erb' | ||
|
||
data = DATA.read | ||
max = 5_000 | ||
title = "hello world!" | ||
content = "hello world!\n" * 10 | ||
|
||
max.times{ | ||
ERB.new(data).result(binding) | ||
} | ||
|
||
__END__ | ||
|
||
<html> | ||
<head> <%= title %> </head> | ||
<body> | ||
<h1> <%= title %> </h1> | ||
<p> | ||
<%= content %> | ||
</p> | ||
</body> | ||
</html> | ||
# | ||
# Create many HTML strings with ERB. | ||
# | ||
|
||
require 'erb' | ||
|
||
data = DATA.read | ||
max = 5_000 | ||
title = "hello world!" | ||
content = "hello world!\n" * 10 | ||
|
||
max.times{ | ||
ERB.new(data).result(binding) | ||
} | ||
|
||
__END__ | ||
|
||
<html> | ||
<head> <%= title %> </head> | ||
<body> | ||
<h1> <%= title %> </h1> | ||
<p> | ||
<%= content %> | ||
</p> | ||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
require 'uri' | ||
|
||
100_000.times{ | ||
uri = URI.parse('http://www.ruby-lang.org') | ||
uri.scheme | ||
uri.host | ||
uri.port | ||
} | ||
require 'uri' | ||
|
||
100_000.times{ | ||
uri = URI.parse('http://www.ruby-lang.org') | ||
uri.scheme | ||
uri.host | ||
uri.port | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
# | ||
# Create files | ||
# | ||
|
||
max = 50_000 | ||
file = './tmpfile_of_bm_io_file_create' | ||
|
||
max.times{ | ||
f = open(file, 'w') | ||
f.close#(true) | ||
} | ||
File.unlink(file) | ||
|
||
# | ||
# Create files | ||
# | ||
|
||
max = 50_000 | ||
file = './tmpfile_of_bm_io_file_create' | ||
|
||
max.times{ | ||
f = open(file, 'w') | ||
f.close#(true) | ||
} | ||
File.unlink(file) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
# | ||
# Seek and Read file. | ||
# | ||
|
||
require 'tempfile' | ||
|
||
max = 20_000 | ||
str = "Hello world! " * 1000 | ||
f = Tempfile.new('yarv-benchmark') | ||
f.write str | ||
|
||
max.times{ | ||
f.seek 0 | ||
f.read | ||
} | ||
# | ||
# Seek and Read file. | ||
# | ||
|
||
require 'tempfile' | ||
|
||
max = 20_000 | ||
str = "Hello world! " * 1000 | ||
f = Tempfile.new('yarv-benchmark') | ||
f.write str | ||
|
||
max.times{ | ||
f.seek 0 | ||
f.read | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
# | ||
# Seek and Write file. | ||
# | ||
|
||
require 'tempfile' | ||
|
||
max = 20_000 | ||
str = "Hello world! " * 1000 | ||
f = Tempfile.new('yarv-benchmark') | ||
|
||
max.times{ | ||
f.seek 0 | ||
f.write str | ||
} | ||
# | ||
# Seek and Write file. | ||
# | ||
|
||
require 'tempfile' | ||
|
||
max = 20_000 | ||
str = "Hello world! " * 1000 | ||
f = Tempfile.new('yarv-benchmark') | ||
|
||
max.times{ | ||
f.seek 0 | ||
f.write str | ||
} |
Oops, something went wrong.