目前分類:ruby (24)

瀏覽方式: 標題列表 簡短摘要

這串Getting Real學習筆記是別人寫的,實際上是非常的不筆記,想快速瀏覽Getting Real這本書在表達些什麼,可以去瞧瞧。


Forth 發表在 痞客邦 留言(0) 人氣()

From Top 11 Rails Plugins

  • Acts As Taggable -上tag
  • Acts As Rateable – 評分
  • Acts As Commentable – 評論
  • Acts As Voteable – 投票
  • Acts As Blog – Textile, Markup, SmartyPants轉HTML
  • Acts As Versioned – 資料歷程
  • Acts As Bookmarkable – 書籤
  • Riff Rails – 資料比對
  • Rails PDF – 產生PDF文件
  • Calendar Helper – 日曆元件
  • Graphs Rails – CSS長條圖

Forth 發表在 痞客邦 留言(0) 人氣()

用了半天時間翻完Ruby for Rails,感想是,學Ruby請讀Programming Ruby: The Pragmatic Programmer's Guide,學Rails請讀Agile Web Development with Rails,讀完Agile Web Development with Rails可以再讀Rails Recipes,不要把時間耗在Ruby for Rails上。


Forth 發表在 痞客邦 留言(0) 人氣()

This is my first Ruby script to fetch photos from TaipeiLink.

#!/usr/local/bin/ruby
require "net/http"

if ARGV.length == 0 puts "tplink.rb <account>" exit end
ARGV.delete("tplink.rb") ARGV.each { |account| puts "Fetching photos from #{account}..." Dir.mkdir(account) if !FileTest.exist?(account) Net::HTTP.start("photo.taipeilink.net", 80) { |http| http.get("/#{account}").body.scan(/<a href="http://photo.taipeilink.net/#{account}?st=album&pg=(d*)"/) { |pg| Dir.mkdir("#{account}/#{pg}") if !FileTest.exist?("#{account}/#{pg}") http.get("/#{account}?st=album&pg=#{pg}").body.scan(/<a href="http://photo.taipeilink.net/#{account}/(d*-d*-d*-d*)?m=0&pg=(d*)"/) { |fileName, pg| url = "/#{account}/#{fileName}?m=1&pg=#{pg}" response = http.head(url) if response["content-type"] == "image/gif" fileName += ".gif" else fileName += ".jpg" end fileName = "#{account}/#{pg}/#{fileName}" if FileTest.exist?(fileName) puts "Skip #{fileName}" else puts "Fetch #{fileName}" response = http.get(url) file = File.new(fileName, "w") file.write(response.body) file.close() end } } } }

Forth 發表在 痞客邦 留言(0) 人氣()

«12