View gist:6338785
1 2 3 4 5 6 7 8 9 10
app = lambda do |env|
request = Rack::Request.new(env)
puts request.inspect
if request.params["t"] == REQUEST_TOKEN
d = JSON.parse(request.body.read)
x=IO.popen([HIPCHAT_SCRIPT, '-t', HIPCHAT_TOKEN, '-f', HIPCHAT_FROM, '-r', HIPCHAT_ROOM],'w+')
 
if d["event_name"] # system event
x.write("#{d["project_name"]}: #{d["event_name"]} - #{d["user_name"]}")
else
View gist:6223322
1 2 3 4 5 6 7 8 9 10
config.assets.precompile << Proc.new { |path|
if path =~ /\.(css|js)\z/ && !( File.basename(path) =~ /^\_/ )
full_path = Rails.application.assets.resolve(path).to_path
app_assets_path = Rails.root.join('app', 'assets').to_path
if full_path.starts_with? app_assets_path
puts "including asset: " + full_path
true
else
puts "excluding asset: " + full_path
View gist:6064129
1 2 3 4 5
ActiveRecord::Base.connection.tables.map{|table|
x=ActiveRecord::Base.connection.select('show full columns from '+table);
x.columns.slice!(7);
x.rows.each{|r| r.slice!(7)};
"<h1>#{table}</h1>"+'<table class="table table-bordered table-striped"><tr><th>'+x.columns.join('</th><th>')+"</th><th></th></tr>\n" + x.rows.map{|y| '<tr><td>'+y.join('</td><td>')+"</td><td></td></tr>\n"}.join('')+"</table>\n"}.join('</hr>')
View gist:5482325
1 2 3 4 5 6 7 8 9
* 升級
* bootstrap-sass 2.3.1.1
* zurb-foundation 4.1.5
* sass-3.2.8
* support livereload protocol version 7
* compass 0.13.alpha.4
* chunyk_png 1.2.8
* 修正
* ubuntu 13.04 下 System tray 顯示問題
View view_helpers.rb
1 2 3 4 5 6 7 8 9 10
module ViewHelpers
def rel_stylesheet_link_tag(*f)
styles=stylesheet_link_tag *f
script_path = self.parser.script_filename.gsub(Compass.configuration.project_path, '')
child_folder= File.dirname( script_path.gsub(/\/[^\/]+/, '/..')[1..-1] )
styles.gsub 'href="', "href=\"#{child_folder}"
end
 
def rel_javascript_include_tag(*f)
styles=javascript_include_tag *f
View http_servlet_handler.rb for linux
1 2 3 4 5 6 7 8 9 10
require 'open3'
 
class JadeHandler
def initialize(app)
@app = app
end
 
def call(env)
if env["PATH_INFO"] =~ /\/$/
env["PATH_INFO"] += "index.jade"
View gist:4652435
1 2 3 4 5 6 7 8 9 10
資料使用限制
政府電子採購網安全保護聲明 http://web.pcc.gov.tw/pis/main/pis/client/pssa/security.do
 
非經行政院公共工程委員會或各權利人之同意,使用者不得以任何形式利用政府電子採購網上之內容,使其存在於任何出版物、網站、檢索系統或相類似之場所。
 
政府電子採購著作權聲明 http://web.pcc.gov.tw/pis/main/pis/client/pssa/right.do
 
1.行政院公共工程委員會網站上刊載之所有內容,除著作權法規定不得為著作權之標的(如法律、命令、公務員撰擬之講稿、新聞稿等--請參考著作權法第9條規定)外,其他包括文字敘述、攝影、圖片、錄音、影像及其他資訊,均受著作權法保護。
 
2.上述不得為著作權標的者,任何人均得自由利用,歡迎各界廣為利用。
View _layout.erb
1 2 3 4 5 6 7 8 9
<%
@page_body=yield
special_comment_regexp = /<!--ruby:(.*)-->/m
if @page_body.match(special_comment_regexp)
eval($1)
@page_body.gsub!(special_comment_regexp, '')
 
elsif @page_body.match(/<h1.*?>(.*)<\/h1>/)
@page_title = $1
View JRuby 1.7.1 result
1 2 3 4 5 6 7 8 9
When Encoding.default_internal is nil
==============================
Wirte remote_binary_data to test_file
Encoding.default_external:#<Encoding:UTF-8>
Encoding.default_internal:nil
data encoding: #<Encoding:ASCII-8BIT>
file external encoding: nil
file internal encoding: nil
file size: 13686
View gist:3936991
1 2 3 4 5 6 7
export XIM=hime
export XIM_PROGRAM=/usr/bin/hime
export XIM_ARGS=
export XMODIFIERS="@im=hime"
export GTK_IM_MODULE=hime
export QT_IM_MODULE=hime
export QT4_IM_MODULE=hime
Something went wrong with that request. Please try again.