Skip to content

Instantly share code, notes, and snippets.

View BetterProgramming's full-sized avatar

BetterProgramming

View GitHub Profile
.App {
display: flex;
text-align: center;
height: 100vh;
}
.button {
max-width: 8em;
max-height: 4em;
font-size: 1em;
margin: auto;
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
{
"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"
console.log(' Start *********************** ');
fs.readFile('file1.txt', 'utf8',(err,data)=>{
if(err){
throw err;
}
console.log(data);
})
console.log('End ***********************');
const server = http.createServer((req,res)=>{
res.write('Hello World !!');
res.end();
})
server.listen(30008,()=>{
console.log('Server Listening on 30008')
})
//Sample Snippet
'.text.html':
'Add A Button with a class':
'prefix': 'clasbut'
'body':
"""
<button class="$1">$2</button>
"""
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({
>>> 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
>>> l4[0]
1
>>> l4[1]
2
>>> l4[2]
[3, 4, [5]]
>>> l4[3]
'a'
>>> l4[4]
3.2
>>> 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
>>>