Skip to content

Instantly share code, notes, and snippets.

@yu-tang
yu-tang / IConstructor.cls
Created March 9, 2012 06:33
Constructor for VBA class module.
Option Explicit
Public Sub Initialize(args() As Variant)
'
End Sub
@yu-tang
yu-tang / classof.js
Created January 27, 2012 18:11
CScript/WScript 環境の JScript 用クラス名取得関数 classof()
/*
CScript/WScript 環境の JScript 用クラス名取得関数 classof()
JScript では constructor.name が使えないので、下記をベースに改良。
Magnetiq - Finding Out Class Names of JavaScript Objects
http://blog.magnetiq.com/post/514962277/finding-out-class-names-of-javascript-objects
何となくそれらしい文字列が取れていれば良いことにしておく。
*/
@yu-tang
yu-tang / ja.lua
Last active November 5, 2019 04:45
ZeroBrane Studio Japanese language file
--- @author Yu Tang
--- @date 2019/05/24
return {
["%s event failed: %s"] = "%s イベントの処理に失敗しました: %s", -- src\editor\package.lua
["%s%% formatted..."] = "フォーマット中(%s%%)...", -- src\editor\print.lua
["%s%% loaded..."] = "読込中(%s%%)...", -- src\editor\commands.lua
["&About"] = "ZeroBrane Studio について(&A)", -- src\editor\menu_help.lua
["&Add Watch"] = "ウォッチ式の追加(&A)", -- src\editor\debugger.lua
["&Break"] = "ブレーク(&B)", -- src\editor\menu_project.lua
["&Close Page"] = "このページを閉じる(&C)", -- src\editor\gui.lua, src\editor\menu_file.lua
/* :name=Activate source text :description=Activate source text on the Editor with keyboard shortcut
*
* The workaround by script for RFE #821:
* Showing cursor on the original segment
* http://sourceforge.net/p/omegat/feature-requests/821/
*
* @author Yu Tang
* @author Kos Ivantsov
* @date 2016-10-24
* @version 1.1.1
@yu-tang
yu-tang / gist:953997
Created May 3, 2011 19:13
ADODB のインメモリ レコードセットを Access 非連結フォームのレコードソースにセットする
' ADODB のインメモリ レコードセットを Access 非連結フォームのレコードソースに
' セットするサンプル コード。
' 下記をコピペでテストする場合は、運送会社テーブルから表形式フォームをオート
' フォームで作成して、フォームのレコードソース プロパティを削除すると多少楽。
Option Compare Database
Option Explicit
Private Sub Form_Load()
' インメモリ レコードセットをフォームのレコードソースにセットします。
@yu-tang
yu-tang / BinaryReader.cls
Last active July 20, 2018 04:17
某所のカウンター GIF 画像を数値変換するデモ(Excel VBA)。
Option Explicit
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" ( _
Destination As Any, _
Source As Any, _
ByVal Length As Long _
)
Private Const ERR_INVALID_PROCEDURE_CALL_OR_ARGUMENT As Long = 5 ' プロシージャの呼び出し、または引数が不正です。
Private Const ERR_SUBSCRIPT_OUT_OF_RANGE As Long = 9 ' インデックスが有効範囲にありません。
@yu-tang
yu-tang / bold_font_to_plain_for_editor.groovy
Last active October 16, 2017 07:47
Make the bold font to plain in the source of active segment
/* :name=Make the bold font to plain in the source of active segment
*
* Usage: move this script to
* <your-scripts-folder>/application_startup/ sub-folder
* for event driven automatically execution.
*
* @author Yu Tang
* @date 2017-04-07
* @version 0.2.1
*/
@yu-tang
yu-tang / adapt_tags_to_match_target.groovy
Last active July 10, 2017 20:57
adapt_tags_to_match_target.groovy
/* :name=Adapt standard tags :description=Adapt standard tags when Replace with Match command invoked
*
* The workaround by script for RFE #841:
* Adapt tags to match target
* http://sourceforge.net/p/omegat/feature-requests/841/
*
* | Editor | Match
* -------+--------------+--------------
* Source | <a1>foo</a1> | <a9>foo</a9>
* -------+--------------+--------------
@yu-tang
yu-tang / extract_Menu_Item_Code.groovy
Created May 21, 2017 09:57
extract a Menu Item Code from a Bundle key
final String key = "TF_MENU_TOOLS_STATISTICS_STANDARD"
final String localized = removeMnemonicMarker(org.omegat.util.OStrings.getString(key))
String removeMnemonicMarker(String text) {
text.replace("&", "")
}
console.println """\
key: $key
localized: $localized"""
@yu-tang
yu-tang / set_caret_at_segment_tail_end.groovy
Created May 5, 2017 12:20
Set caret position at the segment tail end when goto previous segment
package me.goat.groovy.scripting.tailedcaret
import javax.swing.SwingUtilities
import org.omegat.core.Core
import org.omegat.core.CoreEvents
import org.omegat.core.data.SourceTextEntry
import org.omegat.core.events.IEntryEventListener
import org.omegat.gui.editor.Document3
import org.omegat.util.gui.UIThreadsUtil