Skip to main content

CHS

User since Oct 28, 2022
44 Posts
JavaScript
Markdown
Shell
Plaintext
TypeScript
JSON
C++
Java
Python

Recent Posts

VSCode Project Settings

CHS
0 likes • Mar 6, 2024 • 1 view
JSON
{
"editor.tabSize": 2,
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll": "always",
"source.organizeImports": "always"
},
"javascript.preferences.importModuleSpecifier": "non-relative",
"javascript.updateImportsOnFileMove.enabled": "always",
"typescript.preferences.importModuleSpecifier": "non-relative",
"typescript.updateImportsOnFileMove.enabled": "always",
"search.exclude": {
"**/node_modules": true,
"**/package-lock.json": true,
"**/dist": true
}
}

Story Format

CHS
0 likes • Mar 4, 2024 • 5 views
Markdown
UI: <story_title>
As a user, I would like <x>, so that <y>.
Definition of Done (DoD):
- Unit test coverage percentage at least maintained
- Changes are documented in main story
- Changes are peer-reviewed
- Relevant documentation is up-to-date
- Software changes are available in a release build
- Configuration is available in config file and environment variables
- Release notes are updated
- Expectations are clearly defined as exceptions in conditions of satisfaction
Conditions of Satisfaction (CoS):
- <CoS_1>
- <CoS_2>
- <CoS_3>

Release Message Format

CHS
0 likes • Mar 4, 2024 • 1 view
Markdown
Do Dashboard x.y.z is available
RPM:
- https://artifactory.devopsbase.com/artifactory/int-unclass-crcdash-nosync-mvn-local/com/ticomgeo/dodashboard/do-dashboard-server/x.y.z/do-dashboard-server-x.y.z.rpm
Tickets Included:
- https://jira.devopsbase.com/browse/CRCDASH-XXXX

TODOs

CHS
0 likes • Feb 13, 2024 • 14 views
Markdown
## DO Dashboard
- Add layer chooser to map
- README
- Separate instructions by OS
- Put polling interval values in a constants file
- Create reusable "isDateValid" function from helper function in src/components/SystemList
- Talk to QA guys on where to put Selenium IDs
### Stories
## Spectral

useLocalStorage Hook

CHS
0 likes • Feb 7, 2024 • 3 views
TypeScript
import { useState } from 'react';
/**
* A custom React hook for storing and retrieving data in localStorage.
* @template T - The type of the state to be stored in local storage.
* @param key - The key under which the data will be stored in localStorage.
* @param initialValue - The initial value to be stored in localStorage.
* @returns A tuple containing the stored value and a function to update the stored value.
* @example
* // Usage example:
* const [value, setValue] = useLocalStorage('myData', 'defaultValue');
* console.log(value); // Retrieve the stored value
* setValue('newValue'); // Update the stored value
*/
export default function useLocalStorage<T>(
key: string,
initialValue: T | (() => T)
): [T, (value: T) => void] {
// Retrieve the value from localStorage, if it exists
const storedValue = localStorage.getItem(key);
// Initialize the state with the stored value or the initial value
const [value, setValue] = useState(
storedValue ? JSON.parse(storedValue) : initialValue
);
/**
* Updates the stored value in localStorage.
* @param value - The new value to be stored.
* @returns
*/
const updateValue = (value: any) => {
setValue(value);
localStorage.setItem(key, JSON.stringify(value));
};
return [value, updateValue];
}

useQueryParams Hook

CHS
0 likes • Feb 6, 2024 • 6 views
TypeScript
import { useSearchParams } from 'react-router-dom';
/**
* A React hook for managing URL search parameters.
* @returns An object containing functions for adding and deleting query parameters in the URL search.
* @example
* const { addQueryParam, deleteQueryParam } = useQueryParams();
* addQueryParam('paramName', 'paramValue');
* deleteQueryParam('paramName');
*/
export default function useQueryParams() {
const [, setSearchParams] = useSearchParams();
const addQueryParam = (key: string, value: any) => {
const valueIsArray = Array.isArray(value);
// Go ahead and delete the query param if the value is an empty array
if (valueIsArray && value.length === 0) {
deleteQueryParam(key);
return;
}
setSearchParams(searchParams => {
searchParams.set(key, valueIsArray ? value.join(',') : value);
return searchParams;
});
};
const deleteQueryParam = (key: string) => {
setSearchParams(searchParams => {
searchParams.delete(key);
return searchParams;
});
};
return { addQueryParam, deleteQueryParam };
}

Post Statistics

Posts

No Posts Found

It looks like CHS hasn't uploaded a post yet

Likes

Please Log In

You must be authenticated to view a user's likes

Shared

Please Log In

You must be authenticated to view a user's shared posts

Profile Privacy

Multi-Factor Authentication

Multi-Factor Authentication (MFA) is an authentication method that requires you to provide two or more verification factors to gain access to your account. In addition to username and password, MFA requires you to verify your email on every login, which decreases the likelihood of someone stealing your account.

Change Password

Forgot Password?

Identity Color

Changes the color of your profile icon and cursor highlight in the live code editor. You and other users will be able to view this change.

Delete Account

Deleting your account is permanent. All data associated with your account will be lost.