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
delimiter // | |
CREATE PROCEDURE Bonanza() | |
BEGIN | |
SELECT name FROM user WHERE id = TRUNCATE(RAND() * ( | |
SELECT MAX(id) FROM user | |
)+ .9, 0); | |
END | |
// | |
delimiter ; |
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
require 'iconv' | |
require 'kconv' | |
require 'nkf' | |
puts "---[UTF-8]---" | |
p slash1 = ["2f".hex].pack('c*') | |
p slash2 = ["c0".hex, "af".hex].pack('c*') | |
p slash3 = ["e0".hex, "80".hex, "af".hex].pack('c*') | |
p slash4 = ["f0".hex, "80".hex, "80".hex, "af".hex].pack('c*') | |
puts "\n---[Shift-JIS]@kconv---" | |
p slash1.tosjis |
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
class Hoge | |
def initialize | |
@initialized_at = self.class.hoge | |
end | |
def self.hoge | |
@hoge = nil if ObjectSpace.each_object(Hoge).none? | |
@hoge ||= Time.now | |
end | |
end |
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
#active_adminのlib/active_admin/inputs/filter_date_range_input.rb を参照 | |
module ActiveAdmin | |
module Inputs | |
class FilterCustomDateRangeInput < ::Formtastic::Inputs::StringInput | |
include FilterBase | |
def to_html | |
input_wrapping do | |
[ label_html, | |
builder.text_field(gt_input_name, input_html_options(gt_input_name)), |
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
class Xian < BasicObject | |
def method_missing(*args, &block) | |
self.class.absolute | |
end | |
def self.method_missing(*args, &block) | |
self.absolute | |
end | |
def self.absolute |