Skip to content

Commit

Permalink
- Changing removeFileNameGuid.js to account for different OSes, not r…
Browse files Browse the repository at this point in the history
…emoving spaces at the end, and excluding the extension from the regex

- Adding node to eslint.config.js for global node commands
  • Loading branch information
incutonez committed Sep 7, 2024
1 parent 19b2d4f commit 4b4e408
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default [
ecmaVersion: "latest",
globals: {
...globals.browser,
...globals.node,
},
"parserOptions": {
"sourceType": "module",
Expand Down
6 changes: 3 additions & 3 deletions linkedIn/main.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/**
* In order to use this, go to about:debugging#/runtime/this-firefox and load the manifest.json file as the Temporary Add-on
*/
const MatchRegex = /Viewed|Applied|Promoted/;
const CompaniesRegex = /SideRamp|DataAnnotation|Veeva Systems|Aha!|HireMeFast|Team Remotely|Recruiting from Scratch|myGwork|Jerry|RemoteWorker|ClickJobs\.io/i;
const MatchRegex = /Viewed|Applied/;
const CompaniesRegex = /SideRamp|DataAnnotation|Veeva Systems|Aha!|HireMeFast|Team Remotely|Recruiting from Scratch|myGwork|Jerry|RemoteWorker|ClickJobs\.io|Varsity Tutors|Ascendion/i;
const Today = new Date();
const OneWeek = 604800000;
const HoursAgoRegex = /(\d+) hours ago/;
const MinutesAgoRegex = /minutes ago/;
const HoursToCheck = 4;
const HoursToCheck = undefined;

setInterval(removeJobs, 100);

Expand Down
16 changes: 9 additions & 7 deletions removeFileNameGuid.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import fs from "fs";
import path from "path";

let [pathToDir] = process.argv.slice(2);
const GuidRegex = /_[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}|\[Explicit\]/ig;
const [pathToDir] = process.argv.slice(2);
const GuidRegex = /_[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}|\[Explicit\]|\s+$/ig;
if (!pathToDir) {
throw Error("Please specify the path!");
}
pathToDir = pathToDir.replace("\"", "");
fs.readdirSync(pathToDir).forEach((file) => {
if (GuidRegex.test(file)) {
file = `${pathToDir}\\${file}`;
fs.renameSync(file, file.replace(GuidRegex, ""));
// If we're in Windows, and we feed a path like "Z:\Blah\"... the backslash at the end will attempt to escape the quote incorrectly
process.chdir(pathToDir.replace(/"$/, ""));
fs.readdirSync(".").forEach((file) => {
const { name, ext } = path.parse(file);
if (GuidRegex.test(name)) {
fs.renameSync(file, name.replace(GuidRegex, "") + ext);
}
});

0 comments on commit 4b4e408

Please sign in to comment.