This file contains 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
# Description: | |
# Allows Hubot to do mathematics. | |
# https://github.com/jgable/hubot-irc-runnable の改造版 | |
# | |
# Commands: | |
# "calc: 1+1" で計算できる | |
# ACCEPT_ROOMSに入っている部屋ではcalcをつけなくてもOK | |
module.exports = (robot) -> | |
ACCEPT_ROOMS = ["example"] | |
robot.hear /(gcalc|calc|calculate|convert|math)?(:|>)?\s*(.*)\s*/i, (msg) -> |
This file contains 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 :app do | |
desc 'アプリケーションの再起動' | |
task :restart do | |
on release_roles :app do | |
fullpath_pidfile_default = "#{current_path}/shared/#{fetch :app_pidfile_default}" | |
fullpath_pidfile_sub = "#{current_path}/shared/#{fetch :app_pidfile_sub}" | |
now_running = nil | |
if test "[ -f #{fullpath_pidfile_default} ]" | |
now_running = :default | |
elsif test "[ -f #{fullpath_pidfile_sub} ]" |
This file contains 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
/** | |
* プロバイダ編集・追加フォーム | |
* | |
* @param provider 追加時はNone, 編集時は編集対象を渡す | |
*/ | |
private def providerForm(provider: Option[Provider] = None) = Form( | |
mapping( | |
"name" -> text.verifying(Provider.isValidName _), | |
"alias" -> text.verifying(Provider.isValidAlias _).verifying("既にこのAliasは使われています", alias => { | |
withDatabaseSession { |
This file contains 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
import scala.util.parsing.combinator.JavaTokenParsers | |
sealed trait JsValue | |
case class JsString(value: String) extends JsValue | |
case class JsNumber(value: BigDecimal) extends JsValue | |
case object JsNull extends JsValue |