How to use crypto on both browsers and nodejs inside a js script

I try to use the crypto API and specifically the randomUUID function. They are both available in NodeJS and browser environments, so it can be used in Nuxt 3.

However, importing them both in this script is hard. How do you make this work?

Here is a try:

// @ts-ignore(TS2304) as the window will only be defined on the browser
const crypto = (typeof process !== "undefined") ? require('crypto'): window.crypto

export const useId = () => {
  const suffix = crypto.randomUUID().slice(0, 8)
  const $id = (name?: string) => name ? `${name}-${suffix}` : suffix
  return { $id }
}

In the end, I get the error Uncaught (in promise) ReferenceError: global is not defined in the browser. It works fine on NodeJS.

Getting access to svg file through d3 (JavaScript) library

I’m trying to access an svg image using the d3.select() method. As a result, I get the following message in the console.(https://i.stack.imgur.com/ZyD5S.jpg)

html code

<div id="container" style="width: 1600px; height: 1200px; border:1px solid black;"> <object class="svg-image" type="image/svg+xml" data="./grf_195.svg"></object> </div>

js code

let r = d3.select('object'.contentDocument); console.log(r);

How to make the code Shorter?🤣 I know that there’s a possibility to make this code shorter. Please help me

I’m from Philippines, I almost hosted my Website for almost 3 yrs but until now I didn’t know how to make the code shorter in JavaScript.
On this section, I have a 3 divs that handle text or content inside the div. Every div has one Header, paragraph and Button. Unfortunately, there are some users that make uncomfortable on the color of my boxes so that I create a features that users can select the colors or backgrounds that they want. It seems my code is perfectly working but I know there are possibilities to make this shorter. I hope you understand my CSS and HTML body because it can frustrate you to understand.

This is the code



<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <title>Page title</title>

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

</head>

<body>

<p1 id="indicator">1st</p1>

<button id="ChangeColor">Change Color</button>   

<div class="Box Box1">

    <h1 class="Header Header1">This Is Header</h1>

    <p class="Para Para1">This Is paragraph</p>

    <input class="BTN BTN1" type="button" value="This Is button">

</div>

<div class="Box Box1">

    <h1 class="Header Header1">This Is Header</h1>

    <p class="Para Para1">This Is paragraph</p>

    <input class="BTN BTN1" type="button" value="This Is button">

</div>

<div class="Box Box1">

    <h1 class="Header Header1">This Is Header</h1>

    <p class="Para Para1">This Is paragraph</p>

    <input class="BTN BTN1" type="button" value="This Is button">

</div>

    

</body>

</html>

<style>

body{

    background: white;

}

.Box{

    width: 100%;

    text-align: center;

    height: 200px;

    margin-top: 12px;

}

h1, p, input{

    width: 100%;

}

input{

    border: none;

    padding: 10px;

    width: 90%;

}

button{

    margin-top: 10px;

    width: 100%;

    background: red;

    color: white;

    border: none;

    font-size: 20px;

    font-weight: bold;

    padding: 10px;

}

.Box1{

    background: blue;

}

.Box2{

    background: red;

}

.Box3{

    background: yellow;

}

.Header1, .Para1{

    color: white;

    /* Para stands For Paragraph */

}

.Header2, .Para2{

    color: yellow;

}

.Header3, .Para3{

    color: black;

}

.BTN1{

    /* BTN stands For BUTTONS */

    background: white;

    color: blue;

}

.BTN2{

    background: yellow;

    color: red;

}

.BTN3{

    background: black;

    color: yellow;

}

#indicator{

    position: absolute;

    background: white;

    border-radius: 50%;

    margin-top: 17.5px;

    width: 30px;

    height: 30px;

    display: flex;

    align-items: center;

    justify-content: center;

    margin-left: 20px;

    

}

</style>

<script>

var A = document.querySelectorAll(".Box");

var B = document.querySelectorAll(".Header");

var C = document.querySelectorAll(".Para");

var D = document.querySelectorAll(".BTN");   

    

ChangeColor.addEventListener("click", function(){

if(indicator.innerHTML == "1st"){

    indicator.innerHTML = "2nd";

A.forEach((item) =>     item.classList.add("Box2"));

A.forEach((item) =>     item.classList.remove("Box1"));

B.forEach((item) =>     item.classList.add("Header2"));

B.forEach((item) =>     item.classList.remove("Header1"));

C.forEach((item) =>     item.classList.add("Para2"));

C.forEach((item) =>     item.classList.remove("Para1"));

D.forEach((item) =>     item.classList.add("BTN2"));

D.forEach((item) =>     item.classList.remove("BTN1"));

}

else if(indicator.innerHTML == "2nd"){

indicator.innerHTML = "3rd";

A.forEach((item) =>     item.classList.add("Box3"));

A.forEach((item) =>     item.classList.remove("Box2"));

B.forEach((item) =>     item.classList.add("Header3"));

B.forEach((item) =>     item.classList.remove("Header2"));

C.forEach((item) =>     item.classList.add("Para3"));

C.forEach((item) =>     item.classList.remove("Para2"));

D.forEach((item) =>     item.classList.add("BTN3"));

D.forEach((item) =>     item.classList.remove("BTN2"));

}

else if(indicator.innerHTML == "3rd"){

indicator.innerHTML = "1st";

A.forEach((item) =>     item.classList.add("Box1"));

A.forEach((item) =>     item.classList.remove("Box3"));

B.forEach((item) =>     item.classList.add("Header1"));

B.forEach((item) =>     item.classList.remove("Header3"));

C.forEach((item) =>     item.classList.add("Para1"));

C.forEach((item) =>     item.classList.remove("Para3"));

D.forEach((item) =>     item.classList.add("BTN1"));

D.forEach((item) =>     item.classList.remove("BTN3"));

}

else{

    

}

});

</script>

Write some android coding apps that works like softwares and have more features for Html css and Js coding language [closed]

Write some android coding apps that works like softwares and have more features for Html css and Js coding language…

I need names of some apps For html css js coding lang. But with more features on android.
Pls tell me.

I tried searching for this and found Speck editor it is good but if there is any other way so I can use that…

Trying to deploy a contract on Ganache

i am trying to deploy a contract in Ganache but having this error

TypeError:
Cannot read properties of undefined (reading ‘JsonRpcProvider’)
at main (/home/sunny/ether-simple-storage/deploy.js:7:41)
at Object. (/home/sunny/ether-simple-storage/deploy.js:27:1)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47

Code:

  const ethers = require("ethers"); // imports the ethers package
const fs = require("fs-extra");

async function main() {
  const provider = new ethers.providers.JsonRpcProvider(
    "http://127.0.0.1:7545"
  ); // last node on the blockchain connection

  const wallet = new ethers.Wallet(
    "0x586b0a2c5a92ae7d51a6ec55d56a937433e47eb08b3c2fe4042e72af1557e8c6",
    provider
  ); // connect wallet

  const abi = fs.readFileSync("./SimpleStorage_sol_SimpleStorage.abi", "utf8");
  const binary = fs.readFileSync(
    "./SimpleStorage_sol_SimpleStorage.bin",
    "utf8"
  );
  const contractFactory = new ethers.ContractFactory(abi, binary, wallet);
  console.log("Deploying, please wait...");
  const contract = await contractFactory.deploy({});
  console.log(contract);
}

main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });

Imported React component not being displayed

i’ve a react component that i import, but its not displayed on the page.

this is my app.js file. i imported the “functionalComponent” component but it is not getting displayed on the browser.

import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import functionalComponent from './functionalComponent';
import classComponent from './classComponent';

function App() {
  return (
    <div className="App">
     
      <functionalComponent/>
    </div>
  );
}

export default App;

This is my functionalComponent.js

import React from "react";

class functionalComponent extends React.Component{

    render(){
        return <p>This is a functional component.</p>
    }
}

export default functionalComponent;

and this is my App.test.js

import { render, screen } from '@testing-library/react';
import App from './App';

test('renders learn react link', () => {
  render(<App />);
  const linkElement = screen.getByText(/learn react/i);
  expect(linkElement).toBeInTheDocument();
});

How do I prevent redirection to the ‘/*’ route on reload in React

So I am creating a react Application (A create-react-app) and it is a multiple pages website. It has authentication, and I’ve used JWT Authentication in the backend.
Now, I am conditionally giving the routes.
A code snippet from app.js that might help understand:

<Routes>
    {!isAuthenticated && (
        <>
            <Route path="/" element={<IndexScreen />} />
            <Route path="/login" element={<LoginScreen />} />
            <Route path="/*" element={<Navigate to={'/'} />} />
        </>
    )}
    {isAuthenticated && type === 'student' && (
        <>
            <Route path="/intro" element={<IntroScreen />} />
            <Route path="/:sessionId/roles" element={<RolesScreen />} />
            <Route path="/history" element={<HistoryScreen />} />
            <Route path="/:sessionId/details" element={<DetailsScreen />} />
            <Route path="/*" element={<Navigate to={'/intro'} />} />
        </>
    )}
    {isAuthenticated && type === 'teacher' && (
        <>
            <Route path="/intro" element={<IntroScreen />} />
            <Route
                path="/teacherquestions"
                element={<TeacherSelectProblemScreen />}
            />
            <Route path="/*" element={<Navigate to={'/intro'} />} />
        </>
    )}

    <Route path="/*" element={<Navigate to={'/'} />} />
</Routes>

In the index.js, I am wrapping it in the following

<React.StrictMode>
    <AuthProvider>
        <BrowserRouter>
            <App />
        </BrowserRouter>
    </AuthProvider>
</React.StrictMode>;

now when I’m on a conditional route, say ‘/:sessionId/details’, and I reload the page, it automatically redirects me to the ‘/*’ route of that block, i.e., takes me back to the ‘/intro’ page. How do I stop that from happening??

I’ve used AuthProvider and useContext to check for authentication:

import { authContext } from './services/authContext';

const {
    isAuthenticated,
    type,
    login,
    newToken,
    setType,
    setRole,
    setUserId,
} = useContext(authContext);

const LStoken = localStorage.getItem('token');
const LStype = localStorage.getItem('type');
const LSrole = localStorage.getItem('role');
const LSuserId = localStorage.getItem('userId');

useEffect(() => {
    if (LStoken && LStype && LSuserId) {
        newToken(LStoken);
        setType(LStype);
        setRole(LSrole);
        setUserId(LSuserId);
        login();
    }
}, [
    LStoken,
    LStype,
    newToken,
    setType,
    login,
    setRole,
    setUserId,
    LSuserId,
    LSrole,
]);

How do I solve this?

One thing worth noting is that when the route is unconditional, it does not redirect on reload.
even the login page doesn’t redirect. So I reckon the authentication is causing the problem.

For reference, this is my AuthContext.js:

import React, { createContext, useState } from 'react';

const authContext = createContext({
    isAuthenticated: false,
    token: null,
    type: 'student',
    role: '',
    userId: '',
    newToken: () => {},
    login: () => {},
    logout: () => {},
    setType: () => {},
    setUserId: () => {},
    setRole: () => {},
    validSession: () => {},
});

export { authContext };

const AuthProvider = ({ children }) => {
    const [isAuthenticated, setIsAuthenticated] = useState(false);
    const [token, setToken] = useState(null);
    const [type, setType] = useState('student');
    const [role, setRole] = useState(null);
    const [userId, setUserId] = useState(null);
    const [sessionId, setSessionId] = useState(null);

    const login = () => {
        setIsAuthenticated(true);
    };

    const logout = () => {
        setIsAuthenticated(false);
        setToken(null);
    };

    const newToken = (newToken) => {
        setToken(newToken);
    };

    const validSession = (sessionId) => {
        setSessionId(sessionId);
    };

    return (
        <authContext.Provider
            value={{
                isAuthenticated,
                token,
                type,
                role,
                userId,
                login,
                logout,
                newToken,
                setType,
                setRole,
                setUserId,
            }}
        >
            {children}
        </authContext.Provider>
    );
};

export default AuthProvider;

I also tried using the HashRouter instead of the BrowserRouter thinking it might solve the problem, but it didn’t.

Attempting to POST to PHP from form resulting in “Cannot POST to file”

I’m working on a website log in right now, and whenever I attempt to post to it, I get “Cannot POST /validateUsername.php”. I’ve been trying to figure this out for a while, but I can’t seem to figure out why it occurs.

index.html:

<!doctype html>
<html lang="en">

<head>
    <title>Log in</title>
    <link rel="stylesheet" href="/styles.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
</head>

<body>
    <div class="signup">
        <span>
            <p class="signtext">Sign in</p>
        </span>
        <form method="POST" action="/validateUsername.php">
            <div class="inputBox">
                <input name="username" type="text" required="required">
                <span>Phone, email, or username</span>
            </div>

            <span>
                    <input type="submit" name="btn-next" class="next" value="Next"></input>
                
            </span>
        </form>

        <span>
            <button class="forgot">Forgot password?</button>
        </span>

        <span class="create">
            <p>Don't have an account? <a href="/signup">Sign up</a></p>
        </span>
    </div>

</body>

</html>

validateUsername.php

<?php

    if (isset($_POST["btn-next"])) {
        $username = $_POST["username"];

        echo '<p>Hi</p>';
        
    }

?>

server.js

const express = require('express');
const path = require('path');
const { readFile } = require('fs');
const app = express();

app.use(express.static("css"));

app.get('/login', (request, response) => {
    response.sendFile(path.join(__dirname, "./pages/index.html"))
});

app.get('/', (request, response) => {
  response.redirect("/login")
});

app.get('/tos', (request, response) => {
  response.sendFile(path.join(__dirname, "./pages/tos.html"))
});

app.get('/styles.css', (req, res) => {
    res.sendFile(__dirname + "/css/styles.css");
});

app.get('/background-tos.png', (req, res) => {
  res.sendFile(__dirname + "/media/background-tos.png");
});

app.get('/pauseScroll.js', (req, res) => {
  res.sendFile(__dirname + "/scripts/pauseScroll.js");
});

app.get('/underLinePart.js', (req, res) => {
  res.sendFile(__dirname + "/scripts/underLinePart.js");
});

app.get('/validateUsername.php', (req, res) => {
  res.render(__dirname + "/php/validateUsername.php");
});



var server = app.listen(25565, function () { 
    console.log("Example app listening at http://localhost:25565")
 })

Any help is greatly appreciated, as I am very confused

Trying to access and edit a Wix Text Element that’s inside an iframe – is it possible?

everyone! Hope y’all doing fine.

In a nutshell: I have a Wix page that we can call “main page”. Inside my “main page” i have two iframes, one called “input iframe” and another one called “output iframe”. The “output iframe” loads inside of it another embedded page, the “insurance page”. This “insurance page” has a Wix text element #s80copqc.

What I’m trying to do is to get the “main page” code to send a postMessage to the “output iframe” and edit the Wix text element #s80copqc that’s located inside the “insurance page” (that loads within the “output iframe”).

I think its simpler than it sounds lol, although I’m not sure it’s possible…

I’ve tried everything from var to innerHTML and nothings worked so far… Any help would be greatly appreciated.

Bootstrap switch not working on partial for some reason

I am using the bootstrap switch all over my site and having no issues.
I have bootstrap switch in my bundle.config and put in my layout.


            bundles.Add(new ScriptBundle("~/Bundles/JS-Site")
                .Include("~/Scripts/Site/Functions.js",
                "~/Scripts/Site/Events.js",
                "~/Scripts/Site-Downloads.js",
                 "~/Scripts/bootstrap-switch.js",
                "~/Scripts/Site/Index.js" )
            );
  bundles.Add(new StyleBundle("~/Content/CSS")
                 .Include("~/Content/Bootstrap/bootstrap.css")
               .Include("~/Content/Bootstrap/bootstrap.min.css")
               .Include("~/Content/Bootstrap/bootstrap-extension.css")
               .Include("~/Content/CSS/Site.css")
               .Include("~/Resources/less/icons/simple-line-icons/css/simple-line-icons.css")
               .Include("~/Content/CSS/Tables.css")
               .Include("~/Content/Bootstrap/bootstrap-switch.css")

            );
    

I have it in my layout here

   @Scripts.Render("~/Bundles/Theme")
    @Scripts.Render("~/Bundles/JS-Tab")

    @Scripts.Render("~/Bundles/JS-Site")

Here is a screenshot of it working on my charts in the header.
enter image description here

It works perfectly fine in the chart partials.

But on my table partials it will not seem to work correctly.
Here is the table code where the checkbox is added to the tables

     else if (table.Switch == true)
                {
                    <div class="row">
                        <div class="col-lg-7 col-md-12 col-sm-12 col-xs-12">
                            <h4 class="card-title">@table.HeaderLabel@if (table.PluralizeHeaderLabel) { WriteLiteral("<span class='pluralize'>(s)</span>"); }</h4>
                            @if (!string.IsNullOrWhiteSpace(table.SubHeaderLabel))
                            {
                                <p class="text-white">@table.SubHeaderLabel</p>
                            }
                            @if (!string.IsNullOrWhiteSpace(table.SubHeaderLabel2))
                            {
                                <p class="text-white">@table.SubHeaderLabel2</p>
                            }
                            @if (table.ShowRowCount)
                            {
                                <p id="tablerowcount" class="text-white">@table.BodyRows.Count() rows</p>
                            }
                        </div>
                        <div class="col-lg-5 col-md-12 col-sm-12 col-xs-12">
                            <div class="panel-action pull-right" style="padding-top:-5px;">
                                <h4 class="card-title"><span><input class="form-check-input chartSwitch" type="checkbox" id="@Model.UniqueTableIdentifier" role="switch" checked data-on-text="%" data-off-text="@table.Currency" /></span></h4>
                                
                                }

                            </div>
                        </div>
                    </div>
                }

you can see above where i am trying to initialize the bootstrap switch with this input.

i event tried adding
@Scripts.Render(“~/Scripts/bootstrap-switch.js”)
@Styles.Render(“~/Content/Bootstrap/bootstrap-switch.css”)
to the partial and nothing is working. Any ideas would be super helpful.

Send button on contact form does not work

Issue: I am encountering a problem while creating a contact form for a website. The form should send the entered data to a specific email address using the SendGrid module. However, when I click the “Send” button, I receive a 404 error in the console, and the email is not sent. The error message is as follows:

POST http://localhost:3000/send-email 404 (Not Found)
Card.tsx:58 Error: Request failed with status code 404
    at createError (createError.js:16:1)
    at settle (settle.js:17:1)
    at XMLHttpRequest.onloadend (xhr.js:66:1)

Code: I have a Card.tsx file representing the contact form on the client-side. Here is the relevant code snippet:

import React, { useState, useEffect, useRef } from "react";
import cardcss from "./Card.module.css";
import axios from "axios";

interface CardProps {
  imageUrl: string;
  title: string;
  body: string;
}

function Card(props: CardProps) {
  const [message, setMessage] = useState("");
  const nameInputRef = useRef<HTMLInputElement>(null);
  const emailInputRef = useRef<HTMLInputElement>(null);
  const messageInputRef = useRef<HTMLInputElement>(null);

  useEffect(() => {
    if (messageInputRef.current) {
      messageInputRef.current.focus();
      messageInputRef.current.setSelectionRange(0, 0);

      // Delay setting the cursor position
      setTimeout(() => {
        messageInputRef.current?.setSelectionRange(0, 0);
      }, 0);
    }
  }, []);

  const handleFocus = (event: React.FocusEvent<HTMLInputElement>) => {
    event.target.setSelectionRange(0, 0);
  };

  const submitHandler = (event: React.FormEvent<HTMLFormElement>) => {
    event.preventDefault();

    if (
      nameInputRef.current &&
      emailInputRef.current &&
      messageInputRef.current
    ) {
      const nameInput = nameInputRef.current.value;
      const emailInput = emailInputRef.current.value;
      const messageInput = messageInputRef.current.value;

      const contactData = {
        Name: nameInput,
        Email: emailInput,
        Message: messageInput,
      };

      axios
        .post("/send-email", contactData)
        .then((response) => {
          console.log("Received email request");
          // Handle success response
        })
        .catch((error) => {
          console.error(error);
          // Handle error response
        });
    }
  };

  return (
    <div className={cardcss.cardcontainer}>
      <div className={cardcss.imagecontainer}>
        <img src={props.imageUrl} alt="" />
      </div>

      <div className={cardcss.cardtitle}>
        <h3>{props.title}</h3>
      </div>

      <div className={cardcss.cardbody}>
        <p>{props.body}</p>

        <form onSubmit={submitHandler}>
          <div>
            <label className={cardcss.namelabel} htmlFor="name">
              Name:
            </label>
            <input
              className={cardcss.nameinput}
              type="text"
              id="name"
              name="name"
              ref={nameInputRef}
            />
          </div>

          <div className={cardcss.emailcontainer}>
            <label className={cardcss.emaillabel} htmlFor="email">
              Email:
            </label>
            <input
              className={cardcss.emailinput}
              type="text"
              id="email"
              name="email"
              ref={emailInputRef}
            />
          </div>

          <div className={cardcss.messagecontainer}>
            <label className={cardcss.messagelabel} htmlFor="message">
              Message:
            </label>
            <input
              ref={messageInputRef}
              className={cardcss.messageinput}
              type="text"
              id="message"
              name="message"
              value={message}
              onChange={(e) => setMessage(e.target.value)}
              onFocus={handleFocus}
            />

            <button className={cardcss.sendbutton} type="submit">
              Send
            </button>
          </div>
        </form>
      </div>
    </div>
  );
}

export default Card;

And here is the server.js file responsible for handling the email sending on the server-side:

const express = require("express");
const sgMail = require("@sendgrid/mail");
const { resolve } = require("path-browserify");

// Set up SendGrid API key
sgMail.setApiKey(
  "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"
);

// Create Express app
const app = express();

// Middleware to parse JSON requests
app.use(express.json());

app.get("/", (req, res) => {
  res.send("Hello, server!");
});
// Route to handle sending emails
app.post("/send-email", (req, res) => {
  const { Name, Email, Message, submitbutton } = req.body;

  const msg = {
    to: "[email protected]",
    from: "[email protected]",
    subject: "Example Subject",
    text: `Name: ${Name}nEmail: ${Email}nMessage: ${Message}nSubmit Button: ${submitbutton}`,
    html: `<p>Name: ${Name}</p><p>Email: ${Email}</p><p>Message: ${Message}</p><p>Submit Button: ${submitbutton}</p>`,
  };

  sgMail
    .send(msg)
    .then(() => {
      res.status(200).json({ message: "Email sent successfully" });
    })
    .catch((error) => {
      console.error(error.toString());
      res.status(500).json({ error: "Failed to send email" });
    });
});

// Set up fallback for path module
resolve.fallback = { path: require.resolve("path-browserify") };

// Start the server
app.listen(3000, () => {
  console.log("Server started on port 3000");
});

What I’ve Tried: I have verified that the SendGrid API key is correctly set up. Both the client and server are running locally. The server is listening on port 3000, and the client is making a POST request to http://localhost:3000/send-email. I have double-checked the server-side code and ensured that the /send-email route is properly defined. I have also confirmed that the form data is correctly retrieved and prepared before making the POST request.

Question: What could be causing the 404 error when attempting to send the email using the SendGrid module? Is there something wrong with my code or configuration? Any help would be greatly appreciated.

How do I extract all SVGs from an Iconify JSON file using Iconify Utils?

I am trying to wrap my head around Iconify Tools / Utils / Types.

All I want to do is extract the raw SVG data from an IconSet. Here is an example from the docs:

(https://iconify.design/docs/libraries/tools/export/directory.html)

import { exportToDirectory, IconSet } from '@iconify/tools';

(async () => {
    // Import icons
    const iconSet = new IconSet({
        prefix: 'test',
        icons: {
            maximize: {
                body: '<g fill="currentColor"><path d="M3 3v10h10V3H3zm9 9H4V4h8v8z"/></g>',
            },
            minimize: {
                body: '<g fill="currentColor"><path d="M14 8v1H3V8h11z"/></g>',
            },
        },
        width: 24,
        height: 24,
    });

    // Export all icons
    await exportToDirectory(iconSet, {
        target: `output/${iconSet.prefix}`,
        log: true,
    });
})();

This only demonstrates how to export two icons from a set (Maximize and Minimize). I need to export everything. Does anyone here know how to instantiate an IconSet that encompasses every icon in a JSON file?

Any help greatly appreciated.

Creating grid 16×16 into div container, using JavaScript and Flexbox

I have a problem with stretching my grids horizontally so they would fit perfectly mine container.
The task is to create grid 16/16 using flexbox and creating divs in js(then put it into container (sketch-screen) in html. The problem is i cant stretch as i want to. I tried to use flex:1 then 1 1 auto on divs in container but it did not want to work. I want it to fill all the space of the container so they will be squares not the rectangles. Plus then I would like to play with the size of grid.

function makeGrids(size) {
  let screen = document.querySelector(".sketch-screen");
  for (let i = 0; i < size; i++) {
    let column = document.createElement("div");
    column.classList.add("column");
    for (let j = 1; j <= size; j++) {
      let row = document.createElement("div");
      row.classList.add("row");
      row.style.border = "2px solid black";
      row.innerText = (i * size) + j;
      column.appendChild(row);
    }
    screen.appendChild(column);
  }
}

makeGrids(16);
* {
  margin: 0;
  padding: 0;
}

body {
  background-color: #7d7d7d;
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
}

footer {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: auto;
  background-color: #555454;
  padding: 12px;
  margin-top: 16px;
}

.container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 16px;
}

.sketch-container {
  display: flex;
  justify-content: center;
  width: 800px;
  height: 800px;
  background-color: #991101;
  padding-top: 50px;
}

.sketch-screen {
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  width: 600px;
  height: 600px;
  background-color: #bfbfbf;
}

.sketch-screen>div {
  height: auto;
  flex: 1 0 auto;
}
<div class="container">
  <div class="sketch-container">
    <div class="sketch-screen">

    </div>
  </div>
</div>
<footer>
  <p>Design by 2023</p>
</footer>

oracle apex using dynamic action on a date field

I am a fresher in oracle apex, need some inputs.

There is a form to enter header information. In that there is a date field :P100_ENTERED_DATE, if this field value is less than current date then we need to enable another field :P_100_REASON and make it mandatory.

Any suggestions would be of great help.

I tried to do with JS expression to put in the client side condition like below but did not work.

WHEN:
Event: Change
Type: Item
Item(s): :P100_ENTERED_DATE

Client-side Condition: Javascript Expression.

JS Expression:

var ld_cust_date = apex.item(“P102_CUST_REQUEST_DATE”).getValue();
var current_date = new Date();

if ((current_date – ld_cust_date) > 2){
return true
}
else {
return false
}

True Condition: Enable the field (I also want to make it mandatory, not sure how to do this)
False Conditoin: Disable the field.