Skip to content

Instantly share code, notes, and snippets.

View Sixeight's full-sized avatar
🏠
Working from home

Tomohiro Nishimura Sixeight

🏠
Working from home
View GitHub Profile
# coding: utf-8
module NaturalOrderStringComparison
COMPARE_EXPRESSION = /^(\D*)(\d*)(.*)$/.freeze
def compare(str1, str2)
str1, str2 = str1.dup, str2.dup
while (str1.length > 0) || (str2.length > 0) do
@Sixeight
Sixeight / cassandra6.rb
Created July 5, 2011 09:16
diff から起したのでもしかすると動かないかも
require 'formula'
class Cassandra < Formula
url 'http://www.mirrorservice.org/sites/ftp.apache.org//cassandra/0.6.13/apache-cassandra-0.6.13-bin.tar.gz'
homepage 'http://cassandra.apache.org'
md5 '9041e7a02e9d162406028fe8c7a63d39'
def install
(var+"lib/cassandra").mkpath
require 'formula'
class Skktools < Formula
url 'http://openlab.ring.gr.jp/skk/tools/skktools-1.3.2.tar.gz'
homepage 'http://openlab.ring.gr.jp/skk/'
md5 '88861ccbe74180b2a7bacfc25484409d'
version '1.3.2'
def install
system "./configure", "--disable-debug", "--disable-dependency-tracking", "--prefix=#{prefix}"
@Sixeight
Sixeight / fast_rspec.rb
Created March 1, 2011 14:11
はやい、Spork ひつよー。 via @jugyo http://blog.twiwt.org/e/cafcfe
#!/usr/bin/env ruby
##
# script/spec_server_irb
require 'drb'
require 'irb'
require 'g'
class FastRSpec
def hoge
yield 2
end
x = 5
hoge do |x|
p x
p local_variables
end
" unite-grep-quickfix {{{
let s:unite_grep_quickfix = { 'name': 'grep-quickfix', 'is_volatile': 1 }
function! s:unite_grep_quickfix.gather_candidates(args, context)
execute printf("vimgrep /%s/jg %s", a:context.input, get(a:args, 0, "**"))
let l:res = []
for l:val in getqflist()
let name = bufname(l:val.bufnr)
let dict = {
\ 'word': printf("%s|%d:%d|%s", name, l:val.lnum, l:val.col, matchstr(l:val.text, '\s*\zs.*\S')),
\ 'source': 'grep-quickfix',
@Sixeight
Sixeight / unite-html5.vim
Created December 3, 2010 20:50
発表用、あとでちゃんと作る
" list kind {{{
let s:kind_list = {
\ 'name' : 'list',
\ 'default_action' : 'list',
\ 'action_table': {},
\}
let s:kind_list.action_table.list = {
\ 'description' : 'list with selected key',
\ }
function! s:kind_list.action_table.list.func(candidate)
@Sixeight
Sixeight / grep.vim
Created December 2, 2010 07:19
unite-grep: grep source for unite.vim
" grep source for unite.vim
"
" setting example:
"
" let g:unite_source_grep_default_dir = '~/.vim'
" let g:unite_source_grep_default_opts = '-iR'
let s:grep_source = { 'name': 'grep', 'is_volatile': 1 }
function! s:grep_source.gather_candidates(args, context)
let l:directory = get(a:args, 0, g:unite_source_grep_default_dir)
@Sixeight
Sixeight / ruby_advent.vim
Created December 1, 2010 11:24
Ruby Advent Calendar jp source for unite.vim (need mattn's webapi-vim: https://github.com/mattn/webapi-vim)
let s:save_cpo = &cpo
set cpo&vim
let s:source_ruby_advent_jp = { 'name': 'ruby_advent_jp' }
let s:source_ruby_advent_en = { 'name': 'ruby_advent_en' }
let s:ruby_advent_jp = []
let s:ruby_advent_en = []
function! unite#sources#ruby_advent#open_url(url)
#! /bin/sh
#
# Install: zen, ccs, views, devel, theme developer
# Make: Custom theme based on zen.
#
echo -n 'drupal path: '
read path
drupalctl -d $path theme add http://ftp.drupal.org/files/projects/zen-6.x-1.1.tar.gz