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
# BufferedLogger format patch. | |
# Install into config/initializer/buffered_logger_format.rb | |
# | |
# - https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1307-bufferedlogger-should-support-message-formatting | |
# - http://saikyoline.jp/weblog/2008/07/01/013418.html | |
# - http://github.com/moro/logger_exception_format/tree/master | |
module ActiveSupport | |
class BufferedLogger | |
def add(severity, message = nil, progname = nil, &block) |
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 "rubygems" | |
require "www/mechanize" | |
# WordPress Client using WWW::Mechanize. | |
class WpClient | |
attr_accessor :m | |
def initialize(baseurl) | |
@base = baseurl | |
@base = @base[0..-2] if @base[-1] == ?/ |
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
#! /bin/sh | |
cat /var/spool/cron/* /etc/crontab | grep '^\(\*\|[0-9]\)' | sort -nk2 -nk1 |
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 "rubygems" | |
require "www/mechanize" | |
class WpClient | |
attr_accessor :m | |
def initialize(baseurl, opts = {}) | |
@base = baseurl | |
@base = @base[0..-2] if @base[-1] == ?/ | |
@opts = opts |
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/env ruby | |
require "open-uri" | |
# o080701 NG | |
# w070615 OK | |
# w081105 OK | |
# ruby/ruby | |
appk = "T-PmFVHrGFvAVN1ipcVEMS2srfoMHuiOWKgW-JV3wqg4.4XU2lHAW8.P67Q.GE70F1Cmix44tSDfrswTh-XQiIa4vKoo6J0r2QRxNK8LMXrnAE158hxE1Yf6LUN10.blID2dNEtfRGmDeTKMWW04Gfx90H.HA3lf.d30Ch56w0g3SKZVN0BpYz.deQVWaKKqefBo5k6nMn6kOpPVX.LGO6BUHDFCHa2Fr1qTD3Gs86DlfflgG.fY7aIciOgH.dJMFVY0ijb9fAe0u78YqcRCNfLxW.Pq7xp5Ifk49TG1CRmw6zOfI2B8bbP-fnI3rpXTrhM.5o9L7GQaj46aTf1R6Q__,cnVieQ__,cnVieQ__" |
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 'net/http' | |
require 'uri' | |
# Simple HTTP request | |
# | |
# See also: | |
# http://addressable.rubyforge.org/ | |
# http://dev.ctor.org/http-access2 | |
# | |
def http_request(method, uri, query_hash = {}, user = nil, pass = nil) |
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
#! /bin/sh | |
# ---------------------------------------------------------------- | |
# Amazon EC2 ami-e048af89 (debian 6.0 squeeze) | |
# ---------------------------------------------------------------- | |
# install git and rake. | |
apt-get update | |
apt-get -y install libidn11-dev | |
apt-get -y install git-core |
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 'benchmark' | |
require 'yaml' | |
open("data1.txt", "w") do |io| | |
5000.times do |i| | |
io << "abcdefghijklmnopqrstuvwxyz\t#{i}\n" | |
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
module SmallCage | |
module RedClothHelper | |
require "redcloth" | |
def render_textile(str) | |
RedCloth.new(str).to_html | |
end | |
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
<html> | |
<head> | |
<style type="text/css"> | |
.selected { font-weight: bold; color: red; background-color: yellow; } | |
</style> | |
</head> | |
<body> | |
<%= menu %> | |
<%= body %> |