Skip to content

Instantly share code, notes, and snippets.

View mikaeelkhalid's full-sized avatar
💭
famous, i am not.

Mikaeel Khalid mikaeelkhalid

💭
famous, i am not.
View GitHub Profile
import json
import boto3
client = boto3.client('lambda')
def lambda_handler(event, context):
inputForInvoker = {'Id': '1', 'Price': 100 }
response = client.invoke(
@mikaeelkhalid
mikaeelkhalid / Controlled.js
Created October 21, 2021 06:58
Difference between controlled and uncontrolled components in react
import React, { useState } from "react";
const Controlled = () => {
const [inputText, setInputText] = useState("");
const handleSubmit = (e) => {
e.preventDefault();
console.log(inputText);
};
@mikaeelkhalid
mikaeelkhalid / flat_array.js
Last active October 20, 2021 11:06
Javascript alternative way to flatten an array
const arr = [1, [7, 8], 2, 3, 4, 5, [6, 9, 10]];
const flat = [].concat(...arr);
console.log(flat); // output: [1, 7, 8, 2, 3, 4, 5, 6, 9, 10]
@mikaeelkhalid
mikaeelkhalid / charat.js
Created October 20, 2021 10:50
5 JavaScript String Methods To Make Your Life Easier
const str = 'Hello World';
console.log(str.charAt(0)); // output: H
@mikaeelkhalid
mikaeelkhalid / filter.js
Created October 20, 2021 10:27
How To Use: sort(), filter() keys() in JavaScript
const isEven = (num) => num % 2 === 0;
const filtered = [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20].filter(isEven);
console.log(filtered); // output: [10, 12, 14, 16, 18, 20]