Skip to content

Instantly share code, notes, and snippets.

View tgxworld's full-sized avatar
🇸🇬

Alan Guo Xiang Tan tgxworld

🇸🇬
View GitHub Profile
diff --git a/app/models/category_list.rb b/app/models/category_list.rb
index ef8e78329e..d106fcead6 100644
--- a/app/models/category_list.rb
+++ b/app/models/category_list.rb
@@ -41,19 +41,6 @@ class CategoryList
"categories_list"
end
- def self.order_categories(categories)
- if SiteSetting.fixed_category_positions
require 'benchmark/ips'
string = <<~STRING
Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences fly into your mouth. Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum decided to leave for the far World of Grammar. The Big Oxmox advised her not to do so, because there were thousands of bad Commas, wild Question Marks and devious Semikoli, but the Little Blind Text didn’t listen. She packed her seven versalia, put her initial into the belt and made herself on the way. When she reached the first hills of the Italic Mountains, she had a last view back on the skyline of her

Keybase proof

I hereby claim:

  • I am tgxworld on github.
  • I am tgxworld (https://keybase.io/tgxworld) on keybase.
  • I have a public key ASAQ-5HZzjTFQQwr9dirO5T8xp4v6c8zFsE5IpDmzarvOQo

To claim this, I am signing this object:

puts "Hellow World"
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
index f721e91203..746e0cf8c1 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
@@ -2,6 +2,7 @@
require "thread"
require "concurrent/map"
+require "concurrent/executor/timer_set"
require "monitor"
sum = 0
processes = []
Dir["/proc/*/fd"].each do |dir|
if dir =~ /proc\/(\d+)\/fd/
count = Dir[dir + '/*'].count
sum += count
if count > 400
pid_info = `ps -p #{Regexp.last_match[1]} -o args=`.chomp
test("search with context enabled", assert => {
server.get('/t/280/73.json', () => {
return [
200,
{ "Content-Type": "application/json" },
{"post_stream":{"posts":[{"id":10846,"name":"Martin Potthast","username":"potthast","avatar_template":"/user_avatar/localhost/potthast/{size}/11363_1.png","created_at":"2013-03-10T22:38:19.665Z","cooked":"<p>I am about to issue a pull-request for a first translation of Discourse into German. While doing it over the weekend, I came across a simple issue that renders proper translation of some phrases impossible: in the code, phrases are composed of too fine-grained units.</p>\n\n<p>Take this simple example of a phrase: </p>\n\n<pre><code>{{Username}} edited {{Topic Title}}.</code></pre>\n\n<p>In the code, this happens to be broken down into the three units \"{{Username}}\" (variable for the user who did something), \"edited\" (some action), and \"{{Topic Title}}\" (variable for the topic title affected).</p>\n\n<p>This works fine for English, but in
@tgxworld
tgxworld / proposal.md
Created May 2, 2016 04:31
May 2016 Ruby Meetup

#May 2016 RubySG Meetup

Event Description

RubySG organizes monthly Ruby meetups which attracts Ruby and Rails developers in Sinagpoare as well as developers who are new to the language and framework. The meetup programme consists of 3 talks given by volunteers from the Ruby community in Singapore. The Ruby meetup will be a great opportunity for Grab to reach out to talented Ruby developers in Singapore as part of recruitment efforts. Furthermore, the meetup will also provide a platform for engineers at Grab to connect with other developers in Singapore and trade ideas over a night of pizzas.

We believe that Grab's presence and participation in the Ruby community will help greatly in making the tech communities in Singapore a more vibrant one.

Number of People

40-70

@tgxworld
tgxworld / 4.2.6
Created April 13, 2016 07:40
Benchmark of Discourse on Rails 5 master vs Rails 4.2.6
Your Results: (note for timings- percentile is first, duration is second in millisecs)
---
categories_admin:
50: 53
75: 55
90: 58
99: 69
home_admin:
50: 50
75: 52
@tgxworld
tgxworld / gist:fc38b562fb383ec56439
Created February 12, 2016 01:04
Thoughts on bucketing
```
T | T+1 | T+2 | T+3 | T+4
1 | 5 | 6 | 2 | 5 # Number of hits
17 logs in 5 secs = 3.4 logs/s
Ex = Expired
One sec later...