This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
convert image.png -bordercolor white -border 0 \ | |
\( -clone 0 -resize 16x16 \) \ | |
\( -clone 0 -resize 32x32 \) \ | |
\( -clone 0 -resize 48x48 \) \ | |
\( -clone 0 -resize 64x64 \) \ | |
-delete 0 -alpha off -colors 256 favicon.ico |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import {GoogleMaps, InfoWindow} from 'react-google-maps'; | |
class MapCanvas extends React.Component { | |
constructor(...args) { | |
super(...args); | |
this.state = { | |
zoomLevel: 3, | |
center: new google.maps.LatLng(34.397, 60.644) | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import GoogleMapsInfobox from 'google-maps-infobox'; | |
import SimpleChildComponent from 'react-google-maps/lib/internals/SimpleChildComponent'; | |
import createRegisterEvents from 'react-google-maps/lib/internals/createRegisterEvents'; | |
import exposeGetters from 'react-google-maps/lib/internals/exposeGetters'; | |
const {PropTypes} = React; | |
class InfoBox extends SimpleChildComponent { | |
constructor (...args) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_animateIcon() { | |
const initTime = Date.now(); | |
raf(function tick() { | |
const {icon} = this.state; | |
const diffTime = Date.now() - initTime; | |
const renderTime = diffTime % 4000; | |
const iconSize = (renderTime / 1000) * 10 + 10; | |
// console.log(iconSize); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import MyStore from './MyStore'; | |
class MyComponent extends React.Component { | |
componentDidMount() { | |
MyStore.addChangeListener(this._onChange.bind(this)); | |
} | |
componentWillUnmount() { | |
MyStore.removeChangeListener(this._onChange.bind(this)); // not working |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"parser": "babel-eslint", | |
"env": { | |
"browser": true, | |
"node": true, | |
"jasmine": true | |
}, | |
"plugins": [ | |
"react", | |
"babel" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get users list (array), convert it to object | |
users = users.reduce((res, user) => { | |
res[user.id] = user; | |
return res; | |
}, {}) | |
// which will look like |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
工具 | |
NPM | |
套件管理工具 | |
https://www.npmjs.com/ | |
Webpack | |
前端打包工具,可用來合併、壓縮、優化各種檔案,且提供 live reloding dev server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mergeFuncs = (...funcs) => (...args) => { | |
for (const func of funcs) { | |
if (typeof func === 'function') func(...args); | |
} | |
} | |
const foo = e => console.log('foo', e) | |
const bar = (e, val) => console.log('bar', e, val) | |
const foobar = mergeFuncs(foo, bar) |
OlderNewer