Skip to content

Instantly share code, notes, and snippets.

View chentsulin's full-sized avatar
🕶️
Keep learning

C. T. Lin chentsulin

🕶️
Keep learning
View GitHub Profile
@chentsulin
chentsulin / week-2.md
Last active October 5, 2016 11:30
Week 2 - After class

Week 2

Homework Assignment

繳交方式

  • Deadline: 3/17 中午 12:00
  • 把檔案寄至 chentsulin@gmail.com,標題寫 [作業二/ 電機X XXX] (如果你已經會用 github 也可以寄 repo 連結過來)

1. 寫一個判斷並回傳型別的 function getType

@chentsulin
chentsulin / week-3.md
Last active October 20, 2015 11:57
Week 3 - After class

Week 3

Homework Assignment

Chat Room Application

繳交方式

  • Deadline: 10/22 中午 12:00
  • 把檔案寄至 chentsulin@gmail.com,標題寫 [作業三/ 電機X XXX] (如果你已經會用 github 也可以寄 repo 連結過來)
@chentsulin
chentsulin / week-4.md
Last active October 15, 2015 13:13
Week 4 - After class
@chentsulin
chentsulin / week-4.md
Last active October 15, 2015 11:16
Week 4 課堂練習
client.sendImagemap(userId, 'Re: [問卦] 齊柏林導演的故事給了我們什麼啟示?', {
baseWidth: 1040,
baseHeight: 720,
baseUrl: 'https://our.image.com/server/path',
actions: [
{
type: 'uri',
linkUri: 'https://www.ptt.cc/bbs/Gossiping/M.1497100764.A.C81.html',
area: {
x: 0,
@chentsulin
chentsulin / App.js
Last active November 5, 2018 14:16
hooks-useState
const App = () => {
const [name, setName] = useState('');
const [email, setEmail] = useState('');
const handleNameChange = event => {
setName(event.target.value);
};
const handleEmailChange = event => {
setEmail(event.target.value);
};
@chentsulin
chentsulin / App.js
Created November 5, 2018 14:15
hooks-useContext
const App = () => {
const theme = useContext(ThemeContext);
const locale = useContext(LocaleContext);
return (
<div className={theme}>
{locale}
</div>
);
};
@chentsulin
chentsulin / App.js
Last active November 6, 2018 03:18
renderProps-Context
const App = () => {
return (
<ThemeContext.Consumer>
{theme => (
<LocaleContext.Consumer>
{locale => (
<div className={theme}>
{locale}
</div>
)}
@chentsulin
chentsulin / App.js
Created November 5, 2018 14:34
Lifecycle
class App extends Component {
componentDidMount() {
this.subscribe(this.props.userId);
}
componentDidUpdate(prevProps) {
if (this.props.userId !== prevProps.userId) {
this.unsubscribe(this.props.userId);
this.subscribe(this.props.userId);
}