Skip to content

Instantly share code, notes, and snippets.

View ysawa's full-sized avatar

Ysawa ysawa

View GitHub Profile
@ysawa
ysawa / truncatesvn
Created October 13, 2011 00:42
remove all .svn directories
#!/bin/sh
find . -name ".svn" -type d -exec rm -rf {} ";"
@ysawa
ysawa / magic.rb
Created October 13, 2011 00:40
insert magic comment to **/*.rb
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
Dir['**/*.rb'].each do |f|
File.open(f, 'r+') do |io|
buf = io.readlines
unless /coding:/ =~ buf[0]
io.rewind
buf.unshift "# -*- coding: utf-8 -*-\n\n"
io.write buf.join
@ysawa
ysawa / .vimrc
Created October 12, 2011 14:31
converting ruby old hash syntax to new one
function! RubyNewHashSyntax()
:%s/:\(\w\+\) =>/\1:/ge
endfunction
command! RubyNewHashSyntax :call RubyNewHashSyntax()