Skip to content

Instantly share code, notes, and snippets.

@rohinomiya
rohinomiya / getDesktopPath.ps1
Created April 9, 2015 12:55
デスクトップのパスを取得
[Environment]::GetFolderPath([Environment+SpecialFolder]::Desktop)
@rohinomiya
rohinomiya / Textwell_expandselection.js
Created October 20, 2014 23:57
Textwell_expandselection.js
var next_action = null;
// next_action = 'tweet';
var text = T.text;
var pattern = '\n';
var j = text.indexOf(pattern, T.range.loc + T.range.len );
var i = text.lastIndexOf(pattern, T.range.loc - 1);
i = (i === -1) ? 0 : i + pattern.length;
j = (j === -1) ? text.length : j + 1;
# Python 最速文法
# 参考
# みんなのPython 第3版
# [python] 年末大感謝祭!初心者脱出のためのPythonTipsを50個紹介
# http://kwatch.houkagoteatime.net/blog/2013/12/07/python-tips/
# エンコード指定
@rohinomiya
rohinomiya / gvim.ahk
Created December 20, 2013 16:55
CPU (32bit / 64bit) に応じて別のアプリを起動する ref: http://qiita.com/rohinomiya/items/80f70b384acc4f0176ab
; Function: 32bit環境か64bit環境かを判別し、異なるEXEを実行する
; NOTICE: 32bit環境でビルドしてください
#NoEnv
SetWorkingDir %A_ScriptDir%
GetNativeSystemInfo() ; OS の種類を取得
{
VarSetCapacity(si,44)
DllCall("GetNativeSystemInfo", "uint", &si)
if ErrorLevel
@rohinomiya
rohinomiya / tutorial.lua
Created May 22, 2013 15:59
Luaを使ってみた時の備忘録 ref: http://qiita.com/items/abeb1d69c640a27d97c5
-- ハイフンを2つ書くと1行コメントになる
--[[
複数行コメント
複数行コメント
複数行コメント
]]
-- 標準出力への改行付き出力
print("Hello, world!")
@rohinomiya
rohinomiya / DeSerialize.cs
Created December 26, 2012 15:08
Dictionaryをシリアル化する(XMLファイルに保存) ref: http://qiita.com/items/b88a5da3965a1c5bed0d
XmlSerializer serializer = new XmlSerializer(typeof(RecordInfo));
RecordInfo record2 = new RecordInfo();
using (FileStream fs = new FileStream(GetXMLFilePath(), FileMode.Open))
{
record2 = serializer.Deserialize(fs) as RecordInfo;
// XML からオブジェクトが復元されている
}
@rohinomiya
rohinomiya / SetText.vb
Created December 20, 2012 14:04
Excel VBA から、クリップボードにテキストをセットする ref: http://qiita.com/items/1b719bc90d7497688699
Dim CB as Object
Set CB = new DataObject
With CB
.SetText "セットしたい文字列"
.PutInClipboard 'クリップボードに反映する
End With
@rohinomiya
rohinomiya / sample.cs
Created November 17, 2012 17:04
C#で、文字コードを表す文字列から、文字に変換する ref: http://qiita.com/items/ca30f311f881cbb33ca8
string charCode = "304C";
int charCode16 = Convert.ToInt32(charCode,16); // 16進数文字列 -> 数値
char c = Convert.ToChar(charCode16); // 数値(文字コード) -> 文字
string newChar = c.ToString(); // "が" という「文字列」
@rohinomiya
rohinomiya / build_project.bat
Created September 12, 2012 15:39
C#で、コマンドラインからプロジェクトのビルドを行う ref: http://qiita.com/items/1374dca1298a5a874ea5
"C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" projectname.csproj /t:build
@rohinomiya
rohinomiya / SampleParams.cs
Created August 30, 2012 14:18
C#で可変長引数を使うには params ref: http://qiita.com/items/b8327999fd835132cb7a
using System;
using System.Linq;
namespace SampleParams
{
class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Sum={0}",Sum(1,2,3,4,5));