Skip to content

Instantly share code, notes, and snippets.

View 4b5ent1's full-sized avatar

500-9 4b5ent1

  • 中國
View GitHub Profile
@4b5ent1
4b5ent1 / oo-banana.md
Created June 4, 2018 12:41 — forked from bryanhunter/oo-banana.md
Joe Armstrong on reusability in software (OO-vs-functional)

I think the lack of reusability comes in object-oriented languages, not functional languages. Because the problem with object-oriented languages is they’ve got all this implicit environment that they carry around with them. You wanted a banana but what you got was a gorilla holding the banana and the entire jungle.

If you have referentially transparent code, if you have pure functions-- all the data comes in its input arguments and everything goes out and leaves no state behind-- it's incredibly reusable. You can just reuse it here, there, and everywhere.

-Joe Armstrong, Designer and implementer of the Erlang programming language

# luna_pinyin.custom.yaml
# 修改字典名爲 luna_pinyin.kunki
# 其對應的用戶詞典名取句點之前部分即 luna_pinyin
patch:
translator/dictionary: luna_pinyin.kunki
@4b5ent1
4b5ent1 / bing_ping_test.cmd
Created August 22, 2014 13:12
Test_Information = { {date, 20140822}, {location, beijing}, {network_environment, [ unicom_3g, edu ]} }.
ping bing.com > bing_ping_test_%1.txt
ping www.bing.com >> bing_ping_test_%1.txt
ping cn.bing.com >> bing_ping_test_%1.txt
ping www.biying.com >> bing_ping_test_%1.txt
@4b5ent1
4b5ent1 / subscriber.py
Last active August 29, 2015 14:00
pyramid.events.BeforeRender: fix the UnicodeDecodeError exception on rendering template
# encoding:utf-8
u"""
用比较恶心的办法解决模板渲染时出现 UnicodeDecodeError 的问题
This subscriber try to convert all <str> to <unicode>
functional available for Chameleon, Jinja2, and Mako