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
@anekos
anekos / scansnap-sound-alert.au3
Created June 22, 2013 16:15
ScanSnap ix500 で、スキャンの続きができるようになったら、音を鳴らす AutoIt スクリプト http://www.autoitscript.com/
While True
while ControlCommand("[CLASS:ScanSnap Manager GetImgClass]", "", "[CLASS:Button; INSTANCE:1]", "IsVisible") = 0
Sleep(250)
WEnd
SoundPlay(@WindowsDir & "\media\tada.wav")
; MsgBox(1, "Ready", "Ready")
@isseium
isseium / gist:5822504
Last active September 17, 2021 03:45
rspec の include で hash 構造をチェックするテスト
describe "Rspec include test" do
it "include" do
hash = {:a => 'A', :b => 'B', :c => { :ca => 'CA' }}
expect(hash).to include(:c => {:ca => 'CA'}); #
expect(hash).to include(:a => 'A', :c => {:ca => 'CA'}); # ならべてもいいっぽい
expect(hash).to_not include(:ca => 'CA'); # ちゃんと構造みてくれる
expect(hash).to include(:a); # キーだけでもOK
expect(hash).to_not include(:d); # キーだけでもOK
end
end
@elazarl
elazarl / cp.go
Last active June 27, 2020 14:42
Unfortunately, searching for "golang copy file" gives subtly wrong code snippets (e.g. https://groups.google.com/d/msg/golang-nuts/JNyQxQLyf5o/kbGnTUK32TkJ that don't check close error code). This is an attempt to copy file content from `src` to `dst`
package cp
import (
"io"
"os"
)
func cp(dst, src string) error {
s, err := os.Open(src)
if err != nil {
@gnarf
gnarf / ..git-pr.md
Last active May 7, 2026 13:08
git pr - Global .gitconfig aliases for Pull Request Managment

Install

Either copy the aliases from the .gitconfig or run the commands in add-pr-alias.sh

Usage

Easily checkout local copies of pull requests from remotes:

  • git pr 4 - creates local branch pr/4 from the github upstream(if it exists) or origin remote and checks it out
  • git pr 4 someremote - creates local branch pr/4 from someremote remote and checks it out
@uduki
uduki / corecursion.hs
Created November 7, 2012 08:49
余再帰あれこれ
{--- 余再帰とその利用例 ---}
{- 末尾再帰と再帰と余再帰
-
- 参考: http://d.hatena.ne.jp/kazu-yamamoto/20091122/1258899591
-
- 末尾再帰 : 引数に結果を蓄積し、自身へgotoして処理の流れが戻ってこないようにする。正格なデータを処理する時に用いるとスタックやヒープの節約になる。
- foldl f a [] = a
- foldl f a (x:xs) = foldl f (f a x) xs
-
@sasaki-shigeo
sasaki-shigeo / gist:3727810
Created September 15, 2012 13:18
Conversion from/to Numeric Type in Scala (Scala における数値型の変換)
import math._
1L // Long型の 1
1:Long // Long型の 1
127:Byte // Byte型の 127
32767:Short // Short型の 32767
(1+2).toLong // Long型への変換
(2+3) toLong // Long型への変換
@rosylilly
rosylilly / gist:3401612
Created August 20, 2012 06:40
先輩と覚える HTTP ステータスコード

先輩に学ぶ HTTP Status Code

超雑にまとめました。修正してください。

登場人物

  • アプリケーション先輩: いつも忙しい。横に広がるのが得意(デブじゃない)。
  • 後輩: 頼んでばっかしで役に立たない。
  • サーバー先輩: アプリケーション先輩と仲がいい。Unix Socket でつながるくらい仲良し。
  • プロクシ先輩: アプリケーション先輩とかサーバー先輩と後輩の間を取り持って代わりに伝えたりしてくれる。たまに勝手にレスポンスを書き換える。
@saitoha
saitoha / screen-bpm-cursorstyle.diff
Created June 23, 2012 11:01
add Bracketed Paste Mode and DECSCUSR support for GNU Screen (http://savannah.gnu.org/git/?group=screen)
diff --git a/src/ansi.c b/src/ansi.c
index d88e153..89116c3 100644
--- a/src/ansi.c
+++ b/src/ansi.c
@@ -193,6 +193,8 @@ register struct win *p;
p->w_insert = 0;
p->w_revvid = 0;
p->w_mouse = 0;
+ p->w_bracketed = 0;
+ p->w_cursorstyle = 0;
nnoremap <silent> <buffer> dd :call <SID>del_entry()<CR>
nnoremap <silent> <buffer> x :call <SID>del_entry()<CR>
vnoremap <silent> <buffer> d :call <SID>del_entry()<CR>
vnoremap <silent> <buffer> x :call <SID>del_entry()<CR>
if exists('*s:del_entry')
finish
endif
function! s:del_entry() range
@anekos
anekos / dont-kill-me-my-lovely-input.js
Created June 17, 2012 14:01
コマンドラインを <Esc> でもあなたのこと、忘れない!!
mappings.addUserMap(
[modes.COMMAND_LINE],
['<Esc>'],
'I wish to escape to the blue sky.',
(function () {
if (this._history && this._history.save)
this._history.save();
events.onEscape();
}).bind(commandline),
{}