Skip to content

Instantly share code, notes, and snippets.

@wonderful-panda
wonderful-panda / bazaar.vim
Created December 13, 2011 15:54
VimのコマンドラインでBazaarコマンドの補完をしてみる
let g:BZR_EXECUTABLE='bzr'
if exists('s:commands')
unlet s:commands
endif
let s:cmd_options = {}
" コマンド名のリストを返す
function! s:GetCommands()
if !exists('s:commands')
@wonderful-panda
wonderful-panda / pycmp_for_bazaar.vim
Created December 17, 2011 16:13
pythoncomplete.vimでlazy_importでインポートしたモジュールも補完できるようにする
:python <<EOS
# coding=utf8
import re
from types import MethodType
# lazy_importブロックを検出するための正規表現(適当)
re_lazy_import = re.compile(
ur'''^lazy_import\s*\(globals\(\)\s*,\s*("""|\'\'\') # lazy_import(globals(), """
(?P<contents>[^"\']*) # inside here document
\1\s*\) # """)
@wonderful-panda
wonderful-panda / gist:1511001
Created December 22, 2011 17:01
Fix for ignore-lightweight-from-remote
=== 変更 ファイル tbzrlib/wtcache.py
--- tbzrlib/wtcache.py 2011-12-22 09:33:51 +0000
+++ tbzrlib/wtcache.py 2011-12-22 16:59:44 +0000
@@ -787,7 +787,7 @@
mutter(u"adding %s to our cache", path)
try:
- tree = open_containing_local_workingtree(path)
+ tree = open_containing_local_workingtree(path.path)
wt_entry = WtCacheEntry(tree, self.crawler)
interface IFoo
{
string Author { get; };
}
class MyTextbox : TextBox, IFoo {...};
class MyCombobox : ComboBox, IFoo {...};
class MyListbox : ListBox, IFoo {...};
public static bool Included<T>(T target, params T[] values)
{
return values.Contains(target);
}
If (foo.Included(hoge, fuga, piyo))
{
// ...
}
@wonderful-panda
wonderful-panda / workon.bat
Created March 21, 2012 21:50
Windows向け virtualenvwrapperもどき
@echo off
set BK_WORKON_HOME=%WORKON_HOME%
set BK_HOMEDIR=%HOMEDIR%
set WORKON_HOME=C:\DEVELOP\py_envs
set HOMEDIR=C:\DEVELOP\bin
for /F "usebackq" %%I IN (`python %HOMEDIR%\workon.py %*`) DO call %%I
set WORKON_HOME=%BK_WORKON_HOME%
@wonderful-panda
wonderful-panda / parameterize.py
Created June 6, 2012 13:43
unittestでパラメタライズドテスト
# -*- coding:utf8 -*-
# unittestでパラメタライズドテストしてみるテスト
from types import MethodType
__all__ = ["param", "parameterize"]
class _Param(object):
"""
パラメータを表現するデコレータ
from bzrlib.commands import plugin_cmds
plugin_cmds.register_lazy('cmd_delta', [],
'bzrlib.plugins.delta.delta')
@wonderful-panda
wonderful-panda / Extensions.vb
Created July 5, 2012 15:13
あれば便利な気がするけどわざわざ作るほどでもない気もする拡張メソッドたち
Public Module Extensions
<Extension()> _
Public Function This(Of T)(ByVal target As T) As T
Return target
End Function
<Extension()> _
Public Function IsNull(Of T As Class)(ByVal target As T) As Boolean
Return target Is Nothing
End Function
public class WeekDay
{
public readonly int Value;
public readonly string Name;
public readonly string ShortName;
public WeekDay(int value, string name, string shortName)
{
this.Value = value;
this.Name = name;
this.ShortName = shortName;