Skip to content

Instantly share code, notes, and snippets.

View haya14busa's full-sized avatar
🐶

haya14busa haya14busa

🐶
View GitHub Profile
@haya14busa
haya14busa / main.go
Created November 1, 2016 23:32
サンプル: Golangにおけるinterfaceをつかったテストで mock を書く技法
package main
import (
"context"
"fmt"
)
type GitHub interface {
CreateRelease(ctx context.Context, opt *Option) (string, error)
GetRelease(ctx context.Context, tag string) (string, error)
@haya14busa
haya14busa / vimlint
Created October 29, 2016 16:54
vimlint
#!/bin/sh
sh /vim-vimlint/bin/vimlint.sh -l /vim-vimlint -p /vim-vimlparser $@
// src is the input for which we want to inspect the AST.
src := `
let s:c = 1.0
let X = F(3.14)*2 + s:c
`
opt := &vimlparser.ParseOption{}
f, err := vimlparser.ParseFile(strings.NewReader(src), "src.vim", opt)
if err != nil {
log.Fatal(err)
function! s:main() abort
let max_process = 8
call ch_logfile('/tmp/channellog.txt', 'w')
TimerStart
let files = []
let rtps = map(items(dein#get()), {_, kv -> kv[1].rtp})
for rtp in rtps
let files += globpath(rtp, 'autoload/**/*.vim', 0, 1)
@haya14busa
haya14busa / 2016-09-18-045740.txt
Created September 17, 2016 19:57
syntax error
runtime/autoload/javascriptcomplete.vim:623:1: vimlparser: E171: Missing :endif: ENDFUNCTION
runtime/autoload/netrw.vim:2530:84: vimlparser: unexpected token: "
runtime/autoload/phpcomplete.vim:2419:1: vimlparser: E477: No ! allowed
runtime/autoload/rubycomplete.vim:199:17: vimlparser: E492: Not an editor command: idx = -1
runtime/ftplugin/spec.vim:113:5: vimlparser: E492: Not an editor command: chgline = line(".")
runtime/indent/dylan.vim:57:12: vimlparser: unexpected token: =
runtime/indent/ruby.vim:392:3: vimlparser: E580: :endif without :if
runtime/indent/sml.vim:155:3: vimlparser: E492: Not an editor command: cursor(lnum,1)
runtime/lang/menu_chinese_taiwan.950.vim:111:56: vimlparser: E492: Not an editor command: (&P)\.\.\.
runtime/lang/menu_japanese_japan.932.vim:29:37: vimlparser: E492: Not an editor command: ���T�[/�o�^(&S)
@haya14busa
haya14busa / 2016-09-17-194710.vim
Last active September 17, 2016 13:00
minlen table
" create builtin command table
"
let s:ex_cmds_h = '/home/haya14busa/src/github.com/vim/vim/src/ex_cmds.h'
let s:Trie = {
\ 'data': {},
\ }
function! s:Trie.new() abort
@haya14busa
haya14busa / job_channel_cb.patch
Created August 28, 2016 15:25
cb of channel of job
diff --git a/src/channel.c b/src/channel.c
index 7488574..81c43a5 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -3456,7 +3456,7 @@ send_common(
EMSG2(_("E917: Cannot use a callback with %s()"), fun);
return NULL;
}
- channel_set_req_callback(channel, part_send,
+ channel_set_req_callback(channel, *part_read,
@haya14busa
haya14busa / job_channel_cb.patch
Created August 28, 2016 15:16
fix callback for job channel
diff --git a/src/channel.c b/src/channel.c
index 7488574..9b952af 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -3456,8 +3456,15 @@ send_common(
EMSG2(_("E917: Cannot use a callback with %s()"), fun);
return NULL;
}
- channel_set_req_callback(channel, part_send,
- opt->jo_callback, opt->jo_partial, id);
@haya14busa
haya14busa / test.vim
Created August 23, 2016 14:06
ch_read
call ch_logfile('/tmp/vimchannellog', 'w')
function! s:cb(channel, msg) abort
echom ch_read(a:channel)
echom string(a:msg)
endfunction
let s:opt = {'callback': function('s:cb')}
function! s:test() abort
@haya14busa
haya14busa / main.go
Created August 23, 2016 14:05
ch_read
package main
import (
"bufio"
"encoding/json"
"flag"
"fmt"
"log"
"net"
"time"