Skip to content

Instantly share code, notes, and snippets.

;; for widen-window.el
(defun ewm:fix-widen-window-pre-start ()
;; widen-window でエラーを起きないようする
(defadvice wlf:layout-internal (around disable-ww-mode activate)
(ad-deactivate-regexp "widen-window")
(unwind-protect
ad-do-it
(ad-activate-regexp "widen-window")))
@vicalejuri
vicalejuri / django-crossdomainxhr-middleware.py
Created June 5, 2010 17:47
Middlware to allow's your django server to respond appropriately to cross domain XHR (postMessage html5 API).
import re
from django.utils.text import compress_string
from django.utils.cache import patch_vary_headers
from django import http
try:
import settings
XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS
@defunkt
defunkt / gist:449668
Created June 23, 2010 08:55 — forked from dustin/gist:397971
Emacs Lisp to automatically add, commit, and push when files change
;; Automatically add, commit, and push when files change.
(defvar autocommit-dir-set '()
"Set of directories for which there is a pending timer job")
(defun autocommit-schedule-commit (dn)
"Schedule an autocommit (and push) if one is not already scheduled for the given dir."
(if (null (member dn autocommit-dir-set))
(progn
(run-with-idle-timer
@tyru
tyru / quickrun.jax
Created June 26, 2010 19:57
quickrun.vim (originally invented by ujihisa, rewritten by thinca) my translated engrish document. Fix me!
*quickrun.txt* コマンドを素早く実行します。
Version: 0.4.1
Author : thinca <[email protected]>
License: クリエイティブ・コモンズの表示 2.1 日本ライセンス
<http://creativecommons.org/licenses/by/2.1/jp/>
==============================================================================
目次 *quickrun-contents*
@timcharper
timcharper / ido-other-window.el
Created July 28, 2010 03:17
Invoke any command using ido in other window / split window, deciding after the fact instead of before
;; This makes ido-find-file-other-window,
;; ido-switch-buffer-other-window, et. al obsolete. It’s a much better
;; abstraction, and I believe it should become apart of ido mode,
;; because any command that uses ido-completing-read can benefit from
;; it without any additional effort, including textmate.el’s
;; textmate-goto-symbol.
(require 'ido)
# -*- coding: utf-8 -*-
# tested against python-libmemcached 0.17 and kumofs-0.4.10
# http://pypi.python.org/pypi/python-libmemcached/0.17.0
from cmemcached import Client
cl = Client(["localhost:11211"], behaviors={'support_cas': 1})
#cl = Client(["localhost:11411"], behaviors={'support_cas': 1})
cl.set('spam', 'SPAM')
value = cl.get('spam')
@miyamuko
miyamuko / htmlfile-xpath.rb
Created July 29, 2010 07:25
Ruby + htmlfile(WIN32OLE) + JavaScript-XPath で XPath
# Ruby + htmlfile + JavaScript-XPath で XPath
#
# Example:
#
# > ruby htmlfile-xpath.rb http://gist.github.com/gists "//div[@class='info']/span/a"
# gist: 497491
# gist: 497481
# gist: 497469
# :
#
@miyamuko
miyamuko / gist:497543
Created July 29, 2010 07:48
xyzzy + htmlfile + JavaScript-XPath で XPath
;; xyzzy + htmlfile + JavaScript-XPath で XPath
;;
;; See:
;; http://d.hatena.ne.jp/amachang/20071112/1194856493
;; http://d.hatena.ne.jp/mobitan/20090829/1251542456#20090829f10
(require "xml-http-request")
(defparameter *javascript-xpath-uri*
"http://svn.coderepos.org/share/lang/javascript/javascript-xpath/trunk/release/javascript-xpath-latest-cmp.js")
@miyamuko
miyamuko / gist:507687
Created August 4, 2010 05:20
xl-json: バイトコンパイルあり・なしでのjsonのベンチマーク
;; バイトコンパイルあり・なしでのjsonのベンチマーク
(require "json")
(require "xml-http-request")
(defmacro benchmark (&body body)
`(let (times result)
(dotimes (i 4)
(gc t)
(message "~[Warm up~:;Round ~:*~A~]" i)
@miyamuko
miyamuko / gist:528722
Created August 17, 2010 06:45
xyzzy ではてな ID や Twitter のユーザ名をクリックできるようにする clickable-uri の設定
;; xyzzy ではてな ID や Twitter のユーザ名をクリックできるようにする clickable-uri の設定
;;
;; * clickable-uri
;; http://ohkubo.s53.xrea.com/xyzzy/index.html#clickable-uri
;;
;; * clickable-uriを導入しよう
;; http://xyzzy.s53.xrea.com/wiki/index.php?QuickTour/ext/clickable-uri#t8450eec
(defun clickable-uri-add-special (prefix id uri-format)
(let ((id-regexp (format nil "~A~A" prefix id))