Skip to content

Instantly share code, notes, and snippets.

View tgxworld's full-sized avatar
🇸🇬

Alan Guo Xiang Tan tgxworld

🇸🇬
View GitHub Profile
@tgxworld
tgxworld / gist:e2ebd5896d29ec335d15
Last active August 29, 2015 14:13
Cover Letter for Nitrous.IO Internship

My background

I'm Alan from Singapore currently reading Mechanical Engineering at the National University of Singapore. Despite majoring in mechanical engineering, I'm really passionate about software engineering and is planning to make that my career.

What I've done

  • Winter Break 2014: I built RubyBench.org after reading Sam Saffon's call for a long running Ruby benchmark. The project had been started but no one had the time to see it to completion due to their full time commitments. Therefore, I decided to spend my winter break to get it to a publishable state.

  • Summer Break 2014: I worked on "Unifying Controller and Integration Tests in Rails" as part of Google Summer of Code 2014. More about the project here.

@tgxworld
tgxworld / gist:49b3ead6a7c1597fa04e
Last active August 29, 2015 14:10
Singapore Team Failed to Compete in USD$310,242 Dota 2 Tournament Due to National Service and School Reasons

Background

First Depature competed in Beyond the Submmit, a global Dota 2 tournament, where regional qualifiers are played online with the winner of each region invited to the Los Angeles studio to compete in a Local Area Network(LAN) finals against the winners of other regions in the world. The tournament starts with a base price pool of a $100,000 dollar with 25% of all in game sales contributing to it. At this time of writing, the total prize pool stands at $310,242!!!!

Price Pool of Beyond the Submmit

A wasted opportunity for national glory

Statement from First Depature

![](https://fbcdn-sphotos-d-a.akamaihd.net/hphotos-ak-xpf1/v/t1.0-9/10532927_1015247092768

@tgxworld
tgxworld / gist:de167eb9cefa3d73f660
Last active August 29, 2015 14:06
Bound Parameters
require 'abstract_unit'
class SomethingController < ApplicationController
def index
render plain: 'ok'
end
end
class SomethingTest < ActionDispatch::IntegrationTest
class SomeController < ApplicationController
@tgxworld
tgxworld / 100_runs.rb
Last active August 29, 2015 14:04
Comparison of runtime between Controllers and Integration Tests. Duplicated test case 10 times to simulate a larger test suite.
# Logging Enabled
guoxiang@guoxiang-GS60-2PC-Ghost rails-contributors (master) $ time for i in {1..100}; do rake test:controllers; done;
real 7m47.588s
user 7m14.987s
sys 0m23.319s
guoxiang@guoxiang-GS60-2PC-Ghost rails-contributors (master) $ time for i in {1..100}; do rake test:integration; done;
real 8m25.046s
user 7m51.508s
sys 0m24.071s
@tgxworld
tgxworld / 100_runs.rb
Created July 17, 2014 05:47
Comparison of runtime between Controllers and Integration Tests. Duplicated test case 10 times to simulate a larger test suite.
real 7m15.452s
user 6m45.995s
sys 0m19.915s
@tgxworld
tgxworld / 100_runs.rb
Created July 17, 2014 05:47
Comparison of runtime between Controllers and Integration Tests. Duplicated test case 10 times to simulate a larger test suite.
real 7m15.452s
user 6m45.995s
sys 0m19.915s
@tgxworld
tgxworld / 100_runs.rb
Last active August 29, 2015 14:04
Comparison of runtime between Controllers and Integration Tests.
# Logging Enabled
guoxiang@guoxiang-GS60-2PC-Ghost rails-contributors (master) $ time for i in {1..100}; do rake test:controllers; done;
real 2m59.920s
user 2m39.629s
sys 0m16.733s
guoxiang@guoxiang-GS60-2PC-Ghost rails-contributors (master) $ time for i in {1..100}; do rake test:integration; done;
real 3m5.075s
user 2m44.631s
sys 0m16.883s
@tgxworld
tgxworld / log.rb
Last active August 29, 2015 14:04
Comparison of runtime between Controllers and Integration Tests. (Rspec included)
guoxiang@guoxiang-GS60-2PC-Ghost rails-contributors (master) $ time rspec spec/controllers
..............................................................................................................
Finished in 3.34 seconds
110 examples, 0 failures
Randomized with seed 12942
real 0m4.700s
@tgxworld
tgxworld / Log
Last active August 29, 2015 14:03
Comparison between Controller and Integration tests for https://github.com/fxn/rails-contributors
guoxiang@guoxiang-GS60-2PC-Ghost rails-contributors (integration) $ time for i in {1..100}; do rake test:controllers; done >> integration.txt
real 2m56.749s
user 2m37.466s
sys 0m15.781s
guoxiang@guoxiang-GS60-2PC-Ghost rails-contributors (integration) $ time for i in {1..100}; do rake test:controllers; done >> controller.txt
real 2m57.044s
user 2m37.664s
sys 0m15.830s
require 'byebug'
integration = []
File.open('/home/guoxiang/app2/itest.txt', 'r').each_line do |line|
line.match(/Finished in ([\d.]+)/)
integration << $1.to_f if $1
end
functional = []
File.open('/home/guoxiang/app2/ftest.txt', 'r').each_line do |line|