Skip to content

Instantly share code, notes, and snippets.

import org.apache.wicket.MarkupContainer;
import org.apache.wicket.Component;
import org.apache.wicket.util.tester.WicketTester;
import java.util.List;
import java.util.ArrayList;
/**
* Provides a method to get a list or descriptive string of descendants
* of a container, with their wicket ID's, and class types.
setBeforeDisabledLink(
"<img src=\"http://www.a-domain.com/an-image.gif\""
+ " alt=\"Submit Disabled\">");
setAfterDisabledLink("</img>");
/**
* For columns that can be identified by a key name.
*/
public interface ColumnWithKey {
String getColumnKey();
}
import org.apache.commons.lang.StringUtils;
import org.apache.wicket.Component;
import org.apache.wicket.MarkupContainer;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.model.IModel;
import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import java.util.List;
import java.util.Arrays;
@keithrbennett
keithrbennett / gist:664901
Created November 5, 2010 21:28
class/self Example
module C
class << self
def f
end
end
end
module D
def self.f
end
# Print currency formatted for all available locales.
# Requires JRuby.
require 'java'
import java.text.NumberFormat
locales = NumberFormat.getAvailableLocales();
amount = 1234.56
locales.each do |locale|
// Demonstrates javap -c retaining identifier names.
//
// Do:
// javac MyClass.java
// javap -c MyClass
public class MyClass {
// Use a value that the compiler cannot predict,
// to eliminate the possibility of the variable
# Demonstrates javap -c revealing identifier names in a compiled JRuby script.
#
# Do:
# jrubyc my_class.rb
# javap -c my_class > my_class.decompiled.txt
# less my_class.decompiled.txt
class MyClass
@keithrbennett
keithrbennett / require_test.rb
Created January 19, 2011 13:55
Tests the requiring of gem code not as gems, but regular file system files.
# Tests the requiring of gem code not as gems, but regular
# file system files.
# As an example, we can use this gem, change this to suit your system:
JSON_REQUIRE_SPEC='/Users/kbennett/.rvm/gems/ree-1.8.7-2010.02/gems/json-1.4.6/lib/json'
# Will change dir to the gem's directory before requiring it,
# and change dir back to original directory when done.
@keithrbennett
keithrbennett / super_example.rb
Created January 19, 2011 16:08
Shows that a derived class' initialize passes its args to super's initialize when super is called without any args.
# Shows that a derived class' initialize passes its args to super's
# initialize when super is called without any args.
class Base
attr_accessor :foo
def initialize(foo='base')
@foo = foo
end