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 / .vimrc
Created July 27, 2010 01:10
ゔぁゔぃゔゔぇゔぉ
let t = eskk#table#create('my_table', 'rom_to_hira')
call t.add('va', 'ゔぁ')
call t.add('vi', 'ゔぃ')
call t.add('vu', 'ゔ')
call t.add('ve', 'ゔぇ')
call t.add('vo', 'ゔぉ')
call t.register()
unlet t
let g:eskk_mode_use_tables.hira = 'my_table'
@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 / promise-is-resolved.js
Last active December 4, 2023 02:54
Check whether a promise is finished / resolved / rejected
function delay(msec, value) {
return new Promise(done => window.setTimeout((() => done(value)), msec));
}
function isResolved(promise) {
  return Promise.race([delay(0, false), promise.then(() => true, () => false)]);
}
function isRejected(promise) {
  return Promise.race([delay(0, false), promise.then(() => false, () => true)]);
@tyru
tyru / gist:376501
Created April 23, 2010 12:40
Zimbu introduction - translation in Japanese
もしあなたが新しいプログラム、例えばテキストエディタを作るとしたら、どの言語で作る?
Suppose you want to write a new program, something like a text editor. What language would you write it in?
* できるだけ速く。なのでインタプリタ言語はダメ。
* It has to be as fast as possible, so interpreted languages are out.
* ちまちまメモリ管理なんてしたくない。だからCはダメ。
* You don't want to micro manage memory, so C is out.
* プログラマに学位をとれなんて言いたくない。だからC++はダメ。
* You don't want to require programmers to have a degree, so C++ is out.
* できるだけ起動は速いほうがいいし、ランタイムには依存させたくない。だからJavaはダメ。
@tyru
tyru / windows-like-word.json
Created March 25, 2020 01:50
[Karabiner Elements][macOS] Windows-like word movement/selection/deletion
{
"title": "[macOS] Windows-like word movement/selection/deletion",
"rules": [
{
"description": "Ctrl + Arrow Keys to Option + Arrow Keys",
"manipulators": [
{
"from": {
"key_code": "up_arrow",
"modifiers": {
@tyru
tyru / mintty_cmd.bat
Created February 5, 2017 10:37
Run cmd.exe in Mintty
@echo off
start "MinTTY cmd.exe" "C:\msys64\usr\bin\mintty.exe" cmd.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
diff --git a/plugin/gist.vim b/plugin/gist.vim
index 574b7e8..ffc276f 100644
--- a/plugin/gist.vim
+++ b/plugin/gist.vim
@@ -556,6 +556,11 @@ function! s:GistPost(user, token, content, private)
let quote = &shellxquote == '"' ? "'" : '"'
let url = 'https://gist.github.com/gists'
let res = system('curl -i -d @'.quote.file.quote.' '.url)
+ echohl Error
+ for _ in split(res, '\n')
@tyru
tyru / gist:984296
Created May 21, 2011 06:02
s:substring() and s:substring_once() in vital.vim
" Substitute a:from => a:to by string.
" To substitute by pattern, use substitute() instead.
function! s:substring(str, from, to)
if a:str ==# '' || a:from ==# ''
return a:str
endif
let str = a:str
let idx = stridx(str, a:from)
while idx !=# -1
is_screen_running() {
# tscreen also uses this varariable.
[ ! -z "$WINDOW" ]
}
is_tmux_runnning() {
[ ! -z "$TMUX" ]
}
is_screen_or_tmux_running() {
is_screen_running || is_tmux_runnning
}
@tyru
tyru / calibre-server.service
Created October 31, 2015 15:10
/etc/systemd/system/calibre-server.service
[Unit]
Description=Calibre Content Server
After=network.target
[Service]
Type=simple
User=tyru
Group=tyru
ExecStart=/usr/bin/calibre-server --with-library /mnt/server/calibre --port 8080