Skip to content

Instantly share code, notes, and snippets.

View arihantverma's full-sized avatar
💃
Dancing my way through learning and building

Arihant Verma arihantverma

💃
Dancing my way through learning and building
View GitHub Profile
@arihantverma
arihantverma / replace-deep-key-value-json.js
Last active March 16, 2023 11:28
Way to change a deep key (node) 's value in JSON using JSON.stringify's replacer function
// https://replit.com/@arihantverma1/JSON-stringify-deeply-nested-node-value-change?v=1
const util = require('util')
const data = {
widgets: [
{
type: "performance",
data: {
progress_bars: [
// https://leerob.io/blog/spotify-api-nextjs
const url = 'https://accounts.spotify.com/authorize'
function getAuthorizationCodeURL() {
const u = new URL(url);
u.searchParams.append('client_id', '');
u.searchParams.append('response_type', 'code');
u.searchParams.append('redirect_uri', 'http://127.0.0.1:8080/callback');
u.searchParams.append('scope', 'user-read-currently-playing');
u.searchParams.append('state', '');
/* Problem Name is &&& Run Length Encoding &&& PLEASE DO NOT REMOVE THIS LINE. */
/**
* Instructions to candidate.
* 1) Run this code in the REPL to observe its behaviour.
* 2) Consider adding some additional tests in doTestsPass().
* 3) Implement rle() correctly.
* 4) If time permits, try to improve your implementation.
*/
/* Problem Name is &&& JS Object to String &&& PLEASE DO NOT REMOVE THIS LINE. */
/**
* Instructions to candidate:
*
* 1) Given the below code. Write a function (ES6 recommended) that loops through all the properties of the Employee and create a comma-seperated string with the values
* For e.g.
* {
* firstName: "X",
* lastName: "Y",
import React, { useState, useEffect, useRef } from "react";
import ReactDOM from "react-dom";
function Counter() {
const [count, setCount] = useState(0);
const [delay, setDelay] = useState(1000);
const [isRunning, setIsRunning] = useState(true);
useInterval(() => {
setCount(count + 1);
/**
* 🦢🦢🦢
* 1. Read the comments and render the required component
* 2. You are allowed to browse react docs if you need be
*/
const Parent = () => {
// 🦢 write code here
return null;
};