Skip to content

Instantly share code, notes, and snippets.

View iamsaksham's full-sized avatar

Saksham Jain iamsaksham

  • Roadzen
  • New Delhi, India
View GitHub Profile
@iamsaksham
iamsaksham / petrolBill.html
Last active January 9, 2024 10:44
HTML format petrol bill BP
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=UTF-8">
<style type="text/css">
<!--
span.cls_002 {
font-family: Times, serif;
font-size: 13.1px;
color: rgb(0, 0, 0);
@iamsaksham
iamsaksham / dynamicFields.js
Created April 1, 2021 09:18
Return field based on the inputType of the JSON
export const fetchFormField = (
fieldItem,
formValues = {},
apiSuggestions = {},
handleFetchSuggestions,
) => {
switch (fieldItem.inputType) {
case 'autocomplete':
return (
<div className="form-autocomplete">
@iamsaksham
iamsaksham / renderForm.jsx
Last active April 1, 2021 09:17
Dynamic form rendering
<form onSubmit={handleSubmit}>
{sections.map(subsectionItem => {
const { fields: formFields = [] } = subsectionItem;
if (formValues[subsectionItem.parent.inputKey] === subsectionItem.parent.inputValue) {
// if parent is null OR parent's value is the desried value, then only show this section
return (
<div
key={subsectionItem.name}
className="subsection-wrapper"
>
@iamsaksham
iamsaksham / dynamicFormCreator.json
Created April 1, 2021 08:07
Sample Json for rendering Dynamic form
{
"form": [
{
"name": "USER DETAILS",
"id": "user_details",
"sections": [
{
"name": "User Intimation",
"fields": [
{
let axios = require('axios');
let querystring = require('querystring');
const email = '<email-id>';
const vehicles = {
'<vehicle-no>': {
fuel: <amount>,
fuelType: '<petrol/diesel>'
}
};
const refuelDays = <no-of-reciepts-per-month>;
@iamsaksham
iamsaksham / lru.js
Created January 15, 2020 06:13
implementation of LRU cache
class Node {
constructor(key, value, next=null, prev=null) {
this.key = key;
this.value = value;
this.next = next;
this.prev = prev;
}
}
class LRU {
@iamsaksham
iamsaksham / bst.js
Created January 15, 2020 06:12
Implementation of BST in javascript
class Node {
constructor(data, left, right) {
this.data = data;
this.left = left;
this.right = right;
}
}
class BST {
constructor() {
@iamsaksham
iamsaksham / FactLoadingScreen.js
Created October 16, 2019 07:10
Loading screen with animated facts after every 5sec interval
import React, { useState, useEffect } from 'react';
.loader-wrapper {
text-align: center;
font-family: 'Open Sans', sans-serif;
}
.loader-icon-wrapper {
margin-top: 10vh;
display: flex;
flex-direction: column;
@iamsaksham
iamsaksham / .zshrc
Last active August 21, 2019 05:31
zshrc file with powerlevel10k/conda/git/
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
source .nvm/nvm.sh
# Path to your oh-my-zsh installation.
export ZSH="/Users/iamsaksham/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will