Skip to content

Instantly share code, notes, and snippets.

@dck-jp
dck-jp / Program.cs
Last active August 29, 2015 14:07
PlayDice
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace test
{
class Program
{
static int seed;
@dck-jp
dck-jp / NoBracketNoLife.cs
Last active August 29, 2015 14:05
NoBracketNoLife
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
var x = 0;
if (x != 0)
NoPoint(); //実行されない
@dck-jp
dck-jp / test.bas
Created June 25, 2014 08:43
SeleniumVBA SwitchToWindow
Sub SwitchWindowTest()
Dim driver As New WebDriver
Call driver.Start("firefox", "http://www.red.oit-net.jp/")
Call driver.get("/tatsuya/java/winopen.htm")
Dim beforeHwd As String
beforeHwd = driver.WindowHandle 'Returns the handle of the current window.
driver.findElementByCssSelector("table.waku:nth-child(13) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(1) > form:nth-child(3) > input:nth-child(1)").click
Option Explicit
Sub add_正常系_Test()
Call Assert.AreEqualVal(3, add(1, 2))
End Sub
Sub add_異常系_Test()
Assert.IsErrFunc 13, Init(New Func, vbVariant, AddressOf add, vbVariant, vbVariant), Array(1, "てすと")
End Sub
Option Explicit
Function add(a, b)
add = CInt(a) + CInt(b)
End Function
@dck-jp
dck-jp / dynamicExecute.bas
Created June 14, 2014 18:23
Dynamic Code Generate & Execute@VBA
Option Explicit
Sub Main()
Dim tempModule As Object: Set tempModule = GenerateSub
Application.Run "SubMethod"
ThisWorkbook.VBProject.VBComponents.Remove tempModule
End Sub
@dck-jp
dck-jp / dynamicAssert.bas
Last active August 29, 2015 14:02
dynamic code generate & execute @ VBA part2
'''+---- --+
'''| Ariawase 0.6.0 |
'''| Ariawase is free library for VBA cowboys. |
'''| The Project Page: https://github.com/vbaidiot/Ariawase |
'''+-- ----+
Option Explicit
Option Private Module
Private Const TestClassSuffix As String = "Test"
Private Const TestProcSuffix As String = "_Test"
@dck-jp
dck-jp / dynamicAssert.bas
Last active August 29, 2015 14:02
dynamic code generate & execute @ VBA
'''+---- --+
'''| Ariawase 0.6.0 |
'''| Ariawase is free library for VBA cowboys. |
'''| The Project Page: https://github.com/vbaidiot/Ariawase |
'''+-- ----+
Option Explicit
Option Private Module
Private Const TestClassSuffix As String = "Test"
Private Const TestProcSuffix As String = "_Test"
@dck-jp
dck-jp / HereDoc.cs
Created May 27, 2014 02:46
simify HereDocumentExtension.cs
/// <summary>
/// [Rules]
/// - all of lines (except first) require same indent
/// * indent = mix of tab and space is ok
/// - first line requires empty (only line break)
/// * linebreak = CR+LF or LF
///
/// [SpecialThanks]
/// this code is inspired by sayurin's code (http://git.io/iE1MhA)
///
/// <summary>
/// [Rules]
/// - all of lines (except first&last) require same indent
/// * indent = mix of tab and space is ok
/// - first line requires empty (only line break)
/// * linebreak = CR+LF or LF
/// - last line requires "no line break"
///
/// [SpecialThanks]
/// this code is same as sayurin's code (http://git.io/iE1MhA)