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
| XMLHttpRequest.prorotype.multipartStream = false | |
| var xhr = new XMLHttpRequest() | |
| xhr.lastChunkBytesRecieved = 0; | |
| if (!('multipart' in xhr)) { | |
| xhr.multipartStream = true | |
| } else { | |
| xhr.multipart = 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
| ;(function (window, document) { | |
| /** | |
| * Form Abandonment script created by @isocroft | |
| * | |
| * Copyright (c) February 2022-2025 | Ifeora Okechukwu | |
| * | |
| * Works in ReactJS / VueJS / jQuery / Angular / Vanilla | |
| * | |
| * This implements a simple algorithm that basically tracks when forms on a given HTML page |
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
| /* @HINT: If statement for feature detection */ | |
| /* @CHECK: https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Feature_detection */ | |
| if (typeof window.History === 'function') { | |
| /* @HINT: Copy out the native browser `pushState` function for later use */ | |
| const __pushState = window.History.prototype.pushState; | |
| /* @HINT: Also, monkey-patch pushState (which is used by React / Vue / jQuery / Vanilla for their routing) */ | |
| window.History.prototype.pushState = function (...args) { | |
| const [, , url] = args | |
| const origin = window.location.origin |
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
| /* @HINT: Extract the native definitions of these APIs from the DOM Interfaces */ | |
| const originalSetAttributeMethod = HTMLElement.prototype.setAttribute | |
| /* @HINT: Create a new definition for `setAttribute` that instruments the API to detect suspicious URIs */ | |
| HTMLElement.prototype.setAttribute = function setAttribute (attributeName, newValue) { | |
| const that = this; | |
| const previousValue = that.getAttribute(attributeName); | |
| const timerID = window.setTimeout(function () { | |
| /* @HINT: Stop [ DOMSubtreeModified ] event from firing before [ DOMAttrModified ] event */ |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <link rel="icon" href="/favicon.ico"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <link href='https://fonts.googleapis.com/css?family=Opren' rel='stylesheet'> | |
| <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
| <meta name="theme-color" content="#f5f5f5" /> |
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
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <title>Isocroft Portfolio Website</title> | |
| <script type="text/javascript" src="https://cdn.jsdelivr.net/gh/isocroft/browsengine@0.2.3/dist/browsengine.min.js"></script> | |
| <script type="text/javascript"> | |
| ;(function (global) { | |
| /* @HINT: feature detection for hidden document */ | |
| const getPageState = function () { | |
| const hidden = (global.document.hidden || global.document.mozHidden || global.document.msHidden || global.document.webkitHidden); |
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 axios, { AxiosError, AxiosResponse, AxiosRequestConfig } from "axios"; | |
| const expandOnError = (errorMessage: string, errorCode?: string, errorResponse?: AxiosResponse) => { | |
| if (errorMessage === "Network Error" && Boolean(!errorResponse)) { | |
| /* @HINT: The message returned below simply means that a CORS error occured OR the name resolution failed */ | |
| return errorCode === undefined | |
| ? "We are currently updating our systems... Please try again later" | |
| : "Your ISP seems to have some other network-related issues"; | |
| } | |
| return "The browser restricted access to the server response! Please contact admin"; |
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 React, { useState } from "react"; | |
| import { render, act, waitFor } from "@testing-library/react"; | |
| import userEvent from "@testing-library/user-event"; | |
| import { roles, Components } from "constants/ui-copy"; | |
| const { _TextBoxes: $RecipeFormTextBoxes, _Buttons: $RecipeFormButtons } = Components.RecipeForm; | |
| function RecipeForm ({ onSubmit }) { | |
| function formToObject(form) { | |
| const formData = new FormData(form); |
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 React, { useMemo } from "react"; | |
| import { Provider as ReactReduxProvider } from "react-redux"; | |
| import { useForm, FormProvider, UseFormProps } from "react-hook-form"; | |
| import { SessionContext } from 'next-auth/react'; | |
| import { IntlProvider as ReactIntlProvider } from "react-intl"; | |
| import { BrowserRouter, BrowserRouterProps, MemoryRouter, MemoryRouterProps, Router, RouterProps } from "react-router-dom"; | |
| import { History, LocationDescriptor, createBrowserHistory, createMemoryHistory } from "history"; | |
| import userEvent from "@testing-library/user-event"; | |
| import { render, RenderOptions, RenderResult } from "@testing-library/react"; | |
| import { renderHook, RenderHookResult, RenderHookOptions } from "@testing-library/react-hooks"; |
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 { lazy } from "react"; | |
| import type { JSX } from "react"; | |
| import type { UseQueryResult } from "@tanstack/react-query"; | |
| /** | |
| * lazyWithRetry: | |
| * | |
| * | |
| * @param {AsyncFunction<[], { default: () => JSX.Element }>} componentImport |