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
#!/usr/bin/ruby | |
require 'rubygems' | |
require 'nokogiri' | |
XSL = <<-EOXSL | |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:output method="xml" encoding="ISO-8859-1"/> | |
<xsl:param name="indent-increment" select="' '"/> | |
<xsl:template name="newline"> |
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
log = require('sys').log | |
dgram = require('./lib/dgram') | |
var Buffer = require('buffer').Buffer; | |
var endat = 10; | |
var count = 0; | |
socket = dgram.createSocket(); | |
socket.addListener('message', function (msg, rinfo) { | |
log('got message from '+ rinfo.address +' port: '+ rinfo.port); | |
log('data len: '+ rinfo.size + " data: "+ msg.toString('ascii', 0, rinfo.size)); |
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
require 'java' | |
java_import 'javax.ws.rs.Path' | |
java_import 'javax.ws.rs.GET' | |
java_import 'javax.ws.rs.Produces' | |
java_package 'com.headius.demo.jersey' | |
java_annotation 'Path("/helloworld")' | |
class HelloWorld | |
java_annotation 'GET' | |
java_annotation 'Produces("text/plain")' |
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
STDOUT.sync = true | |
require 'queue' | |
start_time = Time.now.to_i | |
msg = 0 | |
queue = Queue.new("testing") | |
queue.subscribe do |obj| | |
msg += 1 |
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
~/projects/jruby ➔ cat remote_rhino.rb | |
require 'java' | |
$CLASSPATH << 'http://mirrors.ibiblio.org/pub/mirrors/maven2/rhino/js/1.7R2/js-1.7R2.jar' | |
ctx = org.mozilla.javascript.Context.enter | |
scope = ctx.init_standard_objects nil | |
result = ctx.evaluate_string scope, 'function f(x){return x+1} f(7)', 'x', 1, nil | |
puts result |
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
#!/usr/bin/env ruby | |
require 'open-uri' | |
require 'net/http' | |
require 'uri' | |
require 'pp' | |
require 'rubygems' | |
require 'json' | |
# This is my modified version of defunkt's gist.rb | |
# http://github.com/defunkt/gist/blob/master/gist.rb |
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
~/projects/jruby ➔ gem install com.lowagie.itext-rtf | |
Successfully installed bouncycastle.bcmail-jdk14-138-java | |
Successfully installed bouncycastle.bcprov-jdk14-138-java | |
Successfully installed bouncycastle.bctsp-jdk14-138-java | |
Successfully installed com.lowagie.itext-rtf-2.1.7-java | |
4 gems installed | |
Installing ri documentation for bouncycastle.bcmail-jdk14-138-java... | |
Installing ri documentation for bouncycastle.bcprov-jdk14-138-java... | |
Installing ri documentation for bouncycastle.bctsp-jdk14-138-java... | |
Installing ri documentation for com.lowagie.itext-rtf-2.1.7-java... |
NewerOlder