Skip to content

Instantly share code, notes, and snippets.

@namutaka
namutaka / git_diff_macvim
Created January 16, 2010 13:54
script for git-diff with MacVim
#!/bin/sh
#git_diff_macvim
mvim --servername GITDIFF --remote-tab-silent +"vertical diffsplit $2|wincmd w" "$5"
sleep 0.1
SN=`mvim --serverlist | grep "GITDIFF"`
until [ "$SN" == "GITDIFF" ]; do
sleep 0.1
SN=`mvim --serverlist | grep "GITDIFF"`
@namutaka
namutaka / daily_memo.js
Created May 19, 2010 03:16
Sakura Editor Macro:日にち別メモ作成
// daily_memo.js
// Sakura Editor Macro
// 日付メモファイル生成マクロ
//
// 指定フォルダ下に、最終投稿メモファイルを基に、本日分のメモファイルを作成する。
// メモファイル名形式:「yyyymmdd.txt」
//=======================================
// 設定
@namutaka
namutaka / CalendarController.groovy
Created June 7, 2010 15:17
Grails ical4j サンプル
// grails-app/controllers/cal/CalendarController.groovy
package cal
import net.fortuna.ical4j.data.*
import net.fortuna.ical4j.model.*
import net.fortuna.ical4j.model.property.*
class CalendarController {
def index = {
@namutaka
namutaka / backup.bat
Created June 19, 2010 13:46
Windowsバックアップ ツール
@ECHO OFF
REM 簡易バックアップ バッチ
REM 引数のファイル群のタイムスタンプを付けたコピーを作成する
REM ファイル名に、& , = が含まれる場合は正しく動かない
SETLOCAL
SET BACKUP_DIR=_backup
:BEGIN
if "%~1" == "" GOTO FINISH
SET T=%~t1
let cmd = "!ls"
function! s:RunCmd()
let tmpfile=tempname()
silent exe cmd . " < " . expand("%") . " > " . tmpfile . " 2>&1"
execute ":sn " . tmpfile
endf
com! Run call s:RunCmd()
map <C-.> :call s:RunCmd()<CR>
@namutaka
namutaka / ladp_fixtures.rb
Created November 18, 2010 15:58
ActiveLdap用 Fixture
#
# ActiveLdap Fixture
#
# class TestCase
# include ActiveLdap::TestLdapFixture
# self.ldap_fixture_path = "#{RAILS_ROOT}/test/fixtures/ldap"
# end
#
# class HogeTest < TestCase
# ldap_fixtures :people
@namutaka
namutaka / gist:740143
Created December 14, 2010 08:22
bookmarklet to load js file.
// base
javascript:(function(d,u){var e=d.createElement('script');e.setAttribute('language','JavaScript');e.setAttribute('src',u);d.body.appendChild(e);})(document,'http://');
// JQuery 1.7.2
javascript:(function(d,u){var e=d.createElement('script');e.setAttribute('language','JavaScript');e.setAttribute('src',u);d.body.appendChild(e);})(document,'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js');
@namutaka
namutaka / handy.rb
Created December 25, 2010 13:12
[irb][ruby]Define handy methods for debug in irb.
#
# Define handy methods for debug in irb.
#
module Handy
# Call Kernel#p method with self.
def _p
p self
self
end
@namutaka
namutaka / smooth_scroll_mod.vim
Created January 23, 2011 10:53
[vim]Smooth scroll modified.
" Smooth Scrooll modified
" 2011/01/23
" [original] http://www.vim.org/scripts/script.php?script_id=1601
"
" * The global variable g:scroll_skip_line_size is the scroll lines by one time.
" * The scroll is stopped when reaching the top and bottom of the buffer.
"
" Smooth Scroll
"
@namutaka
namutaka / import_from_rss_to_readitlater.rb
Created March 3, 2011 13:40
Import from a rss xml file to ReadItLater.
#! /opt/local/bin/ruby -Ku
require 'kconv'
require 'cgi'
require "rexml/document"
require "net/http"
require "uri"
uid = ARGV[0]
password = ARGV[1]
hatena_id = ARGV[2]