Skip to content

Instantly share code, notes, and snippets.

## Level 8
# https://www.bloc.io/ruby-warrior/#/warriors/53460/levels/8
## Level 9
# https://www.bloc.io/ruby-warrior/#/warriors/53460/levels/9
class Player
def initialize
@maxhealth = 20
@previous_health = @maxhealth
@previous_damage = nil
@hazisarashi
hazisarashi / file0.txt
Created April 5, 2013 19:29
Rails::Generators の #namespace がフォルダ名にも影響していて、ハマった話。 ref: http://qiita.com/items/62390417e7d4c9816770
$ rails g h_o_g_e:config
@hazisarashi
hazisarashi / gist:5232663
Created March 24, 2013 17:07
rbenv install ruby for Mac (homebrew)
CONFIGURE_OPTS="--enable-shared --with-openssl-dir=/usr/local/opt/openssl --with-readline-dir=/usr/local/opt/readline" rbenv install 1.9.3-p362
@hazisarashi
hazisarashi / gist:5232655
Created March 24, 2013 17:04
トップレベルの名前空間からクラスを呼び出す
#!ruby
#coding: utf-8
class Test
def self.test
'top Test.test'
end
end
module A
@hazisarashi
hazisarashi / gist:3414994
Created August 21, 2012 12:14
Macのアプリが起動中かを調べる
$ osascript -e '
on run argv
set applicationName to item 1 of argv
tell application "System Events"
set mystatus to exists of application process applicationName
return mystatus
end tell
end run' CotEditor
true
@hazisarashi
hazisarashi / gist:3403532
Created August 20, 2012 12:02
Jenkins for Mac 導入メモ

Macでいろんなスクリプトの実行を行う際の管理ツールとして、Jenkinsを使ってみることにしたのでメモ。

インストール

Jenkinsは普通に、homebrewにいるので、homebrewからインストールする。

ちなみに、オフィシャルサイトにいけばOS X用パッケージファイルもある。

$ brew install jenkins
@hazisarashi
hazisarashi / entry.rb
Created August 8, 2012 17:34 — forked from tondol/entry.rb
Markov Twitter Bot
# -*- coding: utf-8 -*-
require_relative 'twitterbot'
Twitter.configure {|config|
config.consumer_key = 'consumer key'
config.consumer_secret = 'consumer secret'
config.oauth_token = 'oauth token'
config.oauth_token_secret = 'oauth token secret'
}
@hazisarashi
hazisarashi / gist:3274532
Created August 6, 2012 13:42 — forked from kyanny/gist:1727338
system-wide installation rbenv + ruby-build @/usr/local
MY_GROUP=""
if [ "$MY_GROUP" = "" ] ; then
echo '!!! undefined variable MY_GROUP.'
echo '!!!'
echo '!!! ex.) MY_GROUP=staff'
echo '!!!'
exit 1
fi
cd /usr/local
< if (mb_strlen($tweet_text, 'UTF-8') > 140 && $settings->split_tweets == 1) {
---
> if (strlen($tweet_text) > 140 && $settings->split_tweets == 1) {
943c943
< if (mb_strlen($temp, 'UTF-8') > 136) {
---
> if (strlen($temp) > 136) {
Thank you ^^