Skip to content

Instantly share code, notes, and snippets.

@marugoshi
marugoshi / create_mongodb_launch_item.sh
Created May 8, 2010 06:19
Create MongoDB Launch Item (for blog)
#!/bin/sh
#
# MongoDB OSX Launch Item
#
# usage: sudo ./install.sh
#
# initialize
DAEMON_PATH=`which mongod`
module Ext
module String
def self.included(base)
base.class_eval do
include InstanceMethods
end
end
module InstanceMethods
def br_to_return
module Ext
module Object
def self.included(base)
base.class_eval do
include InstanceMethods
end
end
module InstanceMethods
def current_method
ja:
# extract from activesupport
date:
formats:
default: "%Y/%m/%d"
short: "%m/%d"
long: "%Y年%m月%d日(%a)"
day_names: [日曜日, 月曜日, 火曜日, 水曜日, 木曜日, 金曜日, 土曜日]
abbr_day_names: [日, 月, 火, 水, 木, 金, 土]
@marugoshi
marugoshi / convert.rake
Created March 3, 2011 14:53
Export MySQL data to sql file in order to import to PostgreSQL task.
#
# Export development database(MySQL) data to sql file in order to
# import to production database(PostgreSQL) task specialized radiant.
#
# WARGNING: It should be configured database.yml also created databases
# both development and production and runned db:migrate before run tasks.
# MySQL database is already imported is needed.
#
# usage: rake db:convert:execute
#
@marugoshi
marugoshi / spork.rake
Created March 14, 2011 15:15
Start, stop, restart spork rake task
namespace :spork do
desc "start spork in background"
task :start do
sh %{spork &}
end
desc "stop spork"
task :stop do
Process.kill(:TERM, `ps -ef | grep spork | grep -v grep | awk '{ print $2 }'`.to_i)
end
@marugoshi
marugoshi / gist:1258003
Created October 2, 2011 21:41
pow install script
#!/bin/sh
# W
# R RW W.
# RW::::RW DR::R
# :RRRRRWWWWRt:::::::RRR::::::E jR
# R.::::::::::::::::::::::::::Ri jiR:::R
# R:::::::.RERRRRWWRERR,::::::Efi:::::::R GjRRR Rj
# R::::::.R R:::::::::::::;G RRj WWR RjRRRRj
# Rt::::WR RRWR R::::::::::::::::fWR::R; WRW RW R
# WWWWRR:::EWR E::W WRRW:::EWRRR::::::::: RRED WR RRW RR
@marugoshi
marugoshi / ramdisk.sh
Created October 7, 2011 19:52
To Save MacBookAir SSD
#!/bin/sh
SIZE=262144
MOUNT_POINT=/Volumes/ramdisk
RAM_DISK=`hdid -nomount ram://$SIZE`
newfs_hfs -v ramdisk $RAM_DISK
mkdir -p $MOUNT_POINT
mount -t hfs $RAM_DISK $MOUNT_POINT
chmod 0777 $MOUNT_POINT
@marugoshi
marugoshi / gist:1306012
Created October 22, 2011 13:31
Sublime Text 2 Setting
{
"font_face": "consolas",
"font_size": 12,
"tab_size": 2,
"translate_tabs_to_spaces": true
}