Skip to content

Instantly share code, notes, and snippets.

View rhiguchi's full-sized avatar
🏠
Working from home

HIGUCHI Ryusuke rhiguchi

🏠
Working from home
  • Yokohama, Japan
View GitHub Profile
@rhiguchi
rhiguchi / VBACodeExporter.vba
Created April 11, 2011 06:48
Excel VBA のコードを出力する。文字コードはUTF-8(BOM無し)に変換される
Option Explicit
Private exportSelf As Boolean
Public Const MODULE_NAME_SPACE As String = "VBACodeExporter"
Private Enum ComponentType
STANDARD_MODULE = 1
CLASS_MODULE = 2
USER_FORM = 3
DOCUMENT_MODULE = 100
{
'A': 'A', 'C': 'C', 'G': 'G', 'T': '[TU]',
'R': '[AG]', 'Y': '[CTU]', 'S': '[GC]',
'W': '[ATU]', 'K': '[GTU]', 'M': '[AC]',
'B': '[CGTU]', 'D': '[AGTU]',
'H': '[ACTU]', 'V': '[ACG]',
'N': '[ACGTU]'
}
@rhiguchi
rhiguchi / invoke_method.php
Created January 16, 2011 01:25
A function for invoking private or protected method with reflection.
/**
* Invoke method by using reflection.
* Require PHP5 (>= 5.3.2)
* @param $method_name
* @param $obj - An object that invokes the method.
* @param mothod_args... Arguments for the method.
*/
public static function invoke_method($method_name, $obj) {
$class_name = get_class($obj);
$class = new ReflectionClass($class_name);
/**
* Creating a instance by using FEST Reflection for testing of Swing Application Framework
* require import static org.fest.reflect.core.Reflection.*;
*/
protected static <C extends Application> C createApplicationInstance(Class<C> appClass, String[] args) {
C application =
staticMethod("create")
.withReturnType(appClass)
.withParameterTypes(Class.class)
.in(appClass)