Skip to content

Instantly share code, notes, and snippets.

@tka
tka / PKGBUILD
Last active May 28, 2017 17:48
opencv-contrib-3.2
# Maintainer: Andrew Crerar <andrew (at) crerar (dot) io>
# Contributor: Valentin Churavy <v.churavy@gmail.com>
# Contributor: Romain Reignier <rom.reignier@gmail.com>
# Contributor: Fabien Dubosson <fabien.dubosson@gmail.com>
# Contributor: David Manouchehri <david@davidmanouchehri.com>
# Contributor: CHEN Xing <cxcxcxcx@gmail.com>
# Contributor: Martin Imobersteg <martin.imobersteg@gmail.com>
# Contributor: Artyom Smirnov <smirnoffjr@gmail.com>
# Also largely inspired by `opencv` in extra, so including contributors too:
# Contributor: Ray Rashif <schiv@archlinux.org>
function requireAll(r) { r.keys().forEach(r); }
requireAll(require.context('../images/', true, /\..*$/));
requireAll(require.context('./vendors/', true, /\..*$/));
@tka
tka / screenshot.js
Last active June 3, 2016 11:23
phatomjs 2.1 網頁抓圖, 可用 css selector 或是 xpath 抓出區塊
"use strict";
var page = require('webpage').create(),
system = require('system'),
address, output, size, pageWidth, pageHeight, targetSelector;
if (system.args.length < 3 || system.args.length > 4) {
console.log('Usage: screenshot.js URL filename [css selector|xpath:path]');
console.log('example: phatomjs screenshot.js https://google.com image.png img');
console.log('example: phatomjs screenshot.js https://google.com image.png xpath://img');
phantom.exit(1);
} else {
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
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
@tka
tka / gist:6064129
Last active December 20, 2015 03:29
rails dump db schema to html table
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>')
* 升級
* 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 顯示問題
@tka
tka / view_helpers.rb
Created April 11, 2013 09:15
fire.app 相對路徑版 stylesheet_link_tag, javascript_include_tag
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
require 'open3'
class JadeHandler
def initialize(app)
@app = app
end
def call(env)
if env["PATH_INFO"] =~ /\/$/
env["PATH_INFO"] += "index.jade"
資料使用限制
政府電子採購網安全保護聲明 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.上述不得為著作權標的者,任何人均得自由利用,歡迎各界廣為利用。