Posts Tagged ‘Ruby’
add follows code into rails app environment.rb and restart the service
# http://rails.lighthouseapp.com/projects/8994/tickets/867-undefined-method-length-for-enumerable
class String
def chars
ActiveSupport::Multibyte::Chars.new(self)
end
alias_method :mb_chars, :chars
end
##
module ActionView
module Helpers
module TextHelper
def truncate(text, length = 30, truncate_string = “…”)
[...]
下面是使用Ruby通过Http请求读取del.icio.us的一个示例.
require ‘net/https’
require “rexml/document”
username = “” # your del.icio.us username
password = “” # your del.icio.us password
resp = href = “”;
begin
http = Net::HTTP.new(”api.del.icio.us”, 443)
http.use_ssl = true
http.start do |http|
req = Net::HTTP::Get.new(”/v1/tags/get”, {”User-Agent” =>
“raecoo.com”})
req.basic_auth(username, password)
[...]
Shoes is a very informal graphics and windowing toolkit. It’s for making regular old apps that run on Windows, Mac OS X and Linux. It’s a blend of my favorite things from the Web, some Ruby style, and a sprinkling of cross-platform widgets. (More in the README, or at the newshoooes.net!)
click here , you can find [...]











