Skip to content

Instantly share code, notes, and snippets.

View gonglexin's full-sized avatar

Lexin Gong gonglexin

View GitHub Profile
{"sig":"7a4d511857260043cf0956936c27b21eeff62b7f7112c57451ed259215ff8c2547dde772e5d77673306c245d3289540eb8769a93ef8bcdc5de03af45edcb2390","msghash":"cefb694aeedac04ecb7cc6bb918482c994d4994b0b2ac73838bc92e1ef774d7a"}

Keybase proof

I hereby claim:

  • I am gonglexin on github.
  • I am gonglexin (https://keybase.io/gonglexin) on keybase.
  • I have a public key ASCKe2doI4rkPb-98Y8pLsOf4Qc6lGv6uv4uIy810GLt8Ao

To claim this, I am signing this object:

require 'nokogiri'
require 'open-uri'
require 'fileutils'
base_uri = 'http://louie.land/wallpapers'
doc = Nokogiri::HTML(open base_uri)
uris = []
doc.css('.grid a').each do |link|
ssh -qCNgf root@8.8.8.8 -D 127.0.0.1:7070
doctype html
html
head
title You title here
= stylesheet_link_tag "application", :media => "all"
= javascript_include_tag "application"
= csrf_meta_tags
body
= yield
@gonglexin
gonglexin / database.rb
Created May 4, 2010 09:09
Ruby:ActiveRecord连接数据库
require 'rubygems'
require 'activerecord'
# 利用 activerecord 连接数据库
ActiveRecord::Base.establish_connection(:adapter => "mysql",
:host => 'localhost',
:username => "root",
:password => "root",
#:prot => "3306",
:database => "depot_development"
#:encoding => "utf8"
@gonglexin
gonglexin / railscasts.rb
Created April 28, 2010 13:17
Ruby::Download railscasts(markdown format)
require 'rss'
url = 'http://feeds.feedburner.com/railscasts'
rss = RSS::Parser.parse(url)
rss.items.reverse.each do |item|
puts "* [#{item.title}](#{item.enclosure.url})"
end
@gonglexin
gonglexin / chinesedecimal.rb
Created April 14, 2010 10:58 — forked from xiaods/chinesedecimal.rb
Ruby:convert RMB currency to chinese describe
$KCODE = 'u'
# Goal: 小写金额转换为大写金额
# Limit: 金额整数位支持到亿位,小数点后支持两位并且不支持四舍五入
class ChineseFee
attr_reader :chn_numbers, :chn_units, :chn_decimals
def initialize
@chn_numbers = %w(零 壹 贰 叁 肆 伍 陆 柒 捌 玖)
@chn_units = %w(元 拾 佰 仟 万 拾万 佰万 仟万 亿)