Skip to content

Instantly share code, notes, and snippets.

Kimihiko NAKAMURA konk303

Block or report user

Report or block konk303

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@konk303
konk303 / createSitemap.rb
Created May 22, 2009
learning ruby; file, csv, xml
View createSitemap.rb
#!/usr/bin/env ruby
require 'csv'
require 'rexml/document'
xml = REXML::Document.new()
xml.add(REXML::XMLDecl.new("1.0", "UTF-8"))
root =REXML::Element.new("urlset")
root.add_namespace("http://www.sitemaps.org/schemas/sitemap/0.9")
xml.add_element(root)
@konk303
konk303 / jetpackTesting.html
Created May 22, 2009
testing jetpack feature
View jetpackTesting.html
<!DOCTYPE html>
<html>
<head>
<link rel="jetpack" href="jetpackTesting.js" />
<title>testing Jetpack</title>
</head>
<body>
<h1>testing Jetpack</h1>
</body>
</html>
View memcached_test.rb
require 'rubygems'
require 'sinatra'
require 'appengine-apis/memcache'
before do
@memcache = AppEngine::Memcache.new
end
get '/test/:key' do
@key = params[:key]
View fixture_load_patch.rb
# -*- coding: utf-8 -*-
module ActiveRecord
module ConnectionAdapters # :nodoc:
module DatabaseStatements
# == rake db:fixture:load のmonkey patch
# 既存のfixture yamlに下記の問題がある
# # 型的に不正な初期値を使用してる箇所がある (sql_mode TRADITIONAL では落ちる)
# # NOT NULL制約のあるカラムに値をセットしていない時がある (sql_mode TRADITIONAL では落ちる)
# # 日付・時間カラムに、システム最小日付(lws_time)が入らない
# ので、ActiveRecord::ConnectionAdapters::DatabaseStatements.insert_fixture
View solve.rb
#!/usr/bin/env ruby
target = gets.to_i
count = gets.to_i
values = {}
count.times do |i|
values[gets.to_i] = 1
end
answer = 0
@konk303
konk303 / test-queue.rb
Last active Jul 6, 2017
Simplified test-queue runner with simplecov
View test-queue.rb
#!/usr/bin/env ruby
require 'test_queue'
require 'test_queue/runner/rspec'
class MyAppTestRunner < TestQueue::Runner::RSpec
def after_fork(num)
SimpleCov.command_name "worker#{num}"
ActiveRecord::Base.configurations['test']['database'] << num.to_s
ActiveRecord::Base.establish_connection(:test)
You can’t perform that action at this time.