Skip to content

Instantly share code, notes, and snippets.

/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');
# var xs = [1,2,3]
# doubleMe(doubleMe(doubleMe(xs)))
#這樣寫法有很多缺點,太多層次要把全部層次讀完才能知道最後結果。
#在墮性語言之中
#我們要做到調用 doubleMe 時並不會立即求值,它會說“嗯嗯,待會兒再做!”
#在真正執行時只會是一個平面,像 xs *2 *2 *2;
(a, b, c) --> a * b * c
#代替了

Movies Recommendation:

Music Recommendation:

@evenchange4
evenchange4 / zsh.md
Last active August 29, 2015 14:16 — forked from tsabat/zsh.md
@evenchange4
evenchange4 / AnotherAntiPattern.js
Created February 5, 2016 03:32 — forked from wuct/AnotherAntiPattern.js
Nesting children is also an anti-pure-render pattern.
// Consider <Button /> is a pure render component
const AntiPureComponet = () => <div>
Call me maybe?
<Button><IconPhone /> Call</Button>
</div>
// When <AntiPureComponet /> renders, it creates a new child (by calling React.createElement) and pass to <Button />.
// This behavior forces <Button /> to re-render everytime.
@evenchange4
evenchange4 / gist:2d02827528853d78a7f3
Created February 24, 2016 08:55 — forked from jonathanmoore/gist:2640302
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

Child Component
onChangeHandler (val, name) {
// Is there anyway that I can share the handler among different Select while keeping in mind that which Select(corresponding to entry) is called ?
this.props.onChange(val, name)
}
render () {
<Select name="select1" value={this.props.data["select1"]} options=this.props.options onChange={value => this.onChangeHandler(value, 'select1')} />
<Select name="select2" value={this.props.data["select2"]} options=this.props.options onChange={value => this.onChangeHandler(value, 'select2')} />
<Select name="select3" value={this.props.data["select3"]} options=this.props.options onChange={value => this.onChangeHandler(value, 'select3')} />
<Select name="select4" value={this.props.data["select4"]} options=this.props.options onChange={value => this.onChangeHandler(value, 'select4')} />
@evenchange4
evenchange4 / !react-enzyme-render-methods.md
Created February 20, 2017 06:22 — forked from richardscarrott/!react-enzyme-render-methods.md
react-enzyme - `shallow` vs `mount` vs `render` lifecycle methods

An exploration of the different render methods available in react-enzyme.

@evenchange4
evenchange4 / circle.yml
Created August 9, 2017 05:46
Auto deployment to now.sh in CI
machine:
node:
version: 7
deployment:
staging:
branch: master
owner: my-company
commands:
- ./deploy-staging.sh
production:
@evenchange4
evenchange4 / multiple_ssh_setting.md
Created March 29, 2018 02:47 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"