├── homeworks
├── week11
│ ├── hw2
│ │ └── index.html
│ ├── hw3
│ │ └── index.html
│ └── hw1
│ │ ├── bg.jpg
│ │ ├── sign_out.php
│ │ ├── handle_delete.php
│ │ ├── verify.php
│ │ ├── sign_in.php
│ │ ├── handle_update.php
│ │ ├── write.php
│ │ ├── handle_write.php
│ │ ├── register.php
│ │ ├── handle_register.php
│ │ ├── update.php
│ │ └── handle_sign_in.php
├── week12
│ ├── hw2
│ │ └── index.html
│ ├── hw1
│ │ ├── bg.jpg
│ │ ├── sign_out.php
│ │ ├── handle_delete.php
│ │ ├── README.md
│ │ ├── verify.php
│ │ ├── handle_subwrite.php
│ │ ├── sign_in.php
│ │ ├── handle_update.php
│ │ ├── write.php
│ │ ├── register.php
│ │ ├── handle_register.php
│ │ ├── handle_write.php
│ │ ├── update.php
│ │ └── handle_sign_in.php
│ └── README.md
├── week18
│ ├── hw1
│ │ ├── index.html
│ │ ├── css
│ │ │ └── test.css
│ │ ├── dist
│ │ │ ├── css
│ │ │ │ └── test.css
│ │ │ └── js
│ │ │ │ ├── test-min.js
│ │ │ │ └── test.js
│ │ ├── lib
│ │ │ └── test.js
│ │ ├── sass
│ │ │ └── test.scss
│ │ └── gulpfile.js
│ ├── hw2
│ │ ├── src
│ │ │ ├── index.js
│ │ │ └── utils.js
│ │ ├── index.html
│ │ ├── webpack.config.js
│ │ └── dist
│ │ │ └── index.bundle.js
│ ├── hwS1
│ │ ├── src
│ │ │ ├── utils.js
│ │ │ ├── index.js
│ │ │ └── test.scss
│ │ ├── index.html
│ │ └── webpack.config.js
│ └── hw3
│ │ └── dist
│ │ ├── style.css
│ │ └── main.js
├── week21
│ ├── be
│ │ ├── hw1
│ │ │ └── index.html
│ │ └── README.md
│ └── fe
│ │ ├── hw1
│ │ ├── .babelrc
│ │ ├── src
│ │ │ ├── img
│ │ │ │ ├── 1.jpg
│ │ │ │ ├── bg.gif
│ │ │ │ └── bg.jpg
│ │ │ └── index.js
│ │ ├── dist
│ │ │ ├── 7c8b4c34d4076c1d71f09080fb713ccb.gif
│ │ │ └── index.html
│ │ ├── index.html
│ │ ├── README.MD
│ │ ├── package.json
│ │ └── webpack.config.js
│ │ ├── hw2
│ │ ├── .babelrc
│ │ ├── src
│ │ │ └── index.js
│ │ ├── index.html
│ │ ├── dist
│ │ │ └── index.html
│ │ ├── package.json
│ │ └── webpack.config.js
│ │ ├── hw3
│ │ ├── .babelrc
│ │ ├── src
│ │ │ ├── img
│ │ │ │ ├── 1.jpg
│ │ │ │ ├── 2.jpg
│ │ │ │ ├── 3.jpg
│ │ │ │ ├── 4.jpg
│ │ │ │ ├── 5.jpg
│ │ │ │ ├── 6.jpg
│ │ │ │ ├── 7.jpg
│ │ │ │ ├── 8.jpg
│ │ │ │ ├── 9.jpg
│ │ │ │ └── bg.jpg
│ │ │ └── index.js
│ │ ├── dist
│ │ │ ├── 54e40ca1322beb42e001bce85f2e9058.jpg
│ │ │ └── index.html
│ │ ├── index.html
│ │ ├── package.json
│ │ └── webpack.config.js
│ │ ├── blog.png
│ │ └── README.md
├── week22
│ ├── be
│ │ ├── hw1
│ │ │ └── index.html
│ │ ├── hw2
│ │ │ └── index.html
│ │ ├── hw3.md
│ │ └── README.md
│ └── fe
│ │ ├── hw1
│ │ ├── src
│ │ │ ├── nav
│ │ │ │ ├── index.js
│ │ │ │ └── Nav.js
│ │ │ ├── home
│ │ │ │ └── index.js
│ │ │ ├── post
│ │ │ │ ├── index.js
│ │ │ │ └── Post.js
│ │ │ ├── about
│ │ │ │ ├── index.js
│ │ │ │ └── About.js
│ │ │ ├── write
│ │ │ │ └── index.js
│ │ │ ├── post_list
│ │ │ │ └── index.js
│ │ │ ├── img
│ │ │ │ └── bg.jpg
│ │ │ ├── scss
│ │ │ │ ├── _variable.scss
│ │ │ │ └── _mixin.scss
│ │ │ ├── App.test.js
│ │ │ ├── index.js
│ │ │ ├── index.scss
│ │ │ └── App.js
│ │ ├── build
│ │ │ ├── robots.txt
│ │ │ ├── favicon.ico
│ │ │ ├── logo192.png
│ │ │ ├── logo512.png
│ │ │ ├── static
│ │ │ │ ├── media
│ │ │ │ │ └── bg.54e40ca1.jpg
│ │ │ │ └── js
│ │ │ │ │ └── runtime-main.04a13e19.js
│ │ │ ├── manifest.json
│ │ │ ├── precache-manifest.0d8b7f79fb8c158922a01fa8b498579c.js
│ │ │ ├── asset-manifest.json
│ │ │ └── service-worker.js
│ │ ├── public
│ │ │ ├── robots.txt
│ │ │ ├── favicon.ico
│ │ │ ├── logo192.png
│ │ │ ├── logo512.png
│ │ │ └── manifest.json
│ │ ├── .gitignore.swp
│ │ ├── .gitignore
│ │ └── package.json
│ │ └── README.md
├── week23
│ ├── be
│ │ ├── hw1
│ │ │ └── index.html
│ │ ├── hw2.md
│ │ └── README.md
│ └── fe
│ │ ├── hw1
│ │ └── src
│ │ │ ├── components
│ │ │ ├── home
│ │ │ │ └── index.js
│ │ │ ├── nav
│ │ │ │ └── index.js
│ │ │ ├── post
│ │ │ │ └── index.js
│ │ │ ├── about
│ │ │ │ ├── index.js
│ │ │ │ └── About.js
│ │ │ ├── write
│ │ │ │ └── index.js
│ │ │ └── post_list
│ │ │ │ ├── index.js
│ │ │ │ └── PostList.js
│ │ │ ├── img
│ │ │ └── bg.jpg
│ │ │ ├── scss
│ │ │ ├── _variable.scss
│ │ │ └── _mixin.scss
│ │ │ ├── reducers
│ │ │ ├── index.js
│ │ │ ├── getPostsReducer.js
│ │ │ └── getWeatherReducer.js
│ │ │ ├── index.js
│ │ │ ├── actionsTypes.js
│ │ │ ├── WebAPI.js
│ │ │ ├── containers
│ │ │ ├── PostListContainer.js
│ │ │ └── HomeContainer.js
│ │ │ ├── actions.js
│ │ │ ├── CodeBlock.js
│ │ │ └── App.js
│ │ ├── 01.jpg
│ │ ├── 02.jpg
│ │ └── README.md
├── week24
│ ├── be
│ │ ├── hw2.md
│ │ └── README.md
│ └── fe
│ │ ├── hw1
│ │ └── src
│ │ │ ├── components
│ │ │ ├── home
│ │ │ │ └── index.js
│ │ │ ├── nav
│ │ │ │ └── index.js
│ │ │ ├── post
│ │ │ │ └── index.js
│ │ │ ├── about
│ │ │ │ ├── index.js
│ │ │ │ └── About.js
│ │ │ ├── write
│ │ │ │ └── index.js
│ │ │ └── post_list
│ │ │ │ ├── index.js
│ │ │ │ └── PostList.js
│ │ │ ├── img
│ │ │ ├── bg.jpg
│ │ │ └── bg2.jpg
│ │ │ ├── scss
│ │ │ ├── _mixin.scss
│ │ │ └── _variable.scss
│ │ │ ├── ScrollToTop.js
│ │ │ ├── actionsTypes.js
│ │ │ ├── reducers
│ │ │ ├── index.js
│ │ │ ├── getWeatherReducer.js
│ │ │ └── getPostsReducer.js
│ │ │ ├── containers
│ │ │ ├── NavContainer.js
│ │ │ ├── WriteContainer.js
│ │ │ ├── HomeContainer.js
│ │ │ ├── PostListContainer.js
│ │ │ └── PostContainer.js
│ │ │ ├── index.js
│ │ │ ├── CodeBlock.js
│ │ │ ├── App.js
│ │ │ └── actions.js
│ │ ├── README.md
│ │ └── hw2.md
├── week14
│ ├── hw1.jpg
│ ├── gcp
│ │ ├── 0.jpg
│ │ ├── 1.jpg
│ │ ├── 10.jpg
│ │ ├── 11.jpg
│ │ ├── 12.jpg
│ │ ├── 13.jpg
│ │ ├── 14.jpg
│ │ ├── 15.jpg
│ │ ├── 16.jpg
│ │ ├── 17.jpg
│ │ ├── 18.jpg
│ │ ├── 19.jpg
│ │ ├── 2.jpg
│ │ ├── 20.jpg
│ │ ├── 21.jpg
│ │ ├── 22.jpg
│ │ ├── 23.jpg
│ │ ├── 24.jpg
│ │ ├── 25.jpg
│ │ ├── 27.jpg
│ │ ├── 28.jpg
│ │ ├── 29.jpg
│ │ ├── 3.jpg
│ │ ├── 30.jpg
│ │ ├── 31.jpg
│ │ ├── 32.jpg
│ │ ├── 33.jpg
│ │ ├── 34.jpg
│ │ ├── 35.jpg
│ │ ├── 36.jpg
│ │ ├── 37.jpg
│ │ ├── 4.jpg
│ │ ├── 5.jpg
│ │ ├── 6.jpg
│ │ ├── 7.jpg
│ │ ├── 8.jpg
│ │ ├── 9.jpg
│ │ ├── 12-2.jpg
│ │ └── ajaxMistake.jpg
│ ├── hw1.md
│ └── README.md
├── week16
│ ├── mdn.jpg
│ ├── test1.jpg
│ ├── test2.jpg
│ ├── hw1
│ │ └── week7
│ │ │ └── hw3
│ │ │ ├── _variable.scss
│ │ │ └── _mixin.scss
│ ├── hw2
│ │ └── main.js
│ └── README.md
├── week6
│ ├── hw3.png
│ ├── hw4.png
│ ├── example.png
│ ├── example2.png
│ ├── hw2
│ │ ├── clap.jpg
│ │ └── style.css
│ └── README.md
├── week7
│ ├── DOM.jpg
│ ├── acco.gif
│ ├── form.png
│ ├── hw2
│ │ └── bg1.jpg
│ ├── twitch.png
│ ├── carousel.gif
│ ├── reaction.gif
│ ├── calculator.png
│ ├── hw1
│ │ ├── index.html
│ │ ├── style.css
│ │ └── index.js
│ └── test.html
├── week9
│ ├── tree.png
│ ├── board.png
│ ├── board2.png
│ ├── board3.png
│ ├── hw2
│ │ ├── handle_loginout.php
│ │ ├── handle_identify.php
│ │ ├── handle_article.php
│ │ ├── handle_signin.php
│ │ ├── member_login.php
│ │ ├── message_board.php
│ │ ├── member_create.php
│ │ ├── handle_register_form.php
│ │ ├── index.php
│ │ └── style.css
│ ├── hw1.md
│ └── hw4.md
├── week13
│ ├── 960s.png
│ ├── hw3
│ │ ├── bg.jpg
│ │ ├── handling
│ │ │ ├── sign_out.php
│ │ │ ├── verify.php
│ │ │ ├── handle_delete.php
│ │ │ ├── handle_subwrite.php
│ │ │ ├── handle_update.php
│ │ │ ├── handle_write.php
│ │ │ ├── board_comments_sub1.php
│ │ │ ├── board_comments.php
│ │ │ ├── handle_register.php
│ │ │ └── handle_sign_in.php
│ │ ├── README.md
│ │ ├── sign_in.php
│ │ ├── register.php
│ │ └── update.php
│ ├── todo.png
│ ├── hw2
│ │ └── style.css
│ ├── hw1
│ │ ├── index.html
│ │ └── style.css
│ └── README.md
├── week20
│ ├── img
│ │ ├── 1.jpg
│ │ └── 6.jpg
│ └── README.md
├── week8
│ ├── hw1
│ │ ├── pz1.jpg
│ │ ├── pz2.jpg
│ │ ├── pz3.jpg
│ │ ├── pz_n.jpg
│ │ └── index.html
│ ├── hw2
│ │ ├── mom.jpg
│ │ └── index.html
│ ├── hw3
│ │ ├── bg.jpg
│ │ ├── bg1.jpg
│ │ ├── index.html
│ │ └── main.css
│ ├── twitch.png
│ └── twitch_amelie.png
├── week15
│ └── README.md
├── week2
│ ├── hw4.js
│ ├── hw1.js
│ ├── hw3.js
│ ├── hw2.js
│ ├── hw5.js
│ ├── hwS1.js
│ └── hw6.md
├── week10
│ └── README.md
├── week4
│ ├── hw1.js
│ ├── hw4.js
│ ├── hw2.js
│ ├── hwS1.js
│ ├── hw3.js
│ └── hwS2.js
├── week3
│ ├── hw3.js
│ ├── hw4.js
│ ├── hw1.js
│ ├── hw1.test.js
│ ├── hw2.js
│ ├── hw2.test.js
│ ├── hw4.test.js
│ ├── hw3.test.js
│ └── README.md
├── week19
│ ├── hw2
│ │ ├── src
│ │ │ ├── _variable.scss
│ │ │ └── _mixin.scss
│ │ └── index.html
│ ├── hw1
│ │ └── models
│ │ │ └── todo_API.php
│ └── README.md
├── week5
│ └── README.md
└── week1
│ ├── hw1.md
│ ├── hw3.md
│ └── hw5.md
├── .gitignore
├── .babelrc
├── examples
├── README.md
├── week4
│ └── package.json
├── week14
│ └── README.md
├── week22
│ └── README.md
├── week23
│ └── README.md
├── week16
│ └── README.md
├── week17
│ └── README.md
├── week9
│ └── README.md
├── week21
│ └── README.md
├── week18
│ └── README.md
├── week2
│ └── README.md
└── week7
│ └── hw1.html
└── .eslintrc.js
/homeworks/week11/hw2/index.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/homeworks/week11/hw3/index.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/homeworks/week12/hw2/index.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/homeworks/week18/hw1/index.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/homeworks/week21/be/hw1/index.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/homeworks/week22/be/hw1/index.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/homeworks/week22/be/hw2/index.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/homeworks/week23/be/hw1/index.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | conn.php
3 | .DS_STORE
--------------------------------------------------------------------------------
/homeworks/week22/be/hw3.md:
--------------------------------------------------------------------------------
1 | ## 什麼是 MVC?
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 |
3 | "presets": ["@babel/preset-env"]
4 |
5 | }
--------------------------------------------------------------------------------
/homeworks/week24/be/hw2.md:
--------------------------------------------------------------------------------
1 | ## 什麼是反向代理(Reverse proxy)?
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/homeworks/week23/be/hw2.md:
--------------------------------------------------------------------------------
1 | ## 什麼是 ORM?
2 |
3 |
4 | ## 什麼是 N+1 problem
5 |
6 |
7 |
--------------------------------------------------------------------------------
/homeworks/week18/hw2/src/index.js:
--------------------------------------------------------------------------------
1 | const add = require('./utils');
2 |
3 | add(10, 3);
4 |
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/src/nav/index.js:
--------------------------------------------------------------------------------
1 | import Nav from './Nav';
2 |
3 | export default Nav;
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/src/home/index.js:
--------------------------------------------------------------------------------
1 | import Home from './Home';
2 |
3 | export default Home;
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/src/post/index.js:
--------------------------------------------------------------------------------
1 | import Post from './Post';
2 |
3 | export default Post;
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/src/about/index.js:
--------------------------------------------------------------------------------
1 | import About from './About';
2 |
3 | export default About;
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/src/write/index.js:
--------------------------------------------------------------------------------
1 | import Write from './Write';
2 |
3 | export default Write;
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw1/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["@babel/preset-env", "@babel/preset-react"]
3 | }
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw2/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["@babel/preset-env", "@babel/preset-react"]
3 | }
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw3/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["@babel/preset-env", "@babel/preset-react"]
3 | }
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/build/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/homeworks/week23/fe/hw1/src/components/home/index.js:
--------------------------------------------------------------------------------
1 | import Home from './Home';
2 |
3 | export default Home;
--------------------------------------------------------------------------------
/homeworks/week23/fe/hw1/src/components/nav/index.js:
--------------------------------------------------------------------------------
1 | import Nav from './Nav';
2 |
3 | export default Nav;
--------------------------------------------------------------------------------
/homeworks/week23/fe/hw1/src/components/post/index.js:
--------------------------------------------------------------------------------
1 | import Post from './Post';
2 |
3 | export default Post;
--------------------------------------------------------------------------------
/homeworks/week24/fe/hw1/src/components/home/index.js:
--------------------------------------------------------------------------------
1 | import Home from './Home';
2 |
3 | export default Home;
--------------------------------------------------------------------------------
/homeworks/week24/fe/hw1/src/components/nav/index.js:
--------------------------------------------------------------------------------
1 | import Nav from './Nav';
2 |
3 | export default Nav;
--------------------------------------------------------------------------------
/homeworks/week24/fe/hw1/src/components/post/index.js:
--------------------------------------------------------------------------------
1 | import Post from './Post';
2 |
3 | export default Post;
--------------------------------------------------------------------------------
/homeworks/week23/fe/hw1/src/components/about/index.js:
--------------------------------------------------------------------------------
1 | import About from './About';
2 |
3 | export default About;
--------------------------------------------------------------------------------
/homeworks/week23/fe/hw1/src/components/write/index.js:
--------------------------------------------------------------------------------
1 | import Write from './Write';
2 |
3 | export default Write;
--------------------------------------------------------------------------------
/homeworks/week24/fe/hw1/src/components/about/index.js:
--------------------------------------------------------------------------------
1 | import About from './About';
2 |
3 | export default About;
--------------------------------------------------------------------------------
/homeworks/week24/fe/hw1/src/components/write/index.js:
--------------------------------------------------------------------------------
1 | import Write from './Write';
2 |
3 | export default Write;
--------------------------------------------------------------------------------
/homeworks/week14/hw1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/hw1.jpg
--------------------------------------------------------------------------------
/homeworks/week16/mdn.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week16/mdn.jpg
--------------------------------------------------------------------------------
/homeworks/week18/hw1/css/test.css:
--------------------------------------------------------------------------------
1 | .app{background-color:red}.app2{background-color:red}.app3{background-color:red}
2 |
--------------------------------------------------------------------------------
/homeworks/week18/hwS1/src/utils.js:
--------------------------------------------------------------------------------
1 | const arr = ['God', 'Tiger', 'Fox'];
2 |
3 | arr.map(obj => console.log(obj));
4 |
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/src/post_list/index.js:
--------------------------------------------------------------------------------
1 | import PostList from './PostList';
2 |
3 | export default PostList;
--------------------------------------------------------------------------------
/homeworks/week6/hw3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week6/hw3.png
--------------------------------------------------------------------------------
/homeworks/week6/hw4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week6/hw4.png
--------------------------------------------------------------------------------
/homeworks/week7/DOM.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week7/DOM.jpg
--------------------------------------------------------------------------------
/homeworks/week7/acco.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week7/acco.gif
--------------------------------------------------------------------------------
/homeworks/week7/form.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week7/form.png
--------------------------------------------------------------------------------
/homeworks/week9/tree.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week9/tree.png
--------------------------------------------------------------------------------
/homeworks/week11/hw1/bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week11/hw1/bg.jpg
--------------------------------------------------------------------------------
/homeworks/week12/hw1/bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week12/hw1/bg.jpg
--------------------------------------------------------------------------------
/homeworks/week13/960s.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week13/960s.png
--------------------------------------------------------------------------------
/homeworks/week13/hw3/bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week13/hw3/bg.jpg
--------------------------------------------------------------------------------
/homeworks/week13/todo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week13/todo.png
--------------------------------------------------------------------------------
/homeworks/week14/gcp/0.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/0.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/1.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/10.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/10.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/11.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/11.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/12.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/12.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/13.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/13.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/14.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/14.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/15.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/15.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/16.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/16.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/17.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/17.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/18.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/18.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/19.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/19.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/2.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/20.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/20.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/21.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/21.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/22.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/22.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/23.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/23.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/24.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/24.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/25.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/25.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/27.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/27.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/28.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/28.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/29.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/29.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/3.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/30.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/30.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/31.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/31.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/32.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/32.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/33.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/33.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/34.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/34.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/35.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/35.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/36.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/36.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/37.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/37.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/4.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/5.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/6.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/7.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/7.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/8.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/8.jpg
--------------------------------------------------------------------------------
/homeworks/week14/gcp/9.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/9.jpg
--------------------------------------------------------------------------------
/homeworks/week16/test1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week16/test1.jpg
--------------------------------------------------------------------------------
/homeworks/week16/test2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week16/test2.jpg
--------------------------------------------------------------------------------
/homeworks/week18/hw1/dist/css/test.css:
--------------------------------------------------------------------------------
1 | .app{background-color:red}.app2{background-color:red}.app3{background-color:red}
2 |
--------------------------------------------------------------------------------
/homeworks/week18/hw2/src/utils.js:
--------------------------------------------------------------------------------
1 | function add(a, b) {
2 | console.log(a, b);
3 | }
4 |
5 | module.exports = add;
6 |
--------------------------------------------------------------------------------
/homeworks/week20/img/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week20/img/1.jpg
--------------------------------------------------------------------------------
/homeworks/week20/img/6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week20/img/6.jpg
--------------------------------------------------------------------------------
/homeworks/week23/fe/01.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week23/fe/01.jpg
--------------------------------------------------------------------------------
/homeworks/week23/fe/02.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week23/fe/02.jpg
--------------------------------------------------------------------------------
/homeworks/week6/example.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week6/example.png
--------------------------------------------------------------------------------
/homeworks/week7/hw2/bg1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week7/hw2/bg1.jpg
--------------------------------------------------------------------------------
/homeworks/week7/twitch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week7/twitch.png
--------------------------------------------------------------------------------
/homeworks/week8/hw1/pz1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week8/hw1/pz1.jpg
--------------------------------------------------------------------------------
/homeworks/week8/hw1/pz2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week8/hw1/pz2.jpg
--------------------------------------------------------------------------------
/homeworks/week8/hw1/pz3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week8/hw1/pz3.jpg
--------------------------------------------------------------------------------
/homeworks/week8/hw2/mom.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week8/hw2/mom.jpg
--------------------------------------------------------------------------------
/homeworks/week8/hw3/bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week8/hw3/bg.jpg
--------------------------------------------------------------------------------
/homeworks/week8/hw3/bg1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week8/hw3/bg1.jpg
--------------------------------------------------------------------------------
/homeworks/week8/twitch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week8/twitch.png
--------------------------------------------------------------------------------
/homeworks/week9/board.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week9/board.png
--------------------------------------------------------------------------------
/homeworks/week9/board2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week9/board2.png
--------------------------------------------------------------------------------
/homeworks/week9/board3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week9/board3.png
--------------------------------------------------------------------------------
/homeworks/week14/gcp/12-2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/12-2.jpg
--------------------------------------------------------------------------------
/homeworks/week21/fe/blog.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week21/fe/blog.png
--------------------------------------------------------------------------------
/homeworks/week23/fe/hw1/src/components/post_list/index.js:
--------------------------------------------------------------------------------
1 | import PostList from './PostList';
2 |
3 | export default PostList;
--------------------------------------------------------------------------------
/homeworks/week24/fe/hw1/src/components/post_list/index.js:
--------------------------------------------------------------------------------
1 | import PostList from './PostList';
2 |
3 | export default PostList;
--------------------------------------------------------------------------------
/homeworks/week6/example2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week6/example2.png
--------------------------------------------------------------------------------
/homeworks/week6/hw2/clap.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week6/hw2/clap.jpg
--------------------------------------------------------------------------------
/homeworks/week7/carousel.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week7/carousel.gif
--------------------------------------------------------------------------------
/homeworks/week7/reaction.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week7/reaction.gif
--------------------------------------------------------------------------------
/homeworks/week8/hw1/pz_n.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week8/hw1/pz_n.jpg
--------------------------------------------------------------------------------
/homeworks/week7/calculator.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week7/calculator.png
--------------------------------------------------------------------------------
/homeworks/week8/twitch_amelie.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week8/twitch_amelie.png
--------------------------------------------------------------------------------
/homeworks/week14/gcp/ajaxMistake.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week14/gcp/ajaxMistake.jpg
--------------------------------------------------------------------------------
/homeworks/week18/hw1/lib/test.js:
--------------------------------------------------------------------------------
1 | const getText = () => 'JavaScript ES6';
2 |
3 | document.getElementById('text').innerHTML = getText();
4 |
--------------------------------------------------------------------------------
/homeworks/week20/README.md:
--------------------------------------------------------------------------------
1 | # 作業
2 |
3 | ## hw1:十六到二十週心得
4 |
5 | 這週複習了不少東西,而且幫網頁優化應該會有一些心得感想,可以稍微寫下來紀錄一下。
6 |
7 | 請將答案寫在 [hw1.md](hw1.md)。
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw1/src/img/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week21/fe/hw1/src/img/1.jpg
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw3/src/img/1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week21/fe/hw3/src/img/1.jpg
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw3/src/img/2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week21/fe/hw3/src/img/2.jpg
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw3/src/img/3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week21/fe/hw3/src/img/3.jpg
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw3/src/img/4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week21/fe/hw3/src/img/4.jpg
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw3/src/img/5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week21/fe/hw3/src/img/5.jpg
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw3/src/img/6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week21/fe/hw3/src/img/6.jpg
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw3/src/img/7.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week21/fe/hw3/src/img/7.jpg
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw3/src/img/8.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week21/fe/hw3/src/img/8.jpg
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw3/src/img/9.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week21/fe/hw3/src/img/9.jpg
--------------------------------------------------------------------------------
/homeworks/week9/hw2/handle_loginout.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw1/src/img/bg.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week21/fe/hw1/src/img/bg.gif
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw1/src/img/bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week21/fe/hw1/src/img/bg.jpg
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw3/src/img/bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week21/fe/hw3/src/img/bg.jpg
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/.gitignore.swp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week22/fe/hw1/.gitignore.swp
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/src/img/bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week22/fe/hw1/src/img/bg.jpg
--------------------------------------------------------------------------------
/homeworks/week23/fe/hw1/src/img/bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week23/fe/hw1/src/img/bg.jpg
--------------------------------------------------------------------------------
/homeworks/week24/fe/hw1/src/img/bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week24/fe/hw1/src/img/bg.jpg
--------------------------------------------------------------------------------
/homeworks/week24/fe/hw1/src/img/bg2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week24/fe/hw1/src/img/bg2.jpg
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/build/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week22/fe/hw1/build/favicon.ico
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/build/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week22/fe/hw1/build/logo192.png
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/build/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week22/fe/hw1/build/logo512.png
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week22/fe/hw1/public/favicon.ico
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week22/fe/hw1/public/logo192.png
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week22/fe/hw1/public/logo512.png
--------------------------------------------------------------------------------
/homeworks/week18/hw1/dist/js/test-min.js:
--------------------------------------------------------------------------------
1 |
2 | const getText = function () { return 'JavaScript ES6'; }; document.getElementById('text').innerHTML = getText();
3 |
--------------------------------------------------------------------------------
/examples/README.md:
--------------------------------------------------------------------------------
1 | # 注意事項
2 |
3 | 這個資料夾底下是每一週的參考解答,或比起參考解答,更精確地說法是:「我的解答」。
4 |
5 | 在交作業前請勿觀看,以免破壞學習樂趣。參考解答主要是給想要更精進的同學看的,若你只是題目解不出來,建議先參考同學的程式碼,他的程度會跟你的比較相近。
6 |
7 |
--------------------------------------------------------------------------------
/homeworks/week18/hwS1/src/index.js:
--------------------------------------------------------------------------------
1 | require('./test.scss');
2 |
3 |
4 | const arr = ['Huli', 'Clay', 'Cindy', 'Melody'];
5 |
6 | arr.map(obj => console.log(obj));
7 |
--------------------------------------------------------------------------------
/homeworks/week24/be/README.md:
--------------------------------------------------------------------------------
1 | # 作業
2 |
3 | ## hw1:部署
4 |
5 | 請把之前寫的 Express 專案部署到自己的主機上。
6 |
7 | ## hw2:簡答題
8 |
9 | 1. 什麼是反向代理(Reverse proxy)?
10 |
11 |
--------------------------------------------------------------------------------
/homeworks/week15/README.md:
--------------------------------------------------------------------------------
1 | # 作業
2 |
3 | ## hw1:十一到十五週心得
4 |
5 | 第三次的複習週東西變得比以往還多,需要一些時間好好消化這些資訊。若是有什麼心得的話,都歡迎寫下來。覺得複習已經夠累了,懶得寫心得的話也沒關係。
6 |
7 | 請將答案寫在 [hw1.md](hw1.md)。
8 |
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/build/static/media/bg.54e40ca1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week22/fe/hw1/build/static/media/bg.54e40ca1.jpg
--------------------------------------------------------------------------------
/homeworks/week18/hw1/dist/js/test.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | const getText = function getText() {
4 | return 'JavaScript ES6';
5 | };
6 |
7 | document.getElementById('text').innerHTML = getText();
8 |
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw1/dist/7c8b4c34d4076c1d71f09080fb713ccb.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week21/fe/hw1/dist/7c8b4c34d4076c1d71f09080fb713ccb.gif
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw3/dist/54e40ca1322beb42e001bce85f2e9058.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lidemy/mentor-program-3rd-ClayGao/HEAD/homeworks/week21/fe/hw3/dist/54e40ca1322beb42e001bce85f2e9058.jpg
--------------------------------------------------------------------------------
/homeworks/week16/hw1/week7/hw3/_variable.scss:
--------------------------------------------------------------------------------
1 | $bg-color : rgb(248, 192, 87);
2 | $main-color : pink;
3 | $btn-color : rgb(170, 231, 231);
4 | $btn-font-color : rgb(158, 25, 65);
5 | $btn-font-family : moonspace;
--------------------------------------------------------------------------------
/homeworks/week2/hw4.js:
--------------------------------------------------------------------------------
1 | function printFactor(n) {
2 | for (let i = 1; i <= n; i += 1) {
3 | if (n % i === 0) {
4 | console.log(i);
5 | }
6 | }
7 | return n;
8 | }
9 | printFactor(44643);
10 |
--------------------------------------------------------------------------------
/homeworks/week18/hw2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ...
5 |
6 |
7 | ...
8 |
9 |
10 |
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw1/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import ReactDOM from 'react-dom'
3 | import App from './App'
4 |
5 | // 當我執行並 render 時,選取到 id = root 的 DOM
6 | ReactDOM.render(, document.getElementById('root'))
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw2/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import ReactDOM from 'react-dom'
3 | import App from './App'
4 |
5 | // 當我執行並 render 時,選取到 id = root 的 DOM
6 | ReactDOM.render(, document.getElementById('root'))
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw3/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import ReactDOM from 'react-dom'
3 | import App from './App'
4 |
5 | // 當我執行並 render 時,選取到 id = root 的 DOM
6 | ReactDOM.render(, document.getElementById('root'))
--------------------------------------------------------------------------------
/homeworks/week18/hw1/sass/test.scss:
--------------------------------------------------------------------------------
1 | $bg-color : red;
2 |
3 | .app {
4 | background-color: $bg-color;
5 | }
6 |
7 | .app2 {
8 | background-color: $bg-color;
9 | }
10 |
11 | .app3 {
12 | background-color: $bg-color;
13 | }
--------------------------------------------------------------------------------
/homeworks/week18/hwS1/src/test.scss:
--------------------------------------------------------------------------------
1 | $bg-color : red;
2 |
3 | .app1 {
4 | background-color: $bg-color;
5 | }
6 |
7 | .app2 {
8 | background-color: $bg-color;
9 | }
10 |
11 | .app3 {
12 | background-color: $bg-color;
13 | }
--------------------------------------------------------------------------------
/homeworks/week13/hw3/handling/sign_out.php:
--------------------------------------------------------------------------------
1 | alert('已成功登出 !');parent.location.href='../index.php';";
6 | ?>
--------------------------------------------------------------------------------
/homeworks/week2/hw1.js:
--------------------------------------------------------------------------------
1 | function printStars(n) {
2 | if (n >= 1 && n <= 30) {
3 | for (let i = 0; i < n; i += 1) {
4 | console.log('*');
5 | }
6 | } else {
7 | console.log('必須至少是 1 且不得超過 30 的正整數');
8 | }
9 | }
10 | printStars(9);
11 |
--------------------------------------------------------------------------------
/homeworks/week11/hw1/sign_out.php:
--------------------------------------------------------------------------------
1 | alert('已成功登出 !');parent.location.href='./index.php';";
6 | ?>
--------------------------------------------------------------------------------
/homeworks/week10/README.md:
--------------------------------------------------------------------------------
1 | # 作業
2 |
3 | ## hw1:六到十週心得與解題心得
4 |
5 | 第二次的複習週終於來了,在這週裡面可以好好整理一下自己前面幾週學到的東西,因此這一週不會有什麼新的進度。
6 |
7 | 這次的作業希望大家整理一下前面幾週的心得,畢竟我們終於開始進入到網頁前後端的領域了,應該會有滿多心得可以寫。
8 |
9 | 而複習週的慣例就是會提供闖關遊戲讓大家玩,也可以一併把心得寫下來
10 |
11 | 請將答案寫在 [hw1.md](hw1.md)。
12 |
--------------------------------------------------------------------------------
/homeworks/week18/hw2/webpack.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 |
3 | module.exports = {
4 | entry: './src/index.js', // 引入的檔案
5 | output: {
6 | path: path.resolve(__dirname, 'dist'), // 輸出的位置
7 | filename: 'index.bundle.js', // * html 要引入的檔案
8 | },
9 | };
10 |
--------------------------------------------------------------------------------
/homeworks/week2/hw3.js:
--------------------------------------------------------------------------------
1 | function reverse(str) {
2 | const strArray = str.split('');
3 | const n = strArray.length - 1;
4 | let newStr = '';
5 | for (let i = n; i >= 0; i -= 1) {
6 | newStr += strArray[i];
7 | }
8 | console.log(newStr);
9 | }
10 | reverse('ClAy');
11 |
--------------------------------------------------------------------------------
/homeworks/week13/hw3/handling/verify.php:
--------------------------------------------------------------------------------
1 | 1, 'currect_user' => $_SESSION['nickname']); // 返還當前使用者名稱
5 | } else {
6 | $arr = array( 'islogin' => 0);
7 | }
8 | echo json_encode($arr);
9 | ?>
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Gobang
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/src/scss/_variable.scss:
--------------------------------------------------------------------------------
1 | $board-bg-color:rgba(110, 105, 105, 0.35);
2 | $border-color: wheat;
3 | $main-color: rgb(0, 116, 189);
4 | $sub-color: rgb(235, 165, 0);
5 | $post-hover-color :rgb(236, 185, 65);
6 | $font-color: white;
7 | $main-bg-img: url('../img/bg.jpg') center center fixed no-repeat;
--------------------------------------------------------------------------------
/homeworks/week23/fe/hw1/src/scss/_variable.scss:
--------------------------------------------------------------------------------
1 | $board-bg-color:rgba(110, 105, 105, 0.35);
2 | $border-color: wheat;
3 | $main-color: rgb(0, 116, 189);
4 | $sub-color: rgb(235, 165, 0);
5 | $post-hover-color :rgb(236, 185, 65);
6 | $font-color: white;
7 | $main-bg-img: url('../img/bg.jpg') center center fixed no-repeat;
--------------------------------------------------------------------------------
/homeworks/week11/hw1/handle_delete.php:
--------------------------------------------------------------------------------
1 | query($spl);
6 | if ($result) {
7 | echo "";
8 | }
9 | ?>
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/src/scss/_mixin.scss:
--------------------------------------------------------------------------------
1 |
2 | @mixin size($height, $width) {
3 | height: $height;
4 | width: $width;
5 | }
6 |
7 | @mixin font($size, $color, $weight, $family) {
8 | font-size: $size;
9 | color: $color;
10 | font-weight: $weight;
11 | font-family: $family;
12 | }
13 |
14 |
--------------------------------------------------------------------------------
/homeworks/week23/fe/hw1/src/scss/_mixin.scss:
--------------------------------------------------------------------------------
1 |
2 | @mixin size($height, $width) {
3 | height: $height;
4 | width: $width;
5 | }
6 |
7 | @mixin font($size, $color, $weight, $family) {
8 | font-size: $size;
9 | color: $color;
10 | font-weight: $weight;
11 | font-family: $family;
12 | }
13 |
14 |
--------------------------------------------------------------------------------
/homeworks/week24/fe/hw1/src/scss/_mixin.scss:
--------------------------------------------------------------------------------
1 |
2 | @mixin size($height, $width) {
3 | height: $height;
4 | width: $width;
5 | }
6 |
7 | @mixin font($size, $color, $weight, $family) {
8 | font-size: $size;
9 | color: $color;
10 | font-weight: $weight;
11 | font-family: $family;
12 | }
13 |
14 |
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Todo-list
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/src/App.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import App from './App';
4 |
5 | it('renders without crashing', () => {
6 | const div = document.createElement('div');
7 | ReactDOM.render(, div);
8 | ReactDOM.unmountComponentAtNode(div);
9 | });
10 |
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.scss';
4 | import App from './App';
5 | import * as serviceWorker from './serviceWorker';
6 |
7 | ReactDOM.render(, document.getElementById('root'));
8 |
9 | serviceWorker.unregister();
10 |
--------------------------------------------------------------------------------
/homeworks/week24/fe/hw1/src/scss/_variable.scss:
--------------------------------------------------------------------------------
1 | $board-bg-color:rgba(110, 105, 105, 0.6);
2 | $border-color: wheat;
3 | $main-color: rgb(0, 116, 189);
4 | $sub-color: rgb(235, 165, 0);
5 | $post-hover-color :rgb(236, 185, 65);
6 | $font-color: rgb(247, 238, 238);
7 | $main-bg-img: url('../img/bg2.jpg') center center fixed no-repeat;
--------------------------------------------------------------------------------
/homeworks/week8/hw3/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/homeworks/week4/hw1.js:
--------------------------------------------------------------------------------
1 | const request = require('request');
2 |
3 |
4 | request('https://lidemy-book-store.herokuapp.com/books?_limit=10', (error, response, body) => {
5 | const obj = JSON.parse(body);
6 | for (let i = 0; i < obj.length; i += 1) {
7 | console.log(`ID : ${obj[i].id} / 書名:${obj[i].name}`);
8 | }
9 | });
10 |
--------------------------------------------------------------------------------
/examples/week4/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "week4",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "twitch.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "dependencies": {
12 | "request": "^2.88.0"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/homeworks/week2/hw2.js:
--------------------------------------------------------------------------------
1 | function capitalize(str) {
2 | let newStr = ''; // 建立一個變數內含字串為空
3 | const strArray = str.split('');
4 | strArray.splice(0, 1, strArray[0].toUpperCase());
5 | for (let i = 0; i < strArray.length; i += 1) {
6 | newStr += strArray[i];
7 | }
8 | return newStr;
9 | }
10 | console.log(capitalize('hi i am clay'));
11 |
--------------------------------------------------------------------------------
/homeworks/week12/hw1/sign_out.php:
--------------------------------------------------------------------------------
1 | alert('已成功登出 !');parent.location.href='./index.php';";
9 | ?>
--------------------------------------------------------------------------------
/homeworks/week13/hw3/handling/handle_delete.php:
--------------------------------------------------------------------------------
1 | prepare("DELETE FROM `claygao_comments` WHERE id = ?");
5 | $stmt->bind_param("i", $id);
6 |
7 | if ($stmt->execute()) {
8 | echo "";
9 | }
10 | ?>
--------------------------------------------------------------------------------
/homeworks/week7/hw1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 | 請點擊螢幕
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/homeworks/week18/hwS1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ...
5 |
6 |
7 |
8 | 123
9 |
10 |
11 | 456
12 |
13 |
14 | 789
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw2/dist/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Gobang
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/homeworks/week3/hw3.js:
--------------------------------------------------------------------------------
1 | function isPrime(n) {
2 | if (n > 1 && n <= 100000) {
3 | for (let i = 2; i <= n; i += 1) { // 2 是最小的質數,所以從 2 開始
4 | if (n % i === 0) {
5 | if (i !== n) return false;
6 | }
7 | }
8 | return true;
9 | } if (n === 1) {
10 | return false;
11 | } return '數字請幫我設在 1 至 100000 之間';
12 | }
13 |
14 |
15 | module.exports = isPrime;
16 |
--------------------------------------------------------------------------------
/homeworks/week3/hw4.js:
--------------------------------------------------------------------------------
1 | function isPalindromes(str) {
2 | let strReverse = '';
3 | if (str.length <= 100) {
4 | for (let i = str.length - 1; i >= 0; i -= 1) {
5 | strReverse += str[i];
6 | }
7 | if (str === strReverse) {
8 | return true;
9 | }
10 | return false;
11 | } return '字串長度需小於 100 個字元';
12 | }
13 |
14 |
15 | module.exports = isPalindromes;
16 |
--------------------------------------------------------------------------------
/examples/week14/README.md:
--------------------------------------------------------------------------------
1 | # 注意事項
2 |
3 | 提示:在寫完作業之後看效果最佳,沒寫作業前請不要看
4 |
5 | ## 部署
6 |
7 | 本週重點就只有這一個而已,但這當然也不是件容易的事。
8 |
9 | 這一期幸運的地方在前一期有學長姐留下的筆記,所以很多時候都跟著做就好。但你要知道那是前人血淚的結晶(?),他們也是部署過很多次,崩潰很多次之後才記起來的。
10 |
11 | 如果你這週是順利的,未來某一天你一樣會經歷這個崩潰的過程。如果你這週本來就很崩潰,放心,以後還有更多讓你崩潰的事。
12 |
13 | 另外,這週最常見的問題就是防火牆的設定,你東西連不進去基本上都是防火牆的問題。防火牆有兩個,一個是你主機上的,一個是你用的雲服務上面的,請確保兩個防火牆都有設定好,應該就沒問題了。
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/homeworks/week3/hw1.js:
--------------------------------------------------------------------------------
1 | function stars(n) {
2 | if (n >= 1 && n <= 30) {
3 | const result = [];
4 | let star = '';
5 | for (let i = 0; i < n; i += 1) {
6 | star = `${star}*`;
7 | result.push(star);
8 | }
9 | console.log(n);
10 | console.log(result);
11 | return result;
12 | } return 'n 的數字僅能在 1 至 30 之間';
13 | }
14 |
15 | module.exports = stars;
16 |
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw1/dist/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Todo-list
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/homeworks/week8/hw1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | 歡迎來到抽獎系統,祝您中獎
4 |
5 |
6 |
7 |
8 |
13 |
14 |
--------------------------------------------------------------------------------
/homeworks/week12/hw1/handle_delete.php:
--------------------------------------------------------------------------------
1 | prepare("DELETE FROM `claygao_comments` WHERE id = ?");
6 | $stmt->bind_param("i", $id);
7 |
8 | if ($stmt->execute()) {
9 | echo "";
10 | }
11 | ?>
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # misc
12 | .DS_Store
13 | .env.local
14 | .env.development.local
15 | .env.test.local
16 | .env.production.local
17 |
18 | npm-debug.log*
19 | yarn-debug.log*
20 | yarn-error.log*
21 |
--------------------------------------------------------------------------------
/homeworks/week19/hw2/src/_variable.scss:
--------------------------------------------------------------------------------
1 | $bg-color: wheat;
2 | $nav-color: gray;
3 | $main-color: none;
4 | $event-title-color: gray;
5 | $event-context-color: rgb(218, 194, 87);
6 | $done-title-color: gray;
7 | $done-context-color:black;
8 | $key-in-btn-color: rgb(20, 218, 142);
9 | $based-padding: 10px 15px;
10 | $heavy-shadow: 0px 8px 7px rgba(0, 0, 0 , 0.7);
11 | $mid-shadow: 0px 8px 7px rgba(0, 0, 0 , 0.3);
12 |
13 |
--------------------------------------------------------------------------------
/homeworks/week12/hw1/README.md:
--------------------------------------------------------------------------------
1 | # 2019 / 6 / 30
2 | - 留言版誕生
3 |
4 | # 2019 / 7 / 7
5 | - 將 cookie 使用 password_hash 改為正規的 SESSION ID 語法 -> OK
6 | - 將留言撈取使用者名字的寫法改掉,不要去撈 cookie 裡面的,要去撈資料庫裏面的 -> OK
7 | - 將輸入留言的功能使用 Javascript 寫入 -> X
8 | - 加入 XSS 防範機制 -> OK
9 | - 加入 SQL injection 防範機制 -> OK
10 | - 將擾人的 alert 改為另一種產出方式 -> X,目前還是一樣擾人
11 |
12 | # 2019 / 7 / 21 預期
13 |
14 | - 2019 / 7 / 7 未完成部分
15 | - Session 要有 HTTP Only 功能
16 |
17 |
--------------------------------------------------------------------------------
/homeworks/week16/hw1/week7/hw3/_mixin.scss:
--------------------------------------------------------------------------------
1 |
2 | @mixin size($height, $width) {
3 | height: $height;
4 | width: $width;
5 | }
6 |
7 | @mixin font($size, $color, $weight, $family) {
8 | font-size: $size;
9 | color: $color;
10 | font-weight: $weight;
11 | font-family: $family;
12 | }
13 |
14 | @mixin border($border..., $redius) {
15 | border: $border {
16 | redius: $redius;
17 | };
18 | }
19 |
--------------------------------------------------------------------------------
/examples/week22/README.md:
--------------------------------------------------------------------------------
1 | # 注意事項
2 |
3 | 提示:在寫完作業之後看效果最佳,沒寫作業前請不要看
4 |
5 | ## 有了 react-router 之後的 deploy
6 |
7 | 有些問題需要注意,第一個問題可參考:[淺談新手在學習 SPA 時的常見問題:以 Router 為例](https://blog.huli.tw/2019/09/18/spa-common-problem-about-router/)
8 |
9 | 第二個問題是你在 deploy 的時候有可能需要調整一些參數,例如說 create-react-app 的 homepage 以及 react-router 的 basename,詳情可參考:[Building for Relative Paths](https://create-react-app.dev/docs/deployment#building-for-relative-paths)
10 |
11 |
--------------------------------------------------------------------------------
/homeworks/week21/be/README.md:
--------------------------------------------------------------------------------
1 | # 作業
2 |
3 | ## hw1:改寫 PHP 留言板
4 |
5 | 在這一系列課程中,留言板是最主要的一個專案,我們不斷更新並且優化留言板。而這週我們則是要把之前用 PHP 寫的留言版換成用 CodeIgniter 來寫,讓你體驗看看兩者的差別在哪裡。
6 |
7 | 之前做了很多版本的留言板,為了不要拖到太多進度,我建議你先從最基本的版本開始。只要有會員功能以及發表、編輯與刪除留言就行了,不需要有子留言,也不需要改成 Ajax。
8 |
9 | 如果有時間的話再實作以下功能就好,但不需要以下功能也可以交作業:
10 |
11 | 1. 子留言
12 | 2. 分頁
13 | 3. 後台管理
14 | 4. Ajax 發表、編輯與刪除留言
15 |
16 | ## hw2:簡答題
17 |
18 | 1. 使用 CodeIgniter 之後跟原本寫純 PHP 有什麼不一樣的地方嗎?你比較喜歡哪一個?
19 |
--------------------------------------------------------------------------------
/homeworks/week23/be/README.md:
--------------------------------------------------------------------------------
1 | # 作業
2 |
3 | ## hw1:部落格
4 |
5 | 相信大家寫留言板應該寫到有點膩了,於是這週就不再讓大家把留言板改成使用 ORM 了。我們來寫一個新的專案吧,寫一個部落格出來,管理員登入之後可以新增、編輯以及刪除文章,然後應該可以使用 Markdown 格式發文(自己找套件來用)。
6 |
7 | 在資料的部分請使用這一週教的 Sequelize。
8 |
9 | 功能不用太複雜,只要寫一個很陽春的版本出來即可,有時間的話才慢慢加新功能上去。
10 |
11 | 這個專案可大可小,分享一個第二期同學做的部落格,我覺得做得很好,想要做的很完整的話就會長這樣:http://enter3017sky.tw/
12 |
13 | 可以自己衡量看看時間及負荷來決定完整程度。
14 |
15 | ## hw2:簡答題
16 |
17 | 1. 什麼是 ORM?
18 | 2. 什麼是 N+1 problem?
19 |
--------------------------------------------------------------------------------
/homeworks/week4/hw4.js:
--------------------------------------------------------------------------------
1 | const request = require('request');
2 |
3 | const clientID = 'qn5gw8fvspu3jaw1lqymckhb9zqyqx';
4 |
5 | request({
6 | url: 'https://api.twitch.tv/helix/games/top',
7 | method: 'GET',
8 | headers: {
9 | 'Client-ID': clientID,
10 | },
11 | }, (error, response, body) => {
12 | const obj = JSON.parse(body);
13 | for (let i = 0; i < obj.data.length; i += 1) { console.log(obj.data[i].id, obj.data[i].name); }
14 | });
15 |
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/src/index.scss:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
4 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/homeworks/week23/fe/hw1/src/reducers/index.js:
--------------------------------------------------------------------------------
1 | import { combineReducers } from 'redux';
2 | import getPostsReducer from './getPostsReducer'
3 | import getWeatherReducer from './getWeatherReducer'
4 | import { getSinglePostReducer, editSinglePostReducer, } from './getSinglePostReducer'
5 |
6 | const blogApp = combineReducers({
7 | getPostsReducer,
8 | getSinglePostReducer,
9 | editSinglePostReducer,
10 | getWeatherReducer
11 | });
12 |
13 | export default blogApp;
--------------------------------------------------------------------------------
/homeworks/week9/hw2/handle_identify.php:
--------------------------------------------------------------------------------
1 | ";
6 | echo " 目前為會員登出狀態
";
7 | require_once('./member_login.php');
8 | } else {
9 | echo "本站為練習用網站,因教學用途刻意忽略資安的實作,註冊時請勿使用任何真實的帳號或密碼
";
10 | echo " 目前為會員登入狀態
";
11 | echo "登入者為 " . $_COOKIE["member_id"];
12 | require_once('./message_board.php');
13 | }
14 | ?>
--------------------------------------------------------------------------------
/homeworks/week24/fe/hw1/src/ScrollToTop.js:
--------------------------------------------------------------------------------
1 | import { Component } from 'react'
2 | import { withRouter } from 'react-router-dom'
3 |
4 | /* 可以套用在每個需要換頁的部分 */
5 |
6 | class ScrollToTop extends Component {
7 | componentDidUpdate(prevProps) {
8 | if (this.props.location !== prevProps.location) {
9 | window.scrollTo(0, 0)
10 | }
11 | }
12 | render() {
13 | return this.props.children
14 | }
15 | }
16 |
17 | export default withRouter(ScrollToTop);
18 |
--------------------------------------------------------------------------------
/homeworks/week3/hw1.test.js:
--------------------------------------------------------------------------------
1 | const stars = require('./hw1');
2 |
3 | describe('hw1', () => {
4 | it('should return correct answer when n = 1', () => {
5 | expect(stars(1)).toEqual(['*']);
6 | });
7 |
8 | it('should return correct answer when n = 1', () => {
9 | expect(stars(5)).toEqual(['*', '**', '***', '****', '*****']);
10 | });
11 |
12 | it('should return correct answer when n = 1', () => {
13 | expect(stars(500)).toEqual('n 的數字僅能在 1 至 30 之間');
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/homeworks/week3/hw2.js:
--------------------------------------------------------------------------------
1 | function alphaSwap(str) {
2 | let result = '';
3 | let aCode = 0;
4 | for (let n = 0; n < str.length; n += 1) {
5 | aCode = str.charCodeAt(n);
6 | if (aCode >= 65 && aCode <= 90) {
7 | aCode += 32;
8 | } else if (aCode >= 97 && aCode <= 122) {
9 | aCode -= 32;
10 | }
11 | aCode = String.fromCharCode(aCode);
12 | result += aCode;
13 | }
14 | console.log(result);
15 | return result;
16 | }
17 |
18 | module.exports = alphaSwap;
19 |
--------------------------------------------------------------------------------
/homeworks/week19/hw2/src/_mixin.scss:
--------------------------------------------------------------------------------
1 | @mixin whole-shadow(){
2 | -webkit-filter: drop-shadow(0px 8px 7px rgba(0, 0, 0, 0.8));
3 | filter: drop-shadow(0px 8px 7px rgba(0, 0, 0, 0.8))
4 | }
5 |
6 | @mixin border($border, $radius) {
7 | border: $border {
8 | radius: $radius;
9 | }
10 | }
11 |
12 | @mixin font($color, $size, $weight, $family) {
13 | color: $color;
14 | font: {
15 | size: $size;
16 | weight: $weight;
17 | family: $family;
18 | }
19 | }
--------------------------------------------------------------------------------
/homeworks/week24/fe/hw1/src/actionsTypes.js:
--------------------------------------------------------------------------------
1 | // Action Types
2 | export const GET_POSTS = 'GET_POSTS'
3 | export const GET_RECENT_POSTS = 'GET_RECENT_POSTS'
4 | export const GET_SINGLE_POST = 'GET_SINGLE_POST'
5 | export const CREATE_SINGLE_POST = 'CREATE_SINGLE_POST'
6 | export const BEGIN_EDIT_SINGLE_POST = 'BEGIN_EDIT_SINGLE_POST'
7 | export const EDIT_SINGLE_POST = 'EDIT_SINGLE_POST'
8 | export const DELETE_SINGLE_POST = 'DELETE_SINGLE_POST'
9 | export const GET_WEATHER_DATA = 'GET_WEATHER_DATA'
10 |
11 |
--------------------------------------------------------------------------------
/examples/week23/README.md:
--------------------------------------------------------------------------------
1 | # 注意事項
2 |
3 | 提示:在寫完作業之後看效果最佳,沒寫作業前請不要看
4 |
5 | ## 有關 Redux
6 |
7 | 簡單再來講一下 Redux 是什麼,它其實就是另外一個存放 state 的地方。
8 |
9 | 為什麼 React component 已經可以存了,卻還要另一個地方呢?因為有些 state 你不知道要放在哪個 component 底下,好像放哪裡都很奇怪,例如說一些 global 的 state。
10 |
11 | 這時候 Redux 就是一個可以讓你放這些 state 的地方。在 Redux 的運作模式裡面,你要改變 state 就要 dispatch 一個 action,action 到 reducer 之後會產生新的 state,就把 state 改變了。
12 |
13 | 然後 react-redux 就是把 Redux 的 state 給自動綁定到 component 的 props,也順便把 dispatch 一起傳進去,把 React 跟 Redux 給綁在一起,這樣才能使用。
14 |
15 |
16 |
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw3/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Blue orange
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/homeworks/week24/fe/hw1/src/reducers/index.js:
--------------------------------------------------------------------------------
1 | import { combineReducers } from 'redux';
2 | import getPostsReducer from './getPostsReducer'
3 | import getWeatherReducer from './getWeatherReducer'
4 | import { getSinglePostReducer, editSinglePostReducer, createSinglePostReducer} from './getSinglePostReducer'
5 |
6 | const blogApp = combineReducers({
7 | getPostsReducer,
8 | getSinglePostReducer,
9 | editSinglePostReducer,
10 | getWeatherReducer,
11 | createSinglePostReducer
12 | });
13 |
14 | export default blogApp;
--------------------------------------------------------------------------------
/homeworks/week22/fe/README.md:
--------------------------------------------------------------------------------
1 | # 作業
2 |
3 | ## hw1:SPA 部落格
4 |
5 | 在這個作業中,我們要把上一週的部落格範例變得更完整一點,請你加入以下功能:
6 |
7 | 1. 美化部落格主頁
8 | 2. 美化部落格文章頁面
9 | 3. 使用 React Router
10 | 4. 串接 API
11 |
12 | API 格式:
13 |
14 | endpoint:https://qootest.com
15 | 使用說明:https://github.com/typicode/json-server
16 |
17 | ```
18 | GET /posts 取得所有 post
19 | GET /posts/:id 取得某個 post
20 | ```
21 |
22 |
23 | ## hw2:簡答題
24 |
25 | 1. React Router 背後的原理你猜是怎麼實作的?
26 | 2. SDK 與 API 的差別是什麼?
27 | 3. 在用 Ajax 的時候如果不是同源,預設是不會把 Cookie 帶上的,要怎麼樣才能把 Cookie 一起帶上?
28 |
--------------------------------------------------------------------------------
/homeworks/week23/fe/hw1/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import App from './App';
4 | import * as serviceWorker from './serviceWorker';
5 | import { Provider } from 'react-redux'
6 | import { createStore } from 'redux'
7 | import blogApp from './reducers'
8 |
9 | let store = createStore(blogApp)
10 |
11 | ReactDOM.render(
12 |
13 |
14 | ,
15 | document.getElementById('root')
16 | );
17 |
18 | serviceWorker.unregister();
19 |
--------------------------------------------------------------------------------
/homeworks/week7/hw1/style.css:
--------------------------------------------------------------------------------
1 | .message {
2 | height: 300px;
3 | width: 500px;
4 | font-size: 72px;
5 | font-weight: bold;
6 | text-align: center;
7 | display: block;
8 | position: absolute;
9 | top: 50%;
10 | left: 50%;
11 | margin-top: -150px;
12 | margin-left: -250px;
13 | }
14 |
15 | .message .btn {
16 | display: block;
17 | position: relative;
18 | left: 40%
19 | }
20 |
21 | body {
22 | transition: all 1.5s;
23 | }
24 |
25 | .bg-red {
26 | background: orange
27 | }
28 |
29 |
--------------------------------------------------------------------------------
/homeworks/week13/hw3/README.md:
--------------------------------------------------------------------------------
1 | # 2019 / 6 / 30
2 | - 留言版誕生
3 |
4 | # 2019 / 7 / 7
5 | - 將 cookie 使用 password_hash 改為正規的 SESSION ID 語法 -> OK
6 | - 將留言撈取使用者名字的寫法改掉,不要去撈 cookie 裡面的,要去撈資料庫裏面的 -> OK
7 | - 將輸入留言的功能使用 Javascript 寫入 -> X
8 | - 加入 XSS 防範機制 -> OK
9 | - 加入 SQL injection 防範機制 -> OK
10 | - 將擾人的 alert 改為另一種產出方式 -> X,目前還是一樣擾人
11 |
12 | # 2019 / 7 / 16 不負責任修改項目
13 | - 撈取留言 / 子留言 / 子留言輸入框 / 編輯與刪除改用前端撈取 PHP 發出的 JSON
14 | - 這週作業本來應該要套用 Bootstrap,但因為在其他部分花費太多時間而作罷,預計實現在 Week14
15 | - XSS 在後端生成 JSON 時就預先處理
16 | - 使用 SESSION,拋棄原本使用的通行證與存放通行證的資料庫
17 |
18 |
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw1/README.MD:
--------------------------------------------------------------------------------
1 | # 簡介
2 |
3 | 這份作業是我練習 React 基礎的第一份作業,內容大多都是臨摹的 QQ
4 |
5 | 所以這邊寫一下這份作業我學習了哪些重點,就不談功能了和基礎的部分了
6 |
7 | 比較讓我驚豔的是 `input` 的部分,利用監聽事件邊輸入內容邊改變 state,再由 `state` render 出 DOM,
8 |
9 | 這樣的作法的確是一開始沒有想到的,老師很慷慨的一開始就展現出這個功能 XD
10 |
11 | 再來就是 App Component 的部分,這邊的 this.state 除了 tasks 以外,也有 taskText 與 taskId,
12 |
13 | 兩者的值之後都會傳入 tasks 中,成為裡面其中一個元素的物件元素
14 |
15 | 說真的如果再給我重頭寫一次我可能想不到這種用法,如果是我的話,應該想不到可以這樣用 XD
16 |
17 | 代表這是一個值得記住的好方法
18 |
19 | 不過其實仔細想想,好像也沒有其他更好的方法了囧,不要忘記還有核取方塊等之類的東西啊
20 |
21 | 大概就是這樣,目前來說沒什麼特別的
22 |
23 |
24 |
--------------------------------------------------------------------------------
/homeworks/week3/hw2.test.js:
--------------------------------------------------------------------------------
1 | const alphaSwap = require('./hw2');
2 |
3 | describe('hw2', () => {
4 | it('should return correct answer when str = nick', () => {
5 | expect(alphaSwap('nick')).toBe('NICK');
6 | });
7 |
8 | it('should return correct answer when str = ClAy is bEst', () => {
9 | expect(alphaSwap('ClAy is bEst 557987,!#@$@@%@@')).toBe('cLaY IS BeST 557987,!#@$@@%@@');
10 | });
11 |
12 | it('should return correct answer when str = haHahAHA', () => {
13 | expect(alphaSwap('haHahAHA')).toBe('HAhAHaha');
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | env: {
3 | browser: true,
4 | es6: true,
5 | node: true,
6 | jest: true,
7 | jquery: true
8 | },
9 | extends: 'airbnb',
10 | globals: {
11 | Atomics: 'readonly',
12 | SharedArrayBuffer: 'readonly',
13 | },
14 | parserOptions: {
15 | ecmaFeatures: {
16 | jsx: true,
17 | },
18 | ecmaVersion: 2018,
19 | },
20 | plugins: [
21 | 'react',
22 | ],
23 | rules: {
24 | "no-console": "off"
25 | //"linebreak-style": [0 ,"error", "windows"]
26 | },
27 | };
28 |
--------------------------------------------------------------------------------
/homeworks/week24/fe/README.md:
--------------------------------------------------------------------------------
1 | # 作業
2 |
3 | ## hw1:SPA 部落格最後加強版
4 |
5 | 這我們要把有 API call 的地方都改成用 redux-promise 來實作,除了這些以外呢,也希望你能新增一些功能:
6 |
7 | 1. 可以用 Markdown 格式來撰寫及顯示文章
8 |
9 | API 格式:
10 |
11 | endpoint:https://qootest.com
12 | 使用說明:https://github.com/typicode/json-server
13 |
14 | ```
15 | POST /posts {title, author, body} 新增 posts
16 | GET /posts 取得所有 post
17 | GET /posts/:id 取得某個 post
18 | DELETE /posts/:id 刪除 post
19 | PUT /posts/:id {title, author, body} 更新 post
20 | ```
21 |
22 |
23 | ## hw2:簡答題
24 |
25 | 1. Redux 如何解決非同步(例如說 call API 拿資料)的問題
26 |
--------------------------------------------------------------------------------
/examples/week16/README.md:
--------------------------------------------------------------------------------
1 | # 注意事項
2 |
3 | 提示:在寫完作業之後看效果最佳,沒寫作業前請不要看
4 |
5 | ## Stack 與 Queue
6 |
7 | 這邊其實滿害怕大家把 Stack 與 call stack 搞混,或者是把 Queue 與下週要講的 callback queue 搞混。
8 |
9 | Stack 與 Queue 是兩種資料結構,就像陣列也是一種資料結構一樣。當我們提到 Stack 跟 Queue 的時候我們知道資料怎麼進出,所以它是一種比較抽象的概念。
10 |
11 | 而 Stack 這個後進先出的特性很適合拿來當執行程式時的資料結構,因為就像你 function 呼叫 function 一樣,一定是後面的執行完才跑回來執行前面的,因此底層會利用 Stack 來實作這個呼叫的流程,這個東西就叫做:Call Stack。
12 |
13 | 所以當有人問你 Stack 是什麼的時候,不要搞混成 Call Stack 了,他想知道的只是這個資料結構在幹嘛而已;當有人問你 Call Stack 的時候,就是想知道你怎麼解釋程式在執行時的底層結構。
14 |
15 | 簡單來說呢,Stack 是一種資料結構,Call Stack 是 Stack 的一種使用方式。
--------------------------------------------------------------------------------
/homeworks/week22/be/README.md:
--------------------------------------------------------------------------------
1 | # 作業
2 |
3 | (附註:這週作業不會用到 Sequelize)
4 |
5 | ## hw1:留言板
6 |
7 | 這週上到了 Express 這一個 Node.js 的框架,而這次的作業很簡單,就是要把之前寫的留言板系統移植到 Express 上面,讓你體驗看看有用框架跟沒有用框架的差別在哪。
8 |
9 | 這次的移植照理來說只會有後端程式碼有變化,前端應該會是完全不變的。
10 |
11 | 有一點請特別注意,請根據自己的時間來決定留言板的完整度。這個作業要求的留言板只需要有會員功能以及最基本的發表、編輯與刪除留言,大概就是 week9 那樣的程度,剩下的功能如果還有時間的話再做。
12 |
13 | ## hw2:短網址系統
14 |
15 | 之前有帶大家設計過短網址的系統架構,那時候是要求大家考量的越大越複雜越好,但這次作業我們只要實作一個簡單的版本就好,能夠讓使用者輸入長網址並且產生短網址,以及讓短網址可以導到正確的網頁去。
16 |
17 | 可以參考現成短網址服務來看看要怎麼設計。
18 |
19 | 至於要怎麼生成短網址的那個網址,就交給大家自己去研究了!
20 |
21 | ## hw3:簡答題
22 |
23 | 1. 什麼是 MVC?
24 |
--------------------------------------------------------------------------------
/homeworks/week24/fe/hw1/src/containers/NavContainer.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Nav from '../components/nav'
3 | import { getWeatherData } from '../actions'
4 | import { connect } from 'react-redux'
5 |
6 | const NavContainer = props => {
7 | return
8 | }
9 |
10 | const mapStateToProps = state => {
11 | return {
12 | weatherData: state.getWeatherReducer.weatherData
13 | }
14 | }
15 |
16 | const mapDispatchToProps = {
17 | getWeatherData
18 | }
19 |
20 | export default connect(mapStateToProps, mapDispatchToProps)(NavContainer)
--------------------------------------------------------------------------------
/homeworks/week2/hw5.js:
--------------------------------------------------------------------------------
1 | function join(str, concatStr) {
2 | let newStr = '';
3 | const len = str.length;
4 | for (let i = 0; i < len; i += 1) {
5 | if (i < (len - 1)) {
6 | newStr += str[i] + concatStr;
7 | } else {
8 | newStr += str[i];
9 | }
10 | }
11 | return newStr;
12 | }
13 |
14 | function repeat(str1, times) {
15 | let newStr1 = '';
16 | for (let n = 0; n < times; n += 1) {
17 | newStr1 += str1;
18 | }
19 | return newStr1;
20 | }
21 |
22 | console.log(join(['a', 'b', 'c'], '!'));
23 | console.log(repeat('a', 5));
24 |
25 | // 陣列可直接當參數代入
26 |
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw3/dist/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Blue orange
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/homeworks/week13/hw3/handling/handle_subwrite.php:
--------------------------------------------------------------------------------
1 | alert('內容不可空白唷 !');parent.location.href='../index.php';";
8 | } else {
9 | $stmt = $conn->prepare("INSERT INTO claygao_comments_sub1(parent_id, sub_content, nickname) VALUES(?, ?, ?)");
10 | $stmt->bind_param("iss", $id_sub1, $subContent, $subContentSender);
11 | $stmt->execute()
12 | }
13 | ?>
--------------------------------------------------------------------------------
/homeworks/week24/fe/hw1/src/containers/WriteContainer.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { connect } from 'react-redux'
3 | import Write from '../components/write'
4 | import { createSinglePost } from '../actions'
5 |
6 | const WriteContainer = props => {
7 | return
8 | }
9 |
10 | const mapStateToProps = state => {
11 | return {
12 | isCreated: state.createSinglePostReducer.isCreated
13 | }
14 | }
15 |
16 | const mapDispatchToProps = {
17 | createSinglePost
18 | }
19 |
20 | export default connect(mapStateToProps, mapDispatchToProps)(WriteContainer)
--------------------------------------------------------------------------------
/homeworks/week13/hw2/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding: 0;
3 | margin: 0;
4 | background-color: wheat;
5 | }
6 |
7 | .container {
8 | height: 900px;
9 | width: 960px;
10 | margin: 0 auto;
11 |
12 | }
13 |
14 | .taskEnter {
15 | margin-top:30px;
16 | margin-bottom:10px;
17 | }
18 |
19 | .taskTmp {
20 | margin-top:30px;
21 | margin-bottom:10px;
22 | }
23 |
24 |
25 |
26 | .badge {
27 | margin: 5px 20px;
28 | }
29 |
30 | .btn ~ .btn {
31 | margin-left: 8px;
32 | }
33 |
34 | .checkbox {
35 | margin-right:10px;
36 | }
37 |
38 | .ok {
39 | text-decoration:line-through;
40 | }
41 |
42 |
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/build/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/homeworks/week18/hw3/dist/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding: 0;
3 | margin: 0;
4 | background-color: wheat;
5 | }
6 |
7 | .container {
8 | height: 900px;
9 | width: 960px;
10 | margin: 0 auto;
11 |
12 | }
13 |
14 | .taskEnter {
15 | margin-top:30px;
16 | margin-bottom:10px;
17 | }
18 |
19 | .taskTmp {
20 | margin-top:30px;
21 | margin-bottom:10px;
22 | }
23 |
24 |
25 |
26 | .badge {
27 | margin: 5px 20px;
28 | }
29 |
30 | .btn ~ .btn {
31 | margin-left: 8px;
32 | }
33 |
34 | .checkbox {
35 | margin-right:10px;
36 | }
37 |
38 | .ok {
39 | text-decoration:line-through;
40 | }
41 |
42 |
--------------------------------------------------------------------------------
/homeworks/week21/fe/README.md:
--------------------------------------------------------------------------------
1 | # 作業
2 |
3 | ## hw1:Todo List
4 |
5 | 請你用 React 實作出一個 todo list,介面跟功能就參考之前用 jQuery 寫出來的那個就行了。
6 |
7 | ## hw2:五子棋遊戲
8 |
9 | 請實作出一個簡單的五子棋遊戲,讓黑棋白棋可以輪流下,並且判定勝負。棋盤的話請用十九路棋盤(19*19),如果想挑戰更進階的,可以試著把棋譜也記錄起來,甚至是做一個輸入棋譜就可以重演整個盤面的小程式。
10 |
11 | ## hw3:Blog SPA
12 |
13 | 請做出一個簡單的 Blog SPA,一共有三個頁面:
14 |
15 | 1. About:隨意顯示一些話
16 | 2. 文章列表:可以看到所有文章
17 | 3. 單篇文章:可以看到單篇文章內容
18 |
19 | API 的話可以用這個:https://jsonplaceholder.typicode.com/posts
20 |
21 | 圖片可參考:
22 |
23 | 
24 |
25 | ## hw4:簡答題
26 |
27 | 1. 為什麼我們需要 React?可以不用嗎?
28 | 2. React 的思考模式跟以前的思考模式有什麼不一樣?
29 | 2. state 跟 props 的差別在哪裡?
30 | 3. 請列出 React 的 lifecycle 以及其代表的意義
--------------------------------------------------------------------------------
/homeworks/week24/fe/hw1/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import App from './App';
4 | import * as serviceWorker from './serviceWorker';
5 | import { Provider } from 'react-redux'
6 | import { createStore, applyMiddleware } from 'redux'
7 | import blogApp from './reducers'
8 | import promiseMiddleware from 'redux-promise-middleware';
9 |
10 | let store = createStore(blogApp, applyMiddleware(promiseMiddleware))
11 |
12 | ReactDOM.render(
13 |
14 |
15 | ,
16 | document.getElementById('root')
17 | );
18 |
19 | serviceWorker.unregister();
20 |
--------------------------------------------------------------------------------
/homeworks/week3/hw4.test.js:
--------------------------------------------------------------------------------
1 | const isPalindromes = require('./hw4');
2 |
3 | describe('hw4', () => {
4 | it('should return correct answer when str = abcdcba', () => {
5 | expect(isPalindromes('abcdcba')).toBe(true);
6 | });
7 |
8 | it('should return correct answer when str = abcdcba', () => {
9 | expect(isPalindromes('CLay like to be ot ekil yalc')).toBe(false);
10 | });
11 |
12 | it('should return correct answer when str = abcdcba', () => {
13 | expect(isPalindromes('CLay like to be ot ekil yalcCLay like to be ot ekil yalcCLay like to be ot ekil yalcCLay like to be ot ekil yalc'))
14 | .toBe('字串長度需小於 100 個字元');
15 | });
16 | });
17 |
--------------------------------------------------------------------------------
/homeworks/week9/hw2/handle_article.php:
--------------------------------------------------------------------------------
1 | query($sql);
19 | if ($result) {
20 | echo "Success!";
21 | header('Location: ./index.php');
22 | } else {
23 | echo "Failed!";
24 | }
25 | ?>
--------------------------------------------------------------------------------
/homeworks/week9/hw2/handle_signin.php:
--------------------------------------------------------------------------------
1 | query($sql);
13 | $row = $result->fetch_assoc();
14 | if ($user_password === $row['password']) {
15 | setcookie("member_id", $row['username'], time()+3600*24);
16 | header("Location: ./index.php");
17 |
18 | } else {
19 | echo '登入失敗,請檢查帳號密碼是否正確';
20 | }
21 | ?>
--------------------------------------------------------------------------------
/homeworks/week23/fe/hw1/src/actionsTypes.js:
--------------------------------------------------------------------------------
1 | // Action Types
2 | export const GET_POSTS = 'GET_POSTS'
3 | export const GET_POSTS_SUCCESS = 'GET_POSTS_SUCCESS'
4 | export const GET_SINGLE_POST = 'GET_SINGLE_POST'
5 | export const GET_SINGLE_POST_SUCCESS = 'GET_SINGLE_POST_SUCCESS'
6 | export const EDIT_SINGLE_POST = 'EDIT_SINGLE_POST'
7 | export const EDIT_SINGLE_POST_SUCCESS = 'EDIT_SINGLE_POST_SUCCESS'
8 | export const DELETE_SINGLE_POST = 'DELETE_SINGLE_POST'
9 | export const DELETE_SINGLE_POST_SUCCESS ='DELETE_SINGLE_POST_SUCCESS'
10 | export const GET_WEATHER_DATA = 'GET_WEATHER_DATA'
11 | export const GET_WEATHER_DATA_SUCCESS = 'GET_WEATHER_DATA_SUCCESS'
12 |
13 |
--------------------------------------------------------------------------------
/homeworks/week9/hw2/member_login.php:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
20 |
21 |
--------------------------------------------------------------------------------
/homeworks/week11/hw1/verify.php:
--------------------------------------------------------------------------------
1 | query($sql);
9 | $row = $result->fetch_assoc();
10 | if ($row && $verifyId === $row['id']) {
11 | $verifyCookie = true; // 可以根據滿足不同的條件給予不同的權限,比如說管理員權限 $adminPermission = true
12 | } else {
13 | $verifyCookie = false;
14 | }
15 | }
16 |
17 | /**
18 | * 需要新增功能 ( 挑戰題 ):
19 | *
20 | * 增加管理員權限 ( 需要滿足更多的條件 )
21 | */
22 | ?>
--------------------------------------------------------------------------------
/homeworks/week19/hw1/models/todo_API.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/homeworks/week9/hw1.md:
--------------------------------------------------------------------------------
1 | 資料庫名稱:mtr03group5
2 |
3 | - table name : claygao_users
4 |
5 | | 欄位名稱 | 欄位型態 | 說明 |
6 | |----------|----------|------|
7 | | id_number | varchar(16) | 帳號名稱 |
8 | | password | varchar(16) | 帳號密碼 |
9 | | password2 | varchar(16) | 第二次輸入之帳號密碼 |
10 | | username | varchar(64) | 使用者名稱 |
11 |
12 | - table name : claygao_comments
13 |
14 | | 欄位名稱 | 欄位型態 | 說明 |
15 | |----------|----------|------|
16 | | id | int(10) | 紀錄第 n 則留言 |
17 | | title | text | 留言文章標題 |
18 | | content | text | 留言文章內容 |
19 | | name | varchar(64) | 當下留言者名稱,這邊會取用目前登入者的 username |
20 | | created_at | datetime[CURRENT_TIMESTAMP] | 創建時間,取發送請求時當下的時間 |
21 |
22 | - hw2 結構
23 |
24 | 
--------------------------------------------------------------------------------
/homeworks/week4/hw2.js:
--------------------------------------------------------------------------------
1 | const request = require('request');
2 | const process = require('process');
3 |
4 |
5 | if (process.argv[2] === 'list') {
6 | request('https://lidemy-book-store.herokuapp.com/books?_limit=20', (error, response, body) => {
7 | const obj = JSON.parse(body);
8 | for (let i = 0; i < obj.length; i += 1) {
9 | console.log(`ID : ${obj[i].id} / 書名:${obj[i].name}`);
10 | }
11 | });
12 | }
13 |
14 |
15 | if (process.argv[2] === 'read') {
16 | request(`https://lidemy-book-store.herokuapp.com/books/${process.argv[3]}`, (error, response, body) => {
17 | const obj = JSON.parse(body);
18 | console.log(`ID : ${obj.id} / 書名:${obj.name}`);
19 | });
20 | }
21 |
--------------------------------------------------------------------------------
/homeworks/week2/hwS1.js:
--------------------------------------------------------------------------------
1 | function search(arr, x) {
2 | const randomMath = Math.floor(Math.random() * (arr.length));
3 | console.log(randomMath);
4 | if ([randomMath] === x) {
5 | return randomMath;
6 | }
7 | if (arr[randomMath] < x) {
8 | for (let i = randomMath; i < arr.length; i += 1) {
9 | if (arr[i] === x) { return i; }
10 | }
11 | } else if (arr[randomMath] > x) {
12 | for (let i = randomMath; i >= 0; i -= 1) {
13 | if (arr[i] === x) { return i; }
14 | }
15 | }
16 | return -1;
17 | }
18 |
19 | console.log(search([1, 3, 10, 14, 39, 55, 68, 98, 150, 200, 210], 800));
20 | /*
21 | while (arr[randomMath] !== x){
22 | randomMath--
23 | } return i
24 | */
25 |
--------------------------------------------------------------------------------
/homeworks/week12/hw1/verify.php:
--------------------------------------------------------------------------------
1 | prepare("SELECT * FROM `claygao_users_certificate` WHERE `id` = ?");
7 | $stmt->bind_param("s", $verifyId);
8 | $stmt->execute();
9 | $result = $stmt->get_result();
10 | $row = $result->fetch_assoc();
11 | if ($row && $verifyId === $row['id']) {
12 | $verifyCookie = true; // 可以根據滿足不同的條件給予不同的權限,比如說管理員權限 $adminPermission = true
13 | } else {
14 | $verifyCookie = false;
15 | }
16 | }
17 |
18 | /**
19 | * 需要新增功能 ( 挑戰題 ):
20 | *
21 | * 增加管理員權限 ( 需要滿足更多的條件 )
22 | * 嗚嗚還沒做
23 | */
24 | ?>
--------------------------------------------------------------------------------
/homeworks/week13/hw3/handling/handle_update.php:
--------------------------------------------------------------------------------
1 | alert('標題和內容不可空白唷 !');parent.location.href='../update.php';";
8 | } else {
9 | $stmt = $conn->prepare("UPDATE `claygao_comments` SET title = ?, content = ? WHERE id = ?");
10 | $stmt->bind_param("ssi", $title, $content, $id);
11 |
12 | if ($stmt->execute()) {
13 | echo "";
14 | } else {
15 | echo "";
16 | }
17 | }
18 | ?>
--------------------------------------------------------------------------------
/homeworks/week23/fe/README.md:
--------------------------------------------------------------------------------
1 | # 作業
2 |
3 | ## hw1:SPA 部落格加強版
4 |
5 | 延續上週的作業,我們這次要把 Redux 給加進來。就如同我們教過的一樣,Redux 通常適合用在儲存「global 的狀態」,因此在這個作業中你必須增把 Navbar 的部分改成用 Redux 來處理,所以你應該會在 store 裡面儲存現在所在的分頁,而且還需要建立一個 action 來改變分頁的狀態。
6 |
7 | 除了這些以外呢,也希望你能新增一些功能:
8 |
9 | 1. 發表文章
10 | 2. 刪除文章
11 | 3. 編輯文章
12 |
13 | API 格式:
14 |
15 | endpoint:https://qootest.com
16 | 使用說明:https://github.com/typicode/json-server
17 |
18 | ```
19 | POST /posts {title, author, body} 新增 posts
20 | GET /posts 取得所有 post
21 | GET /posts/:id 取得某個 post
22 | DELETE /posts/:id 刪除 post
23 | PUT /posts/:id {title, author, body} 更新 post
24 | ```
25 |
26 |
27 | ## hw2:簡答題
28 |
29 | 1. 為什麼我們需要 Redux?
30 | 2. Redux 是什麼?
31 | 3. Single Page Application 是什麼?有哪些頁面一定要用這個架構去設計嗎?
32 |
--------------------------------------------------------------------------------
/homeworks/week23/fe/hw1/src/reducers/getPostsReducer.js:
--------------------------------------------------------------------------------
1 | import * as actionTypes from '../actionsTypes';
2 |
3 | const initState = {
4 | postListData: [],
5 | isLoadingGetPosts: false
6 | }
7 |
8 | export default function getPostsReducer(state = initState, action) {
9 | switch(action.type) {
10 | case actionTypes.GET_POSTS:
11 | return {
12 | ...state,
13 | isLoadingGetPosts: true,
14 | }
15 | case actionTypes.GET_POSTS_SUCCESS:
16 | return {
17 | ...state,
18 | postListData: action.data,
19 | isLoadingGetPosts: false
20 | }
21 | default:
22 | return state
23 | }
24 | }
--------------------------------------------------------------------------------
/homeworks/week24/fe/hw1/src/containers/HomeContainer.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { BrowserRouter as Router, Route, Link, withRouter } from "react-router-dom";
3 | import Home from '../components/home'
4 | import { getRecentPosts } from '../actions'
5 | import { connect } from 'react-redux'
6 |
7 | const HomeContainer = props => {
8 | return
9 | }
10 |
11 | const mapStateToProps = state => {
12 | return {
13 | postListData: state.getPostsReducer.postListData,
14 | weatherData: state.getWeatherReducer.weatherData
15 | }
16 | }
17 |
18 | const mapDispatchToProps = {
19 | getRecentPosts
20 | }
21 |
22 | export default withRouter(connect(mapStateToProps, mapDispatchToProps)(HomeContainer))
--------------------------------------------------------------------------------
/homeworks/week12/hw1/handle_subwrite.php:
--------------------------------------------------------------------------------
1 | alert('內容不可空白唷 !');parent.location.href='./index.php';";
8 | } else {
9 | $stmt = $conn->prepare("INSERT INTO claygao_comments_sub1(parent_id, sub_content, nickname) VALUES(?, ?, ?)");
10 | $stmt->bind_param("iss", $id_sub1, $subContent, $subContentSender);
11 | if (!$stmt->execute()) {
12 | echo "";
13 | } else {
14 | header("location:./index.php");
15 | }
16 | }
17 | ?>
--------------------------------------------------------------------------------
/homeworks/week24/fe/hw1/src/containers/PostListContainer.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { connect } from 'react-redux'
3 | import { BrowserRouter as Router, Route, Link, withRouter } from "react-router-dom";
4 | import PostList from '../components/post_list'
5 | import { getPostList } from '../actions'
6 |
7 | const PostListContainer = props => {
8 | return
9 | }
10 |
11 | const mapStateToProps = state => {
12 | return {
13 | isLoadingGetPosts: state.getPostsReducer.isLoadingGetPosts,
14 | postListData: state.getPostsReducer.postListData,
15 | }
16 | }
17 |
18 | const mapDispatchToProps = {
19 | getPostList
20 | }
21 |
22 | export default withRouter(connect(mapStateToProps, mapDispatchToProps)(PostListContainer))
--------------------------------------------------------------------------------
/homeworks/week11/hw1/sign_in.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 | Love Message Board
9 |
10 |
11 |
17 |
18 |
19 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/homeworks/week12/hw1/sign_in.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 | Love Message Board
9 |
10 |
11 |
17 |
18 |
19 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/homeworks/week11/hw1/handle_update.php:
--------------------------------------------------------------------------------
1 | alert('標題和內容不可空白唷 !');parent.location.href='./update.php';";
8 | } else {
9 | $sql = "UPDATE `claygao_comments` SET title = '$title', content='$content' where id =" .$id;
10 | $result = $conn->query($sql);
11 | if ($result) {
12 | echo "";
13 | } else {
14 | echo "";
15 | }
16 | }
17 |
18 | /**
19 | * 下週新增功能 :
20 | *
21 | * 可以覆蓋 created_at,讓留言板顯示的編輯時間為最後編輯時間
22 | */
23 | ?>
--------------------------------------------------------------------------------
/homeworks/week13/hw3/sign_in.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 | Love Message Board
9 |
10 |
11 |
17 |
18 |
19 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/homeworks/week23/fe/hw1/src/reducers/getWeatherReducer.js:
--------------------------------------------------------------------------------
1 | import * as actionTypes from '../actionsTypes';
2 |
3 | const initState = {
4 | weatherData: [],
5 | isLoadingGetWeatherData: false,
6 | currentTime: {}
7 | }
8 |
9 | export default function getWeatherReducer(state = initState, action) {
10 | switch(action.type) {
11 | case actionTypes.GET_WEATHER_DATA:
12 | return {
13 | ...state,
14 | isLoadingGetWeatherData: true,
15 | }
16 | case actionTypes.GET_WEATHER_DATA_SUCCESS:
17 | return {
18 | ...state,
19 | weatherData: action.data,
20 | isLoadingGetWeatherData: false
21 | }
22 | default:
23 | return state
24 | }
25 | }
--------------------------------------------------------------------------------
/homeworks/week5/README.md:
--------------------------------------------------------------------------------
1 | # 作業
2 |
3 | ## hw1:前四週心得與解題心得
4 |
5 | 複習週除了複習以往的內容以外,也可以好好整理一下自己這四週學到了些什麼,因此這次的作業就是寫一下自己對於前四週學習的心得感想。
6 |
7 | 除此之外,這一週的兩個小挑戰應該也會讓你們有一些心得,可以一併把它記錄下來。
8 |
9 | 請將答案寫在 [hw1.md](hw1.md)。
10 |
11 | ##
12 |
13 |
14 | 安安,歡迎來到 Lidemy HTTP Challenge。
15 |
16 | URL : https://lidemy-http-challenge.herokuapp.com/start
17 |
18 | 這裡一共有 10 道關卡,每一關的網址皆為 /lvX,X 即為關卡的數字。
19 | 但只知道網址是沒有用的,需要搭配正確的 token 才能順利進入關卡,傳入 token 的方式為 query string,例如 /lv1?token=xxx。
20 |
21 | 另外,為了讓你方便辨別這是 token,token 的內容一定是用一個大括弧刮起來的字串。
22 | 每一關都會有提示,只要按照提示照著做,就能拿到前往下一關的 token。
23 |
24 | 你可以用任何你擅長的工具來通關,只靠瀏覽器的話有些關卡是沒辦法通過的喔!
25 |
26 | 準備好了嗎?
27 |
28 | 第一關的 token 為:{GOGOGO}
29 |
30 | 附註:所以第一關網址為 /lv1?token={GOGOGO},不是 /lv1?token=GOGOGO,之後的關卡也是一樣
31 | 如果你需要提示的話,在網址最後面加上 &hint=1 就會看到提示了,例如說:/lv1?token={GOGOGO}&hint=1
--------------------------------------------------------------------------------
/homeworks/week9/hw2/message_board.php:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
24 |
25 |
--------------------------------------------------------------------------------
/homeworks/week9/hw2/member_create.php:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
Walk here and write your story
10 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/homeworks/week24/fe/hw1/src/reducers/getWeatherReducer.js:
--------------------------------------------------------------------------------
1 | import * as actionTypes from '../actionsTypes';
2 |
3 | const initState = {
4 | weatherData: [],
5 | isLoadingGetWeatherData: false,
6 | currentTime: {}
7 | }
8 |
9 | export default function getWeatherReducer(state = initState, action) {
10 | switch(action.type) {
11 | case actionTypes.GET_WEATHER_DATA + '_PENDING':
12 | return {
13 | ...state,
14 | isLoadingGetWeatherData: true,
15 | }
16 | case actionTypes.GET_WEATHER_DATA + '_FULFILLED':
17 | return {
18 | ...state,
19 | weatherData: action.payload,
20 | isLoadingGetWeatherData: false
21 | }
22 | default:
23 | return state
24 | }
25 | }
--------------------------------------------------------------------------------
/homeworks/week16/hw2/main.js:
--------------------------------------------------------------------------------
1 | function Stack() {
2 | const arrStack = [];
3 | return arrStack;
4 | }
5 |
6 | function Queue() {
7 | const arrQueue = [];
8 |
9 | this.push = function (n) {
10 | arrQueue.unshift(n);
11 | return arrQueue;
12 | };
13 | this.pop = function () {
14 | const arrNew = arrQueue[arrQueue.length - 1];
15 | arrQueue.length -= 1;
16 | return arrNew;
17 | };
18 | }
19 |
20 | const stack = new Stack();
21 | stack.push(10);
22 | stack.push(5);
23 | console.log(stack.pop()); // 5
24 | console.log(stack.pop()); // 10
25 |
26 | const queue = new Queue();
27 | queue.push(1);
28 | queue.push(2);
29 | queue.push(3);
30 | queue.push(4);
31 | console.log(queue.pop()); // 1
32 | console.log(queue.pop()); // 2
33 | console.log(queue.pop()); // 3
34 | console.log(queue.pop()); // 4
35 |
--------------------------------------------------------------------------------
/homeworks/week13/hw3/handling/handle_write.php:
--------------------------------------------------------------------------------
1 | alert('標題和內容不可空白唷 !');parent.location.href='../write.php';";
10 | } else {
11 | $stmt = $conn->prepare("INSERT INTO claygao_comments(title, content, nickname, `id_number`) VALUES (?, ?, ?, ?)");
12 | $stmt->bind_param("ssss", $title, $content, $_SESSION['nickname'], $_SESSION['id_number']);
13 |
14 | if ($stmt->execute()) {
15 | $newMessage = array('result' => 'Success ! ');
16 | echo json_encode($newMessage);
17 | } else {
18 | echo "";
19 | }
20 | }
21 | ?>
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/build/precache-manifest.0d8b7f79fb8c158922a01fa8b498579c.js:
--------------------------------------------------------------------------------
1 | self.__precacheManifest = (self.__precacheManifest || []).concat([
2 | {
3 | "revision": "5a22e67d980705c13158b12c28e23174",
4 | "url": "./index.html"
5 | },
6 | {
7 | "revision": "234f6afeee24df506fec",
8 | "url": "./static/css/main.8944381c.chunk.css"
9 | },
10 | {
11 | "revision": "6d437889d78150986224",
12 | "url": "./static/js/2.2f7e563d.chunk.js"
13 | },
14 | {
15 | "revision": "234f6afeee24df506fec",
16 | "url": "./static/js/main.754a5e05.chunk.js"
17 | },
18 | {
19 | "revision": "f49e0e74df6e6c3c28bc",
20 | "url": "./static/js/runtime-main.04a13e19.js"
21 | },
22 | {
23 | "revision": "54e40ca1322beb42e001bce85f2e9058",
24 | "url": "./static/media/bg.54e40ca1.jpg"
25 | }
26 | ]);
--------------------------------------------------------------------------------
/homeworks/week12/hw1/handle_update.php:
--------------------------------------------------------------------------------
1 | alert('標題和內容不可空白唷 !');parent.location.href='./update.php';";
8 | } else {
9 | $stmt = $conn->prepare("UPDATE `claygao_comments` SET title = ?, content = ? WHERE id = ?");
10 | $stmt->bind_param("ssi", $title, $content, $id);
11 |
12 | if ($stmt->execute()) {
13 | echo "";
14 | } else {
15 | echo "";
16 | }
17 | }
18 |
19 | /**
20 | * 下下週新增功能 :
21 | *
22 | * 可以覆蓋 created_at,讓留言板顯示的編輯時間為最後編輯時間
23 | * 沒錯 Week12 依舊沒做 QQ
24 | */
25 | ?>
--------------------------------------------------------------------------------
/homeworks/week13/hw3/handling/board_comments_sub1.php:
--------------------------------------------------------------------------------
1 | prepare("SELECT * FROM claygao_comments_sub1");
14 | $stmt->execute();
15 | $result = $stmt->get_result();
16 | while($row = $result->fetch_assoc()) {
17 | $sub_comment = new Sub_comments();
18 | $sub_comment->parent_id = $row['parent_id'];
19 | $sub_comment->nickname = XSSDef($row['nickname']);
20 | $sub_comment->sub_content = XSSDef($row['sub_content']);
21 | $sub_comment->created_at = XSSDef($row['created_at']);
22 | $arr[] = $sub_comment;
23 | }
24 | echo json_encode($arr, JSON_UNESCAPED_UNICODE);
25 | ?>
--------------------------------------------------------------------------------
/homeworks/week14/hw1.md:
--------------------------------------------------------------------------------
1 | # 短網址服務系統
2 |
3 | 
4 |
5 | 1. 使用者輸入原網址,按下發送
6 | 2. 伺服器端的 Load Balancer 收到 Request,經由運算之後決定讓其中一台 Server 處理
7 | 3. Server 先檢查 cache 中有無相同資料,若無,則找尋資料庫;若有,則返還 cache 中資料
8 | 4. 若資料庫也無對應資料,則寫入資料庫與 cache
9 |
10 | 簡單補充 :
11 |
12 | 1. 存取 cache 的 Server 與接收使用者請求的 Server 不一樣,如何比對資料?
13 |
14 | - 使用 NFS ( Network FileSystem )
15 |
16 | 簡單來說就是讓不同機器 / 不同作業系統彼此分享檔案
17 |
18 | - 網路空間 ( 如 AWS )
19 |
20 | 2. 不同的 Server 如何辨識同一個 User 的 Session ?
21 |
22 | - 在 Server 主機程式中使用叢集 ( Cluster ) 連接各伺服器,以達到「共有 Session 」
23 |
24 | - 自行設計 Session 機制,比如說設立一個讓所有 Server 都可以存取資料的地方
25 |
26 | 資料來源 :
27 |
28 | [大架構的概念與程式設計系列文章](http://akuma1.pixnet.net/blog/post/168180962-%E5%A4%A7%E6%9E%B6%E6%A7%8B%E7%9A%84%E6%A6%82%E5%BF%B5%E8%88%87%E7%A8%8B%E5%BC%8F%E8%A8%AD%E8%A8%88%EF%BC%8D%EF%BC%8D%EF%BC%88%E4%B8%80%EF%BC%89%E5%B0%8E%E8%AB%96)
--------------------------------------------------------------------------------
/homeworks/week9/hw2/handle_register_form.php:
--------------------------------------------------------------------------------
1 | query($sql);
19 |
20 | if ($result) {
21 | echo "Success!";
22 | setcookie("member_id", $username, time()+3600*24);
23 | header('Location: ./index.php');
24 | } else {
25 | echo "Failed!可能是這個帳號被使用過了 ! ";
26 | }
27 | ?>
--------------------------------------------------------------------------------
/homeworks/week13/hw3/handling/board_comments.php:
--------------------------------------------------------------------------------
1 | prepare("SELECT * FROM claygao_comments");
16 | $stmt->execute();
17 | $result = $stmt->get_result();
18 | while($row = $result->fetch_assoc()) {
19 | $comment = new Comments();
20 | $comment->id = $row['id'];
21 | $comment->nickname = XSSDef($row['nickname']);
22 | $comment->title = XSSDef($row['title']);
23 | $comment->content = XSSDef($row['content']);
24 | $comment->created_at = XSSDef($row['created_at']);
25 | $arr[] = $comment;
26 | }
27 | echo json_encode($arr, JSON_UNESCAPED_UNICODE);
28 | ?>
--------------------------------------------------------------------------------
/homeworks/week18/hw1/gulpfile.js:
--------------------------------------------------------------------------------
1 |
2 |
3 | const gulp = require('gulp');
4 | const sass = require('gulp-sass');
5 | const babel = require('gulp-babel');
6 | const minify = require('gulp-minify');
7 | const del = require('del');
8 |
9 | sass.compiler = require('node-sass');
10 |
11 | // Sass 使用內建壓縮
12 | function sassToCSS() {
13 | return gulp.src('./sass/**/*.scss')
14 | .pipe(sass({
15 | outputStyle: 'compressed', // 這邊就可以壓縮
16 | }).on('error', sass.logError)) // 有錯誤會 log 出來
17 | .pipe(gulp.dest('./dist/css')); //
18 | }
19 |
20 | // Babel 搭配 minify-js
21 | function runBabel(done) {
22 | gulp.src('./lib/*.js')
23 | .pipe(babel())
24 | .pipe(minify())
25 | .pipe(gulp.dest('./dist/js'));
26 | done();
27 | }
28 |
29 | // 清空檔案
30 | function clean() {
31 | return del(['dist']);
32 | }
33 |
34 | const test = gulp.series(clean, sassToCSS, runBabel);
35 | gulp.task('default', test);
36 |
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/build/asset-manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "files": {
3 | "main.css": "./static/css/main.8944381c.chunk.css",
4 | "main.js": "./static/js/main.754a5e05.chunk.js",
5 | "main.js.map": "./static/js/main.754a5e05.chunk.js.map",
6 | "runtime-main.js": "./static/js/runtime-main.04a13e19.js",
7 | "runtime-main.js.map": "./static/js/runtime-main.04a13e19.js.map",
8 | "static/js/2.2f7e563d.chunk.js": "./static/js/2.2f7e563d.chunk.js",
9 | "static/js/2.2f7e563d.chunk.js.map": "./static/js/2.2f7e563d.chunk.js.map",
10 | "index.html": "./index.html",
11 | "precache-manifest.0d8b7f79fb8c158922a01fa8b498579c.js": "./precache-manifest.0d8b7f79fb8c158922a01fa8b498579c.js",
12 | "service-worker.js": "./service-worker.js",
13 | "static/css/main.8944381c.chunk.css.map": "./static/css/main.8944381c.chunk.css.map",
14 | "static/media/App.scss": "./static/media/bg.54e40ca1.jpg"
15 | }
16 | }
--------------------------------------------------------------------------------
/homeworks/week23/fe/hw1/src/WebAPI.js:
--------------------------------------------------------------------------------
1 | import axios from 'axios';
2 |
3 | const url = 'https://qootest.com/posts'
4 | const weatherAuth = 'CWB-8D8B5254-991F-47D6-A679-B8EE1C6CDAE2'
5 | const weatherDataId = 'F-C0032-001'
6 |
7 | export const getPosts = () => axios.get(url + '?_sort=id&_order=desc')
8 |
9 | export const getRecentPosts = () => axios.get(url + '?_sort=id&_order=desc&_limit=3')
10 |
11 | export const sendSinglePost = (data) => axios.post(url, data)
12 |
13 | export const getSinglePost = (listId) => axios.get(url + '/' + listId)
14 |
15 | export const editSinglePost = (listId, title, body) => axios.patch(url + '/' + listId,{ title:title, body:body})
16 |
17 | export const deleteSinglePost = (listId) => axios.delete(url + '/' + listId)
18 |
19 | // 取得天氣 API
20 | export const getWeather = () => axios.get(`https://opendata.cwb.gov.tw/fileapi/v1/opendataapi/${weatherDataId}?Authorization=${ weatherAuth}&format=JSON`)
21 |
22 |
--------------------------------------------------------------------------------
/homeworks/week8/hw2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 歡迎來到王媽留言板
5 |
6 |
7 |
8 |
9 |
15 |
16 |
17 |
18 |
19 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/homeworks/week13/hw1/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | RWD 網格
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
1
14 |
2
15 |
3
16 |
4
17 |
5
18 |
6
19 |
7
20 |
8
21 |
9
22 |
10
23 |
11
24 |
12
25 |
13
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw2/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "todo-list",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "webpack.config.js",
6 | "dependencies": {},
7 | "devDependencies": {
8 | "@babel/core": "^7.6.0",
9 | "@babel/preset-env": "^7.6.0",
10 | "@babel/preset-react": "^7.0.0",
11 | "babel-loader": "^8.0.6",
12 | "css-loader": "^3.2.0",
13 | "html-webpack-plugin": "^3.2.0",
14 | "node-sass": "^4.12.0",
15 | "react": "^16.9.0",
16 | "react-dom": "^16.9.0",
17 | "sass-loader": "^8.0.0",
18 | "style-loader": "^1.0.0",
19 | "webpack": "^4.39.3",
20 | "webpack-cli": "^3.3.8",
21 | "webpack-dev-server": "^3.8.0"
22 | },
23 | "scripts": {
24 | "test": "echo \"Error: no test specified\" && exit 1",
25 | "start": "webpack-dev-server --mode development --open --hot",
26 | "build": "webpack --mode production"
27 | },
28 | "author": "",
29 | "license": "ISC"
30 | }
31 |
--------------------------------------------------------------------------------
/examples/week17/README.md:
--------------------------------------------------------------------------------
1 | # 注意事項
2 |
3 | 提示:在寫完作業之後看效果最佳,沒寫作業前請不要看
4 |
5 | ## Callback queues
6 |
7 | 這一週附上的 event loop 影片應該就講的滿清楚的了,但大部分同學都會忽略掉一個小細節。
8 |
9 | 以下面的程式碼為例:
10 |
11 | ``` js
12 | setTimeout(() => {
13 | console.log('hello')
14 | }, 0)
15 | ```
16 |
17 | 執行流程是什麼?
18 |
19 | 是先把這整段放到 call stack 裡面去執行,所以才會執行 setTimeout 這個 function。然後 setTimeout 是 web API,呼叫瀏覽器幫忙設定一個 0 ms 後到期的定時器,到期之後就會把第一個參數:`() => {console.log('hello')}` 放進去 callback queues。
20 |
21 | 這邊最多人誤解的點就是會把 `setTimeout(...)` 整段丟進去 callback queues,不是這樣的,只會把第一個參數丟進去而已。你必須先執行 setTimeout 才能設定計時器,才能把第一個參數丟進去 callback queues。
22 |
23 | 設定完成以後從 call stack pop 出來,main 也 pop,stack 清空,把 `() => {console.log('hello')}` 丟進去 call stack,執行之後發現這個 function 裡面還要呼叫 `console.log('hello')`,所以把 console.log 丟進去 call stack,印出 hello,pop,然後原本的 function 也沒東西要執行了所以也 pop,stack 清空,結束。
24 |
25 |
26 | ## Function expression 的初始化
27 |
28 | 這邊可以參考我跟同學們的討論:https://github.com/Lidemy/mentor-program-3rd-ClayGao/pull/24
29 |
--------------------------------------------------------------------------------
/homeworks/week18/hw3/dist/main.js:
--------------------------------------------------------------------------------
1 | const taskList = [];
2 |
3 | function render() {
4 | $('.list-todo').empty();
5 | for (let i = 0; i < taskList.length; i += 1) {
6 | const $newTask = $(`
7 |
8 | ${taskList[i]}
9 |
10 | `);
11 | $('.list-todo').append($newTask);
12 | }
13 | $('.list-todo > li').click((e) => {
14 | if (e.target.type !== 'checkbox') return;
15 | taskList.splice(e.target.name, 1);
16 | render();
17 | });
18 | }
19 |
20 | function addTask(task) {
21 | taskList.push(task);
22 | render();
23 | }
24 |
25 | $('.input__block').keydown((e) => {
26 | if (e.key === 'Enter' && e.target.value !== '') {
27 | addTask(e.target.value);
28 | e.target.value = '';
29 | }
30 | });
31 |
32 | $('#input').click(() => {
33 | alert('不要點我,鍵盤按 Enter 就好');
34 | });
35 |
--------------------------------------------------------------------------------
/homeworks/week24/fe/hw1/src/components/about/About.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactMarkdown from 'react-markdown'
3 |
4 | const About = () => {
5 | return (
6 |
7 |
8 | About Blog
9 |
10 |
11 |
19 |
20 | Author: Clay Gao
21 |
22 |
23 |
24 | )
25 | }
26 |
27 |
28 | export default About
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/src/about/About.js:
--------------------------------------------------------------------------------
1 | import React, {Component} from 'react';
2 | import ReactMarkdown from 'react-markdown'
3 |
4 | const About = () => {
5 | return (
6 |
7 |
8 | About Blog
9 |
10 |
11 |
19 |
20 | Author: Clay Gao
21 |
22 |
23 |
24 | )
25 | }
26 |
27 |
28 | export default About
--------------------------------------------------------------------------------
/homeworks/week11/hw1/write.php:
--------------------------------------------------------------------------------
1 | alert('您沒有權限訪問這個頁面!');parent.location.href='./index.php';"; }
5 | ?>
6 |
7 |
8 |
9 |
10 | Love Message Board
11 |
12 |
13 |
19 |
20 |
21 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/homeworks/week12/hw1/write.php:
--------------------------------------------------------------------------------
1 | alert('您沒有權限訪問這個頁面!');parent.location.href='./index.php';"; }
5 | ?>
6 |
7 |
8 |
9 |
10 | Love Message Board
11 |
12 |
13 |
19 |
20 |
21 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/homeworks/week19/README.md:
--------------------------------------------------------------------------------
1 | # 作業
2 |
3 | ## hw1:Todo list
4 |
5 | 還記得你的好朋友 h0w 哥嗎?
6 |
7 | 他最近實在是太忙太忙了,接了一大堆案子跟業配,完全忙不過來。而現在最困擾他的事情是有時候會忘記廠商交代的事情,最後被罵個臭頭。這時候他想到了之前樂於助人的你,於是跑來找你,希望你能幫他做一個 Todo list 的 API 就好,只有 API 而已,可以不用有前端沒關係,前端他會再找其他朋友來做。
8 |
9 | 因此,你的任務就是幫 h0w 哥做一個 Todo list 的 API,需要有以下功能:
10 |
11 | 1. 獲取所有 todo
12 | 2. 讀取單一 todo
13 | 3. 刪除 todo
14 | 4. 新增 todo
15 | 5. 修改 todo
16 | 6. 一個 todo 會有內容跟狀態,狀態可分為兩種:已完成跟未完成。
17 |
18 | ## hw2:邊緣人
19 |
20 | 當你完成了 todo list API 兩天以後,h0w 哥又跑過來找你:「欸欸,可以幫我把前端也做一做嗎?」
21 |
22 | 『靠北喔,阿你之前不是說要找其他朋友幫你做』
23 |
24 | 「可是我...沒朋友」
25 |
26 | 『嗚嗚...這真是太可憐了,那我就幫你做吧!』
27 |
28 | 於是乎,你就接下了這個燙手山芋,決定好人做到底,把前端的部分也做一做,但這次 h0w 哥提出了一個前所未見的需求:為了使用者體驗著想,我希望前端永遠不會換頁,都在同一個頁面上操作。
29 |
30 | 翻成技術白話文,意思就是:所有跟後端的溝通都透過 ajax,這樣就不會換頁了。
31 |
32 | 因此,這就是你的任務!請實作出一個不會換頁的 todo list,並跟上一個作業自己寫出來的 api 串接。
33 |
34 | ## hw3:簡答題
35 |
36 | 1. 請簡單解釋什麼是 Single Page Application
37 | 2. SPA 的優缺點為何
38 |
39 | 請將答案寫在 [hw3.md](hw3.md)。
40 |
41 | ## 挑戰題
42 |
43 | 無
44 |
45 |
46 | ## 超級挑戰題
47 |
48 | 無
49 |
50 |
--------------------------------------------------------------------------------
/homeworks/week23/fe/hw1/src/components/about/About.js:
--------------------------------------------------------------------------------
1 | import React, {Component} from 'react';
2 | import ReactMarkdown from 'react-markdown'
3 |
4 | const About = () => {
5 | return (
6 |
7 |
8 | About Blog
9 |
10 |
11 |
19 |
20 | Author: Clay Gao
21 |
22 |
23 |
24 | )
25 | }
26 |
27 |
28 | export default About
--------------------------------------------------------------------------------
/homeworks/week11/hw1/handle_write.php:
--------------------------------------------------------------------------------
1 | alert('標題和內容不可空白唷 !');parent.location.href='./write.php';";
8 | } else {
9 | $sql = "SELECT * FROM `claygao_users` WHERE `id_number` = '$id'";
10 | $result = $conn->query($sql);
11 | $row = $result->fetch_assoc();
12 | $nickName = $row['nickname'];
13 | $id_number = $row['id_number'];
14 |
15 | $sql = "INSERT INTO `claygao_comments`(`title`, `content`, `nickname`, `id_number`) VALUES('$title', '$content', '$nickName', '$id_number')";
16 | $result = $conn->query($sql);
17 | if ($result) {
18 | echo "";
19 | } else {
20 | echo "";
21 | }
22 | }
23 | ?>
--------------------------------------------------------------------------------
/homeworks/week11/hw1/register.php:
--------------------------------------------------------------------------------
1 | alert('本站為練習用網站,因教學用途刻意忽略資安的實作,註冊時請勿使用任何真實的帳號或密碼')";
4 | ?>
5 |
6 |
7 |
8 |
9 | Love Message Board
10 |
11 |
12 |
18 |
19 |
20 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/homeworks/week12/hw1/register.php:
--------------------------------------------------------------------------------
1 | alert('本站為練習用網站,因教學用途刻意忽略資安的實作,註冊時請勿使用任何真實的帳號或密碼')";
4 | ?>
5 |
6 |
7 |
8 |
9 | Love Message Board
10 |
11 |
12 |
18 |
19 |
20 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "my-app",
3 | "version": "0.1.0",
4 | "private": true,
5 | "homepage": ".",
6 | "dependencies": {
7 | "axios": "^0.19.0",
8 | "node-sass": "^4.12.0",
9 | "react": "^16.9.0",
10 | "react-dom": "^16.9.0",
11 | "react-markdown": "^4.2.2",
12 | "react-remarkable": "^1.1.3",
13 | "react-router-dom": "^5.0.1",
14 | "react-scripts": "3.1.2",
15 | "remarkable": "^2.0.0",
16 | "remarkable-react": "^1.4.1"
17 | },
18 | "scripts": {
19 | "start": "react-scripts start",
20 | "build": "react-scripts build",
21 | "test": "react-scripts test",
22 | "eject": "react-scripts eject"
23 | },
24 | "eslintConfig": {
25 | "extends": "react-app"
26 | },
27 | "browserslist": {
28 | "production": [
29 | ">0.2%",
30 | "not dead",
31 | "not op_mini all"
32 | ],
33 | "development": [
34 | "last 1 chrome version",
35 | "last 1 firefox version",
36 | "last 1 safari version"
37 | ]
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/homeworks/week13/hw3/register.php:
--------------------------------------------------------------------------------
1 | alert('本站為練習用網站,因教學用途刻意忽略資安的實作,註冊時請勿使用任何真實的帳號或密碼')";
4 | ?>
5 |
6 |
7 |
8 |
9 | Love Message Board
10 |
11 |
12 |
18 |
19 |
20 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/homeworks/week1/hw1.md:
--------------------------------------------------------------------------------
1 | ## 交作業流程
2 |
3 | - 前置
4 |
5 |
6 | 1. 寫作業保持良好習慣,開一個新的 branch,本周作業我命名為 week1
7 |
8 | 2. 寫好之後,先上傳到 GitHub,一樣保持在 week1 這個 branch
9 |
10 | 3. 記得先連線,輸入以下語法,目的是取得連線
11 |
12 | git remote add origin https://github.com/Lidemy/mentor-program-3rd-ClayGao.git
13 |
14 | 4. 之後再 push 上去
15 |
16 | git push origin week1
17 |
18 | 5. 回到 GitHub,在 Github 端你會看到一個訊息,表示你有一個新的 branch 剛剛被 push 上來
19 | 6. 點擊右邊綠色按鈕 Compare & pull request
20 | 7. 進入畫面後看到 base : master <- compare : week1,接著在留言欄部分輸入你想輸入的標題(這邊不限格式內容),與你想說的話或問題。好了點擊右下按鈕 Create pull request,並將網址複製下來。
21 | 8. 去另外一個 repo,名稱為 homework-3rd ( 你可以在 Lidemy底下直接搜尋名字 )
22 | 9. 承上,在該 repo 的 Issues 頁面底下建立一個 New Issue,並照正確格式輸入標題 [Week1],然後在下列 Write 的部分貼上剛剛複製的網址,讓老師可以連結到你的作業。
23 | 其餘空白部分也可以寫你想寫的話。
24 | 10. 老師如果改完作業並覺得 OK,就會 merge Week1,然後刪除 Week1 這個 branch,並且關閉該 Issue。
25 | 11. 承上,這時候你就可以回到本地端,checkout 回 master,然後 pull 老師已經改完並完成 merging 的 master 到本地端,接著你再把 Week1 這個 branch 刪除。
26 | 12. 完成。
27 |
28 | - 總結:完成作業 -> push branch -> Issue 留言貼網址 -> ***老師改完,merge branch 並關閉 Issue*** -> pull master ->刪除本地端 branch
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw2/webpack.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path')
2 | const HtmlWebpackPlugin = require("html-webpack-plugin")
3 |
4 | module.exports = {
5 | entry: './src/index.js',
6 | output: {
7 | path: path.resolve(__dirname, './dist'),
8 | filename: 'bundle.[hash].js'
9 | },
10 | module: {
11 | rules: [
12 | {
13 | test: /\.js/,
14 | exclude: /node_modules/,
15 | loader:'babel-loader'
16 | },
17 | {
18 | test: /\.s[ac]ss$/i,
19 | use: [
20 | // Creates `style` nodes from JS strings
21 | 'style-loader',
22 | // Translates CSS into CommonJS
23 | 'css-loader',
24 | // Compiles Sass to CSS
25 | 'sass-loader',
26 | ],
27 | },
28 | ]
29 | },
30 | plugins: [
31 | new HtmlWebpackPlugin({
32 | template: './index.html'
33 | })
34 | ]
35 | }
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw1/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "todo-list",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "webpack.config.js",
6 | "dependencies": {},
7 | "devDependencies": {
8 | "@babel/core": "^7.6.0",
9 | "@babel/preset-env": "^7.6.0",
10 | "@babel/preset-react": "^7.0.0",
11 | "babel-loader": "^8.0.6",
12 | "css-loader": "^3.2.0",
13 | "expose-loader": "^0.7.5",
14 | "file-loader": "^4.2.0",
15 | "html-webpack-plugin": "^3.2.0",
16 | "jquery": "^3.4.1",
17 | "node-sass": "^4.12.0",
18 | "react": "^16.9.0",
19 | "react-dom": "^16.9.0",
20 | "sass-loader": "^8.0.0",
21 | "style-loader": "^1.0.0",
22 | "url-loader": "^2.1.0",
23 | "webpack": "^4.39.3",
24 | "webpack-cli": "^3.3.8",
25 | "webpack-dev-server": "^3.8.0"
26 | },
27 | "scripts": {
28 | "test": "echo \"Error: no test specified\" && exit 1",
29 | "start": "webpack-dev-server --mode development --open --hot",
30 | "build": "webpack --mode production"
31 | },
32 | "author": "",
33 | "license": "ISC"
34 | }
35 |
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw3/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "todo-list",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "webpack.config.js",
6 | "dependencies": {},
7 | "devDependencies": {
8 | "@babel/core": "^7.6.0",
9 | "@babel/preset-env": "^7.6.0",
10 | "@babel/preset-react": "^7.0.0",
11 | "babel-loader": "^8.0.6",
12 | "css-loader": "^3.2.0",
13 | "expose-loader": "^0.7.5",
14 | "file-loader": "^4.2.0",
15 | "html-webpack-plugin": "^3.2.0",
16 | "jquery": "^3.4.1",
17 | "node-sass": "^4.12.0",
18 | "react": "^16.9.0",
19 | "react-dom": "^16.9.0",
20 | "sass-loader": "^8.0.0",
21 | "style-loader": "^1.0.0",
22 | "url-loader": "^2.1.0",
23 | "webpack": "^4.39.3",
24 | "webpack-cli": "^3.3.8",
25 | "webpack-dev-server": "^3.8.0"
26 | },
27 | "scripts": {
28 | "test": "echo \"Error: no test specified\" && exit 1",
29 | "start": "webpack-dev-server --mode development --open --hot",
30 | "build": "webpack --mode production"
31 | },
32 | "author": "",
33 | "license": "ISC"
34 | }
35 |
--------------------------------------------------------------------------------
/homeworks/week9/hw2/index.php:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
11 |
12 |
13 |
Walk here and write your story
14 |
15 | query($sql);
18 | if ($result->num_rows > 0) {
19 | while($row = $result->fetch_assoc()) {
20 | echo "
";
21 | echo "
第 " . $row['id'] . " 樓
";
22 | echo "
作者 :" . $row['name'] . "
";
23 | echo "
" . $row['title'] . "
";
24 | echo "
" . $row['content'] . "
";
25 | echo "
" .$row['created_at'] . "
";
26 | echo "
";
27 | }
28 | }
29 | ?>
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/homeworks/week11/hw1/handle_register.php:
--------------------------------------------------------------------------------
1 | alert('有內容未輸入 !');parent.location.href='./register.php';";
12 | }
13 |
14 | // 檢查前後密碼是否相符
15 | if ( $password !== $password2 ) {
16 | echo "";
17 | }
18 |
19 | $passwordHash = password_hash($password, PASSWORD_DEFAULT);
20 |
21 | $sql = "INSERT INTO `claygao_users`(`id_number`, `password`, `nickname`) VALUES('$idNumber', '$passwordHash', '$nickName')";
22 | $result = $conn->query($sql);
23 | if($result) {
24 | echo "";
25 | } else {
26 | echo "";
27 | }
28 | ?>
--------------------------------------------------------------------------------
/homeworks/week24/fe/hw1/src/containers/PostContainer.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { connect } from 'react-redux'
3 | import Post from '../components/post'
4 | import { getSinglePost, deleteSinglePost, beginEditSinglePost, editSinglePost } from '../actions'
5 |
6 | const PostContainer = props => {
7 | return
8 | }
9 |
10 | const mapStateToProps = state => {
11 | return {
12 | isEdited: state.editSinglePostReducer.isEdited,
13 | isDeleted: state.editSinglePostReducer.isDeleted,
14 | isLoadingSinglePost: state.getSinglePostReducer.isLoadingSinglePost,
15 | singlePostData: state.getSinglePostReducer.singlePostData,
16 | isEditing: state.editSinglePostReducer.isEditing,
17 | title: state.editSinglePostReducer.title,
18 | body: state.editSinglePostReducer.body
19 | }
20 | }
21 |
22 | const mapDispatchToProps = {
23 | getSinglePost,
24 | deleteSinglePost,
25 | beginEditSinglePost,
26 | editSinglePost
27 | }
28 |
29 | export default connect(mapStateToProps, mapDispatchToProps)(PostContainer)
--------------------------------------------------------------------------------
/homeworks/week23/fe/hw1/src/containers/PostListContainer.js:
--------------------------------------------------------------------------------
1 | import React, {Component} from 'react';
2 | import { connect } from 'react-redux'
3 | import { BrowserRouter as Router, Route, Link, withRouter } from "react-router-dom";
4 | import { getPosts } from '../WebAPI'
5 | import PostList from '../components/post_list'
6 | import * as actions from '../actions'
7 |
8 | const PostListContainer = props => {
9 | return
10 | }
11 |
12 | const mapStateToProps = state => {
13 | return {
14 | isLoadingGetPosts: state.getPostsReducer.isLoadingGetPosts,
15 | postListData: state.getPostsReducer.postListData,
16 | }
17 | }
18 |
19 | const mapDispatchToProps = dispatch => {
20 | return {
21 | getPostList: () => {
22 | dispatch(actions.getPosts())
23 | getPosts().then(resp => {
24 | dispatch(actions.getPostsSuccess(resp.data))
25 | })
26 | }
27 | }
28 | }
29 |
30 |
31 |
32 |
33 |
34 | export default withRouter(connect(mapStateToProps, mapDispatchToProps)(PostListContainer))
--------------------------------------------------------------------------------
/homeworks/week13/hw1/style.css:
--------------------------------------------------------------------------------
1 | .container {
2 | height: 900px;
3 | width: 960px;
4 | margin: 0 auto;
5 | min-width: 960px;
6 | text-align: center;
7 | }
8 |
9 | .grid > div {
10 | border:1px solid black;
11 | box-sizing:border-box;
12 | }
13 |
14 | .grid {
15 | display: grid;
16 | grid-template-columns: repeat(12, 1fr);
17 | grid-column-gap: 10px;
18 | grid-row-gap: 10px;
19 | }
20 |
21 | .grid > div {
22 | background-color: pink;
23 | }
24 |
25 | .col-1 { grid-column: span 1 }
26 | .col-2 { grid-column: span 2 }
27 | .col-3 { grid-column: span 3 }
28 | .col-4 { grid-column: span 4 }
29 | .col-5 { grid-column: span 5 }
30 | .col-6 { grid-column: span 6 }
31 | .col-7 { grid-column: span 7 }
32 | .col-8 { grid-column: span 8 }
33 | .col-9 { grid-column: span 9 }
34 | .col-10 { grid-column: span 10 }
35 | .col-11 { grid-column: span 11 }
36 | .col-12 { grid-column: span 12 }
37 |
38 |
39 | @media screen and (max-width: 720px) {
40 | .col-1,.col-2,.col-3,.col-4,.col-5,.col-6,.col-7,.col-8,.col-9,.col-10,.col-11,.col-12 {grid-column: 1/13;}
41 | }
42 |
43 |
--------------------------------------------------------------------------------
/homeworks/week4/hwS1.js:
--------------------------------------------------------------------------------
1 | const request = require('request');
2 |
3 | const clientID = 'qn5gw8fvspu3jaw1lqymckhb9zqyqx';
4 |
5 | request({
6 | url: 'https://api.twitch.tv/helix/streams?game_id=21779&sort=views&first=100',
7 | method: 'GET',
8 | headers: {
9 | 'Client-ID': clientID,
10 | },
11 | }, (error, response, body) => {
12 | const obj = JSON.parse(body);
13 |
14 | const afterStr = obj.pagination.cursor;
15 |
16 | for (let i = 0; i < obj.data.length; i += 1) {
17 | console.log(`ID : ${obj.data[i].id} Name : ${obj.data[i].user_name} Views : ${obj.data[i].viewer_count}`);
18 | }
19 | request({
20 | url: `https://api.twitch.tv/helix/streams?game_id=21779&sort=views&first=100&after=${afterStr}`,
21 | method: 'GET',
22 | headers: {
23 | 'Client-ID': clientID,
24 | },
25 | }, (error2, response2, body2) => {
26 | const obj2 = JSON.parse(body2);
27 |
28 | for (let i = 0; i < obj2.data.length; i += 1) {
29 | console.log(`ID : ${obj2.data[i].id} Name : ${obj2.data[i].user_name} Views : ${obj2.data[i].viewer_count}`);
30 | }
31 | });
32 | });
33 |
--------------------------------------------------------------------------------
/homeworks/week12/hw1/handle_register.php:
--------------------------------------------------------------------------------
1 | alert('有內容未輸入 !');parent.location.href='./register.php';";
12 | }
13 |
14 | // 檢查前後密碼是否相符
15 | if ( $password !== $password2 ) {
16 | echo "";
17 | }
18 |
19 | $passwordHash = password_hash($password, PASSWORD_DEFAULT);
20 |
21 | $stmt = $conn->prepare("INSERT INTO claygao_users(id_number, password, nickname) VALUES (?, ?, ?)");
22 | $stmt->bind_param("sss", $idNumber, $passwordHash, $nickName);
23 |
24 | if($stmt->execute()) {
25 | echo "";
26 | } else {
27 | echo "";
28 | }
29 | ?>
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/src/nav/Nav.js:
--------------------------------------------------------------------------------
1 | import React, {Component} from 'react';
2 | import { BrowserRouter as Router, Route, Link } from "react-router-dom";
3 |
4 |
5 | function Tab({ label, to, exact }) {
6 | return (
7 | (
11 |
12 | {label}
13 |
14 | )}
15 | />
16 | );
17 | }
18 |
19 | const Nav = ({isMove}) => {
20 | return (
21 |
32 | )
33 | }
34 |
35 |
36 | export default Nav
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/homeworks/week13/hw3/handling/handle_register.php:
--------------------------------------------------------------------------------
1 | alert('有內容未輸入 !');parent.location.href='../register.php';";
12 | }
13 |
14 | // 檢查前後密碼是否相符
15 | if ( $password !== $password2 ) {
16 | echo "";
17 | }
18 |
19 | $passwordHash = password_hash($password, PASSWORD_DEFAULT);
20 |
21 | $stmt = $conn->prepare("INSERT INTO claygao_users(id_number, password, nickname) VALUES (?, ?, ?)");
22 | $stmt->bind_param("sss", $idNumber, $passwordHash, $nickName);
23 |
24 | if($stmt->execute()) {
25 | echo "";
26 | } else {
27 | echo "";
28 | }
29 | ?>
--------------------------------------------------------------------------------
/homeworks/week13/hw3/handling/handle_sign_in.php:
--------------------------------------------------------------------------------
1 | alert('帳號密碼未輸入 !');parent.location.href='../sign_in.php';";
10 | } else {
11 | // 比對使用者資料庫中該使用者的密碼是否相符
12 | $stmt = $conn->prepare("SELECT * FROM `claygao_users` WHERE `id_number` = ?");
13 | $stmt->bind_param("s", $idNumberSignIn);
14 | $stmt->execute();
15 | $result = $stmt->get_result();
16 | $row = $result->fetch_assoc();
17 | $verify = password_verify($passwordSignIn , $row['password']); // 比對密碼是否相符
18 |
19 | if ( $verify ) {
20 | session_start(); // 啟動 Session
21 | $_SESSION['id_number'] = $row['id_number'];
22 | $_SESSION['nickname'] = $row['nickname'];
23 | echo "";
24 | } else {
25 | echo "";
26 | }
27 | }
28 | ?>
--------------------------------------------------------------------------------
/homeworks/week14/README.md:
--------------------------------------------------------------------------------
1 | # 作業
2 |
3 | ## hw1:短網址系統設計
4 |
5 | 請你畫出一張短網址服務的後端系統架構圖,越詳細越好,可以考慮到如何增進效能、scaling 以及備份資料。
6 |
7 | 沒靈感的話可參考:[短网址(short URL)系统的原理及其实现](https://hufangyun.com/2017/short-url/)、[Design TinyURL](https://leetcode.com/problems/design-tinyurl/description/)
8 |
9 | 圖片可參考下圖(這是一張 Mobile 與 Web 前端如何跟後端溝通的圖,這示意圖只是大概講一下應該要怎麼畫,但你實際畫出來一定跟這個長得不一樣):
10 | 
11 |
12 | ## hw2:部署
13 |
14 | 請把你之前寫的 PHP 程式部署到自己的機器上面,並且對應到自己購買的網域。
15 |
16 | 可參考其他同學的心得(特別感謝 @yuchun33 跟 @futianshen ):
17 | 1. [部署 AWS EC2 遠端主機 + Ubuntu LAMP 環境 + phpmyadmin ](https://github.com/Lidemy/mentor-program-2nd-yuchun33/issues/15)
18 | 2. [一小時完成 VPS (Virtual Private Server) 部署 ](https://github.com/Lidemy/mentor-program-2nd-futianshen/issues/21)
19 |
20 | ## hw3:簡答題
21 |
22 | 1. 什麼是 DNS?Google 有提供的公開的 DNS,對 Google 的好處以及對一般大眾的好處是什麼?
23 | 2. 什麼是資料庫的 lock?為什麼我們需要 lock?
24 | 3. NoSQL 跟 SQL 的差別在哪裡?
25 | 4. 資料庫的 ACID 是什麼?
26 |
27 | 請將答案寫在 [hw3.md](hw3.md)。
28 |
29 | ## 挑戰題
30 |
31 | 在主機上使用 nginx 來當伺服器而不是 Apache。
32 |
33 | ## 超級挑戰題
34 |
35 | 使用 Docker 把 PHP 留言板以及資料庫都包進去,並且使用 Docker 來部署。
36 |
--------------------------------------------------------------------------------
/homeworks/week23/fe/hw1/src/containers/HomeContainer.js:
--------------------------------------------------------------------------------
1 | import React, {Component} from 'react';
2 | import { BrowserRouter as Router, Route, Link, withRouter } from "react-router-dom";
3 | import { getRecentPosts } from '../WebAPI'
4 | import Home from '../components/home'
5 | import * as actions from '../actions'
6 | import { connect } from 'react-redux'
7 |
8 | const HomeContainer = props => {
9 | return
10 | }
11 |
12 | const mapStateToProps = state => {
13 | return {
14 | postListData: state.getPostsReducer.postListData,
15 | weatherData: state.getWeatherReducer.weatherData,
16 | isLoadingGetWeatherData: state.getWeatherReducer.isLoadingGetWeatherData
17 | }
18 | }
19 |
20 | const mapDispatchToProps = dispatch => {
21 | return {
22 | getPostList: () => {
23 | dispatch(actions.getPosts())
24 | getRecentPosts().then(resp => {
25 | dispatch(actions.getPostsSuccess(resp.data))
26 | })
27 | }
28 | }
29 | }
30 |
31 | export default withRouter(connect(mapStateToProps, mapDispatchToProps)(HomeContainer))
--------------------------------------------------------------------------------
/examples/week9/README.md:
--------------------------------------------------------------------------------
1 | # 注意事項
2 |
3 | ### 注意,以下都與第九週作業簡答題相關,還沒寫完請不要看喔!
4 |
5 |
6 | ## 資料庫欄位型態 VARCHAR 跟 TEXT 的差別是什麼
7 |
8 | 網路上查可以查到很多相關資料,但我個人覺得最重要的一個點在於 VARCHAR 可以設長度但是 TEXT 不行。
9 |
10 | 意思就是說,當你本來就知道大概會需要多少字元的時候,就用 VARCHAR,真的逼不得已東西很長(例如說要存文章)的時候才用 TEXT,才能節省空間。
11 |
12 | ## Cookie 跟 Session 不要搞混了
13 |
14 | 這週其實還沒講到 Session 的概念,為的其實就是希望大家不要搞混。但因為之前 CS101 火球術其實已經提到了,所以反而有點弄巧成拙(?),還是滿多人搞混的。
15 |
16 | 請大家注意這一週作業問的問題:
17 |
18 | > Cookie 是什麼?在 HTTP 這一層要怎麼設定 Cookie,瀏覽器又會以什麼形式帶去 Server?
19 |
20 | 如果是我的話大概會這樣答:
21 |
22 | Cookie 是個儲存在瀏覽器的小型文字檔案,在 HTTP 這層 Server 可以透過 Set-Cookie 這個 response header 來讓瀏覽器儲存相對應的 Cookie。而瀏覽器發送 Request 時,會把相對應的 Cookie 放在 `Cookie` 這個 Header,Server 就可以拿到資料。
23 |
24 | 「相對應的」指的是每一個 Cookie 都有一些選項可以設置,要符合條件才能寫入以及傳送,例如說你無法寫入其他 domain 的 cookie。
25 |
26 | 所以我這邊在談的是 Cookie 的本質:儲存資料。而另一個重點就是伺服器可以把資料寫在 Cookie,瀏覽器也會幫你把 Cookie 帶給伺服器。
27 |
28 | 至於其他用途(廣告追蹤、身份驗證)那都是再延伸出去的東西了,其實不是這題的重點。可以當作額外補充,但你要知道的是 Cookie 本身就是個儲存容器,身份驗證是其中的用途之一,但還有其他用途。
29 |
30 | ## 這週會碰到的問題
31 |
32 | 這週的作業主要會碰到的問題有兩個(當然還有更多啦,先提兩個):
33 |
34 | 1. 密碼存明碼,當駭客入侵把你資料庫偷走之後,你家會員的密碼就全部被駭客知道了。解法在十一週會講。
35 | 2. 利用 cookie 裡的 user id 來判斷登入的人是誰,我只要把 cookie 裡面的值一改掉,就可以偽造別人身份登入。解法在十一週也會講。
36 |
--------------------------------------------------------------------------------
/homeworks/week24/fe/hw2.md:
--------------------------------------------------------------------------------
1 | ## Redux 如何解決非同步(例如說 call API 拿資料)的問題
2 |
3 | Redux 解決非同步的問題是採用 Middleware,簡單理解就是 Action -> Reducer 之間所做的處理
4 |
5 | 運用這個方法的概念,是讓 Action Creator 回傳一個 Function,而這個 Function 內中做我們想做的非同步處理
6 |
7 | 當然 Function 最後處理完仍會回傳一個 Action 物件給 Reducer 接收
8 |
9 | 概念如以上,而開發者能使用的套件也各有不同
10 |
11 | 目前為人所知的是 [Redux Thunk](https://github.com/reduxjs/redux-thunk) 與 [Redux saga](https://github.com/redux-saga/redux-saga),而這次作業使用的 [Redux-promise-middleware](https://github.com/pburtchaell/redux-promise-middleware) 更是就我們原本對 Middleware 的理解下更進一步的優化套件。
12 |
13 | Redux Thunk 的概念其實很簡單,也就是 Action Creator 回傳的如果是 Function 而不是 Object,那就執行該 Function
14 |
15 | 那麼這樣理解就是將我們的商業邏輯放在 Action Creator 回傳的 Function 之中,但當專案變大之後,我們的 Action Creator 可能就不這麼純粹了,而且一個充滿邏輯的 Action 集合想必是很難以維護
16 |
17 | Redux Saga 可以幫我們解決上述的問題,使用 Redux Saga,Action Creator 一樣可以只回傳單純的 Action Object,而我們會使用 Saga.js 去監聽是否有非同步的邏輯需要運行,做法是「當監聽到 Action Object 中特定 Type 時,就執行某 Function」
18 |
19 | 當然上述的部分牽扯到 Saga 的核心概念與「generator function」,但這邊我也只找到資料,還沒開始研究就是了
20 |
21 | 另外在很早的老師教學中有提到當同時發送三個 Request,但第二個比第三個晚回來,但我只想要最後一個 Response,該如何解決?這邊在 Redux Saga 中也有解決方案,但目前尚未自行操作過,就學習曲線上,Redux Saga 是比較難入門的套件,這邊就有待我之後去實作了。
22 |
23 |
--------------------------------------------------------------------------------
/homeworks/week24/fe/hw1/src/CodeBlock.js:
--------------------------------------------------------------------------------
1 | import React, { PureComponent } from "react";
2 | import PropTypes from "prop-types";
3 | import { PrismLight as SyntaxHighlighter } from "react-syntax-highlighter";
4 | import { tomorrow } from "react-syntax-highlighter/dist/esm/styles/prism";
5 | import { jsx, javascript, php } from "react-syntax-highlighter/dist/esm/languages/prism";
6 |
7 | class CodeBlock extends PureComponent {
8 | static propTypes = {
9 | value: PropTypes.string.isRequired,
10 | language: PropTypes.string
11 | };
12 |
13 | static defaultProps = {
14 | language: null
15 | };
16 |
17 | componentWillMount() {
18 | SyntaxHighlighter.registerLanguage("jsx", jsx);
19 | SyntaxHighlighter.registerLanguage("javascript", javascript);
20 | SyntaxHighlighter.registerLanguage("php", php);
21 | }
22 |
23 | render() {
24 | const { language, value } = this.props;
25 | return (
26 |
27 |
28 | {value}
29 |
30 |
31 | );
32 | }
33 | }
34 |
35 | export default CodeBlock;
--------------------------------------------------------------------------------
/homeworks/week24/fe/hw1/src/reducers/getPostsReducer.js:
--------------------------------------------------------------------------------
1 | import * as actionTypes from '../actionsTypes';
2 |
3 | const initState = {
4 | postListData: [],
5 | isLoadingGetPosts: false
6 | }
7 |
8 | export default function getPostsReducer(state = initState, action) {
9 | switch(action.type) {
10 | case actionTypes.GET_POSTS + '_PENDING':
11 | return {
12 | ...state,
13 | isLoadingGetPosts: true,
14 | }
15 | case actionTypes.GET_POSTS + '_FULFILLED' :
16 | return {
17 | ...state,
18 | postListData: action.payload.data,
19 | isLoadingGetPosts: false
20 | }
21 | case actionTypes.GET_RECENT_POSTS + '_PENDING':
22 | return {
23 | ...state,
24 | isLoadingGetPosts: true,
25 | }
26 | case actionTypes.GET_RECENT_POSTS + '_FULFILLED' :
27 | return {
28 | ...state,
29 | postListData: action.payload.data,
30 | isLoadingGetPosts: false
31 | }
32 | default:
33 | return state
34 | }
35 | }
--------------------------------------------------------------------------------
/homeworks/week6/hw2/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding: 0px;
3 | margin: 0px 15px;
4 | }
5 |
6 | .wrapper {
7 | max-width: 900px;
8 | margin: 0 auto;
9 | padding-top: 40px;
10 |
11 | }
12 |
13 | p {
14 | padding: 10px 0;
15 | }
16 |
17 | .clap-button {
18 | position: fixed;
19 | top: 150px;
20 | left: 36px;
21 | height: 60px;
22 | width: 60px;
23 | border: 1px solid grey;
24 | border-radius: 50%;
25 | cursor: pointer;
26 | text-align: center;
27 | }
28 |
29 | @media screen and (max-width: 1120px){
30 | .clap-button {
31 | position: relative;
32 | top: 40px;
33 | left: 10px;
34 | height: 60px;
35 | width: 60px;
36 | border: 1px solid grey;
37 | border-radius: 50%;
38 | cursor: pointer;
39 | text-align: center;
40 | }
41 | }
42 |
43 | .clap-button:hover {
44 | border: 1px solid black;
45 | }
46 |
47 | .title {
48 | font-size: 42px;
49 | }
50 |
51 |
52 | .text {
53 | font-size: 20px;
54 | }
55 |
56 | @media screen and (max-width: 900px) {
57 | .title {
58 | font-size: 36px;
59 | }
60 | .text {
61 | font-size: 18px;
62 | }
63 | }
--------------------------------------------------------------------------------
/homeworks/week16/README.md:
--------------------------------------------------------------------------------
1 | # 作業
2 |
3 | ## hw1:CSS 預處理器
4 |
5 | 自從學會 CSS 預處理器之後,寫 CSS 的複雜度一下子降低了很多,一方面是巢狀 CSS 可以很簡單的實作出來,另一方面是多了變數這個好用的東西。
6 |
7 | 現在請你把以前寫的 CSS 用你自己挑的 CSS preprocessor(LESS, SASS, Stylus)來改寫(要選哪一個作業都行,隨便選一個就好,只是想讓大家熟悉一下預處理器的用法) 。
8 |
9 | ## hw2:實作出 Stack 與 Queue
10 |
11 | 請你實作出`Stack`跟`Queue`兩個 Function(或是 Class),讓以下程式碼可以順利執行:
12 | (禁止使用內建函式`push`與`pop`)
13 |
14 | ``` js
15 | var stack = new Stack()
16 | stack.push(10)
17 | stack.push(5)
18 | console.log(stack.pop()) // 5
19 | console.log(stack.pop()) // 10
20 |
21 | var queue = new Queue()
22 | queue.push(1)
23 | queue.push(2)
24 | console.log(queue.pop()) // 1
25 | console.log(queue.pop()) // 2
26 | ```
27 |
28 | ## hw3:HTTP Cache
29 |
30 | 請閱讀這篇文章:[循序漸進理解 HTTP Cache 機制](https://blog.techbridge.cc/2017/06/17/cache-introduction/)來理解 HTTP Cache 機制。
31 |
32 | ## hw4:簡答題
33 |
34 | 1. CSS 預處理器是什麼?我們可以不用它嗎?
35 | 2. 請舉出任何一個跟 HTTP Cache 有關的 Header 並說明其作用。
36 | 3. Stack 跟 Queue 的差別是什麼?
37 | 4. 請去查詢資料並解釋 CSS Selector 的權重是如何計算的(不要複製貼上,請自己思考過一遍再自己寫出來,沒有很完整也行)
38 |
39 | 請將答案寫在 [hw4.md](hw4.md)。
40 |
41 | ## 挑戰題
42 |
43 | 去查詢什麼是 PostCSS 並使用它,順便解釋為什麼我們需要 PostCSS。
44 |
45 | ## 超級挑戰題
46 |
47 | 去學習兩種新的資料結構:Deque 與 Priority queue,並且用 JavaScript 來實作。
48 |
--------------------------------------------------------------------------------
/examples/week21/README.md:
--------------------------------------------------------------------------------
1 | # 注意事項
2 |
3 | 提示:在寫完作業之後看效果最佳,沒寫作業前請不要看
4 |
5 | ## 關於五子棋判斷邏輯
6 |
7 | 如果某方下了一顆棋子然後產生勝負的話,就代表最後一顆落子一定在連成一線當中,才會產生勝負,因此只要朝那顆棋子的周邊去搜就可以了。
8 |
9 | 可以寫一個很 general 的 function,能夠傳入最後一個的 x, y 以及要判斷的方向:
10 |
11 | ``` js
12 | function countTotal(currentX, currentY, directionX, directionY) {
13 |
14 | // 現在要檢查的棋子是什麼顏色
15 | const now = board[currentX][currentY]
16 |
17 | let tempX = currentX
18 | let tempY = currentY
19 | let total = 0
20 | do {
21 | tempX += directionX // 檢查下一顆棋子
22 | tempY += directionY
23 |
24 | // 如果新的棋子等於我現在要檢查的(意思就是連續啦)
25 | if (board[tempX][tempY] === now) {
26 |
27 | // 連續的棋子數 + 1
28 | total++
29 | } else {
30 | break
31 | }
32 | }
33 | return total
34 | }
35 | ```
36 |
37 | 這樣就可以得到某個方向的總數,於是判斷勝負的程式碼就可以這樣寫:
38 |
39 | ``` js
40 | if (
41 | countTotal(x, y, 1, 0) + countTotal(x, y, -1, 0) >= 4 ||
42 | countTotal(x, y, 0, 1) + countTotal(x, y, 0, -1) >= 4 ||
43 | countTotal(x, y, 1, 1) + countTotal(x, y, -1, -1) >= 4 ||
44 | countTotal(x, y, 1, -1) + countTotal(x, y, -1, 1) >= 4
45 | ) {
46 | // do something
47 | }
48 | ```
49 |
50 | 優雅地解決了這一題,而且程式碼可能還比窮舉法少XD
51 |
52 | 然後如果你是用一維陣列去存棋盤的話,建議不要,因為會變得很麻煩,用二維方便很多。
--------------------------------------------------------------------------------
/homeworks/week3/hw3.test.js:
--------------------------------------------------------------------------------
1 | const isPrime = require('./hw3');
2 |
3 | describe('hw3', () => {
4 | it('should return correct answer when n = 45456456', () => {
5 | expect(isPrime(45456456)).toBe('數字請幫我設在 1 至 100000 之間');
6 | });
7 |
8 | it('should return correct answer when n = 1', () => {
9 | expect(isPrime(1)).toBe(false);
10 | });
11 |
12 | it('should return correct answer when n = 3', () => {
13 | expect(isPrime(3)).toBe(true);
14 | });
15 |
16 | it('should return correct answer when n = 9977', () => {
17 | expect(isPrime(9977)).toBe(false);
18 | });
19 |
20 | it('should return correct answer when n = 1457', () => {
21 | expect(isPrime(1457)).toBe(false);
22 | });
23 |
24 | it('should return correct answer when n = 11', () => {
25 | expect(isPrime(11)).toBe(true);
26 | });
27 |
28 | it('should return correct answer when n = 17', () => {
29 | expect(isPrime(17)).toBe(true);
30 | });
31 |
32 | it('should return correct answer when n = 99578', () => {
33 | expect(isPrime(99578)).toBe(false);
34 | });
35 |
36 | it('should return correct answer when n = 99578', () => {
37 | expect(isPrime(995878)).toBe('數字請幫我設在 1 至 100000 之間');
38 | });
39 | });
40 |
--------------------------------------------------------------------------------
/homeworks/week1/hw3.md:
--------------------------------------------------------------------------------
1 | ## 教你朋友 CLI
2 |
3 | 嗨,首先在學指令之前,想先請你下載一兩個好用的工具
4 |
5 | 如果你是 Windows 系統,請去下載 Cmder,不用安裝,可以直接打開用
6 |
7 | 如果你是 MacOS,內建的 terminal 已經很好用,或者你可以多下載 ITerm2,但我是用 Windows,這你可能就要自己研究一下了。
8 |
9 | 下載好了我們就開始吧!
10 |
11 | 1. 打開你的終端機 ( Cmder / terminal )
12 |
13 | 2. 輸入 pwd 可以打印出你現在的位置
14 |
15 | 3. 輸入 mkdir Wifi 創建一個叫做 Wifi 的資料夾,請記得這個指令
16 |
17 | 4. 創建好了不代表你就進入這個資料夾了,請輸入 cd Wifi 進入這個資料夾,如果你想退回上一個目錄,則用 cd .. 退回。
18 |
19 | 5. 輸入 touch afu.js,意思是創建一個叫做 touch afu.js 的檔案,touch 後面接檔案名稱會將該檔案的修改時間更新至當下,該目錄若無該檔案,則會自動創建一個,因此我們使用該語法創建 afu.js
20 |
21 | 6. 輸入 ls,會印出 afu.js 這個檔案,該指令可以印出該目錄裡的檔案及子目錄,如果你輸入 ls -al 則會連隱藏檔案目錄也一起印出
22 |
23 | 7. 如果你看這個檔案不順眼可以輸入 rm afu.js 移除它,如果要強制移除則加入參數 -f,則會是 rm -f afu.js,使用時請小心,不要刪錯東西了。
24 |
25 | 8. 刪除資料夾則是另一種形式,若以 Wifi 這個資料夾為例,rm -d Wifi 會顯示錯誤,因為裡面還有 afu.js 這個檔案,則時候如果你懶得用上一步去刪除它,你可以加入參數 -r,也就是rm -r Wifi,那就會連裡面的檔案一起刪除了,使用起來不可不慎。
26 |
27 | ---
28 | 整理一下剛剛的指令:
29 |
30 | 指令|功能|舉例
31 | :---:|:---:|:---:
32 | mkdir / md|創建資料夾|mkdir wifi / md wifi
33 | touch|更新最後編輯時間或創立檔案|touch afu.js
34 | cd / cd ..|切換至該目錄 / 退回上一個目錄|cd wifi
35 | ls|印出目錄下檔案或子目錄|ls / ls -al
36 | rm|移除檔案|rm afu.js / rm -f afu.js
37 | rm -d|移除空資料夾|rm -d wifi
38 | rm -r|強制移除資料夾與內含檔案與子目錄|rm -r wifi
39 |
40 | ---
41 | 以上就是基本會到的指令囉!
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/homeworks/week12/hw1/handle_write.php:
--------------------------------------------------------------------------------
1 | alert('標題和內容不可空白唷 !');parent.location.href='./write.php';";
11 | } else {
12 |
13 | $stmt = $conn->prepare("SELECT * FROM claygao_users WHERE id_number = ?");
14 | $stmt->bind_param("s", $user_id);
15 | $stmt->execute();
16 | $result = $stmt->get_result();
17 | $row = $result->fetch_assoc();
18 |
19 | $nickName = $row['nickname'];
20 | $id_number = $row['id_number'];
21 |
22 | $stmt = $conn->prepare("INSERT INTO claygao_comments(title, content, nickname, `id_number`) VALUES (?, ?, ?, ?)");
23 | $stmt->bind_param("ssss", $title, $content, $nickName, $id_number);
24 |
25 | if ($stmt->execute()) {
26 | echo "";
27 | } else {
28 | echo "";
29 | }
30 |
31 | }
32 | ?>
--------------------------------------------------------------------------------
/homeworks/week18/hw2/dist/index.bundle.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable */!(function (e) { const t = {}; function n(r) { if (t[r]) return t[r].exports; const o = t[r] = { i: r, l: !1, exports: {} }; return e[r].call(o.exports, o, o.exports, n), o.l = !0, o.exports; }n.m = e, n.c = t, n.d = function (e, t, r) { n.o(e, t) || Object.defineProperty(e, t, { enumerable: !0, get: r }); }, n.r = function (e) { typeof Symbol !== 'undefined' && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: 'Module' }), Object.defineProperty(e, '__esModule', { value: !0 }); }, n.t = function (e, t) { if (1 & t && (e = n(e)), 8 & t) return e; if (4 & t && typeof e === 'object' && e && e.__esModule) return e; const r = Object.create(null); if (n.r(r), Object.defineProperty(r, 'default', { enumerable: !0, value: e }), 2 & t && typeof e !== 'string') for (const o in e)n.d(r, o, (t => e[t]).bind(null, o)); return r; }, n.n = function (e) { const t = e && e.__esModule ? function () { return e.default; } : function () { return e; }; return n.d(t, 'a', t), t; }, n.o = function (e, t) { return Object.prototype.hasOwnProperty.call(e, t); }, n.p = '', n(n.s = 0); }([function (e, t, n) { n(1)(10, 3); }, function (e, t) { e.exports = function (e, t) { console.log(e, t); }; }]));
2 |
--------------------------------------------------------------------------------
/homeworks/week11/hw1/update.php:
--------------------------------------------------------------------------------
1 | alert('您沒有權限訪問這個頁面!');parent.location.href='./index.php';";
6 | } else {
7 | $id = $_GET['id'];
8 | $spl = "SELECT * FROM `claygao_comments` WHERE id = " . $id;
9 | $result = $conn->query($spl);
10 | $row = $result->fetch_assoc();
11 | }
12 | ?>
13 |
14 |
15 |
16 |
17 | Love Message Board
18 |
19 |
20 |
26 |
27 |
28 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/homeworks/week13/README.md:
--------------------------------------------------------------------------------
1 | # 作業
2 |
3 | ## hw1:實作基本網格系統
4 |
5 | 其實網格系統說穿了,就只是在不同寬度的時候依照比例調整 column 的寬度而已。這一個作業,你要實作出基本的網格系統,詳細規格可參考下面:
6 |
7 | 1. 每一個 row 有 12 格
8 | 2. 有一個叫做 container 的 class 會把裡面的內容置中,寬度則是 960px
9 | 3. 一共有 12 種 col 的 class,col-1, col-2...col-12
10 |
11 | 只要螢幕寬度小於 720px,每一格都會佔滿整個 row。
12 |
13 | ## hw2:超基礎 Todo list
14 |
15 | 
16 |
17 | 請你完成一個很簡單的 Todo List,需要有以下功能:
18 |
19 | 1. 身為使用者,我可以新增 todo item
20 | 2. 身為使用者,我可以刪除 todo item
21 | 3. 身為使用者,我可以標記某個 todo item 已完成
22 |
23 | ## hw3:加強留言板
24 |
25 | 之前在課程中講過 Bootstrap 這一個好用的 library,能夠讓你把版面變得好看一點,現在就請你利用 Bootstrap 改造之前的留言板 UI。
26 |
27 | 另外,請把發送留言跟刪除留言的地方改成 ajax,新增留言跟刪除的時候都不用換頁,藉此增進使用者體驗。
28 |
29 | 最後,我們在之前有實作過「通行證」的機制,其實在 PHP 裡面有內建的可以用,而這個機制就叫做 session。可以參考 [PHP 5 Sessions](https://www.w3schools.com/php/php_sessions.asp) 或是 [PHP Session 使用介紹,啟用與清除 session](http://www.webtech.tw/info.php?tid=33),把之前留言板的作業改成用 PHP 內建的 session 機制,而不是用我們自己實作的。
30 |
31 | ## hw4:簡答題
32 |
33 | 1. Bootstrap 是什麼?
34 | 2. 請簡介網格系統以及與 RWD 的關係
35 | 3. 請找出任何一個與 Bootstrap 類似的 library
36 | 4. jQuery 是什麼?
37 | 5. jQuery 與 vanilla JS 的關係是什麼?
38 |
39 | 請將答案寫在 [hw4.md](hw4.md)。
40 |
41 | ## 挑戰題
42 |
43 | 把留言板用自己寫的網格系統,改成支援 RWD。
44 |
45 | ## 超級挑戰題
46 |
47 | 把所有跟留言板有關的操作都變成 Ajax,並且與自己寫的後端 API 串接。
48 |
--------------------------------------------------------------------------------
/homeworks/week23/fe/hw1/src/actions.js:
--------------------------------------------------------------------------------
1 | import * as actionTypes from './actionsTypes'
2 |
3 | // Action creator
4 | export const getPosts = () => ({
5 | type: actionTypes.GET_POSTS
6 | })
7 |
8 | export const getPostsSuccess = (data) => ({
9 | type: actionTypes.GET_POSTS_SUCCESS,
10 | data
11 | })
12 |
13 | export const getSinglePost = () => ({
14 | type: actionTypes.GET_SINGLE_POST
15 | })
16 |
17 | export const getSinglePostSuccess = (data) => ({
18 | type: actionTypes.GET_SINGLE_POST_SUCCESS,
19 | data
20 | })
21 |
22 | export const deleteSinglePost = () => ({
23 | type: actionTypes.DELETE_SINGLE_POST
24 | })
25 |
26 | export const deleteSinglePostSuccess = () => ({
27 | type: actionTypes.DELETE_SINGLE_POST_SUCCESS,
28 | })
29 |
30 | export const editSinglePost = (title, body) => ({
31 | type: actionTypes.EDIT_SINGLE_POST,
32 | title,
33 | body
34 | })
35 | export const editSinglePostSuccess = () => ({
36 | type: actionTypes.EDIT_SINGLE_POST_SUCCESS
37 | })
38 |
39 | export const getWeatherData = () => ({
40 | type: actionTypes.GET_WEATHER_DATA,
41 | })
42 |
43 | export const getWeatherDataSuccess = (data) => ({
44 | type: actionTypes.GET_WEATHER_DATA_SUCCESS,
45 | data
46 | })
47 |
48 |
--------------------------------------------------------------------------------
/homeworks/week23/fe/hw1/src/CodeBlock.js:
--------------------------------------------------------------------------------
1 | import React, { PureComponent } from "react";
2 | import PropTypes from "prop-types";
3 | import { PrismLight as SyntaxHighlighter } from "react-syntax-highlighter";
4 | // 設置高亮樣式
5 | import { tomorrow } from "react-syntax-highlighter/dist/esm/styles/prism";
6 | // 設置高亮的語言
7 | import { jsx, javascript, php, sass, scss } from "react-syntax-highlighter/dist/esm/languages/prism";
8 |
9 | class CodeBlock extends PureComponent {
10 | static propTypes = {
11 | value: PropTypes.string.isRequired,
12 | language: PropTypes.string
13 | };
14 |
15 | static defaultProps = {
16 | language: null
17 | };
18 |
19 | componentWillMount() {
20 | // 註冊要高亮的語法,
21 | // 注意:如果不設置打包後供第三方使用是不起作用的
22 | SyntaxHighlighter.registerLanguage("jsx", jsx);
23 | SyntaxHighlighter.registerLanguage("javascript", javascript);
24 | SyntaxHighlighter.registerLanguage("php", php);
25 | }
26 |
27 | render() {
28 | const { language, value } = this.props;
29 | return (
30 |
31 |
32 | {value}
33 |
34 |
35 | );
36 | }
37 | }
38 |
39 | export default CodeBlock;
--------------------------------------------------------------------------------
/homeworks/week9/hw2/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | padding: 0;
4 | background: black;
5 | color:wheat;
6 | }
7 |
8 |
9 | .wrapper {
10 | width: 700px;
11 | min-width: 700px;
12 | height: auto;
13 | margin: 0 auto;
14 | margin-right: auto;
15 | margin-left: auto;
16 | background: black;
17 | text-align: center;
18 | padding: 20px;
19 | }
20 |
21 | .story {
22 | border: 2px solid gray;
23 | border-radius: 10px;
24 | padding: 15px;
25 | text-align: left;
26 | word-break: break-all;
27 | }
28 |
29 | .story ~ .story {
30 | margin-top: 25px;
31 | }
32 |
33 | .write {
34 | border: 2px solid gray;
35 | border-radius: 10px;
36 | padding: 10px;
37 | }
38 |
39 | .enter__title {
40 | background: wheat;
41 | }
42 |
43 | .enter__content {
44 | height: 180px;
45 | width:500px;
46 | background: wheat;
47 | word-break: break-all;
48 | resize: none;
49 | }
50 |
51 | .btn {
52 | margin: 5px;
53 | padding:5px;
54 | border: 2px solid gray;
55 | background: wheat;
56 | }
57 |
58 | .register {
59 | border:2px solid gray;
60 | border-radius: 10px;
61 | padding: 15px;
62 | text-align: left;
63 | }
64 |
65 | form > div{
66 | margin-top: 10px;
67 | }
68 |
--------------------------------------------------------------------------------
/homeworks/week12/README.md:
--------------------------------------------------------------------------------
1 | # 作業
2 |
3 | ### 注意
4 |
5 | 這週的 hw1~hw2 是連續的作業,只要交一份就好,不用每一個都特地交一個。然後記得把你連線到資料庫的檔案(conn.php),加入`.gitignore`,否則這檔案會被放到 GitHub 上,大家就知道資料庫的帳號密碼了。
6 |
7 | 另外,請你在留言板的最上方加註一行警語:「本站為練習用網站,因教學用途刻意忽略資安的實作,註冊時請勿使用任何真實的帳號或密碼」,加警語的目的是因為這週要做的網站極度不安全,很有可能被駭客拿到整個資料庫的資料,因此請切記在這網頁上不要輸入任何敏感資訊。
8 |
9 | ## hw1:修補漏洞
10 |
11 | 如同我在課程中提過的,上週做出來的網頁裡面,會有兩個網頁最知名的漏洞:
12 |
13 | 1. SQL Injection
14 | 2. XSS
15 |
16 | 現在請你試試看對你上週做出來的網頁做這兩種攻擊,看看是否能成功,並且修補這兩個漏洞。
17 |
18 | ## hw2:加強留言板
19 |
20 | 這一週要再次增強留言板的功能:
21 |
22 | 1. 身為使用者,可以在別人的留言底下新增留言,一樣可以輸入暱稱跟留言內容
23 | 2. 身為系統,在顯示留言時應該一併列出底下所有的子留言
24 | 3. 會員在自己的留言底下回覆的話,背景會顯示不同的顏色
25 |
26 | 簡單來說就是新增一個「子留言」的功能,只要有一層即可,不需要實作多層的子留言。然後也加一個小功能,如果原 po 自己回覆自己的留言,那篇子留言的背景要用不同顏色,這樣大家很容易辨別他是原 po。
27 |
28 | ## hw3:簡答題
29 |
30 | 1. 請說明 SQL Injection 的攻擊原理以及防範方法
31 | 2. 請說明 XSS 的攻擊原理以及防範方法
32 | 3. 請說明 CSRF 的攻擊原理以及防範方法
33 |
34 | 請將答案寫在 [hw3.md](hw3.md)。
35 |
36 | ## 挑戰題
37 |
38 | 幫每個留言都新增一個「讚」的按鈕,使用者可以點任何留言讚,但只能點一次。再點一次的話會取消讚。前端介面要顯示總共被讚了幾次。
39 |
40 | ## 超級挑戰題
41 |
42 | 支援多層子留言,最多到五層。意思就是說,我的留言可以長這樣(`--`代表一層):
43 |
44 | ```
45 | 大家好,我是新的會員
46 | -- 你好
47 | ---- 幸會幸會
48 | ---- 最近好嗎
49 | -- 安安,我台北人
50 | ---- 我也台北人欸
51 | ------ 有人是高雄人嗎?
52 | ------ 有人嗎?
53 | -------- 我是高雄人
54 | -------- 高雄有什麼好吃的
55 | ---- 好巧喔
56 | ---- 台北好玩的點有什麼
57 | -- 哈囉,我也是新的會員
58 | ```
59 |
--------------------------------------------------------------------------------
/homeworks/week23/fe/hw1/src/App.js:
--------------------------------------------------------------------------------
1 | import React, {Component,} from 'react';
2 | import './scss/App.scss';
3 | import Nav from './containers/NavContainer'
4 | import PostList from './containers/PostListContainer'
5 | import Post from './containers/PostContainer'
6 | import About from './components/about'
7 | import Write from './components/write'
8 | import Home from './containers/HomeContainer'
9 | import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
10 |
11 | class App extends Component {
12 | constructor(props) {
13 | super(props)
14 | }
15 |
16 |
17 |
18 | render() {
19 | return (
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | )
35 | }
36 | }
37 |
38 | export default App;
39 |
--------------------------------------------------------------------------------
/homeworks/week24/fe/hw1/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import './scss/App.scss';
3 | import Nav from './containers/NavContainer'
4 | import PostList from './containers/PostListContainer'
5 | import Post from './containers/PostContainer'
6 | import About from './components/about'
7 | import Write from './containers/WriteContainer'
8 | import Home from './containers/HomeContainer'
9 | import ScrollToTop from './ScrollToTop'
10 | import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
11 |
12 | const App = () => {
13 | return (
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | )
31 | }
32 |
33 | export default App;
34 |
--------------------------------------------------------------------------------
/homeworks/week12/hw1/update.php:
--------------------------------------------------------------------------------
1 | alert('您沒有權限訪問這個頁面!');parent.location.href='./index.php';";
6 | } else {
7 | $id = $_GET['id'];
8 | $stmt = $conn->prepare("SELECT * FROM `claygao_comments` WHERE id = ?");
9 | $stmt->bind_param("s", $id);
10 | $stmt->execute();
11 | $result = $stmt->get_result();
12 | $row = $result->fetch_assoc();
13 | }
14 | ?>
15 |
16 |
17 |
18 |
19 | Love Message Board
20 |
21 |
22 |
28 |
29 |
30 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/homeworks/week13/hw3/update.php:
--------------------------------------------------------------------------------
1 | alert('您沒有權限訪問這個頁面!');parent.location.href='./index.php';";
6 | } else {
7 | $id = $_GET['id'];
8 | $stmt = $conn->prepare("SELECT * FROM `claygao_comments` WHERE id = ?");
9 | $stmt->bind_param("s", $id);
10 | $stmt->execute();
11 | $result = $stmt->get_result();
12 | $row = $result->fetch_assoc();
13 | }
14 | ?>
15 |
16 |
17 |
18 |
19 | Love Message Board
20 |
21 |
22 |
28 |
29 |
30 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/homeworks/week24/fe/hw1/src/actions.js:
--------------------------------------------------------------------------------
1 | import * as actionTypes from './actionsTypes'
2 | import * as WebAPI from './WebAPI'
3 |
4 | // Action creator
5 | export const getPostList = () => ({
6 | type: actionTypes.GET_POSTS,
7 | payload: WebAPI.getPosts()
8 | })
9 |
10 | export const getRecentPosts = () => ({
11 | type: actionTypes.GET_RECENT_POSTS,
12 | payload: WebAPI.getRecentPosts()
13 | })
14 |
15 | export const getSinglePost = (postId) => ({
16 | type: actionTypes.GET_SINGLE_POST,
17 | payload: WebAPI.getSinglePost(postId)
18 | })
19 |
20 | export const createSinglePost = (data) => ({
21 | type: actionTypes.CREATE_SINGLE_POST,
22 | payload: WebAPI.createSinglePost(data)
23 | })
24 |
25 | export const deleteSinglePost = (postId) => ({
26 | type: actionTypes.DELETE_SINGLE_POST,
27 | payload: WebAPI.deleteSinglePost(postId)
28 | })
29 |
30 | export const beginEditSinglePost = (title, body) => ({
31 | type: actionTypes.BEGIN_EDIT_SINGLE_POST,
32 | title,
33 | body
34 | })
35 |
36 | export const editSinglePost = (postId, title, body) => ({
37 | type: actionTypes.EDIT_SINGLE_POST,
38 | payload: WebAPI.editSinglePost(postId, title, body)
39 | })
40 |
41 |
42 | export const getWeatherData = () => ({
43 | type: actionTypes.GET_WEATHER_DATA,
44 | payload: WebAPI.getWeather()
45 | })
46 |
47 |
48 |
--------------------------------------------------------------------------------
/homeworks/week18/hwS1/webpack.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path');
2 | const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
3 |
4 |
5 | module.exports = {
6 | entry: './src/index.js', // 引入的檔案
7 | output: {
8 | path: path.resolve(__dirname, 'dist'), // 輸出的位置
9 | filename: '[name].min.js', // html 要引入的檔案
10 | },
11 | module: {
12 | rules: [
13 | {
14 | test: /\.css$/,
15 | use: [
16 | { loader: 'style-loader' },
17 | {
18 | loader: 'css-loader',
19 | options: {
20 | modules: true,
21 | minimize: true,
22 | },
23 | },
24 | ],
25 | },
26 | {
27 | test: /\.scss$/,
28 | use: [
29 | 'style-loader', // creates style nodes from JS strings
30 | 'css-loader', // translates CSS into CommonJS
31 | 'sass-loader', // compiles Sass to CSS, using Node Sass by default
32 | ],
33 | },
34 | {
35 | test: /\.m?js$/,
36 | exclude: /(node_modules|bower_components)/,
37 | use: {
38 | loader: 'babel-loader',
39 | options: {
40 | presets: ['@babel/preset-env'],
41 | },
42 | },
43 | },
44 | ],
45 | },
46 | optimization: {
47 | minimizer: [new UglifyJsPlugin()],
48 | },
49 | };
50 |
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/build/service-worker.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Welcome to your Workbox-powered service worker!
3 | *
4 | * You'll need to register this file in your web app and you should
5 | * disable HTTP caching for this file too.
6 | * See https://goo.gl/nhQhGp
7 | *
8 | * The rest of the code is auto-generated. Please don't update this file
9 | * directly; instead, make changes to your Workbox build configuration
10 | * and re-run your build process.
11 | * See https://goo.gl/2aRDsh
12 | */
13 |
14 | importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
15 |
16 | importScripts(
17 | "./precache-manifest.0d8b7f79fb8c158922a01fa8b498579c.js"
18 | );
19 |
20 | self.addEventListener('message', (event) => {
21 | if (event.data && event.data.type === 'SKIP_WAITING') {
22 | self.skipWaiting();
23 | }
24 | });
25 |
26 | workbox.core.clientsClaim();
27 |
28 | /**
29 | * The workboxSW.precacheAndRoute() method efficiently caches and responds to
30 | * requests for URLs in the manifest.
31 | * See https://goo.gl/S9QRab
32 | */
33 | self.__precacheManifest = [].concat(self.__precacheManifest || []);
34 | workbox.precaching.precacheAndRoute(self.__precacheManifest, {});
35 |
36 | workbox.routing.registerNavigationRoute(workbox.precaching.getCacheKeyForURL("./index.html"), {
37 |
38 | blacklist: [/^\/_/,/\/[^\/?]+\.[^\/]+$/],
39 | });
40 |
--------------------------------------------------------------------------------
/homeworks/week11/hw1/handle_sign_in.php:
--------------------------------------------------------------------------------
1 | alert('帳號密碼未輸入 !');parent.location.href='./sign_in.php';";
10 | } else {
11 | // 比對使用者資料庫中該使用者的密碼是否相符
12 | $sql = "SELECT * FROM `claygao_users` WHERE `id_number` = '$idNumberSignIn'";
13 | $result = $conn->query($sql);
14 | $row = $result->fetch_assoc();
15 | $verify = password_verify($passwordSignIn , $row['password']); // 比對密碼是否相符
16 |
17 | // 發送 cookie 到 claygao_users_certificate 與 Clinet
18 | if ($verify) {
19 | $cookieHash = password_hash( $row['id_number'], PASSWORD_DEFAULT); // 比對成功之後,創建一組專屬 cookie
20 | $id = $row['id_number'];
21 | $sql = "INSERT INTO `claygao_users_certificate`(`id`, `username`) VALUES('$cookieHash', '$id') ON DUPLICATE KEY UPDATE `id` = '$cookieHash'";
22 | $result = $conn->query($sql);
23 | setcookie("member_username", $id, time()+3600*24);
24 | setcookie("member_id", $cookieHash, time()+3600*24);
25 | echo "";
26 | } else {
27 | echo "";
28 | }
29 | }
30 | ?>
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw1/webpack.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path')
2 | const HtmlWebpackPlugin = require("html-webpack-plugin")
3 |
4 | module.exports = {
5 | entry: './src/index.js',
6 | output: {
7 | path: path.resolve(__dirname, './dist'),
8 | filename: 'bundle.[hash].js'
9 | },
10 | module: {
11 | rules: [
12 | {
13 | test: /\.js/,
14 | exclude: /node_modules/,
15 | loader:'babel-loader'
16 | },
17 | {
18 | test: /\.s[ac]ss$/i,
19 | use: [
20 | // Creates `style` nodes from JS strings
21 | 'style-loader',
22 | // Translates CSS into CommonJS
23 | 'css-loader',
24 | // Compiles Sass to CSS
25 | 'sass-loader',
26 | ]
27 | },
28 | {
29 | test: /\.(png|jpg|gif)$/i,
30 | use: [
31 | {
32 | loader: 'url-loader',
33 | options: {
34 | limit: 8192,
35 | },
36 | },
37 | ],
38 | },
39 | ]
40 | },
41 | plugins: [
42 | new HtmlWebpackPlugin({
43 | template: './index.html'
44 | })
45 | ]
46 | }
--------------------------------------------------------------------------------
/homeworks/week21/fe/hw3/webpack.config.js:
--------------------------------------------------------------------------------
1 | const path = require('path')
2 | const HtmlWebpackPlugin = require("html-webpack-plugin")
3 |
4 | module.exports = {
5 | entry: './src/index.js',
6 | output: {
7 | path: path.resolve(__dirname, './dist'),
8 | filename: 'bundle.[hash].js'
9 | },
10 | module: {
11 | rules: [
12 | {
13 | test: /\.js/,
14 | exclude: /node_modules/,
15 | loader:'babel-loader'
16 | },
17 | {
18 | test: /\.s[ac]ss$/i,
19 | use: [
20 | // Creates `style` nodes from JS strings
21 | 'style-loader',
22 | // Translates CSS into CommonJS
23 | 'css-loader',
24 | // Compiles Sass to CSS
25 | 'sass-loader',
26 | ]
27 | },
28 | {
29 | test: /\.(png|jpg|gif)$/i,
30 | use: [
31 | {
32 | loader: 'url-loader',
33 | options: {
34 | limit: 8192,
35 | },
36 | },
37 | ],
38 | },
39 | ]
40 | },
41 | plugins: [
42 | new HtmlWebpackPlugin({
43 | template: './index.html',
44 | })
45 | ]
46 | }
--------------------------------------------------------------------------------
/homeworks/week7/test.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
13 |
39 |
40 |
--------------------------------------------------------------------------------
/homeworks/week12/hw1/handle_sign_in.php:
--------------------------------------------------------------------------------
1 | alert('帳號密碼未輸入 !');parent.location.href='./sign_in.php';";
10 | } else {
11 | // 比對使用者資料庫中該使用者的密碼是否相符
12 | $stmt = $conn->prepare("SELECT * FROM `claygao_users` WHERE `id_number` = ?");
13 | $stmt->bind_param("s", $idNumberSignIn);
14 | $stmt->execute();
15 | $result = $stmt->get_result();
16 | $row = $result->fetch_assoc();
17 | $verify = password_verify($passwordSignIn , $row['password']); // 比對密碼是否相符
18 |
19 | // 發送 cookie 到 claygao_users_certificate 與 Clinet
20 | // 出現一個 id 當作 session id 發給資料庫與 Client
21 | if ( $verify ) {
22 | session_start(); // 啟動 Session
23 | $sessionID = session_id();
24 | $id = $row['id_number'];
25 |
26 | $stmt = $conn->prepare("INSERT INTO claygao_users_certificate(id, `user_id`) VALUES(?, ?) ON DUPLICATE KEY UPDATE `id` = ?");
27 | $stmt->bind_param("sss",$sessionID, $id, $sessionID);
28 | $stmt->execute();
29 | echo "";
30 | } else {
31 | echo "";
32 | }
33 | }
34 | ?>
--------------------------------------------------------------------------------
/homeworks/week6/README.md:
--------------------------------------------------------------------------------
1 | # 作業
2 |
3 | ## hw1:切版
4 |
5 | 請切出如下圖的版面:
6 |
7 | 
8 |
9 | 不需要做到完全一樣,但可以盡你所能做的相似,除此之外,還要支援超基本的 RWD,在手機上看也不會跑版。
10 |
11 | 你可以觀察[這個網頁](https://lidemy.github.io/mentor-program-kristxeng/homeworks/week2/hw1/)來決定應該如何實作。
12 |
13 | ### 進階挑戰題
14 |
15 | 1. 把內容改成一些真的文字(主題自己想,重點是要讓這網站看起來是真的可以用的網站)並美化網站
16 |
17 | ## hw2:仿 Medium
18 |
19 | 請切出如下圖的版面:
20 | 
21 |
22 | 可以先觀察[這個網頁](https://lidemy.github.io/mentor-program-kristxeng/homeworks/week2/hw2)。
23 |
24 | 文字可以自己換成其他的,只要效果有達到就好。一樣要支援簡易的 RWD,在手機上看不會跑版(拍手會自動隱藏)。
25 |
26 | ### 進階挑戰題
27 |
28 | 1. 去觀察 Medium 的網站,連下面的推薦文章一起實作
29 | 2. 去觀察 Medium 的網站,左側的功能不只拍手,連社交分享功能一起切出來
30 | 3. 去觀察 Medium 的網站,並加上網頁上方的 nav bar
31 |
32 | ## hw3:CSS Diner
33 |
34 | 請完成這個小遊戲:https://flukeout.github.io/
35 |
36 | ## hw4:Flexbox Froggy
37 |
38 | 請完成這個小遊戲:http://flexboxfroggy.com/
39 |
40 | ## hw5:簡答題
41 |
42 | 請將答案寫在 [hw5.md](hw5.md)。
43 |
44 | 1. 請找出三個課程裡面沒提到的 HTML 標籤並一一說明作用。
45 | 2. 請問什麼是盒模型(box modal)?
46 | 3. 請問 display: inline, block 跟 inline-block 的差別是什麼?什麼時機點會用到?
47 | 4. 請問 position: static, relative, absolute 跟 fixed 的差別是什麼?分別各舉一個會用到的場合
48 |
49 | ## 挑戰題
50 |
51 | [Hacker News](https://news.ycombinator.com/) 是一個很知名的網站,上面有著各種與科技相關的資訊。現在請你看著這個網站,把它切出來。
52 |
53 | 或是如果你想把它變得更美,也可以試試看。
54 |
55 | ## 超級挑戰題
56 |
57 | 打開你的 Facebook,看著它。
58 |
59 | 打開你的文字編輯器,開始依樣畫葫蘆,切出一個 Facebook。
60 |
61 | 你只要切出你現在看得到的版面就好,不用考慮往下滑什麼的。但如果你切完還是心有餘力,那也可以試試看。
62 |
--------------------------------------------------------------------------------
/homeworks/week2/hw6.md:
--------------------------------------------------------------------------------
1 | ``` js
2 | function isValid(arr) {
3 | for(var i=0; i 0 為 false ( 若為 true,則回傳字串 'invalid' )
20 | 4. 執行第 2 行,i + 1,判斷執行條件 i < arr.length 為 true
21 | 5. 執行第 3 行,判斷 arr[1] > 0 為 false
22 | 6. 執行第 2 行,i + 1,判斷執行條件 i < arr.length 為 true
23 | 7. 執行第 3 行,判斷 arr[2] > 0 為 false
24 | 8. 執行第 2 行,i + 1,判斷執行條件 i < arr.length 為 true
25 | 9. 執行第 3 行,判斷 arr[3] > 0 為 false
26 | 10. 執行第 2 行,i + 1,判斷執行條件 i < arr.length 為 true
27 | 11. 執行第 3 行,判斷 arr[4] > 0 為 false
28 | 12. 執行第 2 行,i + 1,判斷執行條件 i < arr.length 為 true
29 | 13. 執行第 3 行,判斷 arr[5] > 0 為 false
30 | 14. 執行第 2 行,i + 1,,判斷執行條件 i < arr.length 為 false,終止 false
31 | 15. 執行第 5 行,宣告變數 i = 2,設定執行條件 i < arr.length,判斷執行條件 i < arr.length 為 true
32 | 16. 執行第 6 行,判斷 arr[2] !== arr[1] + arr[0] 為 false ( 若為 true,則回傳字串 'invalid' )
33 | 17. 執行第 5 行,i + 1,判斷執行條件 i < arr.length 為 true
34 | 18. 執行第 6 行,判斷 arr[3] !== arr[2] + arr[1] 為 false
35 | 19. 執行第 5 行,i + 1,判斷執行條件 i < arr.length 為 true
36 | 20. 執行第 6 行,判斷 arr[4] !== arr[3] + arr[2] 為 true,回傳字串 'invalid'
37 | 21. 終止函式 isValid 運算
--------------------------------------------------------------------------------
/examples/week18/README.md:
--------------------------------------------------------------------------------
1 | # 注意事項
2 |
3 | 提示:在寫完作業之後看效果最佳,沒寫作業前請不要看
4 |
5 | ## 關於 gulp 停止更新的消息
6 |
7 | 假消息,沒這種事。
8 |
9 | 作者只在推特上這樣說:
10 |
11 | > With the gulp 4.0.0 official release - it's time for me to find my next journey. Maybe a product, maybe some @reasonml consulting!? Excited to see the opportunities available
12 |
13 | 並沒有明確指出自己不更新 gulp 了,gulp 官方也完全沒有任何相關消息。不要被錯誤的解讀給誤導了。
14 |
15 |
16 | ## Webpack 與 gulp 的差異
17 |
18 | gulp 裡面有很多 task,而每一個 task 其實都可以連結到某個特定的功能,而且都要倚靠其他函式庫才能執行。
19 |
20 | 什麼意思?
21 |
22 | 例如說把 scss 轉成 css,gulp「本身」做得到嗎?做不到,要使用 gulp-sass 之類的 plugin 才能做得到。
23 |
24 | 所以 Webpack 與 gulp 的差異這個問題其實就有點像是在問「gulp 與 sass」的差異一樣,問得有點莫名其妙。
25 |
26 | 但為什麼還是會有這種問題出現呢?因為 Webpack 太過強大了,導致很多我們原本使用 gulp 的原因都可以被 Webpack 取代。gulp 是個必須完全倚靠 plugin 才能執行工作的 library,而 Webpack 除了最主要的打包功能以外,也支援了一大堆 plugin。
27 |
28 | 假設我們原本用 gulp 是為了把 ES6 轉成 ES5,把 scss 轉成 css,然後用 Webpack 把東西打包在一起。所以我們 gulp 裡面就必須使用幾個不同的 plugin。
29 |
30 | 但是前面提過了,Webpack 本身就有支援 plugin,所以它的一些 plugin 可以在打包的時候「順便」把程式碼裡面的 ES6 變成 ES5,把 scss 轉成 css。如果你原本在 gulp 就是用這些東西,那當然可以被 webpack 取代掉。
31 |
32 | 那什麼情形底下才不會被取代掉?
33 |
34 | 例如說你每次打包以前都必須 call API 拿到一個設定檔,建立 config.js,打包結束以後要再次 call API,告訴 server 你打包完成了。
35 |
36 | 你純用 Webpack 基本上達不到這個功能,因為 Webpack 支援的功能都跟「打包」有關,例如說用 babel 轉譯程式碼,是因為程式碼是 Webpack 可以載入的資源之一,sass 同理,圖片優化也同理,那些都是「資源」。但是 call API 不是什麼資源,所以 Webpack 本身做不到。
37 |
38 | 但 gulp 身為一個管理 task 的工具,你自己寫一個 task 就行了,上面講的場景用 gulp 就能輕鬆做到。
39 |
40 | 最後再強調一次,gulp 是管理 task 的工具,webpack 是拿來打包程式碼的工具,或許一般情形下兩個工具可以做到的事差不多,但他們本質上是完全不一樣的。
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/homeworks/week3/README.md:
--------------------------------------------------------------------------------
1 | # 作業
2 |
3 | 在交這週的作業以前,請務必確認 hw1~hw4 都已經通過 [Lidemy OJ](https://lidemy-oj.netlify.com/contests/2) 的測試並拿到 100 分。只有 hw5 例外,hw5 沒有寫對還是可以交作業(因為比較難)。
4 |
5 | ## hw1:好多星星
6 | 給定 n(1<=n<=30),依照規律「回傳」正確圖形(每一行是一個陣列的元素)
7 |
8 | ```
9 | n = 1
10 | ["*"]
11 |
12 | n = 3
13 | ["*", "**", "***"]
14 |
15 | n = 6
16 | ["*", "**", "***", "****", "*****", "******"]
17 | ```
18 |
19 | ## hw2:大小寫互換
20 | 給定一字串,把小寫字母轉成大寫,大寫字母轉成小寫之後回傳,若不是英文字母則忽略。
21 |
22 | ```
23 | input: nick
24 | output: NICK
25 |
26 | input: Nick
27 | output: nICK
28 |
29 | input: ,hEllO122
30 | output: ,HeLLo123
31 | ```
32 |
33 | ## hw3:判斷質數
34 | 給定一個數字 n(1<=n<=100000),請回傳 n 是否為質數(質數的定義:除了 1 以外,所有小於他的數都無法整除)
35 |
36 | ```
37 | n = 2 => true
38 | n = 3 => true
39 | n = 10 => false
40 | n = 37 => true
41 | n = 38 => false
42 | ```
43 |
44 | ## hw4:判斷迴文
45 | 給定一個長度小於 100 的字串 s,請回傳 s 是否為迴文(迴文的定義:正著唸倒著念都一樣)
46 |
47 | ```
48 | abcba => true
49 | apple => false
50 | aaaaa => true
51 | applppa => true
52 | ```
53 |
54 | ## hw5:大數加法
55 | 給定兩個長度為 l(1<=l<=1000)的數字(但型態為字串),請回傳兩個數字相加後的結果。
56 |
57 | 提示:
58 |
59 | 1. 這題不是要考你型態轉換,而且這題很難,真的很難
60 | 2. 小時候怎麼做直式加法,這一題就怎麼做,可以拿紙跟筆試試看
61 |
62 | ```
63 | "123"+"456" => "579"
64 | "12312383813881381381"+"129018313819319831" => "12441402127700701212"
65 | ```
66 |
67 | ## hw6:簡答題
68 | 請將答案寫在 [hw6.md](hw6.md)。
69 |
70 | 1. 請寫下以上五題的解題心得
71 |
72 | ## 挑戰題
73 |
74 | 大數乘法:給定兩個長度為 l(1<=l<=1000)的數字(但型態為字串),請回傳兩個數字「相乘」後的結果。
75 |
76 | ## 超級挑戰題
77 |
78 | 大數除法:給定兩個長度為 l(1<=l<=1000)的數字(但型態為字串),請回傳兩個數字「相除」後的結果。
--------------------------------------------------------------------------------
/homeworks/week24/fe/hw1/src/components/post_list/PostList.js:
--------------------------------------------------------------------------------
1 | import React, {Component} from 'react';
2 | import ReactMarkdown from 'react-markdown';
3 |
4 | class PostList extends Component {
5 |
6 | componentDidMount() {
7 | this.props.getPostList()
8 | }
9 |
10 | render(){
11 | const {history, isLoadingGetPosts, postListData} = this.props
12 | return (
13 |
14 |
15 | Articles
16 |
17 | {isLoadingGetPosts ?
18 |
19 | Loading...
20 |
:
21 | postListData.map(card => (
22 |
{
25 | history.push('/list/' + card.id)
26 | }}>
27 |
28 | {card.title}
29 |
30 |
34 |
35 | Author: {card.author ? card.author : "Noname"}
36 |
37 |
38 | ))}
39 |
40 | )
41 | }
42 | }
43 |
44 |
45 | export default PostList
--------------------------------------------------------------------------------
/homeworks/week7/hw1/index.js:
--------------------------------------------------------------------------------
1 | const bgChange = document.querySelector('body');
2 | let checkpoint = 0;// 0 為遊戲關閉的狀態
3 | const sec = Math.random() * 3000;
4 |
5 | window.addEventListener('click', () => {
6 | if (checkpoint === 0) {
7 | alert('你太早按了,失敗');
8 |
9 | const btn = document.createElement('input');
10 | btn.setAttribute('type', 'button');
11 | btn.setAttribute('value', '再玩一次');
12 | btn.setAttribute('class', 'btn');
13 | btn.setAttribute('onclick', 'document.location.reload()');
14 | document.querySelector('.message').appendChild(btn);
15 | checkpoint -= 2;
16 | }
17 | });
18 |
19 | setTimeout(() => {
20 | checkpoint += 1;
21 | if (checkpoint === 1) { // 1 為遊戲開啟的狀態
22 | bgChange.classList.add('bg-red');
23 | window.addEventListener('click', (e) => {
24 | if (checkpoint > 0) {
25 | const runningTimes = e.timeStamp;
26 | const grade = (runningTimes - sec) / 1000;
27 | if (grade <= 1.5) {
28 | alert(`成功了 ! 反應時間為 ${grade.toFixed(2)} 秒 !`);
29 | } else if (grade > 1.5) {
30 | alert('你太晚按了,失敗');
31 | }
32 |
33 | const btn = document.createElement('input');
34 | btn.setAttribute('type', 'button');
35 | btn.setAttribute('value', '再玩一次');
36 | btn.setAttribute('class', 'btn');
37 | btn.setAttribute('onclick', 'document.location.reload()');
38 | document.querySelector('.message').appendChild(btn);
39 |
40 | checkpoint -= 2;
41 | }
42 | });
43 | }
44 | }, sec);
45 |
--------------------------------------------------------------------------------
/homeworks/week9/hw4.md:
--------------------------------------------------------------------------------
1 | ## 資料庫欄位型態 VARCHAR 跟 TEXT 的差別是什麼
2 |
3 | - VARCHAR :
4 |
5 | 在 5.0.3 版本以前最大支援長度為 255,5.0.3 版之後最大長度可支援到 65535 個字節
6 |
7 | 我們在 VARCHAR 中設定的長度是字符,而字符最大可以儲存多少,與字符集有關,因為在不同字符集之下,每個字符所佔用的字節不一樣。比如在 UTF-8 之中,每個字符是 1-3 個字節,如漢字就是佔 3 個字節,所以最長可以儲存 (65535-1-2)/3 = 21844 個字符。
8 |
9 | (65535-1-2)/3
10 |
11 | -1 是因為 VARCHAR 實際儲存會從第二個字節開始,所以第一個字節不算
12 | -2 是因為超過255個字符會有2字節的額外占用空間
13 | /3 是因為最大占用字符數為 3,如漢字
14 |
15 |
16 | - TEXT :
17 |
18 | 這個型態內中不能有默認值,最大的長度為 2 的 16 次方 -1 也是 65535,但其實超出這個數字還是可以儲存,因為其還有 MediumTEXT 類型選擇,所以理論上,儲存長度是比 VARCHAR 還要多的 ( 前提是 VARCHAR 有設定長度 )。與 VARCHAR 的差別是 TEXT 需要兩個字節的空間紀錄字段總字節數,在運行資料時的速度不及 VARCHAR
19 |
20 |
21 | ---
22 |
23 |
24 | ## Cookie 是什麼?在 HTTP 這一層要怎麼設定 Cookie,瀏覽器又會以什麼形式帶去 Server?
25 |
26 | Cookie 是一個純文字型的檔案,用加密的方式儲存在用戶端上,它可能是你的登入資訊,搜尋紀錄等等。而每個 Cookie 都是有時效性的。
27 |
28 | 通常我們在發送 Request 時,伺服器會回傳一個或包含多個 Set-Cookie 的 Response 回來 ( Set-Cookie 位於 Header ),瀏覽器就會儲存之,當下一次瀏覽網頁發送 Request 時,瀏覽器就會檢查 Cookie,看看有沒有相關的 Cookies,如果有,就會在 Request Header 加入 Cookie 帶去 Server。
29 |
30 | ---
31 |
32 |
33 | ## 我們本週實作的會員系統,你能夠想到什麼潛在的問題嗎?
34 |
35 | 這樣來講,我的伺服器端會發送 Cookie 給對方瀏覽器,而我設定的 Cookie 值為該會員的暱稱,這樣做的安全性應該可以稍微好一點,因為每個會員的名稱都不相同 ( 來源為資料庫的內容 ),各自的 Cookie 也不會一樣。
36 |
37 | 但若是僅給予一個相同的值,比如說作業上預設的 001,很可能就會被盜取,因為各會員都收到一樣的 Cookie 值。
38 |
39 | 而就會員系統本身也有一些問題是,由於帳號密碼都是以原本的形式存在於資料庫之中,所以很可能的狀況是我把太多會員的帳號密碼都依賴在一個資料庫的帳號密碼上面,只要這個資料庫的密碼一被知道,裡面內含的會員帳號資訊都會曝光。
40 |
41 | 所以有一個可以做的方法是,我可以把會員的密碼以一個複雜的公式,近乎亂數的方式儲存在資料庫之中,然後當會員需要登入驗證時,也採用這套公式對比資料庫內的資料,所以至少我就可以把真正的秘密藏在我後端的運作邏輯,而非一目了然的表單了。
42 |
43 |
44 |
--------------------------------------------------------------------------------
/homeworks/week4/hw3.js:
--------------------------------------------------------------------------------
1 | const request = require('request');
2 | const process = require('process');
3 |
4 |
5 | if (process.argv[2] === 'list') {
6 | request('https://lidemy-book-store.herokuapp.com/books?_limit=20', (error, response, body) => {
7 | const obj = JSON.parse(body);
8 | for (let i = 0; i < obj.length; i += 1) {
9 | console.log(`ID : ${obj[i].id} / 書名:${obj[i].name}`);
10 | }
11 | });
12 | }
13 |
14 |
15 | if (process.argv[2] === 'read') {
16 | request(`https://lidemy-book-store.herokuapp.com/books/${process.argv[3]}`, (error, response, body) => {
17 | const obj = JSON.parse(body);
18 | console.log(`ID : ${obj.id} / 書名:${obj.name}`);
19 | });
20 | }
21 |
22 |
23 | if (process.argv[2] === 'delete') {
24 | request(`https://lidemy-book-store.herokuapp.com/books/${process.argv[3]}`, (error, response, body) => {
25 | const obj = JSON.parse(body);
26 | console.log(`您刪除了ID : ${obj.id} / 書名:${obj.name}`);
27 | });
28 | request.delete(`https://lidemy-book-store.herokuapp.com/books/${process.argv[3]}`);
29 | }
30 |
31 |
32 | if (process.argv[2] === 'create') {
33 | request.post(
34 | {
35 | url: 'https://lidemy-book-store.herokuapp.com/books',
36 | form: {
37 | name: process.argv[3],
38 | },
39 | },
40 | );
41 | }
42 |
43 |
44 | if (process.argv[2] === 'update') {
45 | request.patch(
46 | {
47 | url: `https://lidemy-book-store.herokuapp.com/books/${process.argv[3]}`,
48 | form: {
49 | name: process.argv[4],
50 | },
51 | },
52 | );
53 | }
54 |
--------------------------------------------------------------------------------
/homeworks/week23/fe/hw1/src/components/post_list/PostList.js:
--------------------------------------------------------------------------------
1 | import React, {Component} from 'react';
2 | import ReactMarkdown from 'react-markdown';
3 |
4 | class PostList extends Component {
5 | constructor(props) {
6 | super(props)
7 | }
8 |
9 | componentDidMount() {
10 | this.props.getPostList()
11 | }
12 |
13 | render(){
14 | const {history, isLoadingGetPosts, postListData} = this.props
15 | return (
16 |
17 |
18 | Articles
19 |
20 | {isLoadingGetPosts ?
21 |
22 | Loading...
23 |
:
24 | postListData.map(card => (
25 |
{
28 | history.push('/list/' + card.id)
29 | }}>
30 |
31 | {card.title}
32 |
33 |
37 |
38 | Author: {card.author ? card.author : "Noname"}
39 |
40 |
41 | ))}
42 |
43 | )
44 | }
45 | }
46 |
47 |
48 | export default PostList
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/build/static/js/runtime-main.04a13e19.js:
--------------------------------------------------------------------------------
1 | !function(e){function r(r){for(var n,p,l=r[0],a=r[1],f=r[2],c=0,s=[];c {
15 | const gameInfo = JSON.parse(body);
16 | console.log(`You are searching ${gameName} now...`);
17 | const gameID = gameInfo.data[0].id;
18 |
19 | request({
20 | url: `https://api.twitch.tv/helix/streams?game_id=${gameID}&sort=views&first=100`,
21 | method: 'GET',
22 | headers: {
23 | 'Client-ID': clientID,
24 | },
25 | }, (error2, response2, body2) => {
26 | const obj = JSON.parse(body2);
27 | const afterStr = obj.pagination.cursor;
28 | for (let i = 0; i < obj.data.length; i += 1) {
29 | console.log(`ID : ${obj.data[i].id} Name : ${obj.data[i].user_name} Views : ${obj.data[i].viewer_count}`);
30 | }
31 | request({
32 | url: `https://api.twitch.tv/helix/streams?game_id=${gameID}&sort=views&first=100&after=${afterStr}`,
33 | method: 'GET',
34 | headers: {
35 | 'Client-ID': clientID,
36 | },
37 | }, (error3, response3, body3) => {
38 | const obj2 = JSON.parse(body3);
39 |
40 | for (let i = 0; i < obj2.data.length; i += 1) {
41 | console.log(`ID : ${obj2.data[i].id} Name : ${obj2.data[i].user_name} Views : ${obj2.data[i].viewer_count}`);
42 | }
43 | });
44 | });
45 | });
46 |
--------------------------------------------------------------------------------
/homeworks/week1/hw5.md:
--------------------------------------------------------------------------------
1 | ## 請解釋後端與前端的差異。
2 |
3 | - 前端:泛指使用者使用瀏覽器時所見到且可與之互動的一切。包括文字,色彩,按鈕,移動到該圖片或影片時會自動放大或自動播放,都是所於前端的範疇。
4 |
5 | - 後端:泛指因前端接收到使用者行為(如輸入帳號密碼,關鍵字,點擊按鈕)而接收其所發出的 request 的一切部分。如伺服器端接受到該 request 並將其輸入內容傳入給資料庫 (Database)分析,都是屬於後端範疇。
6 |
7 | * 兩者差異;比較明顯的差異是本質與事件順序的不同。
8 |
9 | 就一般使用者感官而言,前端所輸出的內容絕大多數都是使用者可見的,而後端的運算邏輯與分析一般使用者通常不易看到或察覺。
10 |
11 | 就時點而言,前端所顯現的內容一般最先被使用者接觸,而使用者與前端互動後才會經過後端的接收 request 與回傳 response 的部分,而其又再次回傳至前端給使用者觀覽。
12 |
13 | ---
14 | ## 假設我今天去 Google 首頁搜尋框打上:JavaScri**p**t 並且按下 Enter,請說出從這一刻開始到我看到搜尋結果為止發生在背後的事情。
15 |
16 |
17 |
18 | 1. 你在搜尋框輸入 Javasript 並按下 Enter
19 | 2. 前端收到 Javascript這個關鍵字,並將其關鍵字送至伺服器
20 | 3. 後端伺服器接收到後,於資料庫經歷過幾千幾萬次的**運算**,彙整最適合的搜尋結果
21 | 4. 伺服器將運算與搜尋結果回傳給前端
22 | 5. 前端瀏覽器收到結果,轉化為使用者可以閱讀的文字與內容部分
23 |
24 | - 在第 3 步驟,關於**運算**的部分,實際上當伺服器接收到關鍵字的同時,Google 資料庫會命令名為 Spider 的搜尋索引功能,這些蜘蛛會先從少量網頁開始,在每一次找到網頁都會再從其蔓延至更多的網頁,當收集了上萬筆資料後,再篩選要取哪些內容,其會分析你關鍵字代表的意思,比如說**判斷關鍵字比較常屬於是別人網址的一部分,或者是標題還是內容,其來自優質網頁還是垃圾網頁**,每經過一次判斷,就過濾一次結果。篩選決定最後要回傳哪些內容給前端至使用者。
25 |
26 | 由於這運算過程經歷過幾上萬至上百萬次運算,故以補充說明補上
27 |
28 | 而上述所有過程,使用可能僅僅只有 0.5 的時間。
29 |
30 |
31 |
32 | - 參考資料:
33 |
34 |
35 | ---
36 | ## 請列舉出 5 個 command line 指令並且說明功用
37 |
38 | 指令|功用|舉例
39 | :-:|:-:|:-:
40 | head|顯示文件最初算起n行的內容|head -n fileName
41 | tail|顯示文件最後往回算起n行的內容|tail -n fileName
42 | diff|比較兩個文件之差異|diff fileA fileB
43 | wc|統計文件的行數, 詞數與字元數 (左至右)|wc fileName
44 | nl|印出文件加上行號|nl fileName
45 |
46 |
47 | - 參考資料:
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/src/post/Post.js:
--------------------------------------------------------------------------------
1 | import React, {Component} from 'react';
2 | import ReactMarkdown from 'react-markdown';
3 | import axios from 'axios';
4 |
5 | class Post extends Component {
6 | constructor(props) {
7 | super(props)
8 | this.state = {
9 | postData: [],
10 | }
11 | }
12 |
13 | handlePostData = () => {
14 | const listId = this.props.match.params.listId
15 | const url = 'https://qootest.com/posts/' + listId
16 | axios.get(url)
17 | .then(resp => {
18 | this.setState({
19 | postData: resp.data
20 | })
21 | })
22 | }
23 |
24 | componentDidMount() {
25 | this.handlePostData()
26 | }
27 |
28 | render(){
29 | const { postData } = this.state
30 | return (
31 |
32 |
34 |
35 | {postData.title}
36 |
37 |
41 |
42 | {"Author: " + (postData.author ? postData.author : "Noname")}
43 |
44 |
45 |
46 | )
47 | }
48 | }
49 |
50 |
51 | export default Post
--------------------------------------------------------------------------------
/homeworks/week22/fe/hw1/src/App.js:
--------------------------------------------------------------------------------
1 | import React, {Component} from 'react';
2 | import './scss/App.scss';
3 | import Nav from './nav'
4 | import PostList from './post_list'
5 | import Post from './post'
6 | import About from './about'
7 | import Write from './write'
8 | import Home from './home'
9 | import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
10 |
11 |
12 |
13 | class App extends Component {
14 | constructor(props) {
15 | super(props)
16 | this.state = {
17 | scrollY : window.scrollY
18 | }
19 | }
20 |
21 | componentDidMount() {
22 | window.addEventListener("scroll", this.scroll);
23 | }
24 |
25 | componentWillUnmount(){
26 | window.removeEventListener("scroll", this.scroll);
27 | }
28 |
29 | scroll = () => {
30 | this.setState({
31 | scrollY : window.scrollY
32 | })
33 | }
34 |
35 | render() {
36 | const {scrollY} = this.state
37 | return (
38 |
39 |
40 |
51 |
52 | )
53 | }
54 | }
55 |
56 | export default App;
57 |
--------------------------------------------------------------------------------
/examples/week2/README.md:
--------------------------------------------------------------------------------
1 | ### 第一題:printStars
2 |
3 | 這題比較沒難度就不解釋了,照著做就行了。有很多人會把字串拼好再印出來,也是 ok
4 |
5 | ``` js
6 | function printStars(n) {
7 | for (let i = 0; i < n; i += 1) {
8 | console.log('*');
9 | }
10 | }
11 | ```
12 |
13 | ### 第二題:capitalize
14 |
15 | 有很多人都會用 charAt 或是先把字串用 split 變成陣列再來做這題,但其實在 JS 裡面你本來就可以用 str[0] 取到第一個字,不需要用 chatAt。
16 | 另一個常見問題是會檢查第一個字是否是小寫再轉,但內建的 toUpperCase 如果本來就是大寫,轉完也還是大寫,想一下之後會發現根本不需要檢查。
17 |
18 | ``` js
19 | function capitalize(str) {
20 | return str[0].toUpperCase() + str.slice(1);
21 | }
22 | ```
23 |
24 | ### 第三題:reverse
25 |
26 | 迴圈倒著做就好
27 |
28 | ``` js
29 | function reverse(str) {
30 | let result = '';
31 | for (let i = str.length - 1; i >= 0; i -= 1) {
32 | result += str[i];
33 | }
34 | console.log(result);
35 | }
36 | ```
37 |
38 | ### 第四題:printFactor
39 |
40 | 這題的迴圈不要從 0 開始,因為語意上是不通的,你不會想拿數字去除以 0
41 |
42 | ``` js
43 | function printFactor(n) {
44 | for (let i = 1; i <= n; i += 1) {
45 | if (n % i === 0) {
46 | console.log(i);
47 | }
48 | }
49 | }
50 | ```
51 |
52 | ### 第五題:內建函式自己做
53 |
54 | join 這題之前跟大家說過第一個參數應該是陣列,這邊我在檔案裡面忘記改到。
55 | 然後一大堆人都沒看清楚範例輸出入,所以最常見的錯誤是最後面多了一個連接的字串。
56 | 另外,當陣列是空的的時候可以特別處理,在這情形下應該要回傳空字串
57 |
58 | ``` js
59 | function join(arr, concatStr) {
60 | if (arr.length === 0) { // special case
61 | return '';
62 | }
63 |
64 | let result = arr[0];
65 | for (let i = 1; i < arr.length; i += 1) {
66 | result += concatStr + arr[i];
67 | }
68 | return result;
69 | }
70 | ```
71 |
72 | repeat 比較容易,就迴圈一下
73 |
74 | ``` js
75 | function repeat(str, times) {
76 | let result = '';
77 | for (let i = 0; i < times; i += 1) {
78 | result += str;
79 | }
80 | return result;
81 | }
82 | ```
--------------------------------------------------------------------------------
/homeworks/week8/hw3/main.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | padding: 0;
4 | background-image: url('./bg1.jpg');
5 | background-size:cover;
6 | background-repeat:no-repeat;
7 | background-color: black;
8 | display: flex;
9 | justify-content: center;
10 | }
11 |
12 | .game__board {
13 | display: flex;
14 | justify-content: center;
15 | flex-wrap: wrap;
16 | width: 1300px;
17 | height: 1300px auto;
18 | align-content:flex-start;
19 | padding-top:15px;
20 | padding-bottom:15px;
21 | }
22 |
23 | .lives__big {
24 | width: 576px;
25 | height: 324px;
26 | background: orange;
27 | margin: 19px;
28 | border: 2px solid rgb(82, 81, 81);
29 | border-radius: 10px;
30 | transition: 0.15s all;
31 | }
32 |
33 | .lives__big:hover {
34 | transform: scale(1.05);
35 | border: 3px solid goldenrod;
36 | border-radius: 10px;
37 | }
38 |
39 |
40 | .lives {
41 | width: 384px;
42 | height: 216px;
43 | border: 2px solid rgb(82, 81, 81);
44 | border-radius: 10px;
45 | margin: 20px;
46 | transition: 0.15s all;
47 | }
48 |
49 | .lives:hover {
50 | transform: scale(1.05);
51 | border: 3px solid goldenrod;
52 | border-radius: 10px;
53 | }
54 |
55 | .lives__text {
56 | width: 100% auto;
57 | height: 30% auto;
58 | background: rgba(129, 125, 125,0.8);
59 | font-family: sans-serif;
60 | font-weight: bold;
61 | color: white;
62 | display: flex;
63 | align-items: center;
64 | overflow: ellipsis;
65 | border: 0px;
66 | border-radius: 10px;
67 | }
68 |
69 | .logo {
70 | margin: 2px 7px;
71 | padding: 0px;
72 | height: 40px ;
73 | width: 40px ;
74 | border: 1.2px solid gray;
75 | border-radius: 50%;
76 | }
--------------------------------------------------------------------------------
/examples/week7/hw1.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
23 |
24 |
25 |
28 |
29 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/homeworks/week19/hw2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
10 |
11 |
28 |
29 |
To-do
30 |
31 |
32 |
33 |
34 |
Done
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------