Skip to content

Instantly share code, notes, and snippets.

@tka
tka / fake_data.yml
Created June 28, 2012 12:55
fire app fake data
- title: 測試活動
date: "2012-01-05"
- title: uicafe
date: "2012-06-05"
- title: RGBA
date: "2012-07-05"
@tka
tka / http_servlet_handler.rb
Created June 17, 2012 04:51
Fire.app v1.2 PHPHandler
class PHPHandler
def initialize(app)
@app = app
end
def call(env)
if env["PATH_INFO"] =~ /\.php$/
php_path = env["PATH_INFO"][1..-1]
body = %x{php #{php_path}}
[200, {"Content-Type" => "text/html"}, body]
@tka
tka / paginated_collection.js
Created February 29, 2012 02:16 — forked from zerowidth/paginated_collection.js
first whack at pagination with backbone.js
// includes bindings for fetching/fetched
PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
this.page = 1;
},
fetch: function(options) {
options || (options = {});
this.trigger("fetching");
@tka
tka / gist:1228111
Created September 20, 2011 01:43
光世代 50mb 與 linode tokyo 與 dallas 簡易測試
09:34 <@tka> wget http://tokyo1.linode.com/100MB-tokyo.bin
09:34 <@tka> 2011-09-20 09:36:14 (4.87 MB/s) - `100MB-tokyo.bin' saved [104857600/104857600]
09:34 <@tka> ping tokyo1.linode.com 50~70ms
09:36 <@tka> wget http://dallas1.linode.com/100MB-dallas.bin
09:37 <@tka> 2011-09-20 09:39:27 (1.16 MB/s) - `100MB-dallas.bin' saved [104857600/104857600]
09:37 <@tka> ping dallas1.linode.com 205ms
memory usage in kilobytes
194688
170944
169600
170252
170960
171720
172312
172668
172996
$ compass create test_project;
$ cd test_projrct;
$ jruby -J-Xmx128m -J-d32 test.rb
memory usage in kilobytes
65496
66360
67316
68224
68496
<!doctype html>
<html>
<head>
<style>
<!--
body {
text-align: center;
}
#doc {
a=Time.now.to_f
require 'stringio'
puts Time.now.to_f - a
require 'thread'
puts Time.now.to_f - a
require "open-uri"
puts Time.now.to_f - a
require "yaml"
puts Time.now.to_f - a
#
# Returns a string which represents the time as dateTime defined by XML
# Schema:
#
# CCYY-MM-DDThh:mm:ssTZD
# CCYY-MM-DDThh:mm:ss.sssTZD
#
# where TZD is Z or [+-]hh:mm.
#
# If self is a UTC time, Z is used as TZD. [+-]hh:mm is used otherwise.
var img = new Image();
$(img).load(function(){
alert('onload)
});
img.src = 'demo.jpg';