Skip to content

Instantly share code, notes, and snippets.

View tototoshi's full-sized avatar

Toshiyuki Takahashi tototoshi

View GitHub Profile
@tototoshi
tototoshi / gist:661999
Created November 4, 2010 01:22
my-auto-complete-config.el
;;====================================
;;; auto-complete.el
;;====================================
(require 'auto-complete-config)
(ac-config-default)
(global-auto-complete-mode t)
(add-to-list 'ac-modes 'org-mode)
(add-to-list 'ac-modes 'python-mode)
(add-to-list 'ac-modes 'text-mode)
(add-to-list 'ac-modes 'shell-script-mode)
@tototoshi
tototoshi / gist:665921
Created November 7, 2010 02:31
windowmove-config.el
;;;;;;;;;;;;;;;;
;; windowmove ;;
;;;;;;;;;;;;;;;;
(setq windowmove-wrap-around t)
(windmove-default-keybindings)
(global-set-key (kbd "C-S-p") 'windmove-up)
(global-set-key (kbd "C-S-n") 'windmove-down)
(global-set-key (kbd "C-S-f") 'windmove-right)
(global-set-key (kbd "C-S-B") 'windmove-left)
@tototoshi
tototoshi / gist:671805
Created November 11, 2010 01:04
my-scroll-config.el
(global-set-key "\M-n" (lambda () (interactive) (scroll-up 1)))
(global-set-key "\M-p" (lambda () (interactive) (scroll-down 1)))
@tototoshi
tototoshi / exec.scala
Created November 27, 2010 16:53
scalaから外部プロセスを起動して結果をリストとして受け取る
def exec(command:String) = {
import java.lang._
import java.io._
def getResult(command:String):Option[BufferedReader] = {
try {
val is = Runtime.getRuntime().exec(command).getInputStream()
Some(new BufferedReader(new InputStreamReader(is)))
} catch {
case _ => None
@tototoshi
tototoshi / my-keysnail-open-google.js
Created December 5, 2010 11:30
新しいタブを開いてGoogleに飛ぶ
key.setGlobalKey(["C-x", "g"], function (ev) {
BrowserOpenTab();
loadURI("http://www.google.co.jp");
}, '新しいタブを開いてGoogleに飛ぶ', true);
key.setViewKey('S', function() {
function mySearch(word){
var query = "q=" + encodeURIComponent(word);
BrowserOpenTab();
@tototoshi
tototoshi / my-keysnail.js
Created December 5, 2010 12:08
my-keysnail-functions.js
// clipboard操作
function getCurrentURL() {
return window._content.document.location.href;
}
function getCurrentTitle() {
return window._content.document.title;
}
function copyTextToClipboard(text) {
@tototoshi
tototoshi / my-keysnail-subscribe-feed.js
Created December 6, 2010 12:30
フィードを開く
key.setViewKey('f', function() {
function collectFeedsURL() {
var doc = window._content.document;
var links = doc.getElementsByTagName('link');
var urls = new Array();
for (var i = 0; i < links.length; ++i) {
var type = links[i].getAttribute('type');
if (type == "application/rss+xml" || type == "application/atom+xml") {
urls.push(links[i].href);
}
key.setViewKey(["C-x", "l"], function () {
var currentURL = window._content.document.location.href;
var nextURL = window.prompt("Input URL", currentURL);
if (nextURL != null) {
loadURI(nextURL);
}
}, "指定URLへジャンプ", true);
@tototoshi
tototoshi / gmail.scala
Created January 13, 2011 13:10
ScalaでGmail
import java.util.{Date, Properties}
import javax.mail._
import javax.mail.internet._
val host = "smtp.gmail.com"
val username = "your_mail_address at gmail.com"
val password = "your_password"
val props: Properties = System.getProperties
props.put("mail.smtps.auth", "true")
@tototoshi
tototoshi / hatenaSummary.scala
Created January 14, 2011 17:09
はてなDiaryからサマリをとってくる
import scala.io.Source
import scala.xml.XML
import java.net.URL
case class Entry(title: String, link: URL)
val rssURL = "http://d.hatena.ne.jp/tototoshi/rss"
val src = Source.fromURL(rssURL)
try {