Skip to content

Instantly share code, notes, and snippets.

@snaka
snaka / gist:3992351
Created November 1, 2012 07:46
excelシートの一覧
Sub create_sheet_index()
Dim idx As Range
Dim i As Integer
' #index という名前のシートに出力
Set idx = Worksheets("#index").Cells(3, 2)
i = 1
For Each sht In ActiveWorkbook.Worksheets
' シート名の頭が#は取り込まない
@snaka
snaka / gist:3837457
Created October 5, 2012 01:04
BashプロンプトにGitのブランチ名を表示し、変更の有無を'*'で識別できるようにする(これを ~/.bashrc に追加)
# for git
#
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
@snaka
snaka / gist:3022723
Created June 30, 2012 06:57
Windows XP 環境(Apache2.2)に PHP 入れて、PukiWikiPlusを動かすまで
Apacheはたぶん標準構成でいれた気がする。
PHP5.2をダウンロード
インストーラにしたがってインストール完了。
Apache再起動
Apacheが起動しない!
@snaka
snaka / FindFolders.wsf
Created June 2, 2012 05:28
[wsh]特定のフォルダを除外しつつ特定の名前を持つフォルダを抽出
<package>
<job id="EnumFolders">
<object id="fso" progid="Scripting.FileSystemObject"/>
<script language="JScript"><![CDATA[
// 除外するパターン
var excludes = createFilter([".svn", "Branches"]);
// 抽出するパターンを配列から生成する
var includes = createFilter([
"Hoge",
@snaka
snaka / enumfiles.wsf
Created June 2, 2012 04:52
[wsh]特定のフォルダを除外しながら再帰的にフォルダを列挙する
<?xml version="1.0" ?>
<!-- 特定のフォルダを除外してフォルダを列挙する -->
<package>
<job id="EnumFolders">
<object id="fso" progid="Scripting.FileSystemObject"/>
<script language="JScript"><![CDATA[
// 除外するパターン
var excludes = new ActiveXObject("VBScript.RegExp");
excludes.Pattern = "^.svn$|^Branches";
@snaka
snaka / app.yaml
Created May 3, 2012 13:40
webapp2_extras の sessions を使う
application: session
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
@snaka
snaka / app.yaml
Created May 3, 2012 03:28
GAEでJinja2を使う
application: webapp2
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: .*
script: main.app
@snaka
snaka / hello.html
Created May 2, 2012 10:19
Jinja2でテンプレートに関数を埋め込む
Hello, {{ hoge() }} san.
@snaka
snaka / runner.bas
Created May 1, 2012 15:33
vbUnit3のManualFixtureの使用例
'
' Test runner module
'
Public Sub run()
Dim tests As ISuite
Dim test As ITest
Dim results As TestResult
Set tests = New vbUnitTestSuite
Set test = tests.suite
@snaka
snaka / hello.html
Created April 30, 2012 03:47
GAEでのカスタムテンプレートタグの本体とそれを利用する側のソースコード例
<html>
<body>
{% hello %}
</body>
</html>