Skip to content

Instantly share code, notes, and snippets.


Yo-An Lin c9s

View GitHub Profile
c9s / GoogleSpreadSheetInviteToSlack.js
Last active Aug 29, 2015
InviteToSlack from Google SpreadSheet
View GoogleSpreadSheetInviteToSlack.js
The original script:
Get channels from: curl '{token}' | json_pp
function getInviteChannels() {
return ['C123123123'];
nikic /
Last active Jul 17, 2020
Post explaining why objects often use less memory than arrays (in PHP)

Why objects (usually) use less memory than arrays in PHP

This is just a small post in response to [this tweet][tweet] by Julien Pauli (who by the way is the release manager for PHP 5.5). In the tweet he claims that objects use more memory than arrays in PHP. Even though it can be like that, it's not true in most cases. (Note: This only applies to PHP 5.4 or newer.)

The reason why it's easy to assume that objects are larger than arrays is because objects can be seen as an array of properties and a bit of additional information (like the class it belongs to). And as array + additional info > array it obviously follows that objects are larger. The thing is that in most cases PHP can optimize the array part of it away. So how does that work?

The key here is that objects usually have a predefined set of keys, whereas arrays don't:

View gist:4525421
09:07 -!- Irssi: Join to was synced in 133 secs
09:08 < MouseMs> 大家早安
09:08 < locy69> 早安
09:09 < StarNight> 早安!~
09:10 < MouseMs> [SITCON] 答案填寫單將於9:30開放submit答案 PS:同時也會開放第五題唷 今天的題目都比較簡單 歡迎大家挑戰:)
09:13 < bency> 早安
09:13 < BeataLin> 早安!
09:21 < SITCON> 今天也有3題等著大家挑戰唷^^
09:23 < kikiqqp_> 今天R0的有線網路有點怪怪的
09:25 < ChAndrew> Good Morning!!
audreyt /
Created Dec 7, 2012
ROT encode/decode
#!/usr/bin/env lsc
# 使用前請先 curl -O
require! fs
c2p = {}; p2c = {}
for l in "#{ 'Mandarin.txt'}" / /\n/
[code, pin] = l / /\s+/
continue unless code is /^....$/ # BMP
audreyt / posa.mkdn
Last active Jan 15, 2020
View posa.mkdn

從 SocialCalc 到 EtherCalc

先前在《開源應用程式架構》 一書中,我介紹了 SocialCalc 這個在瀏覽器中運行的試算表編輯器,以取代伺服器為中心的 WikiCalc 架構。SocialCalc 在瀏覽器中執行所有的運算,只有在載入和儲存試算表時才會使用伺服器。

追求效能是 Socialtext 團隊在 2006 年時設計 SocialCalc 的主要目的。重點在於:在 JavaScript 環境下執行客戶端運算,儘管在當年的速度僅有伺服器端 Perl 運算的十分之一,但仍然勝過 AJAX 來回傳輸資料造成的網路延遲:

WikiCalc 與 SocialCalc 架構比較

nikic / guestbook.markdown
Created Jul 29, 2012
Quick doesn't have to mean dirty: Also applies to PHP!
View guestbook.markdown

Quick doesn't have to mean dirty: Also applies to PHP!

This is just a quick response to I won't bother to write a proper blog post for this, so a Gist will have to do ;)

When I read that article, one thing really striked me: If you want to quickly create a web app in PHP, you do exactly the same. I mean, exactly.

I never used the Silex microframework before, so I took this as a chance to see how it works. I'll just do the same as eevee did, only with a bit less commentary (this is a Gist after all!)

I hope that this will show you that PHP and Python are really similar to work with. Also this should show that just because you're using PHP, doesn't mean that you write dirty code. The similarity in the process and code is really incredible :)


Avoid jQuery When Possible

jQuery does good jobs when you're dealing with browser compatibility. But we're living in an age that fewer and fewer people use old-school browsers such as IE <= 7. With the growing of DOM APIs in modern browsers (including IE 8), most functions that jQuery provides are built-in natively.

When targeting only modern browsers, it is better to avoid using jQuery's backward-compatible features. Instead, use the native DOM API, which will make your web page run much faster than you might think (native C / C++ implementaion v.s. JavaScript).

If you're making a web page for iOS (e.g. UIWebView), you should use native DOM APIs because mobile Safari is not that old-school web browser; it supports lots of native DOM APIs.

If you're making a Chrome Extension, you should always use native APIs, not only because Chrome has almost the latest DOM APIs available, but this can also avoid performance issue and unnecessary memory occupation (each jQuery-driven extension needs a separate

paulmillr /
Last active Aug 13, 2020
Most active GitHub users (by contributions).

Most active GitHub users (

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at from Tue, 06 Dec 2016 17:06:46 GMT till Wed, 06 Dec 2017 17:06:46 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

  .filter(user => user.followers > 1000)


Original transcript:




erning /
Created Nov 28, 2011

多关键字的文本精确匹配搜索 (mss - Multi-String Search)






You can’t perform that action at this time.