Skip to content

Instantly share code, notes, and snippets.

@honda0510
honda0510 / TheEndOfTheMonth.ics
Created May 31, 2011 04:35
Google カレンダーに月末の予定を追加するiCalendarファイル
BEGIN:VCALENDAR
PRODID:-//Google Inc//Google Calendar 70.9054//EN
VERSION:2.0
METHOD:PUBLISH
BEGIN:VTIMEZONE
TZID:Asia/Tokyo
BEGIN:STANDARD
TZOFFSETFROM:+0900
TZOFFSETTO:+0900
TZNAME:JST
@honda0510
honda0510 / gist:1008613
Created June 5, 2011 03:23
Linux コマンド
ファイル内検索
grep -R -n foo .
ファイル名検索
find -type f -name *bar*
@honda0510
honda0510 / gist:1028558
Created June 16, 2011 02:25
WinHttpRequestでダウンロード
Option Explicit
' 参照設定
' Microsoft WinHTTP Services, version 5.1
' Microsoft ActiveX Data Objects 2.x Library
' 参考
' http://msdn.microsoft.com/en-us/library/aa384061%28v=VS.85%29.aspx
Sub test()
@honda0510
honda0510 / func.js
Created June 23, 2011 03:08
JScript で InputBox と MsgBox
function InputBox(prompt, title) {
if ( prompt === undefined ) prompt = '';
if ( title === undefined ) title = '';
var script = new ActiveXObject('MSScriptControl.ScriptControl');
script.language = 'vbscript';
return script.eval('inputbox("' + prompt + '","' + title + '")');
}
function MsgBox(msg) {
var script = new ActiveXObject('MSScriptControl.ScriptControl');
@honda0510
honda0510 / GetClipboardText.js
Created June 23, 2011 08:59
クリップボードのテキスト取得
function GetClipboardText() {
var data = GetObject('new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}');
data.GetFromClipboard();
return data.GetText();
}
@honda0510
honda0510 / gist:1044432
Created June 24, 2011 08:19
通常使うプリンタの設定と取得
' 通常使うプリンタに設定
Function SetDefaultPrinter(UNCName As String) As String
CreateObject("WScript.Network").SetDefaultPrinter UNCName
End Function
' 通常使うプリンタを取得
Function GetDefaultPrinter() As String
Dim service As Object
Dim printers As Object
Dim printer As Object
@honda0510
honda0510 / Module1.bas
Created June 30, 2011 01:50
SAX サンプル
Option Explicit
' 参照設定
' Microsoft WinHTTP Services, version 5.1
' Microsoft VBScript Regular Expressions 5.5
Sub test()
Const WEBLIO_URI As String = "http://ejje.weblio.jp/content/"
Const WEBLIO_QUERY As String = WEBLIO_URI & "morning"
Option Explicit
Sub test()
Dim expressions(3) As String
Dim find As String
Dim replacement As String
Dim LookAt As XlLookAt
Dim match_case As Boolean
Dim match_byte As Boolean
Dim i As Long
@honda0510
honda0510 / Module1.bas
Created July 1, 2011 15:18
Yahoo!のWeb APIを使って住所から最寄り駅を取得
Option Explicit
' ----------------------------------------------------------------------
' 参照設定
'
' Microsoft WinHTTP Services, version 5.1
' Microsoft VBScript Regular Expressions 5.5
' ----------------------------------------------------------------------
Sub test()
@honda0510
honda0510 / Module1.bas
Created July 3, 2011 04:17
VBAで擬似継承
Option Explicit
Sub test()
Dim bar As bar
Set bar = New bar
bar.method_a ' fooのメソッド
bar.method_b "test" ' fooのメソッド
bar.method_c ' barのメソッド
bar.property_a = 1 ' fooのプロパティ
MsgBox bar.property_a ' fooのプロパティ