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
| 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. |
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
| setBeforeDisabledLink( | |
| "<img src=\"http://www.a-domain.com/an-image.gif\"" | |
| + " alt=\"Submit Disabled\">"); | |
| setAfterDisabledLink("</img>"); |
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
| /** | |
| * For columns that can be identified by a key name. | |
| */ | |
| public interface ColumnWithKey { | |
| String getColumnKey(); | |
| } |
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
| 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; |
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
| module C | |
| class << self | |
| def f | |
| end | |
| end | |
| end | |
| module D | |
| def self.f | |
| end |
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
| # 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| |
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
| // 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 |
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
| # 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 | |
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
| # 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. |
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
| # 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 |