Skip to content

Instantly share code, notes, and snippets.

ja:
errors:
messages:
not_found: "は見つかりませんでした"
# not_found: "not found"
already_confirmed: "は既に登録済みです"
# already_confirmed: "was already confirmed"
not_locked: "は凍結されていません"
# not_locked: "was not locked"
@Epictetus
Epictetus / devise.ja.yml
Created October 21, 2012 22:07 — forked from orzccc/devise.ja.yml
Japanese locale file for "Devise" (2.1.2) http://github.com/plataformatec/devise/wiki/I18n
ja:
errors:
messages:
expired: "の期限が切れましたので、新しくリクエストしてください"
# expired: "has expired, please request a new one"
not_found: "は見つかりませんでした"
# not_found: "not found"
already_confirmed: "は既に登録済みですのでログインしてください"
# already_confirmed: "was already confirmed, please try signing in"
not_locked: "は凍結されていません"
@Epictetus
Epictetus / intelligent.rb
Created October 17, 2012 19:55
会話できる人工知能のプログラム (Ruby)
# coding: utf-8
puts %w(マジで ヤバい ウケルー).sample while gets != "\n"
@Epictetus
Epictetus / environment.rb
Created October 17, 2012 15:24 — forked from yuroyoro/environment.rb
Railsで"Rendered share/_header.html.haml (0.8ms)"のようなログを黙らせる
# Supress ActionView events log
['render_template', 'render_partial', 'render_collection'].each{|name|
ActiveSupport::Notifications.instance_eval{
notifier.listeners_for("#{name}.action_view").each(&method(:unsubscribe))
}
}
@Epictetus
Epictetus / wrong protected
Created October 16, 2012 03:53 — forked from shugo/wrong protected
Wrong example of proteted
class Node {
def eval(other: Node): Unit = other.protected_method(this)
protected def protected_method(other: Node) = other
}
class NodeFake(node: Node) extends Node {
override def eval(other: Node): Unit = {
println("pre")
println(this == other.protected_method(this))
@Epictetus
Epictetus / gist:3881622
Created October 12, 2012 21:27 — forked from maiha/gist:3877900
awesome_print
##################################################
### Before
irb(main):001:0> Song.limit(2)
Song Load (0.2ms) SELECT "songs".* FROM "songs" LIMIT 2
=> [#<Song id: 5, key: "55197", name: "CONTRADICTION", singer: "ももいろクローバーZ", lyric: "前田たかひろ", music: "大隅知宇", body: "飼い馴らせない欲望を\n恥じるのなら\n�...", created_at: "2012-09-19 22:08:16", updated_at: "2012-09-19 22:29:21">, #<Song id: 6, key: "57767", name: "サンタさん", singer: "ももいろクローバーZ", lyric: "前山田健一", music: "前山田健一", body: " ランランラン…\n\nせーの!\nメリークリ�...", created_at: "2012-09-19 22:08:16", updated_at: "2012-09-19 22:29:21">]
##################################################
### Install
@Epictetus
Epictetus / 0-readme.md
Created October 4, 2012 10:29 — forked from burke/0-readme.md
ruby-1.9.3-p194 cumulative performance patch.

Patched ruby 1.9.3-p194 for 30% faster rails boot

Overview

This script installs a patched version of ruby 1.9.3-p194 with boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84). It also includes the new backported GC from ruby-trunk.

Many thanks to funny-falcon for the performance patches.

@Epictetus
Epictetus / application_controller.rb
Created September 28, 2012 07:09 — forked from jugyo/application_controller.rb
switching page_cache_path for pc and mobile
class ApplicationController < ActionController::Base
include Mobylette::RespondToMobileRequests
...
protected
def cache_page_with_mobile_feature(content = nil, options = nil, gzip = Zlib::BEST_COMPRESSION)
prefix = params[:format] == 'mobile' ? '/mobile' : '/pc'
path = "#{prefix}#{request.path}"
cache_page_without_mobile_feature(content, path, gzip)
end
alias_method_chain :cache_page, :mobile_feature
@Epictetus
Epictetus / test-okum-ruby.tex
Created September 27, 2012 12:46 — forked from zr-tex8r/test-okum-ruby.tex
okumacroの\rubyを縦書きで使う
\documentclass[a4paper]{jsarticle}
\usepackage{plext}
\usepackage{okumacro}
%% \ruby の設定を縦書き用にする. (現在グループで有効)
\newcommand{\taterubysetup}{%
\renewcommand*{\kanjistrut}{\rule[-0.5zw]{0pt}{1zw}}%
}
\newcommand{\SampleText}{%
\ruby{夜食}{やしょく}\\
\ruby{就寝}{しゅうしん}
require 'active_support/core_ext/string'
module Rails
class << self
def cmd
command = 'console' if defined?(Rails::Console)
command = 'runner' if defined?(Rails::Runner)
command = 'server' if defined?(Rails::Server)
@_command ||= ActiveSupport::StringInquirer.new(command)
end