Skip to content

Instantly share code, notes, and snippets.

View igrep's full-sized avatar
:shipit:
Writing in Haskell, TypeScript, or Power Automate

YAMAMOTO Yuji igrep

:shipit:
Writing in Haskell, TypeScript, or Power Automate
View GitHub Profile
@igrep
igrep / git_menu.vim
Last active August 29, 2015 13:55 — forked from scrooloose/git_menu.vim
Adds git command menu items.
" Put this in ~/.vim/after/nerdtree_plugin/git_menu.vim
" NOTE: I fixed a bug of NERDTree to get this plugin work.
" You may have to cherry-pick or fork the pull request to use this plugin.
" https://github.com/scrooloose/nerdtree/pull/308
"
" Adds git command menu items
"
" TODO: Behave like nerdtree_plugin/fs_menu.vim
" Extend nerdtree_plugin/fs_menu.vim without deleting any defalut menu items.
"
@igrep
igrep / 0_reuse_code.js
Last active August 29, 2015 14:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@igrep
igrep / evalex.rb
Last active August 29, 2015 14:13
神奈川Ruby会議01のペアプロ問題から。 http://nabetani.sakura.ne.jp/kanagawa.rb/evalex/
require 'strscan'
=begin
神奈川Ruby会議01のペアプロ問題から。 http://nabetani.sakura.ne.jp/kanagawa.rb/evalex/
ちょうど今読んでいる http://www.amazon.co.jp/Programming-Principles-Practice-Using-Edition/dp/0321992784
に電卓を作る例があったので、ほとんど写経するような形で書いてみた。
書いておきながら細かいところをちゃんと説明できないので途中まで書いていてすごく不安だった...
=end
Token = Struct.new(:kind, :string)
@igrep
igrep / file0.txt
Last active August 29, 2015 14:16
間違えてmasterやdevelopにpushしてしまうあなたは今すぐこれを.git/hooks/pre-commitにコピペしなさい ref: http://qiita.com/igrep/items/b0eabaeb7b301cdc2045
#!/bin/bash
current_branch=$(git rev-parse --abbrev-ref HEAD)
warn_branch() {
echo "You can't commit on '$current_branch'!"
}
case $current_branch in
master) warn_branch; exit 1 ;; # Of cource you can add any other important branches as you need.
@igrep
igrep / gist:3f71a70e69a7fa051091
Created June 3, 2015 15:57
error when trying to execute github-reader. See https://github.com/azu/github-reader/issues/5
$ npm install
npm WARN engine xmlbuilder@2.2.1: wanted: {"node":"0.8.x || 0.10.x"} (current: {"node":"0.12.4","npm":"2.10.1"})
node-webkit-winstate@1.1.1 node_modules\node-webkit-winstate
intelli-espower-loader@0.6.0 node_modules\intelli-espower-loader
parse-github-event@0.2.0 node_modules\parse-github-event
bluebird@2.9.27 node_modules\bluebird
@igrep
igrep / file0.vim
Last active August 29, 2015 14:22
全角アルファベットやひらがな・カタカナを入力しても(ちょっと)いい感じに解釈してくれるvimrc ref: http://qiita.com/igrep/items/2c0dae6242eed5baf172
"ひらがな・カタカナ・全角アルファベットによるコマンド入力を有効にする
noremap あ a
noremap い i
noremap う u
noremap え e
noremap お o
noremap ア a
noremap イ i
noremap ウ u
noremap エ e
=begin
Termtter plugin.
Mark everytime timeline is updated. inspired by plugin/mark.rb
=end
config.plugins.mark_on_update.set_default( :wrap_color, 'on_red' )
config.plugins.mark_on_update.set_default( :time_format, 'TIMELINE at %R' )
Termtter::Client.register_hook(
:name => :mark_on_update,
:points => [:post_filter],
#!/usr/bin/ruby -wKu
# vim: set fileencoding=utf-8 :
=begin
return the results of both Enumerable#take and Enumerable#drop
=end
module Enumerable
def split_between val
first = true
first_ary = []
require 'socket'
module SocketSpecs
# helper to get the hostname associated to 127.0.0.1
def self.hostname
# Calculate each time, without caching, since the result might
# depend on things like do_not_reverse_lookup mode, which is
# changing from test to test
Socket.getaddrinfo("127.0.0.1", nil)[0][2]
end
@igrep
igrep / object-pattern.rb
Created August 24, 2010 03:41
Wacky Ruby
#!/usr/bin/ruby -wKu
# vim: set fileencoding=utf-8 :
class ObjectPattern
def initialize obj, method=:[]
@delegate_object = obj
@delegate_method = method
end
attr_reader :delegate_object, :delegate_method
def === other