This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nkf' | |
# 文字列の正規化 | |
def clean_string(str) | |
str = str.encode("UTF-8") | |
.gsub(/\r|\n/, '') | |
.gsub(/ /, ' ') | |
.gsub(/\s+/, ' ') | |
puts str | |
NKF.nkf('-WwXm0Z0', str) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'fileutils' | |
require 'sequel' | |
require 'faraday' | |
# Skypeのアカウント | |
SKYPE_NAME = 'skype.id' | |
# ChatworkのAPIトークン | |
CHATWORK_API_TOKEN = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'anemone' | |
Anemone.crawl('http://example.com/start_page.html') do |anemone| | |
# クロールするごとに呼び出される | |
anemone.focus_crawl do |page| | |
# 条件に一致するリンクだけ残す | |
# この `links` はanemoneが次にクロールする候補リスト | |
page.links.keep_if { |link| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
install_name_tool -change /usr/lib/libedit.3.dylib /usr/local/Cellar/readline/6.2.4/lib/libreadline.dylib ~/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/x86_64-darwin12.4.0/readline.bundle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :git do | |
desc 'remoteのmerge済みのbranchをすべて削除' | |
task clear_remote: :environment do | |
STDOUT.puts '[警告] remoteのmerge済みのbranchをすべて削除します [y/n]:' | |
input = STDIN.gets.chomp.downcase | |
if input == 'y' | |
system %q(git branch -a --merged | grep -v master | grep -v staging | grep -v develop | grep remotes/github| sed -e 's% *remotes/github/%%' | xargs -I% git push github :%) | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rjb' | |
class Kuromoji | |
Rjb::load(File.expand_path('../kuromoji-0.8-SNAPSHOT.jar', __FILE__)) | |
module JavaIterator | |
def each | |
i = self.iterator | |
while i.has_next |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --disable-all --enable-libxml --with-libxml-dir=/usr/local --enable-zend-multibyte --with-regex=php --enable-filter --with-pcre-regex=yes --with-mysql=/usr/local/mysql --with-gd --with-jpeg-dir --enable-session --enable-mbstring --enable-xml --enable-json --enable-sockets --with-zlib --with-zlib-dir=/usr/lib --with-curl |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"auto_indent": true, | |
"bold_folder_labels": true, | |
"color_scheme": "Packages/User/SublimeLinter/Monokai (SL).tmTheme", | |
"caret_style": "phase", | |
"draw_white_space": "all", | |
"ensure_newline_at_eof_on_save": true, | |
"fade_fold_buttons": false, | |
"font_face": "Ricty", | |
"font_size": 11, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
echo "データベースを初期化します" | |
echo "この操作は取り消せません" | |
echo "mysqlを起動してください" | |
echo "mysqlのrootパスワードを入力してください" | |
APP_NAME="appname" | |
SQL_FILE=`dirname ${0}`/../db/sql/${APP_NAME}_development.sql # <= DBの初期化SQLを用意 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CONFIG = { | |
'language': 'Ruby', | |
# 'executable': 'ruby', | |
'executable': '/Users/<ユーザー名>/.rvm/rubies/ruby-1.9.3-p194/bin/ruby', | |
'lint_args': '-wc' | |
} | |
``` | |
以上で、煩わしい偽Syntax Errorを回避できる。 |