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 elements = document.querySelectorAll('.amount.isEditable'); | |
| const arr = []; | |
| elements.forEach((element) => { | |
| arr.push(element.innerText) | |
| }); | |
| arr.reduce((total, current) => { | |
| current = Number(current.replace('₹', '').replace(',','')); | |
| total += Number(current) | |
| return total; | |
| }, 0) |
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
| import { useCallback, useState } from 'react'; | |
| export const initialState = { | |
| draggedFrom: null, | |
| draggedTo: null, | |
| isDragging: false, | |
| defaultOrder: [], | |
| updatedOrder: [] | |
| }; |
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
| file = open('coupons_seeds.txt', 'r') | |
| queries = list() | |
| def writeQuery (): | |
| for line in file: | |
| line = line.split(' ') | |
| if(line[0] == '\n'): continue | |
| query = 'insert into coupons (code, discount) values (\'{0}\', {1});'.format(line[0], line[1].replace('\n', '').replace('$', '')) | |
| print(query) |
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
| import { useState, useEffect } from 'react' | |
| export const useFetch = (url) => { | |
| const [data, setData] = useState(undefined) | |
| const [loading, setLoading] = useState(false) | |
| useEffect(() => { | |
| // loading set to true for spinner to show up | |
| setLoading(true) | |
| // make the api call |
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
| .hero-h1{ | |
| margin:30vh auto 25px; | |
| font-weight: bold; | |
| padding-bottom: 5px; | |
| position: relative; | |
| opacity: 0; | |
| animation: 1s fade-in 1s forwards; | |
| } | |
| .hero-h1:before{ | |
| content: ""; |
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
| // Question 1: The output for the below code snippet | |
| for(var i=0;i<10;i++){ | |
| setTimeout(function(){ | |
| console.log(i); | |
| },0); | |
| } | |
| // is the number '10' printed 10 times . The reason for this is that each function executed within the | |
| // loop will be executed after the entire loop has completed and all will therefore reference the last value stored | |
| // in i, which was 10. |
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
| .start-btn | |
| { | |
| background : -moz-linear-gradient(0% 50% 0deg,rgba(79, 34, 128, 1) 0%,rgba(212, 20, 90, 1) 100%); | |
| background : -webkit-linear-gradient(0deg, rgba(79, 34, 128, 1) 0%, rgba(212, 20, 90, 1) 100%); | |
| background : -webkit-gradient(linear,0% 50% ,100% 50% ,color-stop(0,rgba(79, 34, 128, 1) ),color-stop(1,rgba(212, 20, 90, 1) )); | |
| background : -o-linear-gradient(0deg, rgba(79, 34, 128, 1) 0%, rgba(212, 20, 90, 1) 100%); | |
| background : -ms-linear-gradient(0deg, rgba(79, 34, 128, 1) 0%, rgba(212, 20, 90, 1) 100%); | |
| -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#4F2280', endColorstr='#D4145A' ,GradientType=0)"; | |
| background : linear-gradient(90deg, rgba(79, 34, 128, 1) 0%, rgba(212, 20, 90, 1) 100%); | |
| border-radius : 26px; |
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
| /* Create A Reducer | |
| * | |
| * You need to create a reducer called "appReducer" that accepts two arguments: | |
| * - First, an array containing information about ice cream | |
| * - Second, an object with a 'DELETE_FLAVOR' `type` key | |
| * (i.e., the object contains information to delete the flavor from the state) | |
| * | |
| * The action your reducer will receive will look like this: | |
| * { type: 'DELETE_FLAVOR', flavor: 'Vanilla' } | |
| * |