Skip to content

Instantly share code, notes, and snippets.

View jhancock532's full-sized avatar
๐Ÿ˜„
Hello world!

James Hancock jhancock532

๐Ÿ˜„
Hello world!
View GitHub Profile
@jhancock532
jhancock532 / gist:05b59514651558e14dd71ab7dc80f74a
Created June 1, 2023 16:34
Storybook pseudo states addon code for preview.js to get nested classes working
let pseudoStyleRules: any = {
':hover': [],
':visited': [],
};
function removeMatchingSubstrings(str: string, patterns: string[]) {
const regex = new RegExp(patterns.join('|'), 'g');
return str.replace(regex, '');
}
@jhancock532
jhancock532 / example.ts
Created January 4, 2024 15:41
A custom GraphQL link for removing the __typename from the operation query object
// N.B. Consider disabling `addTypename` in InMemoryCache instead, if applicable
/*
const client = new ApolloClient({
...
cache: new InMemoryCache({
addTypename: false,
}),
...
});
*/