Skip to content

Instantly share code, notes, and snippets.

$ compass create test_project;
$ cd test_projrct;
$ jruby -J-Xmx128m -J-d32 test.rb
memory usage in kilobytes
65496
66360
67316
68224
68496
memory usage in kilobytes
194688
170944
169600
170252
170960
171720
172312
172668
172996
@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
@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 / 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 / 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 / create_gems_folder.sh
Created July 19, 2012 07:47
建立 custom gems folder
#!/bin/bash
gem install sass --prerelease -i $1 --no-rdoc --no-ri
gem install compass --prerelease -i $1 --no-rdoc --no-ri
gem install rack-test fssm execjs coffee-script rack tilt activesupport tzinfo i18n rake haml slim kramdown -i $1 --no-rdoc --no-ri
curl -o tka-serve.zip --location-trusted https://github.com/tka/serve/zipball/master
unzip tka-serve.zip
rm tka-serve.zip
mv tka-serve-* $1/gems/serve-1.5.1
cp $1/gems/serve-1.5.1/serve.gemspec $1/specifications
curl -o tka-rack-coffee.zip --location-trusted https://github.com/tka/rack-coffee/zipball/master
x220t[~/test]$ rvm use jruby --ignore-gemsets
Using /home/tka/.rvm/gems/jruby-1.6.7.2
x220t[~/test]$ gem list
*** LOCAL GEMS ***
x220t[~/test]$ wget http://rubygems.org/downloads/rawr-1.4.5.gem 100%[============================================================================================================>] 3,542,528 764KB/s in 8.8s
2012-08-25 01:00:35 (395 KB/s) - ‘rawr-1.4.5.gem’ saved [3542528/3542528]
x220t[~/test]$ gem install rawr-1.4.5.gem rvm:jruby-1.6.7.2
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
@tka
tka / JRuby 1.7.1 result
Created December 5, 2012 05:13
JRuby 1.7.1 vs MRI 1.9.3-p327 write binary string to file when Encoding.default_internal is UTF-8
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