Skip to content

Instantly share code, notes, and snippets.

@tyabuta
tyabuta / JavaScript_CodeSnippet.js
Last active December 10, 2015 01:58
JavaScript Code Snippet
// ----------------------------------------------
// 文字列に引数のデータを書き込みます。
// データを書き込む位置に{0}などと表記してください。
// e.g.
// sprintf("position(x:{0},y:{1}", x,y);
// ----------------------------------------------
sprintf = function(fmt){
for (var i=1; i<arguments.length; i++){
var reg = new RegExp("\\{" + (i-1) + "\\}", "g");
@tyabuta
tyabuta / ExcelVBA_CodeSnippet.vba
Last active December 10, 2015 01:18
Excel VBA Code Snippet
' *******************************************************************
'
' Excel VBA Code Snippet
'
' *******************************************************************
' -----------------------------------------------
' 曜日を表す文字列を取得する。
'
@tyabuta
tyabuta / Ruby_CodeSnippet.rb
Created November 23, 2012 04:29
Ruby CodeSnippet
######################################################################
# Ruby CodeSnippet
######################################################################
# --------------------------------------------------------------------
# Rubyでの起動を指定。一行目に記述する必要あり。
# -KuオプションでUTF-8を指定。日本語を出力する時にないと文字化けする。
# --------------------------------------------------------------------
#!/usr/bin/ruby -Ku
@tyabuta
tyabuta / CodeSnippet.php
Created November 17, 2012 14:27
PHP CodeSnippet
/*********************************************************************
* PHP CodeSnippet
*********************************************************************/
/*--------------------------------------------------------------------
include
--------------------------------------------------------------------*/
// ファイル取り込み
require_once 'hoge.php';
@tyabuta
tyabuta / SetClipboard.cpp
Created October 7, 2012 14:06
png画像をクリップボードへ貼付ける。(Windows C++)
BOOL SetClipboardPng(LPCWSTR filename){
// ▼クリップボードの占有を開始
if (FALSE == OpenClipboard(NULL)) return FALSE;
BOOL bRet = FALSE;
// ▼ファイルオープン
HANDLE hFile = CreateFile(
filename, // lpFileName
@tyabuta
tyabuta / DeleteDir.vba
Created October 4, 2012 15:26
DeleteDir for VBA
' 指定ディレクトリを削除する。
Function DeleteDir(dir_ As String) As Boolean
On Error Resume Next
Kill dir_ & "\*.*"
RmDir dir_
If Err = 0 Then DeleteDir = True
End Function
@tyabuta
tyabuta / MSDebugStreambuf.hpp
Created June 10, 2012 00:01
OutputDebugString関数のストリームバッファClass
#include <windows.h>
#include <sstream>
#ifdef _MSC_VER
/*
* OutputDebugString関数のストリームバッファClass
*
* // インスタンス作成
* std::ostream dout(new MSDebugStreambuf);
@tyabuta
tyabuta / oo4oバインド変数
Created June 7, 2012 22:23
Oracleデータベースでバインド変数の設定方法 for VBA
' I/Oタイプ
Const ORAPARM_INPUT = 1
Const ORAPARM_OUTPUT = 2
Const ORAPARM_BOTH = 3
' 変数型
Const ORATYPE_VARCHAR2 = 1
Const ORATYPE_NUMBER = 2
Const ORATYPE_SINT = 3
Const ORATYPE_FLOAT = 4