Deploy a Express.js project on Heroku
Step by step from command line by Michael Hsu
$ express myfirstexpress && cd myfirstexpress
#!/usr/bin/env python3 | |
import sys | |
import csv | |
import plistlib | |
import os | |
csv_file = sys.argv[1] | |
with open(csv_file, 'r', encoding='utf-8') as f: | |
result = list(csv.DictReader(f)) |
Step by step from command line by Michael Hsu
$ express myfirstexpress && cd myfirstexpress
Preferences | Appearance | Tabs | Theme > Dark
dstr > ttf
, install all font files by double clicking)Preferences | Profiles | Text
Font
to 14pt Fira code regular
and Check Use Ligatures
checkboxNon ASCII Font
to 14pt Fira mono
and Check Use Ligatures
checkboxPreferences | Profiles | Color Presets > Snazzy
# Compile nginx standalone without root access | |
mkdir ~/installed | |
mkdir ~/installed/nginx | |
mkdir ~/src | |
cd ~/src | |
# PCRE dependency - we'll compile against this statically | |
wget http://kent.dl.sourceforge.net/sourceforge/pcre/pcre-8.42.tar.gz | |
tar -xzvf pcre-8.42.tar.gz |
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "your_email@youremail.com"
machine: | |
node: | |
version: 7 | |
deployment: | |
staging: | |
branch: master | |
owner: my-company | |
commands: | |
- ./deploy-staging.sh | |
production: |
An exploration of the different render methods available in react-enzyme.
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')} /> |
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.
// 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. |