Skip to content

Instantly share code, notes, and snippets.

View tsukkee's full-sized avatar

Takayuki Tsukitani tsukkee

View GitHub Profile
@tsukkee
tsukkee / tabnumber.css
Created December 8, 2010 18:49 — forked from caisui/gist:733339
numbering on each tab for Firefox
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
#TabsToolbar {
counter-reset: tabnumber;
}
#TabsToolbar tab {
counter-increment: tabnumber;
}
@tsukkee
tsukkee / Omake.cs
Created January 21, 2011 07:03
C#'s ternery operator needs left hand side?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TernaryOperatorTest
{
class Program
{
static void Main(string[] args)
@tsukkee
tsukkee / fizzbuzz-c++0x.cpp
Created January 25, 2011 13:11
FizzBuzz with C++0x lambda
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <iterator>
static const int SIZE = 100;
int main(int argc, char const* argv[])
{
@tsukkee
tsukkee / wrapper_for_afxbeginthread.cpp
Created January 26, 2011 10:44
A wrapper function for AfxBeginThread
// [Reference]
// Cのコールバック関数をC++のメンバ関数にバインディングする方法 - kazuhoのメモ置き場
// http://d.hatena.ne.jp/kazuhooku/20110126/1296031454
template <typename T, UINT (T::*THREAD_PROC)()>
UINT ToThreadCallback(LPVOID pParam)
{
return (static_cast<T *>(pParam)->*THREAD_PROC)();
}
@tsukkee
tsukkee / define_function_in_python.vim
Created February 24, 2011 11:53
PythonのデコレータでVim ScriptからでもPythonからでも呼べる関数を定義する
python <<EOM
# coding=utf-8
import vim
vim.command("""
function! Hoge(str)
return a:str . a:str
endfunction
""")
function! s:read_line() dict
let l:output = self.buffer
let l:res = l:output
while l:res !~ '\r\?\n' && !self.__eof
let l:res = self.read(256)
let l:output .= l:res
endwhile
let l:pos = match(l:output, '\v%(\r?\n|$)\zs')
let l:line = matchstr(l:output[: l:pos - 1], '.\{-}\ze\r\?\n$')
@tsukkee
tsukkee / yokohamavim2.vim
Created September 25, 2011 05:23
Yokohama.vim #2 presentation by tsukkee
--
Yokohama.vim #2
キーマッピングを考える
tsukkee
@tsukkee
tsukkee / outputdebugstring.cpp
Created November 22, 2011 17:12
Macro for OutputDebugString (for Windows)
#include <windows.h>
#include <tchar.h>
#include <sstream>
typedef std::basic_stringstream<TCHAR> tstringstream;
template<typename T> tstringstream& operator,(tstringstream& tss, T t) { tss << _T(" ") << t; return tss; }
#define OUTPUT_DEBUG_STRING(...) ::OutputDebugString((tstringstream(), _T("***"), __VA_ARGS__, _T("\n")).str().c_str());
int main(int argc, char *argv[]) {
OUTPUT_DEBUG_STRING(_T("abc"), 1, 2.3, true); // -> " *** abc 1 2.3 1"
@tsukkee
tsukkee / python_vim_function.vim
Created December 17, 2011 14:23
Vim Advent Calendar 18日目
python <<EOM
# coding=utf-8
import vim
import re
# decorator for defining Vim script function
_functions_for_vim = {}
def vimfunc(name, *args):
def _(func):
_functions_for_vim[name] = func
@tsukkee
tsukkee / pythread.vim
Last active December 11, 2015 04:39
古いVimだと動くけど、最新のVimだと動かない
echomsg 'begin'
python <<EOF
# coding: utf-8
import thread
import time
def func():
for i in range(0, 10):
print i