Skip to content

Instantly share code, notes, and snippets.

@miyamuko
miyamuko / gist:540143
Created August 20, 2010 11:55
ファイルの内容を全部読む処理のベンチマーク #xyzzy
;; ファイルの内容を全部読む処理のベンチマーク #xyzzy
;;
;; 参考
;;
;; * SLURP-FILE Performance Comparison
;; http://cybertiggyr.com/gene/sfpc/
;; * Slurping a file in Common Lisp | The Lambda meme - all things Lisp, and more
;; http://www.ymeme.com/node/83
(defun slurp-buffer (filename)
;;; inao-mode.el --- major mode for writing inao manuscripts
;; Copyright (C) 2010 SAKURAI Masashi
;; Author: SAKURAI Masashi <m.sakurai at kiwanami.net>
;; Keywords: outlines, convenience
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
(autoload 'js-console "js-console" nil t)
(defun js-console-eval-region (start end)
"Execute region"
(interactive "r")
(let ((buf-name (buffer-name (current-buffer))))
(copy-region-as-kill start end)
(switch-to-buffer-other-window "*js*")
(js-console-exec-input (car kill-ring))
(switch-to-buffer-other-window buf-name)))
(defun run-js-console-and-split-window ()
;; for kansai_emacs #0x02
(require 'deferred)
;; ■ 基本的使い方
(deferred:$
(deferred:next
(lambda (x) (message "deferred start")))
(deferred:nextc it
;; HTTP POST by url-retrieve
;; ref: http://www.emacswiki.org/emacs/UrlPackage
(defun deferred:url-retrieve-post (url args &optional cbargs)
(lexical-let ((nd (deferred:new))
(url url) (args args)
(cbargs cbargs)
buf)
(deferred:next
(lambda (x)
@kiwanami
kiwanami / init.el
Created September 29, 2010 14:22 — forked from myuhe/init.el
(defun py-doc-exec ()
(interactive)
(save-current-buffer
(let ((symbol
(with-syntax-table python-dotty-syntax-table (current-word)))
(tmpbuf (get-buffer-create "*py-doc-popup*"))
(enable-recursive-minibuffers t))
(if (equal symbol "") (error "No symbol"))
(set-buffer "*py-doc-popup*")
(comint-redirect-send-command-to-process
;;; eval-last-sexp-popup.el --- eval here
;; Copyright (C) 2010, 2011 SAKURAI Masashi
;; Author: SAKURAI Masashi <m.sakurai at kiwanami.net>
;; Keywords: convenience
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;;; concurrent.el --- Concurrent utility functions (PLAN!)
;; Copyright (C) 2010 SAKURAI Masashi
;; Author: SAKURAI Masashi <sakurai@liza2>
;; Keywords: deferred, async, thread
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; generator
(setq fib-list nil)
(setq fib-gen
(lexical-let ((a1 0) (a2 1))
(cc:generator
(lambda (x) (push x fib-list))
(yield a1)
(yield a2)
;; http://d.hatena.ne.jp/kiwanami/20101022/1287770278
;; ■■再帰と非同期
;; ■同期的に実行
(defun fib (n)
(if (<= n 1) n
(+ (fib (- n 1))
(fib (- n 2)))))