Skip to content

Instantly share code, notes, and snippets.

@hachibeeDI
hachibeeDI / maybeclosure.cs
Created June 27, 2012 03:32
on C#, demonstration of lambda and lexical scope
// map自体は、.NETでは.select拡張メソッドとして提供されているかんじっぽい?
// old
static int[]
squarefunc(int[] lis)
{
for(var i = 0; i <= lis.Count() -1; ++i)
{
lis[i] = lis[i] * lis[i];
}
@hachibeeDI
hachibeeDI / GetOdakyulineInfo.py
Created August 12, 2012 08:18
get odakyu-line infomation. from its official twitter acounts
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import json
import urllib2
from datetime import *
_MONTH = {u'Jan':u'01', u'Feb':u'02', u'Mar':u'03', u'Apr':u'04',
u'May':u'05', u'Jun':u'06', u'Jul':u'07', u'Aug':u'08',
# vim: fileencoding=utf-8
def main():
print 'gist!'
if __name__ == '__main__':
main()
@hachibeeDI
hachibeeDI / tablecalc.html
Created August 20, 2012 02:48
this is for training Javascript, and calculate table cell's value on tfoot references columns line.
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8" />
</head>
<body>
<header>
<h1>Table sum up calculation test</h1>
</header>
Imports System.Runtime.CompilerServices
''' <summary> エイリアス的な拡張メソッドたち </summary>
Module StringExtention
''' <summary> </summary>
<Extension()> _
Public Function setFormat(this As String, ParamArray values As String()) As String
Return String.Format(this, values)
End Function
@hachibeeDI
hachibeeDI / EnumUtils.vb
Created October 5, 2012 09:52
Convert value as Integer to Enum
Imports System.Runtime.CompilerServices
Module EnumUtils
<Extension()> _
Public Function convertEnum(Of TEnum)(this As Integer) As TEnum
Dim t As TEnum
If Not t.GetType().IsEnum Then
Throw New ArgumentException("Enum型以外はダメですよん")
End If
@hachibeeDI
hachibeeDI / gist:3917553
Created October 19, 2012 10:56
zsh function for git
# http://qiita.com/items/1f01aa09ccf148542f21
gs() {
git status -sb
}
gst() {
git status -sb | head -n 1
git status -sb | sed '1d' | grep --line-number '^'
}
@hachibeeDI
hachibeeDI / zurui.less
Created November 5, 2012 14:39
ずるいデザインのやつをPlayで使いたいのでLESSにうつしてる途中のアレ
// depend on twitterbootstrap's mixins.less
@import "mixins.less";
.zurui-line-top(@op1: .1, @op2: 1) {
border-top: 1px solid rgba(0,0,0, @op1);
.box-shadow(0 1px 0 rgba(255,255,255,@op2) inset);
}
.zurui-line-left(@op1: .1, @op2: 1) {
border-left: 1px solid rgba(0,0,0, @op1);
@hachibeeDI
hachibeeDI / lemowl.py
Created November 21, 2012 14:06
change iTerm's transparency
#!/usr/bin/env python
import sys
import appscript
def main():
iterm_transparency = appscript.app('iTerm').current_terminal.current_session.transparency
iterm_transparency.set("0.9" if sys.argv[1] == '-' else "0.1")
if __name__ == '__main__':
@hachibeeDI
hachibeeDI / vbnet.vim
Last active December 9, 2015 19:19
vbnet syntax for vim
" Vim syntax file
" Language : VisualBasic.NET
" Maintainers: OGURA Daiki
" Last Change: 2012 12 17
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif