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
Index: vendor/plugins/exception_logger/lib/exception_loggable.rb | |
=================================================================== | |
--- vendor/plugins/exception_logger/lib/exception_loggable.rb (revision 2600) | |
+++ vendor/plugins/exception_logger/lib/exception_loggable.rb (working copy) | |
@@ -29,9 +29,18 @@ | |
:exc_date => "%b %d, %Y", | |
:exc_time => "%l:%M %p" | |
}) | |
+ | |
+ target.class_eval do |
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
#!/usr/bin/ruby | |
require 'rubygems' | |
require 'em-http-request' | |
urls = %w( | |
http://www.livedoor.com/ | |
http://www.dena.jp/ | |
http://mixi.jp/ | |
http://www.gaiax.co.jp/ |
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 'tempfile' | |
def tempwrite | |
f = Tempfile.new('temp') | |
f.puts 'nihanihanihanihatorigairu' | |
f.close | |
return f.path | |
end | |
path = tempwrite |
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 'tempfile' | |
def tempwrite | |
f = Tempfile.new('temp') | |
f.puts 'nihanihanihanihatorigairu' | |
f.close | |
return f | |
end | |
temp = tempwrite |
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
# from Ruby技術者認定試験公式ガイド pp169 | |
even_number = 101 % 2 == 0 | |
if even_number == true | |
p "偶数" | |
elsif | |
p "奇数" | |
end | |
# 上のプログラムは下と同じ | |
even_number = 101 % 2 == 0 |
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
CFUNC_FRAME_USAGE_CHECK: start | |
??#core#define_method 0 262 | |
Class#new 0 32892 | |
??#core#define_singleton_metho 0 125 | |
Array#each 4 41 | |
Kernel#require 1 3 | |
Module#private 11 0 | |
??#require 0 2 | |
Kernel#methods 1 0 | |
Module#=== 1398 0 |
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
CFUNC_FRAME_USAGE_CHECK: start | |
??#core#define_method 0 2862 | |
Class#new 0 129760932 | |
??#core#define_singleton_metho 0 504 | |
Array#each 33076237 7633579 | |
Kernel#require 1 3 | |
Module#private 164 0 | |
??#require 0 2 | |
Kernel#methods 2 0 | |
Module#=== 50888085 0 |
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
module Rack #:nodoc: | |
class ForceEscapeSingleQuoteInHTMLAttribute | |
def initialize(app, options = {}) | |
@app = app | |
end | |
def call(env) | |
status, headers, response = @app.call(env) | |
if headers['Content-Type'] =~ %r!text/html|application/xhtml\+xml! | |
body = build_response_body(response) |
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
#!/usr/bin/ruby19 | |
# -*- coding: utf-8 -*- | |
require 'apachelogregex' | |
require 'uri' | |
require 'mongo' | |
format = '%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\" \"%{Cookie}i\"' | |
parser = ApacheLogRegex.new(format) |
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
#!/usr/bin/ruby19 | |
# -*- coding: utf-8 -*- | |
require 'mongo' | |
connection = Mongo::Connection.new | |
db = connection.db('apache-log') | |
logs = db.collection('log') | |
map =<<'_FUNC_' |
OlderNewer