Skip to content

Instantly share code, notes, and snippets.

rbx 1.0
-------
danny-donnells-iMac:ranka ddonnell$ rvm use rbx
Using rbx 1.0.0 20100514
danny-donnells-iMac:ranka ddonnell$ ruby cli.rb
user system total real
ranka: 4.862326 0.000000 4.862326 ( 4.862317)
danny-donnells-iMac:ranka ddonnell$ ruby cli.rb
user system total real
ranka: 4.855770 0.000000 4.855770 ( 4.855766)
diff --git a/vendor/plugins/haml/init.rb b/vendor/plugins/haml/init.rb
index 3b64a9e..7cd9a05 100644
--- a/vendor/plugins/haml/init.rb
+++ b/vendor/plugins/haml/init.rb
@@ -1,18 +1,8 @@
begin
require File.join(File.dirname(__FILE__), 'lib', 'haml') # From here
rescue LoadError
- begin
- require 'haml' # From gem
public class ThreadedTest {
private static boolean ready;
private static int number;
private static class ReaderThread extends Thread {
public void run() {
while (!ready)
Thread.yield();
System.out.println(number);
}
}
(defn send-url [url]
(try
(let [ip (ru/ip-address (get-domain url))]
(log/debug (str "SENDING URL: " url))
(if (@fetchers ip)
(send-off (@fetchers ip)
handle-url
url)
(do
(add-fetcher ip)
# an example for setting the classpath in a custom buildr task
task :threadingtest => [:compile, :test] do
# this will give us the project dependencies
specs = (project.compile.dependencies + project.test.compile.dependencies).flatten
# this turns them into the proper string representation
cp = Buildr.artifacts(specs).each(&:invoke).map(&:name).join(File::PATH_SEPARATOR)
# last we need to add our compiled classes
cp = cp + ":" + path_to('target', 'classes') + ":" + path_to('target', 'test', 'classes')
cmd = "java -cp #{cp} org.junit.runner.JUnitCore com.jaydonnell.javautils.MultiThreadedIT"
@jaydonnell
jaydonnell / gist:882081
Created March 22, 2011 21:13
using ant and ivy from rake with jruby
require 'ant'
def ivy_retrieve(org, mod, rev)
ant.retrieve :organisation => org,
:module => mod,
:revision => rev,
:pattern => 'javalib/[conf]/[artifact].[ext]',
:inline => true
end
puts "give me a command (q to quit):"
STDOUT.flush
while(input = gets)
break if input.strip == 'q'
puts `#{input}`
puts "give me a command:"
STDOUT.flush
end
import java.io.*;
public class JavaSystemCalls {
public static void main(String args[]) {
String s = null;
try {
public boolean exists (String className) {
try {
Class.forName (className);
return true;
}
catch (ClassNotFoundException exception) {
return false;
}
}
yakkstr.com:80 77.88.25.26 - - [13/May/2011:19:57:52 -0700] "GET /tags/1703-glenn-beck HTTP/1.1" 200 1953 "-" "Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)"
yakkstr.com:80 119.63.196.80 - - [13/May/2011:19:58:11 -0700] "GET /tags/28-introduction-of-sorts HTTP/1.1" 200 1953 "-" "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)"
yakkstr.com:80 67.195.113.242 - - [13/May/2011:19:58:19 -0700] "GET /tags/504-food HTTP/1.0" 200 4584 "-" "Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)"
yakkstr.com:80 66.249.67.242 - - [13/May/2011:19:59:58 -0700] "GET /posts/3240-Borders-bookstores-gives-executives-8300000-in-bonuses-after-it-lays-off-6000-workers-and-goes-into-chapter-11-bankruptcy- HTTP/1.1" 200 5011 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
yakkstr.com:80 77.88.25.26 - - [13/May/2011:20:00:02 -0700] "GET /posts/1535-Its-piling-up HTTP/1.1" 200 5625 "-" "Mozilla/5.0 (compatible; YandexBo