Skip to content

Instantly share code, notes, and snippets.

;; This buffer is for notes you don't want to save, and for Lisp evaluation.
;; If you want to create a file, visit that file with C-x C-f,
;; then enter the text in that file's own buffer.
;;;; -*- mode: emacs-lisp; coding: iso-2022-7bit -*-
(define-key global-map [8] 'delete-backward-char)
(define-key global-map "\M-?" 'help-command)
(define-key global-map "\M-g" 'goto-line)
;;;; -*- mode: emacs-lisp; coding: iso-2022-7bit -*-
;;; key-bind for cake
;; C-h をバックスペースに変更。
(define-key global-map [8] 'delete-backward-char)
(define-key global-map "\M-?" 'help-command)
(define-key global-map "\M-g" 'goto-line)
;; buffer list表示後カーソルをそこに移動する。
(define-key ctl-x-map "\C-b" 'buffer-menu)
function map(arr, fn) {
var result = [];
for (var i = 0; i < arr.length; i++) {
result[i] = fn(arr[i]);
}
return result;
}
set tabstop=2
set shiftwidth=2
set expandtab
set autoindent
set nowrap
set nocompatible
set smartcase
set smartindent
set smarttab
(add-hook 'view-mode-hook
(lambda ()
(define-key view-mode-map "b" 'View-scroll-page-backward)
(define-key view-mode-map "j" 'View-scroll-line-forward)
(define-key view-mode-map "k" 'View-scroll-line-backward)))
#!/bin/bash
function cmd() {
target=$1; shift
pane=$1; shift
tmux send-keys -t:$target.$pane "$*" C-m
}
function window() {
tmux new-window -a -n "$1"
@kkismd
kkismd / gist:6709486
Created September 26, 2013 03:22
ひとつ先読みするeach
module Enumerable
def each_with_peek_ahead
@_start = false
self.each_with_index do |current, idx|
if idx == 0
@_last = current
@_start = true
else
yield @_last, current
@_last = current
$ bundle exec rake -T
/usr/local/bin/rake:23:in `load': cannot load such file -- /usr/local/lib/ruby/gems/1.9.1/specifications/bin/rake (LoadError)
from /usr/local/bin/rake:23:in `<main>'
$ bundle exec ruby -e 'p Gem.bin_path("rake", "rake")'
"/usr/local/lib/ruby/gems/1.9.1/specifications/bin/rake"
$ ruby -e 'p Gem.bin_path("rake", "rake")'
"/usr/local/lib/ruby/gems/1.9.1/gems/rake-10.0.4/bin/rake"

Gitの中身を説明してみる

  1. Gitではソースコードのツリー構造をグラフデータベースで管理している

Git用語 ファイルシステム graph用語
blob ファイル内容 エッジ
tree ディレクトリ ノード
@kkismd
kkismd / fizzbuzz.rb
Created July 20, 2014 10:52
4行でFizzBuzz
fizzbuzz = ->(i){ i % 3 == 0 && i % 5 == 0 ? 'FizzBuzz' : i }
fizz = ->(i){ i % 3 == 0 ? 'Fizz' : i }
buzz = ->(i){ i % 5 == 0 ? 'Buzz' : i }
(1..16).map(&fizzbuzz).map(&fizz).map(&buzz)