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
| function makeId(length) { | |
| let result = ""; | |
| const characters = | |
| "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; | |
| const charactersLength = characters.length; | |
| for (let i = 0; i < length; i++) { | |
| result += characters.charAt(Math.floor(Math.random() * charactersLength)); | |
| } | |
| return result; | |
| } |
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
| //Dijkstra algorithm is used to find the shortest distance between two nodes inside a valid weighted graph. Often used in Google Maps, Network Router etc. | |
| //helper class for PriorityQueue | |
| class Node { | |
| constructor(val, priority) { | |
| this.val = val; | |
| this.priority = priority; | |
| } | |
| } |
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
| "use strict"; | |
| class Color { | |
| constructor(r, g, b) { | |
| this.set(r, g, b); | |
| } | |
| toString() { | |
| return `rgb(${Math.round(this.r)}, ${Math.round(this.g)}, ${Math.round( | |
| this.b | |
| )})`; |
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
| //get the nth number in fibonacci sequence, base case is 0 and 1. | |
| //solution 1, easier to understand but it's not good. It has a time complexity of O(2^n). | |
| function fib(num) { | |
| if (num === 2) return 1; | |
| if (num === 1) return 0; | |
| return fib(num - 1) + fib(num - 2); | |
| } | |
| fib(6) //returns 5 |
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
| // A binary tree is a tree data structure in which each node has at most two children, which are referred to as the left child and the right child. | |
| // Left child is always less than it's parent and the right child is always bigger than it's parent. | |
| class Node { | |
| constructor(value) { | |
| this.value = value; | |
| this.right = null; | |
| this.left = null; | |
| } | |
| } |
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 React, { useRef, useEffect, useState } from "react"; | |
| import { RxCross2 } from "react-icons/rx"; | |
| import { motion } from "framer-motion"; | |
| import { BiDotsHorizontalRounded } from "react-icons/bi"; | |
| import { useLocation } from "react-router-dom"; | |
| import { Rings } from "react-loader-spinner"; | |
| function checkIfArraysEmpty(obj) { | |
| for (let key in obj) { | |
| if (Array.isArray(obj[key]) && obj[key].length > 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
| const functions = require("firebase-functions"); | |
| const admin = require("firebase-admin"); | |
| const privateKey = ""; | |
| const clientEmail = ""; | |
| const projectId = ""; | |
| if (!admin.apps.length) { | |
| admin.initializeApp({ | |
| credential: admin.credential.cert({ |
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
| {"UserId":"12xxxx", | |
| "PlatformID": ["twitter"], | |
| "Description": "Hello World", | |
| "Hashtags": ["#watch", "#cartier"], | |
| "Mentions": ["@someone", "@else", "@here"], | |
| "Image": ["data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAeAB4AAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wAARCAHgAnEDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEA |
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
| {% comment %} | |
| @param class_root {String} | |
| Base class root | |
| @param show_range {Bool} | |
| Show price range | |
| @param price_range_format {String} | |
| 'range' or 'from', defaults to 'range' |
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
| [ | |
| { | |
| "role": "system", | |
| "content": "Imagine you're an expert product reviewers that tries to give insight on specific and important details based on reviews" | |
| }, | |
| { | |
| "role": "user", | |
| "content": "This is the first product: Budge Lite Car Cover Dirtproof, Scratch Resistant, Breathable, Dustproof, Car Cover Fits Sedans up to 264\", Gray and here are its reviews from other people, I'll send more reviews in a bit: [{\"rating\":\"5.0 out of 5 stars\",\"title\":\"5.0 out of 5 stars\\n\\n\\n\\n\\n\\n\\n\\n \\n \\n Not suitable for 98+ Lincoln hood ornament modifications\",\"text\":\"I ordered this cover for a 1998 Lincoln Town Car. Its the right size, it wards off dust just like it says. I ordered just the dust cover and surprisingly its a tad “water resistant”. By that i mean any part of the cover that isn’t directly laying flat on your car will “roll” water off the side. Pretty cool! I ordered and used Amazon’s size confirming feature to make sure it would fit the 1998 lincoln town car i meant |
NewerOlder