Skip to content

Instantly share code, notes, and snippets.

View afaquejam's full-sized avatar
🚀
Deploying new features, all the time!

Afaque Jamadar afaquejam

🚀
Deploying new features, all the time!
View GitHub Profile
@afaquejam
afaquejam / example-serverless-service.yml
Created June 3, 2021 09:23
Example Serverless Service
service: restaurants-service
frameworkVersion: '2'
plugins:
- serverless-bundle
provider:
name: aws
runtime: nodejs12.x
@afaquejam
afaquejam / example-service-cloudformation.json
Created June 3, 2021 09:09
Example Service Cloudformation
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "The AWS CloudFormation template for this Serverless application",
"Resources": {
"ServerlessDeploymentBucket": {
"Type": "AWS::S3::Bucket",
"Properties": {
"BucketEncryption": {
"ServerSideEncryptionConfiguration": [
{
@afaquejam
afaquejam / pagination-dot.ts
Created October 4, 2020 07:28
React Pagination Dot
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';
@afaquejam
afaquejam / config-vscode-for-python
Last active August 18, 2019 15:31
VS Code Config for Python
# 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).
@afaquejam
afaquejam / eslint-config-for-node
Last active August 12, 2020 19:28
eslint config for node
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,
@afaquejam
afaquejam / async-await-example.js
Last active August 18, 2019 15:32
Async Await Example
'use strict';
const students = [
{
id: 1,
name: 'Bart',
},
{
id: 2,
name: 'Lisa',
@afaquejam
afaquejam / general-promise-usage.js
Last active August 18, 2019 15:32
General Promise Usage
'use strict';
const students = [
{
id: 1,
name: 'Bart',
},
{
id: 2,
name: 'Lisa',
@afaquejam
afaquejam / async-basics.js
Last active August 18, 2019 15:34
Async Basics
/*
* 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
@afaquejam
afaquejam / js-for-iteration.js
Last active August 18, 2019 15:34
Javascript for iteration
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
@afaquejam
afaquejam / js-error-handling.js
Last active August 18, 2019 15:34
Javascript Error Handling
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 {