This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .App { | |
| display: flex; | |
| text-align: center; | |
| height: 100vh; | |
| } | |
| .button { | |
| max-width: 8em; | |
| max-height: 4em; | |
| font-size: 1em; | |
| margin: auto; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = { | |
| webpack: function (config, env) { | |
| return config; | |
| }, | |
| jest: function (config) { | |
| return config; | |
| }, | |
| // configFunction is the original react-scripts function that creates the | |
| // Webpack Dev Server config based on the settings for proxy/allowedHost. | |
| // react-scripts injects this into your function (so you can use it to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "02_basic", | |
| "version": "1.0.0", | |
| "description": "This project is made for medium article", | |
| "main": "index.js", | |
| "scripts": { | |
| "test": "echo \"Error: no test specified\" && exit 1" | |
| }, | |
| "keywords": [ | |
| "node.js","basics" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| console.log(' Start *********************** '); | |
| fs.readFile('file1.txt', 'utf8',(err,data)=>{ | |
| if(err){ | |
| throw err; | |
| } | |
| console.log(data); | |
| }) | |
| console.log('End ***********************'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const server = http.createServer((req,res)=>{ | |
| res.write('Hello World !!'); | |
| res.end(); | |
| }) | |
| server.listen(30008,()=>{ | |
| console.log('Server Listening on 30008') | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Sample Snippet | |
| '.text.html': | |
| 'Add A Button with a class': | |
| 'prefix': 'clasbut' | |
| 'body': | |
| """ | |
| <button class="$1">$2</button> | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| state = { | |
| rawData = null; // by default | |
| } | |
| componentDidMount() { | |
| // your code to fetch data via REST API, GraphQL, etc. | |
| .then(response => { | |
| // If response has data | |
| if (response.data) { | |
| // Add response data to state to force re-render of components | |
| this.setState({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >>> id | |
| <built-in function id> | |
| >>> print(id.__doc__) | |
| Return the identity of an object. | |
| This is guaranteed to be unique among simultaneously existing objects. | |
| (CPython uses the object's memory address.) | |
| >>> | |
| >>> # let's see it in action | |
| >>> | |
| >>> a = 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >>> l4[0] | |
| 1 | |
| >>> l4[1] | |
| 2 | |
| >>> l4[2] | |
| [3, 4, [5]] | |
| >>> l4[3] | |
| 'a' | |
| >>> l4[4] | |
| 3.2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >>> l4['eggs'] | |
| Traceback (most recent call last): | |
| File "<stdin>", line 1, in <module> | |
| TypeError: list indices must be integers or slices, not str | |
| >>> | |
| >>> l4[1.0] | |
| Traceback (most recent call last): | |
| File "<stdin>", line 1, in <module> | |
| TypeError: list indices must be integers or slices, not float | |
| >>> |