Skip to content

Instantly share code, notes, and snippets.

View yaotti's full-sized avatar

Hiroshige Umino yaotti

View GitHub Profile
@yaotti
yaotti / named-params.rb
Created February 7, 2014 06:34
Ruby's named params and a hash with string keys
def foo(arg: 1)
puts "arg: #{arg}"
end
foo({ arg: 10 })
#=> arg: 10
foo({ 'arg' => 10 })
#=> /Users/yaotti/sandbox/named-params.rb:1:in `foo': wrong number of arguments (1 for 0) (ArgumentError)
# from /Users/yaotti/sandbox/named-params.rb:6:in `<main>'
@yaotti
yaotti / ruboty-startup_quote.gemspec
Last active August 29, 2015 14:17
ruboty-startup_quote
Gem::Specification.new do |spec|
spec.name = "ruboty-startup_quote"
spec.version = "0.0.1"
spec.authors = ["Hiroshige Umino"]
spec.email = ["hiroshige88@gmail.com"]
spec.summary = "A ruboty handler for Startup Quote"
spec.homepage = "https://github.com/yaotti"
spec.license = "MIT"
spec.files = ["ruboty-startup_quote.rb"]
echo "loading..."
set focuscontent
set titlestring=Firefox
map h <C-p>
map l <C-n>
map j 3j
map k 3k
map J <Space>
;; cf.http://d.hatena.ne.jp/rubikitch/20081104/1225745862
(setq view-read-only t)
(defvar pager-keybind
`( ;; vi-like
("h" . backward-word)
("l" . forward-word)
("j" . next-line)
("k" . previous-line)
;;(";" . gene-word)
@yaotti
yaotti / gist:23719
Created November 11, 2008 02:22
convert let&named-let to lambda
;; named-letの実装復習
;; let, named-let
;; (let name ((var1 exp1) (var2 exp2) ...) body)
;; ->
;; ((lambda (var1 var2 ...)
;; (define name (lambda (var1 var2 ...) body))
;; (name var1 var2 ...))
;; exp1 exp2 ...)
;; ->
;; http://www.bookshelf.jp/soft/meadow_30.html#SEC400
(defun swap-screen()
"Swap two screen,leaving cursor at current window."
(interactive)
(let ((thiswin (selected-window))
(nextbuf (window-buffer (next-window))))
(set-window-buffer (next-window) (window-buffer))
(set-window-buffer thiswin nextbuf)))
(defun swap-screen-with-cursor()
"Swap two screen,with cursor in same buffer."
;;; Gisty.el
;;; A gisty interface of Emacs
(defun gisty-post ()
(interactive)
(let ((filename (buffer-file-name))
(shell-file-name "/bin/zsh"))
(start-process-shell-command
"gisty" "*gisty*"
"gisty" (concat "post "
(defun gisty-post ()
(interactive)
(let ((filename (buffer-file-name))
(shell-file-name "/bin/zsh"))
(start-process-shell-command
"gisty" "*gisty*"
"gisty" (concat "post "
filename))))
;;; Gisty.el
;;; A gisty interface for Emacs
(defun gisty-post ()
(interactive)
(let ((filename (buffer-file-name))
(shell-file-name "/bin/zsh"))
(start-process-shell-command
"gisty" "*gisty*"
"gisty" (concat "post "
(require 'outputz)
;; scheme (gauche) !!
(add-to-list 'outputz-modes 'scheme-mode)
(add-to-list 'outputz-modes 'gauche-mode)
(add-to-list 'outputz-modes 'clmemo-mode)
(add-to-list 'outputz-modes 'change-log-mode)
(setq outputz-uri "http://yaotti.net/outputz/%s")