Skip to content

Instantly share code, notes, and snippets.

View dck-jp's full-sized avatar

dck-jp dck-jp

  • Osaka, Japan
View GitHub Profile
@dck-jp
dck-jp / ArrayExTest.bas
Last active August 29, 2015 13:56
ArrayEx.cls sample code
Option Explicit
Sub ArrayExTest()
Dim list As New ArrayEx
list.AddVal (11)
list.AddVal (21)
list.AddVal (31)
Dim arr: arr = list.ToArray
Debug.Print (arr(2)) '"31" displays at ImmediateWindow
@dck-jp
dck-jp / cdoMail2.bas
Created February 15, 2014 13:47
a part of CdoMail.cls
Public Sub SetAddress( _
ByVal addrTo As Variant, _
'省略
)
xMsg.To = GetAddrList(addrTo)
'省略
End Sub
Private Function GetAddrList(ByVal addlst As Variant) As String
@dck-jp
dck-jp / cdoMail.bas
Created February 15, 2014 13:41
a part of CdoMail.cls
Private Const uriCdoConf As String = "http://schemas.microsoft.com/cdo/configuration/"
Private Const cdoSendUsingMethod As String = uriCdoConf & "sendusing"
@dck-jp
dck-jp / CdoMailTest.bas
Last active August 29, 2015 13:56
CdoMail.cls TestCode
Option Explicit
Sub CdoMailTest()
Dim mail As New CdoMail
Call mail.Configure("oreore@mailsagi.com", _
"smtp.server.com:25", _
cdoBasic, "userName", "pass", _
False)
Call mail.NewMail
@dck-jp
dck-jp / PartOfWinINet.bas
Created February 13, 2014 11:59
A part of WinInet.bas in Ariawase
#If VBA7 And Win64 Then
Private Sub SaveDownloading(ByVal hCnn As LongPtr, ByVal svPath As String)
#Else
Private Sub SaveDownloading(ByVal hCnn As Long, ByVal svPath As String)
#End If
Dim strm As Object: Set strm = CreateAdoDbStream(adTypeBinary)
strm.Open
' 中略
@dck-jp
dck-jp / FileDownloadTest.bas
Last active August 29, 2015 13:56
Test Code of the FileDownload Subroutine in Ariawase
Option Explicit
Sub FileDownloadTest()
Dim url As String
Dim savePath As String: savePath = "D:\Test\"
Dim returnValue As String
url = "http://msdn.microsoft.com/en-us/library/aa385483.aspx"
returnValue = FileDownload(url, savePath)
'returnValue is "D:\Test\aa385483.aspx"
@dck-jp
dck-jp / flipImg.js
Last active August 29, 2015 13:56
Flip the image vertically In China Trademark Search Result
javascript:(function(){
var html = document.getElementsByTagName('Body')[0].innerHTML;
document.getElementsByTagName('Body')[0].innerHTML = html.replace(/<img .*src=\"([^\"\s]+)\"[^>]*>/,"<img id=target src=\"$1\" style=\"-webkit-transform: rotateX(180deg);-moz-transform: rotateX(180deg);transform:rotateX(180deg);\">");
})();
@dck-jp
dck-jp / Class1.cs
Last active January 4, 2016 02:29
PrefetchedProperty ver.2
public class Class1
{
private Task _LoadPropertyATask;
private string _PropertyA;
public string PropertyA
{
get
{
if (_LoadPropertyATask == null) Initialize(); //同期読み出しの場合、非同期読み出し命令をここで実行
@dck-jp
dck-jp / Test1.cs
Created January 22, 2014 03:47
Unit test code for PrefetchedProperty.cs by NUnit & ChainingAssertion
[TestFixture]
public class Test1
{
[Test]
public void TestMethod即座に読み出し()
{
var prefetch = new Class1();
prefetch.PropertyA.Is("abc");
}
@dck-jp
dck-jp / PrefetchedProperty.cs
Created January 22, 2014 03:42
Getter that prefetched the value asynchronously
class Class1
{
private Task<string> _propertyALoadTask;
private string _PropertyA;
public string PropertyA{
get
{
if(_PropertyA != null) return _PropertyA;