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
| from enum import Enum | |
| class Xyz(Enum): | |
| """Xyz._member_map_.values()""" | |
| A = 100 | |
| B = 200 | |
| # Key: Pair of Enums | |
| map = Xyz._member_map_ |
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
| Vite is a fast and efficient WebD build tool to build and serve web apps | |
| 1. instant server start and fast code reloading make development a breeze. | |
| 2. PROD builds are optimized for performance, resulting in smaller bundle sizes and faster load times. | |
| 3. not work seamlessly with older browsers. | |
| 4. Hot Module Replacement (HMR) is a feature that allows developers to update and reload individual modules (e.g., JavaScript files) without requiring a full page reload. | |
| This enables a faster and more efficient development experience. | |
| Install Node (Linux) |
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
| <!-- https://mvnrepository.com/artifact/org.modelmapper/modelmapper --> | |
| <dependency> | |
| <groupId>org.modelmapper</groupId> | |
| <artifactId>modelmapper</artifactId> | |
| <version>3.2.2</version> | |
| </dependency> | |
| ....................................................................................................... | |
| package com.example.DemoApp.service; |
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 time | |
| from functools import wraps | |
| def timed_cache(expiration): | |
| cache = {} | |
| def decorator(func): | |
| @wraps(func) | |
| def wrapper(*args): | |
| now = time.time() |
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
| from db_connector import SQLHelper | |
| import pandas as pd | |
| chunk_size = 20 # Number of rows in chunks | |
| chunks = [] | |
| file_name = 'customers-100.csv' | |
| for chunk in pd.read_csv(file_name, chunksize=chunk_size, delimiter=","): | |
| df: pd.DataFrame = chunk |
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
| """ | |
| sudo mysql -u root | |
| > CREATE USER 'sammy'@'localhost' IDENTIFIED BY 'password'; | |
| > ALTER USER 'sammy'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; | |
| > GRANT ALL PRIVILEGES ON dbTest.* To 'user'@'hostname' IDENTIFIED BY 'password'; | |
| > FLUSH PRIVILEGES; | |
| > mysql://deepanshu:deepanshu@localhost:3306/my_db |
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
| console.log("chart called"); | |
| const plu = { | |
| htmlLegend: { | |
| // ID of the container to put the legend in | |
| containerID: 'legend-container', | |
| }, | |
| legend: { | |
| display: true, |
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 wixdata from 'wix-data'; | |
| import wixWindowFrontend from 'wix-window-frontend'; | |
| let collection = ""; | |
| let x_axis_field = null; | |
| let y_axis_field = null; | |
| let animationDuration = 1000; | |
| let chartData = {}; | |
| let chartClass = ".LCNC-Charts" | |
| let toggleGrid = { |
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
| 3 steps: | |
| 1. create custom errors and sxtend from `RuntimeException` | |
| 2. create a global Exception Handler | |
| 3. directly throw the exception from anywhere | |
| ................................................................................................................. | |
| @ResponseStatus(HttpStatus.BAD_REQUEST) | |
| public class BadReq extends RuntimeException { |
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 com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |
| import com.fasterxml.jackson.annotation.JsonIgnore; | |
| import com.fasterxml.jackson.annotation.JsonProperty; | |
| import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | |
| import com.fasterxml.jackson.databind.DeserializationContext; | |
| import com.fasterxml.jackson.databind.annotation.JsonSerialize; | |
| import com.fasterxml.jackson.databind.annotation.JsonNaming; | |
| import com.fasterxml.jackson.databind.json.JsonMapper; |