Skip to content

Instantly share code, notes, and snippets.

View tyru's full-sized avatar
🏠
Working from home

Fujiwara Takuya tyru

🏠
Working from home
View GitHub Profile
@tyru
tyru / deferred.vim
Created February 10, 2018 07:24
Deferred object using Vital.Async.Promise
let s:V = vital#vital#new()
let s:P = s:V.import('Async.Promise')
unlet s:V
function! s:_defer() abort
let d = {}
let d.promise = s:P.new({resolve, reject -> extend(d, {
\ 'resolve': {-> call(resolve, a:000)},
\ 'reject': {-> call(reject, a:000)},
\})})
@tyru
tyru / client.vim
Last active December 4, 2025 22:21
WIP: [Preview] Chrome Debugging Protocol in Vim script
" Run:
" 1. mkdir tmp
" 2. {chrome} --remote-debugging-port=9222 --no-first-run --no-default-browser-check --user-data-dir=tmp
"
" In another shell:
" 1. vim -S client.vim
"
" ref. https://developer.mozilla.org/ja/docs/Tools/Remote_Debugging/Chrome_Desktop
@tyru
tyru / bench.vim
Last active February 5, 2018 15:11
Benchmarks of Vital.Data.String.trim*() functions
" ================= trim =================
function! s:trim_matchstr_posix(s) abort
return matchstr(a:s,'^[[:space:]]*\zs.\{-}\ze[[:space:]]*$')
endfunction
function! s:trim_matchstr(s) abort
return matchstr(a:s,'^[ \t\r\n\v\f]*\zs.\{-}\ze[ \t\r\n\v\f]*$')
endfunction
@tyru
tyru / clone-progress.go
Last active March 16, 2024 19:22
go-git progress notification output
package main
import (
"bytes"
"encoding/binary"
"fmt"
"io/ioutil"
"net/http"
"os"
"strings"
@tyru
tyru / esc.c
Last active January 9, 2018 16:32
Struggling with ANSI escape code: https://en.wikipedia.org/wiki/ANSI_escape_code
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <time.h>
#include <ctype.h>
#include <termios.h>
#include <unistd.h>
#define ESC "\x1b"
@tyru
tyru / 冬アニメ.md
Last active January 6, 2018 03:08
2018年 冬アニメ 録画リスト

  • ヴァイオレット・エヴァーガーデン
    • 最速放送日 2018年1月10日(水)24:00~(TOKYO MX)
  • からかい上手の高木さん
    • 最速放送日 2018年1月8日(月)23:00~(TOKYO MX)
  • 恋は雨上がりのように
Running 'bash ./test.sh'
Exited: 0
buf = {'out': 'hello1^@hello2^@hello3^@', 'err': 'hello4^@hello5^@'}
s:run() end
Exited: 0
{}
s:run() end
s:read_to_buf()
@tyru
tyru / path.diff
Created December 11, 2017 11:00
The modified patch for go1.10beta1 of WSL (Windows Subsystem Linux) specific problem of os.RemoveAll(): https://github.com/vim-volt/volt/issues/1
--- src/os/path.go.old 2017-12-11 19:45:29.722217500 +0900
+++ src/os/path.go 2017-12-11 19:51:19.668455900 +0900
@@ -84,26 +84,35 @@
return err
}
- // Directory.
- fd, err := Open(path)
- if err != nil {
- if IsNotExist(err) {
@tyru
tyru / output
Last active November 1, 2017 14:59
[function! s:load_on()
imap <expr> <Tab> neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)" : "\<Tab>"
endfuncti]