62 lines
7.4 KiB
Markdown
62 lines
7.4 KiB
Markdown
# Gregs Memory Palace
|
|
|
|
This project contains several files that perform various tasks to make my life easier. This README is maintained by one of the functions in here and ran on a pre-commit hook. Any new files added in utils make sure there are comments so this file can be as useful as possible.
|
|
|
|
# File Summary
|
|
|
|
## [apiResponseChecker.js](src\utils\apiResponseChecker.js)
|
|
|
|
This file contains a script that fetches data from an API and writes it to a file.
|
|
The script makes multiple API calls at regular intervals for a specified duration.
|
|
The fetched data is appended to separate files based on the data center, user tier, and security symbol.
|
|
The script uses Axios for making HTTP requests and the fs module for file operations.
|
|
|
|
The script exports a function fetchAndWriteApiData that takes an object with the following properties:
|
|
- url: The URL of the API endpoint to fetch data from.
|
|
- headers: An object containing the headers to be sent with the request.
|
|
- dataCenter: The data center to which the API request should be made.
|
|
- userTier: The user tier for which the API request should be made.
|
|
- xid: The xid of the security for which the API request should be made.
|
|
- symbol: The symbol of the security for which the API request should be made.
|
|
|
|
The script also schedules the API calls to be made every 2 minutes for a duration of 4 hours.
|
|
The start time and stop time are logged to the console.
|
|
|
|
## [bookmarkletMaker.js](src\utils\bookmarkletMaker.js)
|
|
|
|
This script generates a bookmarklet from a JavaScript file.
|
|
It reads the JavaScript file, removes any multiline comments, and creates a bookmarklet string.
|
|
The bookmarklet can then be used to execute the JavaScript code in a browser.
|
|
|
|
Use this to generate a bookmarklet from a JavaScript file in the utils/bookmarklets directory.
|
|
|
|
@param {string} filePath - The path to the JavaScript file.
|
|
@returns {string} The generated bookmarklet.
|
|
|
|
## [apiDocs.js](src\utils\bookmarklets\apiDocs.js)
|
|
|
|
Opens the API documentation for a given project API.
|
|
|
|
Requires the use of utils/bookmarkletMaker.js to generate the bookmarklet.
|
|
|
|
@param {string} projectAPI - The project API to open the documentation for.
|
|
|
|
## [dag.js](src\utils\bookmarklets\dag.js)
|
|
|
|
Opens the DAG Task details page(s) based on user input.
|
|
If user provides a comma-separated list of DAG Task numbers, it opens each task's details page in a new tab.
|
|
If user does not provide any input, it opens the default DAG Tasks page in a new tab.
|
|
|
|
Requires the use of utils/bookmarkletMaker.js to generate the bookmarklet.
|
|
|
|
## [hashid.js](src\utils\bookmarklets\hashid.js)
|
|
|
|
This JavaScript function takes a string, decodes it using decodeURIComponent,
|
|
alerts the decoded string, and copies the result to the clipboard.
|
|
|
|
The function works as follows:
|
|
1. Takes a string as input.
|
|
2. Decodes the string using decodeURIComponent.
|
|
3. Alerts the decoded string.
|
|
4. Copies the decoded string to the clipboard.
|
|
|
|
Note: This function uses the Clipboard API which might not be fully supported in all browsers.
|
|
|
|
Requires the use of utils/bookmarkletMaker.js to generate the bookmarklet.
|
|
|
|
## [jira.js](src\utils\bookmarklets\jira.js)
|
|
|
|
This JavaScript function is a bookmarklet that prompts the user for a JIRA ticket number
|
|
and then opens a new browser tab with the corresponding JIRA page for that ticket.
|
|
|
|
The function works as follows:
|
|
1. Prompts the user to enter a JIRA ticket number. The entered value is stored in the `answer` variable.
|
|
2. Sets a default URL to the JIRA dashboard.
|
|
3. Checks if the user entered a value in the prompt.
|
|
4. If the user entered a value, changes the URL to point to the specific JIRA page for the entered ticket number.
|
|
5. Opens the URL in a new browser tab and brings focus to it.
|
|
|
|
Note: This function is wrapped in a self-invoking function `(function() {...})();` which means it will automatically execute as soon as it is defined.
|
|
Requires the use of utils/bookmarkletMaker.js to generate the bookmarklet.
|
|
|
|
## [moids.js](src\utils\bookmarklets\moids.js)
|
|
|
|
This JavaScript function is a bookmarklet that prompts the user for multiple MOID (Markit On Demand) numbers
|
|
and then opens a new browser tab for each corresponding Jira page for those MOIDs.
|
|
|
|
The function works as follows:
|
|
1. Prompts the user to enter MOID numbers separated by commas. The entered values are stored in the `answers` array.
|
|
2. Sets a default URL to the Jira dashboard.
|
|
3. Checks if the user entered any values in the prompt.
|
|
4. If the user entered values, changes the URL to point to the specific Jira page for each entered MOID number.
|
|
5. Opens each URL in a new browser tab and brings focus to the last opened tab.
|
|
|
|
Note: This function is wrapped in a self-invoking function `(function() {...})();` which means it will automatically execute as soon as it is defined.
|
|
Requires the use of utils/bookmarkletMaker.js to generate the bookmarklet.
|
|
|
|
## [jsToMsDate.js](src\utils\bookmarklets\notMine\jsToMsDate.js)
|
|
No Description Provided
|
|
|
|
## [msToJsDate.js](src\utils\bookmarklets\notMine\msToJsDate.js)
|
|
No Description Provided
|
|
|
|
## [showDebugInfo.js](src\utils\bookmarklets\notMine\showDebugInfo.js)
|
|
No Description Provided
|
|
|
|
## [rbc-di-featureflags.js](src\utils\bookmarklets\rbc-di-featureflags.js)
|
|
|
|
This function creates a modal dialog that allows the user to toggle feature flags.
|
|
It retrieves the feature flags from the session storage, creates checkboxes for each flag,
|
|
and saves the updated flags back to the session storage when the user clicks the save button.
|
|
The modal dialog is appended to the document body and can be closed by clicking the save button.
|
|
|
|
Requires the use of utils/bookmarkletMaker.js to generate the bookmarklet.
|
|
|
|
## [rbcSessionStorage.js](src\utils\bookmarklets\rbcSessionStorage.js)
|
|
|
|
Deletes the 'fnc-rbc-session' property from the session storage if it exists.
|
|
If the property exists, it prompts the user for confirmation before deleting.
|
|
If the property does not exist, it displays an alert message.
|
|
|
|
Requires the use of utils/bookmarkletMaker.js to generate the bookmarklet.
|
|
|
|
## [rbcSiteNavigator.js](src\utils\bookmarklets\rbcSiteNavigator.js)
|
|
|
|
Opens a specific URL based on the provided environment and language.
|
|
Prompts the user to enter the environment and language in the format 'prod|ste,en|fr'.
|
|
If the input is valid, it opens the corresponding URL in a new tab.
|
|
If the input is invalid, it logs an error message to the console.
|
|
|
|
Requires the use of utils/bookmarkletMaker.js to generate the bookmarklet.
|
|
|
|
## [rbcWatchlistPopulator.js](src\utils\bookmarklets\rbcWatchlistPopulator.js)
|
|
|
|
This code is a bookmarklet that populates a watchlist on a web page.
|
|
It defines an array of new securities and a function called populateWatchlist.
|
|
The function finds the input field on the page, iterates over the new securities array,
|
|
and sets the value of the input field to each security in the array.
|
|
It then triggers events to simulate user input and key presses to add the security to the watchlist.
|
|
The process repeats for each security in the array with a delay of 2.5 seconds between each iteration.
|
|
The code is executed when the bookmarklet is clicked on the web page.
|
|
|
|
Requires the use of utils/bookmarkletMaker.js to generate the bookmarklet.
|
|
|
|
## [workspace.js](src\utils\bookmarklets\workspace.js)
|
|
No Description Provided
|
|
|
|
## [updateReadme.js](src\utils\git\updateReadme.js)
|
|
|
|
This file is responsible for updating the README file with file links and descriptions.
|
|
It reads the files in the specified directory, extracts their descriptions, and generates
|
|
markdown links for each file. Then, it updates the README file with the generated links
|
|
and descriptions. |