Skip to content

Instantly share code, notes, and snippets.

View yosmoc's full-sized avatar

Yoshihisa Mochihara yosmoc

  • IKEA IT AB
  • Sweden
View GitHub Profile
@yosmoc
yosmoc / gist:2155
Created July 24, 2008 14:11
rm_hatenagraph.rb
# -*- coding: utf-8 -*-
require 'mechanize'
require 'pit'
require 'uri'
pit = Pit.get('hatena', :require => {
'username' => 'username',
'password' => 'password'})
BASE = URI("http://graph.hatena.ne.jp/#{pit['username']}/")
def default_value
p 'generate default_value'
'default value'
end
def some_method(param = nil)
param ||= default_value
p param
end
def default_value
p 'generate default_value'
'default value'
end
def some_method(param = nil)
param ||= default_value
p param
end
#!/usr/bin/env ruby
require 'pit'
require 'mechanize'
require 'uri'
pit = Pit.get('github', :require => {
'username' => 'username',
'password' => 'password'})
BASE = URI('http://gist.github.com/')
#!/usr/bin/env ruby
require 'pathname'
if ARGV.length < 1
p 'please input dir name'
else
@dir = Pathname.new(ARGV.shift).expand_path
@join_name = ARGV.join('_')
end
html {
margin: 0;
padding: 0;
}
body{
color: #f0f0f0;
background-color: #303030;
font-size: 80%;
font-family: Verdana, "Lucida Grande", "Hiragino Kaku Gothic Pro", "ヒラギノ角ゴ Pro W3", "MS Pゴシック", sans-serif;
body {
font-family: "Hiragino Kaku Gothic Pro", "Arial", sans-serif;
margin: 0 8%;
font-size: 14px;
}
h1 {
font-size: 50px;
}
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'pit'
require 'mechanize'
require 'ruby-growl'
require 'cgi'
$KCODE ='u'
conf = Pit.get('outputz.com', :require => { 'key' => 'please input your secret key!'})
#!/usr/bin/env ruby
timing = [1, 7, 14, 30]
now = Time.now
result = timing.inject(now) do |res, t|
p res.strftime("%Y/%m/%d")
res + t * 24 * 60 * 60
end
require 'nokogiri'
require 'net/http'
$KCODE = 'u'
def lou(text)
req = Net::HTTP::Post.new('/?')
Net::HTTP.version_1_2
Net::HTTP.start('lou5.jp') do |http|
res = http.request(req, "text=#{text}")
doc = Nokogiri::HTML.parse(res.body, nil, 'utf-8')