This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: restaurants-service | |
frameworkVersion: '2' | |
plugins: | |
- serverless-bundle | |
provider: | |
name: aws | |
runtime: nodejs12.x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Description": "The AWS CloudFormation template for this Serverless application", | |
"Resources": { | |
"ServerlessDeploymentBucket": { | |
"Type": "AWS::S3::Bucket", | |
"Properties": { | |
"BucketEncryption": { | |
"ServerSideEncryptionConfiguration": [ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { StatusBar } from 'expo-status-bar'; | |
import React, { useState } from 'react'; | |
import { StyleSheet, Text, View, Button } from 'react-native'; | |
import PaginationDot from 'react-native-animated-pagination-dot'; | |
export default function App() { | |
const [currentPage, setCurrentPage] = useState(0); | |
const maxPage = 20; | |
const color = 'black'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Configure VSCode for Python Programming | |
* Install Python on your computer. | |
* Install Python extension in VSCode. | |
* Install pylint (it follows PEP8. | |
* Run this command: `pylint --generate-rcfile > ~/.pylintrc` | |
* Look at the bottom status bar (left side) for the Python Interpretor currently selected. Change if necessary. | |
* Install Ctags: brew install ctags. This will help you generate a list of object properties while coding (auto-completing). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
New info: have a look into this: https://travishorn.com/setting-up-eslint-on-vs-code-with-airbnb-javascript-style-guide-6eb78a535ba6 | |
// npm install eslint --save-dev | |
// eslint --init | |
// Update the .eslintrc.json | |
{ | |
"extends": "google", | |
"env": { | |
"node": true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const students = [ | |
{ | |
id: 1, | |
name: 'Bart', | |
}, | |
{ | |
id: 2, | |
name: 'Lisa', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const students = [ | |
{ | |
id: 1, | |
name: 'Bart', | |
}, | |
{ | |
id: 2, | |
name: 'Lisa', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* An async function always returns a promise. | |
* Whatever value you return, it will be returned as a promise. | |
* If you want to reject a promise, then you can do so by throwing an error. | |
*/ | |
let getData = async (userInput) => { | |
if (userInput === 1) | |
return 'Yes!' | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let myArray = [1, 2, 3, 4]; | |
// This iterates over contents of container. This is not applicable for objects. | |
for (item of myArray) { | |
console.log(item); // 1, 2, 3, 4 | |
} | |
let myObject = { | |
first: 1, | |
second: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let myName = undefined; | |
try { | |
if (myName === undefined) | |
throw Error('Name not defined!'); | |
} catch (error) { | |
console.log( | |
`Error name is ${error.name} & the error message is ${error.message}` | |
); | |
} finally { |
NewerOlder