Skip to content

Instantly share code, notes, and snippets.

View masutaka's full-sized avatar

Takashi Masuda masutaka

View GitHub Profile
@tmd45
tmd45 / Gemfile
Last active August 29, 2015 14:02
nippo.rb; refs. Githubで今日なにをしたか、調べるスクリプトを書いた - きたけーTechブログ http://kitak.hatenablog.jp/entry/2014/04/22/013849
source 'https://rubygems.org'
ruby '2.1.5'
gem 'i18n'
gem 'activesupport'
gem 'octokit'
key.setEditKey("M-l",
function (ev, arg) {
let elem = ev.originalTarget;
elem.style.imeMode = {
active : "inactive",
inactive : "active"
}[elem.style.imeMode] || "active";
elem.blur();
#include <stdio.h>
void dotimes(void (*func)(void), int n)
{
int i;
for (i = 0; i < n; ++i)
{
func();
}
}
@yoshinari-nomura
yoshinari-nomura / .zaliases
Created September 27, 2011 06:30
Small aliases to get along with Emacs buffer.
## Invoke the ``dired'' of current working directory in Emacs buffer.
function dired () {
emacsclient -e "(dired \"$PWD\")"
}
## Chdir to the ``default-directory'' of currently opened in Emacs buffer.
function cde () {
EMACS_CWD=`emacsclient -e "
(expand-file-name
(with-current-buffer
@hitode909
hitode909 / dial-scroll.el
Created October 5, 2011 07:24
dial-scroll.el
(defun dial-scroll ()
(interactive)
(lexical-let ((last_rad 0.0))
(run-with-timer 0.05 0.05
(lambda ()
(let ((current_x (car (cdr (mouse-position))))
(current_y (cdr (cdr (mouse-position)))))
(let ((diff_x (float (- current_x (/ (window-width) 2))))
(diff_y (float (- current_y (/ (window-height) 2)))))
(let ((rad (atan (/ diff_y diff_x))))
@minimum2scp
minimum2scp / ecat.sh
Created October 12, 2011 11:41
emacsのカレントバッファを標準出力に出すシェル関数
function ecat (){
local ecat_tempfile=`mktemp -t ecat_tempfile.XXXXXXXX`
emacsclient -e "
(with-current-buffer
(if (featurep 'elscreen)
(let* ((frame-confs (elscreen-get-frame-confs (selected-frame)))
(num (nth 1 (assoc 'screen-history frame-confs)))
(cur-window-conf (cadr (assoc num (assoc 'screen-property frame-confs))))
(marker (nth 2 cur-window-conf)))
(marker-buffer marker))
(defvar twinstall-curl-program (executable-find "curl"))
(defun twinstall-tweet (url)
(let* ((name (file-name-nondirectory url))
(text (format "%sをインストールしました。 #emacsjp #twinstall %s"
name url)))
(twittering-call-api
'update-status
`((status . ,text)))))
(add-private-load-path "auto-complete")
(require 'popup)
(defun dic-at-point ()
(interactive)
(let* ((word (word-at-point))
(desc (and word (shell-command-to-string (format "dic '%s'" word)))))
(when (and desc (null popup-instances))
(popup-tip desc :margin t))))
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
# Please add INDEX to speedup the SQL queries which use LIKE clauses:
#
# sqlite3 "#{DICT_FILE}" 'CREATE INDEX dict_key ON dict (key COLLATE NOCASE);'
SQLITE = "sqlite3"
DICT_FILE = "'#{ENV['HOME']}/sys/lib/Dic/EDP/mouseoverdictionary.sqlite'"
@gfx
gfx / vla.c
Created October 19, 2011 05:16
$ clang vla.c
$ ./a.out
sizeof VLA: 10
sizeof VLA: 20
sizeof VLA: 30