Skip to content

Instantly share code, notes, and snippets.

@troter
troter / gist:9927116
Created April 2, 2014 02:43
いろいろ手直しした結果、'hg locate + grep'より'hg grepfile'の方が早くなったっぽい。 https://bitbucket.org/troter/hg-grepfile
# OS X 10.9.2
# CPU 2.3 GHz Intel Core i7
# MEM 16GB 1600 MHz DDR3
% hg clone http://selenic.com/hg
% cd hg
# hg locate + grep
% for i in $(seq 3); do time (hg locate | xargs grep -n -i ctx.walk > /dev/null) ; done
( hg locate | xargs grep -n -i ctx.walk > /dev/null; ) 0.73s user 0.06s system 97% cpu 0.807 total
@troter
troter / gist:11364851
Created April 28, 2014 07:59
diff-highlight、diffの内容が「新規ファイル追加、変更」の順の場合、新規ファイル追加の内容の出力位置がずれる。
% cat hoge.txt
--- /dev/null
+++ b/new.txt
@@ -0,0 +1,1 @@
+aaa
diff --git a/exist.txt b/exist.txt
index 1d95c52..8bffa50 100644
@@ -0,0 +1,1 @@
-bbbb
+aaaa
@troter
troter / README.rst
Last active August 29, 2015 14:02
hg diffとgit diffの出力の違い

hg diffとgit diffの出力の違い

hg diff:

% hg diff
diff --git a/p.c b/p.c
--- a/p.c
+++ b/p.c
@@ -1,26 +1,25 @@
 #include <stdio.h>
--- rails-4-2-stable_initialzer.txt 2015-03-23 18:02:56.000000000 +0900
+++ rails-master_initializer.txt 2015-03-23 18:03:30.000000000 +0900
@@ -9,10 +9,11 @@
-- action_mailer.logger before: after:
-- action_mailer.set_configs before: after:action_mailer.logger
-- action_view.caching before: after:action_view.set_configs
+ -- action_view.collection_caching before: after:action_view.caching
-- action_view.embed_authenticity_token_in_remote_forms before: after:
-- action_view.logger before: after:action_view.embed_authenticity_token_in_remote_forms
-- action_view.set_configs before: after:action_view.logger
PWD=$(shell pwd)
EMACS_REPOS_DIR=emacs-git-repos
EMACS_DAILY=emacs-daily
EMACS_DAILY_DIR=emacs-daily-$(shell date +%Y%m%d%H%M)
CONFIGURE_OPTIONS=
.PHONY: all link build repository-update repository-init
all: build
@troter
troter / Rakefile
Created September 1, 2009 14:13 — forked from yhara/Rakefile
# configurations
BIN_DIR = File.expand_path("~/bin/")
INSTALL_DIR = File.expand_path("~/bin/rubys/")
P185 = "p231"
P186 = "p369"
P187 = "p174"
P191 = "p129"
JRUBY_VER = "1.3.0"
@troter
troter / ExcelUtil.bas
Created January 4, 2010 08:11
Activate A1 All.
Attribute VB_Name = "ExcelUtil"
Sub ActivateA1All()
Dim Index
For Index = 1 To Worksheets.Count
With Worksheets(Index)
.Activate
.Cells(1, 1).Activate
End With
Next
@troter
troter / im-kayac.el
Created January 10, 2010 18:42
Post im.kayac.com
;;; im-kayac.el --- Post im.kayac.com
;;; test code
;; - 認証なし
;; (setq im-kayac-username "username")
;; (setq im-kayac-authorization-type nil)
;;
;; - パスワード
;; (setq im-kayac-username "username")
;; (setq im-kayac-password "password")
@troter
troter / astar.el
Created January 15, 2010 20:10
A* Algorithm implementation for el
;; astar.el -- A* Algorithm implementation
(require 'cl)
(defstruct (astar-node-struct
(:constructor astar-make-node-struct
(&key pair parent f-star)))
pair parent f-star)
(defun astar-node-struct-pair-pair-equal (node pair)
@troter
troter / gist:728019
Created December 4, 2010 07:51
single table inheritance emulation
public class Player {
protected Long id;
protected PlayerBehavior behavior;
protected String name;
protected String club;