Skip to content

Instantly share code, notes, and snippets.

Avatar
:electron:
solving problems

TK leandrotk

:electron:
solving problems
View GitHub Profile
@leandrotk
leandrotk / globo-trash-recycle.js
Last active Feb 14, 2021
Remove entertainment and sports from globo page
View globo-trash-recycle.js
const entertainmentTrash = document.querySelectorAll('[data-tracking-action="entretenimento"]');
const sportsTrash = document.querySelectorAll('[data-tracking-action="esporte"]')
const trash = [...entertainmentTrash, ...sportsTrash];
trash.forEach(t => t.remove());
View lighthouse-ci-assertions.js
assertions: {
'resource-summary:script:size': [
'error',
{ maxNumericValue: 1000000 },
],
'resource-summary:image:size': [
'error',
{ maxNumericValue: 100000 },
],
'resource-summary:total:size': [
View redux-pack-typo-example.ts
import { LIFECYCLE, MetaPayload } from 'redux-pack';
// Type of computed property's value is '"success"', which is not assignable to type 'LIFECYCLEValues'.
const payloadMeta: MetaPayload<{}> = {
'redux-pack/LIFECYCLE': LIFECYCLE.SUCCESS
};
// Works fine!
const payloadMeta: MetaPayload<{}> = {
'redux-pack/LIFECYCLE': 'succes' // typo!
View remove-leetcode-locked-problems.js
const lockedProblems = document.querySelectorAll('[data-original-title="Subscribe to unlock"]');
lockedProblems.forEach(problem => {
problem.parentElement.parentElement.parentElement.parentElement.remove();
});
View example-43.ts
const {
newArticlePath,
imageCoverExamplePath,
imageCoverPath,
assetsFolder,
imageCoverFileName
}: ArticlePaths = buildPaths(newArticleFolderPath);
View example-42.ts
type ArticlePaths = {
newArticlePath: string;
imageCoverExamplePath: string;
imageCoverPath: string;
assetsFolder: string;
imageCoverFileName: string;
};
View example-41.ts
const buildPaths = (newArticleFolderPath: string): ArticlePaths => {
const imageExtension: string = getImageExtension();
const imageCoverFileName: string = `cover.${imageExtension}`;
const newArticlePath: string = `${newArticleFolderPath}/index.html`;
const imageCoverExamplePath: string = resolve(__dirname, `../examples/${imageCoverFileName}`);
const assetsFolder: string = `${newArticleFolderPath}/assets`;
const imageCoverPath: string = `${assetsFolder}/${imageCoverFileName}`;
return {
newArticlePath,
View example-40.ts
await copyFile(imageCoverExamplePath, imageCoverPath);
View example-39.ts
await mkdir(assetsFolder, { recursive: true });