Skip to content

Instantly share code, notes, and snippets.

View yuutayamada's full-sized avatar

Yuta Yamada yuutayamada

View GitHub Profile
@yuutayamada
yuutayamada / gist:2178022
Created March 24, 2012 03:57
Magit: search the commit message by anything
;;; search commit log by anything
(defvar anything-c-source-log-edit-comment
'((name . "Log-edit Comment")
(candidates . anything-c-log-edit-comment-candidates)
(action . (("Insert" . (lambda (str) (insert str)))))
(migemo)
(multiline))
"Source for browse and insert Log-edit comment.")
(defun anything-c-log-edit-comment-candidates ()
(require 'zencoding-mode)
(eval-when-compile (require 'cl))
(require 'flyspell)
(defun my/zencoding-expand ()
"Execute zencoding if current point is in string and
you can execute from minibuffer if you push C-u before this command"
(interactive)
(lexical-let*
((quote "['\"]")
@yuutayamada
yuutayamada / use-mykie-el-with multiple-cursor.el
Created January 7, 2014 19:09
Use this snippet if you encountered some trouble when you are using mykie.el with multiple-cursor.el
(eval-when-compile (require 'cl))
(defun* my/set-keybinds (map &rest key-and-func)
(loop with use-keymap = (keymapp map)
for i from 0 to (1- (length key-and-func)) by 2
for key = (nth i key-and-func)
for formatted-key = (if (vectorp key) key (kbd key))
for func = (nth (1+ i) key-and-func)
if use-keymap
do (define-key map formatted-key func)
@yuutayamada
yuutayamada / auto-complete-with-yasnippet.el
Last active May 18, 2017 10:26
Use auto-complete with yasnippet on markdown-mode
(add-hook 'markdown-mode-hook
'(lambda ()
(auto-complete-mode t)
(local-unset-key [tab])
(setq-local yas-fallback-behavior '(apply auto-complete))))
(defun org-dwim ()
"My convinience function for `org-mode'."
(interactive)
(cond
((org-in-block-p '("src"))
;; (org-in-src-block-p)
(org-edit-special))
((org-src-edit-buffer-p)
(org-edit-src-exit))
((org-table-p)
@yuutayamada
yuutayamada / fizzbuzz.nim
Last active October 4, 2017 18:05
fizz buzz nim static version
type
fbEnum = enum
raw = 0
fizz = "Fizz\n" # 1
buzz = "Buzz\n" # 2
fizzBuzz = "FizzBuzz\n" # 3
template isFizz(i: typed): bool = i mod 3 == 0
template isBuzz(i: typed): bool = i mod 5 == 0
proc computeFizzBuzz(i: int): fbEnum =