Skip to content

Instantly share code, notes, and snippets.

@kannokanno
kannokanno / colorize.pl
Last active August 29, 2015 14:18 — forked from Cside/colorize.pl
#!/usr/bin/env perl
=head1 Examples
$ tail -f access_log | perl colorize.pl
$ plackup app.psgi 2>&1 | perl colorize.pl
=cut
use strict;
@kannokanno
kannokanno / ctrlp-dwm,vim
Last active August 29, 2015 13:57
ctrlp + dwm
function! OpenWithDWM(action, line)
call ctrlp#acceptfile(a:action, a:line)
if winnr() !=# 1 && exists('*DWM_Focus')
call DWM_Focus()
endif
endfunction
let g:ctrlp_open_func = {
\ 'files' : 'OpenWithDWM',
\ 'buffers' : 'OpenWithDWM',
@kannokanno
kannokanno / mono.rb
Last active December 19, 2015 03:39 — forked from shtirlic/mono.rb
# http://www.mono-project.com/Compiling_Mono_on_OSX
require 'formula'
class Mono < Formula
url 'http://download.mono-project.com/sources/mono/mono-3.0.12.tar.bz2'
sha1 'be46f28e16721e9b975ba17ae02b021ddcc7406e'
homepage 'http://www.mono-project.com/'
@kannokanno
kannokanno / pl-sample.pl
Last active December 18, 2015 21:28
引数の型で処理を振り分けるサンプル
use 5.012;
use strict;
use warnings;
use List::Util qw(max);
sub my_max(\[$@%]) {
my $arg = shift;
my $max = 0;
my $ref = ref($arg);
import unittest
def plus(a, b):
return a + b
def minus(a, b):
return a - b
" 指定したVim scriptをsourceしてエラーをquickfixに表示
function! s:vim_lint(file)
let messages = s:vim_lint_messages(s:vim_lint_hook_file(a:file))
let srclines = readfile(a:file)
let errors = []
let start_pos = 0
let info = {}
echo g:__func_lnums__
for l in split(messages, "\n")
if l =~ '^行'
@kannokanno
kannokanno / gist:3158930
Created July 22, 2012 08:40
Mock sample for Vim script
function! s:mock(context)
let mock = {'context' : a:context, 'instance_map' : {}}
function! mock.function(name)
let instance = s:mock_instance(self.context, a:name)
let self.instance_map[instance.funcname_full] = instance
return instance
endfunction
function! mock.assert()
@kannokanno
kannokanno / gist:2532548
Created April 29, 2012 03:57
ctagsでphpのtagsを作成した場合にコメント中のfunctionも検出してしまう
--sample.php
<?php
/**
* function something
*/
function something() {
return 1;
}
?>
--