Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

FUJIWARA Takuya tyru

🏠
Working from home
Block or report user

Report or block tyru

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tyru
tyru / bench.vim
Created Nov 19, 2019
Benchmark for parsing SKK dictionary
View bench.vim
function! s:run() abort
let skkdict = expand('~/Dropbox/config/skkdict/system-dict')
" for memory cache
call readfile(skkdict)
let start = reltime()
call readfile(skkdict)
let b1 = reltimestr(reltime(start, reltime()))
@tyru
tyru / main.rs
Last active Aug 25, 2019
JSON Parser in Rust
View main.rs
#![feature(slice_patterns)]
use std::io;
use std::fmt;
use std::str;
use std::result;
use std::iter::Iterator;
// TODO: take deparse option from command-line arguments
fn main() {
View chain-op-test.vim
function! HasKey(dict, key)
return has_key(a:dict, a:key)
endfunction
function! s:has_key(dict, key)
return has_key(a:dict, a:key)
endfunction
function! Fold(list, init, f)
let l:V = a:init
for l:Elem in a:list
@tyru
tyru / profile.txt
Created Aug 1, 2019
Add readable name to numbered-function (and vim-jp/vim-vimlparser profiling result)
View profile.txt
SCRIPT /Users/tyru/config/home/volt/repos/github.com/vim-jp/vim-vimlparser/autoload/vimlparser.vim
Sourced 1 time
Total time: 0.011356
Self time: 0.011356
count total (s) self (s)
" vim:set ts=8 sts=2 sw=2 tw=0 et:
"
" VimL parser - Vim Script Parser
"
@tyru
tyru / require.vim
Last active Jul 2, 2019
require() function for deeply nested very loooooooooong named autoload function
View require.vim
let s:L = vital#of('vital').import('Data.List')
function! s:require(ns, ...) abort
let ns = strtrans(a:ns)
let fnlist = map(
\ split(execute('function /' . ns), '\n'),
\ {_,l -> matchstr(l, '^function ' . ns . '#\zs\w\+\ze(')}
\)
call filter(fnlist, '!empty(v:val)')
if a:0
@tyru
tyru / search-decl-php-ftplugin-2.patch
Last active Jun 6, 2019
Searching declaration in PHP ftplugin (Fix [[, ]] mappings problems, added [], ][ mappings)
View search-decl-php-ftplugin-2.patch
--- php.vim.bak 2018-10-10 14:08:25.875669800 +0900
+++ php.vim 2018-10-10 14:04:30.777334700 +0900
@@ -61,15 +61,107 @@
setlocal omnifunc=phpcomplete#CompletePHP
endif
-" Section jumping: [[ and ]] provided by Antony Scriven <adscriven at gmail dot com>
-let s:function = '\(abstract\s\+\|final\s\+\|private\s\+\|protected\s\+\|public\s\+\|static\s\+\)*function'
-let s:class = '\(abstract\s\+\|final\s\+\)*class'
+" Section jumping: [[ and ]] provided by:
@tyru
tyru / run.gs
Last active Mar 21, 2019
Google Apps Script で Gmail の添付ファイルを Google Drive に保存
View run.gs
// Google Drive でフォルダに移動した時のURLで分かる
// https://drive.google.com/drive/u/1/folders/{フォルダのID}
var SAVE_FOLDER_ID = 'フォルダのID';
var READ_LABEL_NAME = '添付ファイル保存済み';
var SEARCH_CONDITION = 'has:attachment -label:' + READ_LABEL_NAME;
var THREADS_PER_PAGE = 100;
function saveAttachments() {
Logger.clear();
Logger.log('start');
View flatten.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef enum _type_t {
INT_T,
STRING_T,
LIST_T,
} type_t;
View vimrc
set laststatus=2
let &statusline = '%!StatusLine()'
function! StatusLine() abort
if &hlsearch
" XXX: 'l', 'h' do not move current cursor!
let searchcount = matchstr(execute('keepjumps keepmarks %s//&/gne', 'silent'), '\d\+')
let searchcount = printf(' (%s/%s)', searchcount !=# '' ? searchcount : '0', @/)
else
let searchcount = ''
View execute-convert-snr.patch
diff --git a/src/eval.c b/src/eval.c
index 4a3cf9912..cdb1d2f4e 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -8109,6 +8109,7 @@ ex_echohl(exarg_T *eap)
ex_execute(exarg_T *eap)
{
char_u *arg = eap->arg;
+ char_u *trans_arg;
typval_T rettv;
You can’t perform that action at this time.