Skip to content

Instantly share code, notes, and snippets.

View june29's full-sized avatar
🚿

june29 june29

🚿
View GitHub Profile
require "rubygems"
require "nokogiri"
require "httpclient"
require "uri"
require "json"
class Pager
@@siteinfo_url = "http://wedata.net/databases/AutoPagerize/items.json"
attr_accessor :doc
{
name: 'tabundle',
domain: 'file:\/\/\/Users\/.+\/Library\/Application%20Support\/Firefox\/Profiles\/.+\/tabundle\/.+\.html',
paragraph: '//li',
link: './div[@class="url"]/a',
stripe: false,
}
require "rubygems"
require "nokogiri"
require "open-uri"
require "uri"
class SimplePager
include Enumerable
attr_reader :doc, :original_url, :current_url
require "rubygems"
require "nokogiri"
require "open-uri"
require "shell"
doc = Nokogiri::HTML(open("http://www.stylegala.com/features/bulletmadness/"))
sh = Shell.new
doc.xpath("//ul[@class='bulletlist']/li/img").each do |img|
src = img.attributes["src"].gsub(" ", "%20")
extensions = ["png", "gif", "ico", "bmp", "jpg"]
pattern = Regexp.new("(\." + extensions.join("$|\.") + "$)")
target = ARGV[0] || "."
puts "<html>"
puts " <head>"
puts " <title>Images</title>"
puts " <style>"
puts " * {margin:0;padding:5px;}"
require "rubygems"
require "open-uri"
require "nokogiri"
BASE_URL = "http://albertayu773.pixnet.net/album/set/14344750"
LINK_XPATH = "//div[@class='thumbList']/ul/li/div/span/a"
IMG_XPATH = "id('imageFrame')//img"
NEXT_XPATH = "//a[@class='pageNext']"
SLEEP_TIME = 3
class String
def to_xml
self.unpack('U*').collect { |c|
if c >= 255
'&#' + c.to_s + ';'
elsif c == 165 || c == 92
'\\'
else
c.chr
end
require "iconv"
require "nkf"
require "kconv"
string = "何をするだァーッ"
puts string
puts Iconv.conv("Shift_JIS", "UTF-8", string)
puts NKF.nkf("-e", string)
@june29
june29 / flickr_every_photo_share.user.js
Created May 7, 2010 09:35
Show embed tag every photo page on Flickr
// ==UserScript==
// @name Flickr every photo share
// @namespace http://june29.jp/
// @description Show embed tag every photo page on Flickr
// @include http://www.flickr.com/photos/*/*/sizes/*/*
// @require http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js
// ==/UserScript==
(function() {
var ownerName = $("div.Owner a:last").text();
require "uri"
require "rubygems"
require "eventmachine"
require "em-websocket"
require "yajl/http_stream"
require "json"
require "pit"
account = Pit.get("twitter", :require => {
"username" => "username",