Skip to content

Instantly share code, notes, and snippets.

# -*- coding: utf-8 -*-
require 'mechanize'
class AmazonOrder
def initialize
@agent = WWW::Mechanize.new
@agent.user_agent_alias = 'Windows IE 7'
end
def login id, password
# -*- coding: utf-8 -*-
require 'mechanize'
require 'uri'
class DokushoMeter
def initialize
@agent = WWW::Mechanize.new
@agent.user_agent_alias = 'Windows IE 7'
end
var items = [2,7,1,5,1,2,4,65,76,874,3,2,1,3,7,1,5,1,2,4,65,76,874,3,2,1,3]
var table = []
items.forEach(function(n){
console.log(table);
table = table.concat(table.map(function(x){return x + n}).concat(n))
})
table.filter(function(x){return x <= 10}).sort(function(x,y){return x < y})[0]
#!/bin/ruby
class Item
include Comparable
attr_accessor :value, :route
def initialize v
@value = v
@route = []
end
#!/bin/ruby
class Item
include Comparable
attr_accessor :value, :route
def initialize v
@value = v
@route = []
end
# -*- encoding: utf-8 -*-
require 'rexml/document'
require 'net/http'
class Keyphrase
def initialize
path = File.join(File.dirname(__FILE__), "..", "config", "yahooapis.yml")
config = YAML::load(File.open(path))
@app_id = config['app_id']
end
@koduki
koduki / ma.rb
Created October 30, 2010 17:18
# -*- encoding: utf-8 -*-
require 'rexml/document'
require 'net/http'
class MA
def initialize
path = File.join(File.dirname(__FILE__), "..", "config", "yahooapis.yml")
config = YAML::load(File.open(path))
@app_id = config['app_id']
end
require "rubygems"
require "mechanize"
password = ''
domain = ''
agent = WWW::Mechanize.new
page = (agent.get 'http://ddo.jp/')
form = page.forms.with.name('dnsupdate').first
# dm-rails付きのrailsでプロジェクトを作成.
rails new rails_example -m http://datamapper.org/templates/rails.rb
cd rails_example
# cucumebr等を追加. 2010/10/31現在のgemはバグがあるため野良gitから取得.
cat > gemfile.patch
--- Gemfile 2010-10-31 11:25:20.286666717 +0900
+++ Gemfile 2010-10-31 11:23:19.700000054 +0900
@@ -36,8 +36,10 @@
gem 'dm-observer', DM_VERSION
rails generate scaffold article title:string body:text
rails generate cucumber:feature article title:string body:text
rake db:setup RAILS_ENV=test
rake features