Skip to content

Instantly share code, notes, and snippets.

(progn
(format t "a")
(format t "b")
(+ 11 12))
module Rubeus::Extensions::Javax::Swing
module Timer
def self.included(base)
base.extend ClassMethods
base.instance_eval do
alias :new_without_rubeus :new
alias :new :new_with_rubeus
end
end
require 'rubygems'
require 'rubeus'
include Rubeus::Swing
JFrame.new do |frame|
label = JLabel.new
t = Timer.new(500) do
label.text = java.util.Date.new.to_s
require 'rubygems'
require 'rubeus'
require 'uri'
require 'net/http'
require 'rss'
class RealTimeRssReader
include Rubeus::Swing
# Reflesh rate [ms]
module Rubeus
module Helpers
def self.setup_derby
return if ENV_JAVA['java.class.path'].split(File::PATH_SEPARATOR).any?{|path| /derby[\-\.\d]*\.jar$/ =~ path}
if ENV_JAVA["java.specification.version"] == "1.6"
begin
require File.join(ENV_JAVA['java.home'], 'db', 'lib', 'derby.jar')
return
rescue LoadError
# ignore error if not installed JavaDB
require 'java'
require 'rubygems'
require 'rubeus'
require 'rubeus/helpers/derby_helper'
class JdbcExample
include Rubeus::Jdbc
def initialize
# Register Driver
require 'java'
require 'poi-3.1-FINAL-20080629.jar'
io = java.io.FileOutputStream.new("test2.xls")
wb = org.apache.poi.hssf.usermodel.HSSFWorkbook.new
wb.createSheet("First")
wb.write(io)
io.close
require 'java'
require 'poi-3.1-FINAL-20080629.jar'
class RubyOutputStream < java.io.OutputStream
def initialize(io)
super()
@io = io
end
def write(b)
import java.awt.*;
import java.awt.event.*;
import java.math.*;
import javax.swing.*;
import javax.swing.event.*;
public class Sierpinski extends JPanel
{
private static final int DRAW_LEVEL = 128;
private static final int RECT_SIZE = 4;
import java.awt.*;
import java.awt.geom.*;
import java.util.Stack;
import javax.swing.*;
// キモい再帰的なツリーを描くプログラム
public class drawtree extends JPanel
{
private static final int DEGREE = 12;
private static final int BRUNCH_LENGTH = 40;