Skip to content

Instantly share code, notes, and snippets.

@JustAyush
JustAyush / react-select-with-rhf.tsx
Created September 14, 2021 11:59
React Select usage with react-hook-form
import {
Button,
FormControl,
FormErrorMessage,
FormLabel,
Link,
SimpleGrid,
Stack,
} from '@chakra-ui/react';
{
"type": "Group",
"address": {
"addressLine1": "567 East Nobel Road",
"addressLine2": "Labore officia facil",
"city": "Accusamus animi mod",
"state": "Explicabo Similique",
"zip": "13204",
"lat": null,
"lng": null
{
"type": "Individual",
"address": {
"addressLine1": "816 East Hague Lane",
"addressLine2": "Fugit quod qui repr",
"city": "Est dolores corrupti",
"state": "Dolorem officia repr",
"zip": "21414",
"lat": null,
"lng": null
@JustAyush
JustAyush / dependent-inputs.tsx
Created February 1, 2022 09:55
Dependent Inputs showcasing use of FormProvider
import {
Button,
FormControl,
FormErrorMessage,
FormHelperText,
FormLabel,
Link,
Select,
SimpleGrid,
Stack,
const transactions = [
{
"id": "f0ca24a0304644a897edfb9cad5aa87b",
"transactionDate": "2021-12-28T21:07:49.628Z",
"subscriptionId": "b70ed8aaa6364f058c81b8a0ace82698",
"gatewayReferenceId": "362234778769",
"totalAmount": "99.00",
"drugName": "Drug name",
"paymentDescriptor": "30 days pack",
"status": "Succeeded",
{
"emmet.includeLanguages": {
"javascript": "javascriptreact"
},
"css.validate": false,
"less.validate": false,
"scss.validate": false,
"javascript.preferences.quoteStyle": "single",
// "editor.detectIndentation": false,
"todo-tree.tree.showScanModeButton": false,
const express = require('express');
const router = express.Router();
const userService = require('./user.services.js');
// Fetch Users
router.get('/', async (req, res) => {
communicationsService.fetch()
.then(data => {
httpResponse.successHandler(res, data);
const userService = (() => {
// import db connection
// import utils
// import constants
// import global services (if any)
function super_digit(n, k) {
const p = find_p(n, k);
const superDigit = find_super_digit(p);
return superDigit;
}
function find_p(n, k) {
let concatString = "";
for (let i = 0; i < k; i++) {
concatString = concatString + n.toString();
<?php
// Import PHPMailer classes into the global namespace
// These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
// Load Composer's autoloader
require 'vendor/autoload.php';