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
@echo off
chdir %*
set BRANCH=
for /f "eol=; tokens=1,2 delims== " %%i in ('"git branch 2>NUL"') do if "%%i"=="*" set BRANCH=%%j
if "%BRANCH%" neq "" (
set PROMPT=$P^(%BRANCH%^)$G
) else (
set PROMPT=$P$G
)
@DimitryDushkin
DimitryDushkin / react-router-queyry-utils.js
Last active March 5, 2021 13:38
React router utility functions to add and remove queries
import { browserHistory } from 'react-router';
/**
* @param {Object} query
*/
export const addQuery = (query) => {
const location = Object.assign({}, browserHistory.getCurrentLocation());
Object.assign(location.query, query);
browserHistory.push(location);
};

WIP某所で喋るための草稿。

Testable JavaScript

当たり前のことを書く。当たり前のことが、当たり前にできない人へ。JavaScriptだから、当たり前のことをしなくていいと思っている人達へ。

基本方針

  • それぞれのファイルは、可能な限り参照透過な関数を提供する
  • それぞれのファイルは、読み込んだだけでは副作用を起こさない
@gakuzzzz
gakuzzzz / sbt-coursier.md
Last active June 27, 2019 03:23
あなたの sbt update を爆速にする sbt-coursier の紹介

あなたの sbt update を爆速にする sbt-coursier の紹介

この記事は Scala Advent Calendar 2016(Adventar) 10日目の記事です。

今は 12/10 の 625時です。年明けなんて無かった。いいね?

さてさて、sbt の依存jarのダウンロードが遅い、というのは割とよく言われる事であります。

で、この原因の一旦に、sbtが Apache Ivy を使っている、という点があります。

@ebith
ebith / extractArchive.js
Last active October 1, 2019 11:20
7-Zip付属の7zG.exeで二重フォルダを防ぎ賢く展開するWSH JScript
var wshell = new ActiveXObject('WScript.Shell');
var fso = new ActiveXObject( 'Scripting.FileSystemObject');
var archivePath = WScript.arguments(0);
var dirPath = wshell.currentDirectory + '/' + fso.getBaseName(archivePath);
var process = wshell.Exec('"C:/Program Files/7-zip/7zG.exe" x "' + archivePath + '" -aou -spe -o"' + dirPath + '"');
while (process.status !== 1) {
WScript.sleep(10);
}
@rhysd
rhysd / foo.vim
Last active November 19, 2016 17:02
function! s:fold(list, init, pred) abort
let acc = a:init
for item in a:list
let acc = a:pred(acc, item)
endfor
return acc
endfunction
echo s:fold([1, 2, 3, 4, 5], 0, {acc, i -> acc + i})
"
" usage: :Vimgrep /foo/ **
"
function! s:exit_handler(id) dict abort
execute 'cfile' self.tempfile
copen
endfunction
function! s:vimgrep(args) abort
@rhysd
rhysd / vimrc.diff
Last active November 11, 2016 18:39
行指定ジャンプするついでにちょっと行番号も見れるやつ
@@ -441,7 +443,15 @@ noremap gm m
"Esc->Escで検索結果とエラーハイライトをクリア
nnoremap <silent><Esc><Esc> :<C-u>nohlsearch<CR>
"{数値}<Tab>でその行へ移動.それ以外だと通常の<Tab>の動きに
-noremap <expr><Tab> v:count != 0 ? "G" : "\<Tab>zvzz"
+function! s:go_to_line(lnum) abort
+ set number
+ augroup vimrc-go-to-line
+ autocmd!
+ autocmd InsertEnter,CursorHold * set nonumber | autocmd! vimrc-go-to-line

Best practices for building Vim plugins

2016-11-05 VimConf 2016

@r0l1
r0l1 / copy.go
Last active March 23, 2024 12:38
Copy a directory tree (preserving permissions) in Go.
/* MIT License
*
* Copyright (c) 2017 Roland Singer [roland.singer@desertbit.com]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions: