Skip to content

Instantly share code, notes, and snippets.

from fnmatch import fnmatch
def check_pdb(ui, repo, hooktype, node=None, source=None, **kwargs):
for file in [f for f in repo[node].files() if fnmatch(f, '*.py')]:
# ファイルごとにチェック
@wonderful-panda
wonderful-panda / seqequal.cs
Created November 10, 2012 02:10
IEnumerableに対するEqualToとEquivalentTo
[TestCase]
public void Test_SequenceEqual()
{
int[] a = { 1, 2, 3 };
List<int> alist = a.ToList();
int []b = { 3, 2, 1 };
Assert.That(a, Iz.EquivalentTo(b)); // 順番が違ってもOK
Assert.That(a, Iz.EquivalentTo(alist)); // 型が違ってもOK
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
public class MyEx1 : Exception
{
public MyEx1(string msg, Exception inner) : base(msg, inner) { }
@wonderful-panda
wonderful-panda / trac.ini
Created November 29, 2012 09:56
DivHelperPlugin
[divhelper]
div-alias.foo = class=foo
span-alias.red = "style=color:red;"
dim x as integer = 0
for i as integer = 0 to (10 and (x < 10))
x = x + i
debug.print(i)
next
@wonderful-panda
wonderful-panda / gist:4493360
Created January 9, 2013 14:08
Spockもどき
from spock import spec, mark, d, v
@spec
def test():
"""length of Spock's and his friends' names"""
@mark
def expect():
assert(len(v.name) == v.length)
select
e.obj_id,
max(decode(e.key, 'A', e.value, null)) A,
max(decode(e.key, 'B', e.value, null)) B,
from EAV e
group by e.obj_id;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using NUnit.Framework;
namespace groupby
{
public static class Class1
@wonderful-panda
wonderful-panda / eachslice.vb
Created March 29, 2013 03:45
VBでeach_slice
Imports System.Runtime.CompilerServices
Namespace Hoge
Class EachSliceEnumerator(Of T)
Implements IEnumerator(Of T())
Private ReadOnly _internal As IEnumerator(Of T)
Private ReadOnly _size As Integer
Private _current As T() = Nothing
@wonderful-panda
wonderful-panda / funcbaseenumerable.vb
Created April 18, 2013 08:33
FuncBaseEnumerable.vb
Public Class FuncBaseEnumerable(Of T)
Implements IEnumerable(Of T)
Private ReadOnly _getEnumerator As Func(Of IEnumerator(Of T))
Public Sub New(getEnumerator As Func(Of IEnumerator(Of T)))
_getEnumerator = getEnumerator
End Sub
Public Function GetEnumerator() As IEnumerator(Of T) Implements IEnumerable(Of T).GetEnumerator