Skip to content

Instantly share code, notes, and snippets.

@oc
Created January 5, 2011 22:21
Show Gist options
  • Select an option

  • Save oc/767138 to your computer and use it in GitHub Desktop.

Select an option

Save oc/767138 to your computer and use it in GitHub Desktop.
~/noko:➔ java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04-307-10M3261)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03-307, mixed mode)
~/noko:➔ rvm use jruby
Using /Users/oc/.rvm/gems/jruby-1.5.6
~/noko:➔ gem install nokogiri
Successfully installed weakling-0.0.4-java
Successfully installed nokogiri-1.4.4.2-java
2 gems installed
~/noko:➔ jruby -S nokogiri -v
---
warnings: []
nokogiri: 1.4.4.2
ruby:
version: 1.8.7
platform: java
engine: jruby
jruby: 1.5.6
libxml:
loaded: 2.7.3
binding: ffi
platform: jruby
refs: weakling
~/noko:➔ gem list
*** LOCAL GEMS ***
bouncy-castle-java (1.5.0145.2)
bundler (1.0.7)
columnize (0.3.1)
jruby-launcher (1.0.3)
jruby-openssl (0.7.2)
nokogiri (1.4.4.2)
rake (0.8.7)
rspec (1.3.0)
ruby-debug (0.10.3)
ruby-debug-base (0.10.3.2)
sources (0.0.1)
weakling (0.0.4)
require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'openssl'
# Ikke valider sertifikatet..
module OpenSSL
module SSL
remove_const :VERIFY_PEER
VERIFY_PEER = VERIFY_NONE
end
end
doc = Nokogiri::HTML(open('https://github.com/oc'))
puts "My public repos"
doc.css('ul#repositories li.public', 'h3 a').each do |link|
puts link['href']
end
puts "\nPublic activity"
# css + xpath
doc.search('div.public_news', '//div[@class="title"]').each do |news|
puts news.text.gsub(/\s+/, ' ') unless news.text =~ /^\s+$/
end
~/noko:➔ jruby noko.rb
My public repos
https://github.com/oc/following
/oc/ultimate-vimrc
/oc/dotfiles
/oc/jackbox
/oc/cuke4duke
/oc/oh-my-zsh
/oc/rest-api-example
/oc/subliftit
/oc/cucumber-tmbundle
/oc/submitit
/oc/poker
/oc/fagdag1109
/oc/fagkveld
/oc/barcode
/oc/features2cards
/oc/poignantguide
/oc/three20
/oc/appsentry
/oc/scalanet
/oc/scalademo
/oc/juristopia
/oc/tillsammans
Public activity
oc created branch master at oc/ultimate-vimrc Wed Dec 29 12:38:00 -0800 2010
oc created repository ultimate-vimrc Wed Dec 29 12:37:32 -0800 2010
oc pushed to master at bring/jasmine-maven-plugin Thu Nov 18 01:57:22 -0800 2010
oc created tag 1.0.1-BRING at bring/jasmine-maven-plugin Thu Nov 18 01:57:19 -0800 2010
oc pushed to master at bring/jasmine-maven-plugin Thu Nov 18 01:57:16 -0800 2010
oc pushed to master at bring/jasmine-maven-plugin Thu Nov 18 01:56:54 -0800 2010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment