{"author_link":"\/users\/4m8g84jhqtgo","author_name":"4m8g84jhqtgo","author_uid":"4m8g84jhqtgo","comments":[],"epoch":1600861648,"event":"LD47","format":"md","ldjam_node_id":214178,"likes":24,"metadata":{"p_key":"146803","p_author":"4m8g84jhqtgo","p_authorkey":"1183827","p_urlkey":"363221","p_title":"3000 is still too much? Slaughter the worst cliches with this script!","p_cat":"LDJam ","p_event":"LD47","p_time":"1600861648","p_likes":"24","p_comments":"0","p_status":"WAYBACK","us_key":"1183827","us_name":"4m8g84jhqtgo","us_username":"4m8g84jhqtgo","event_start":"1601596800","event_key":"76","event_name":"Ludum Dare 47"},"node":{"_collation":{"body_sanitizer":"TextUtils::SanitizeHTML via existing importer","event":"LD47","removed_author":false},"_superparent":212256,"_trust":1,"author":183827,"body":"Thanks(?) to the server downtime, we only have 3000 themes to go through this time! ...Unfortunately, too much of them are still terrible cliches! As a result, I'm posting this script again in case anyone needs it.\n\n## Quick usage\n\nFirst, copy the following code into a text editor:\n\n```js\n(() => {\n    \/\/ Time to wait between requests, in milliseconds. Defaults to 0.5 seconds.\n    const WAIT_MS = 500; \n\n    const wait = (ms) => {\n        return new Promise((resolve, reject) => {\n            setTimeout(() => resolve(), ms);\n        });\n    };\n\n    const slaughterAll = async (themes) => {\n        let ok = 0;\n        let failed = 0;\n\n        for (const set of themes) {\n            for (const key in set) {\n                let response = await fetch(`https:\/\/api.ldjam.com\/vx\/theme\/idea\/vote\/no\/${key}`, {\n                    credentials: 'include',\n                });\n                await wait(WAIT_MS);\n\n                if (response.ok) {\n                    console.log(`Slaughtered ${key} (${set[key]})`);\n                    ok += 1;\n                }\n                else {\n                    console.warn(`Error slaughtering ${key} (${set[key]}): ${response.status} ${response.statusText}`);\n                    failed += 1;\n                }\n            }\n        }\n\n        return {\n            ok, failed,\n        };\n    };\n\n    slaughterAll([\n        \/\/ ---------- Paste lists after this line! ----------\n        \n        \/\/ ---------- Paste lists before this line! ----------\n    ])\n    .then((results) => console.log(`Done! ${results.ok} ok, ${results.failed} failed.`));\n})()\n```\n\nThen, paste one or more of these lists between the separators:\n\n(These lists use the same keywords from last time, but are updated for Ludum Dare 47)\n\n* **(NEW!)** Longer than 25 characters, or containing any brackets or commas: https:\/\/pastebin.com\/df4iwVaD\n* Control\/buttons: https:\/\/pastebin.com\/hUg1w7ey\n* Virus: https:\/\/pastebin.com\/pzYWYX82\n* Currency: https:\/\/pastebin.com\/wjwAWBfq\n* Die\/lose to win: https:\/\/pastebin.com\/bfyjzaFw\n* Thing is key: https:\/\/pastebin.com\/xHJdBvtA\n* You are bad: https:\/\/pastebin.com\/7dFiJ8fg\n* Colors: https:\/\/pastebin.com\/r7XKh0eA\n\nAfter you're done, the `slaughterAll` section should look somewhat like:\n\n```js\n    slaughterAll([\n        \/\/ ---------- Paste lists after this line! ----------\n        \n\/\/ Themes that contain: words, words, words, words, words\n{\n    \"12345\": \"theme content\",\n    \"12345\": \"theme content\",\n    \"12345\": \"theme content\",\n},   \n\n\/\/ Themes that contain: words, words, words, words, words\n{\n    \"12345\": \"theme content\",\n    \"12345\": \"theme content\",\n    \"12345\": \"theme content\",\n},\n\n\/\/ ...\n\n        \/\/ ---------- Paste lists before this line! ----------\n    ])\n```\n\nFinally, go to https:\/\/ldjam.com\/events\/ludum-dare\/47\/theme, and paste the entire file into the web Console (F12). Press Enter and relax!\n\nNote: Don't refresh or close the page until \"Done! X ok, X failed.\" is printed, or you will lose your progress. It's normal for the pie chart to not update.\n\n## Making your own lists\n\nTo make your own lists, you'll need a JSON of all themes. You may find the URL by looking at the requests sent while loading https:\/\/ldjam.com\/events\/ludum-dare\/47\/theme. The URL should look like `https:\/\/api.ldjam.com\/vx\/theme\/idea\/vote\/get\/<some_number>`.\n\nAfter you have obtained the list, save it as `theme.json` somewhere. Then, save the following Node.js script as `gen_list.js` in the save folder as `theme.json`:\n\n```js\nconst fs = require('fs');\nconst process = require('process');\n\nlet themes = fs.readFileSync('themes.json', {\n    encoding: 'utf8',\n});\nthemes = JSON.parse(themes);\n\nconst blacklist = process.argv.slice(2);\nconst blacklistMap = {};\nfor (const word of blacklist) {\n    blacklistMap[word] = true;\n}\n\nconst trailingDots = \/(\\.)+$\/;\nconst wordSeparator = \/[\\W_]\/;\n\nconst words = {};\nconst killList = {};\n\nfor (const key in themes.ideas) {\n    const theme = themes.ideas[key];\n    for (let word of theme.split(wordSeparator)) {\n        word = word.replace(trailingDots, '');\n        word = word.toLowerCase();\n\n        if (word.length < 1) {\n            continue;\n        }\n\n        if (blacklistMap[word]) {\n            killList[key] = theme;\n            break;\n        }\n    }\n}\n\nprocess.stdout.write('\/\/ Themes that contain: ');\nprocess.stdout.write(blacklist.join(', '));\nprocess.stdout.write('\\n');\nprocess.stdout.write(JSON.stringify(killList, null, 4));\nprocess.stdout.write(',\\n');\n```\n\nYou can now generate your own lists by running this file from the command line!\n\n```\nnode gen_list.js keyword_1 keyword_2 keyword3\n```","comments":13,"comments-timestamp":"2020-09-24T18:16:57Z","created":"2020-09-23T11:46:06Z","files":[],"files-timestamp":0,"id":214178,"love":24,"love-timestamp":"2020-09-25T02:06:05Z","meta":[],"modified":"2020-09-25T02:06:05Z","name":"3000 is still too much? Slaughter the worst cliches with this script!","node-timestamp":"2020-09-23T12:38:54Z","parent":214176,"parents":[1,5,9,212256,214176],"path":"\/events\/ludum-dare\/47\/$214176\/3000-is-still-too-much-slaughter-the-worst-cliches-with-this-script","published":"2020-09-23T11:47:28Z","scope":"public","slug":"3000-is-still-too-much-slaughter-the-worst-cliches-with-this-script","subsubtype":"","subtype":"","type":"post","version":646459},"node_metadata":{"n_key":"214178","n_urlkey":"363221","n_parent":"214176","n_path":"\/events\/ludum-dare\/47\/$214176\/3000-is-still-too-much-slaughter-the-worst-cliches-with-this-script","n_slug":"3000-is-still-too-much-slaughter","n_type":"post","n_subtype":"","n_subsubtype":"","n_author":"183827","n_created":"1600861566","n_modified":"1600999565","n_version":"646459","n_status":"WAYBACK"},"source_url":"https:\/\/ldjam.com\/events\/ludum-dare\/47\/$214176\/3000-is-still-too-much-slaughter-the-worst-cliches-with-this-script","text":"Thanks(?) to the server downtime, we only have 3000 themes to go through this time! ...Unfortunately, too much of them are still terrible cliches! As a result, I'm posting this script again in case anyone needs it.\n\n## Quick usage\n\nFirst, copy the following code into a text editor:\n\n```js\n(() => {\n    \/\/ Time to wait between requests, in milliseconds. Defaults to 0.5 seconds.\n    const WAIT_MS = 500; \n\n    const wait = (ms) => {\n        return new Promise((resolve, reject) => {\n            setTimeout(() => resolve(), ms);\n        });\n    };\n\n    const slaughterAll = async (themes) => {\n        let ok = 0;\n        let failed = 0;\n\n        for (const set of themes) {\n            for (const key in set) {\n                let response = await fetch(`https:\/\/api.ldjam.com\/vx\/theme\/idea\/vote\/no\/${key}`, {\n                    credentials: 'include',\n                });\n                await wait(WAIT_MS);\n\n                if (response.ok) {\n                    console.log(`Slaughtered ${key} (${set[key]})`);\n                    ok += 1;\n                }\n                else {\n                    console.warn(`Error slaughtering ${key} (${set[key]}): ${response.status} ${response.statusText}`);\n                    failed += 1;\n                }\n            }\n        }\n\n        return {\n            ok, failed,\n        };\n    };\n\n    slaughterAll([\n        \/\/ ---------- Paste lists after this line! ----------\n        \n        \/\/ ---------- Paste lists before this line! ----------\n    ])\n    .then((results) => console.log(`Done! ${results.ok} ok, ${results.failed} failed.`));\n})()\n```\n\nThen, paste one or more of these lists between the separators:\n\n(These lists use the same keywords from last time, but are updated for Ludum Dare 47)\n\n* **(NEW!)** Longer than 25 characters, or containing any brackets or commas: https:\/\/pastebin.com\/df4iwVaD\n* Control\/buttons: https:\/\/pastebin.com\/hUg1w7ey\n* Virus: https:\/\/pastebin.com\/pzYWYX82\n* Currency: https:\/\/pastebin.com\/wjwAWBfq\n* Die\/lose to win: https:\/\/pastebin.com\/bfyjzaFw\n* Thing is key: https:\/\/pastebin.com\/xHJdBvtA\n* You are bad: https:\/\/pastebin.com\/7dFiJ8fg\n* Colors: https:\/\/pastebin.com\/r7XKh0eA\n\nAfter you're done, the `slaughterAll` section should look somewhat like:\n\n```js\n    slaughterAll([\n        \/\/ ---------- Paste lists after this line! ----------\n        \n\/\/ Themes that contain: words, words, words, words, words\n{\n    \"12345\": \"theme content\",\n    \"12345\": \"theme content\",\n    \"12345\": \"theme content\",\n},   \n\n\/\/ Themes that contain: words, words, words, words, words\n{\n    \"12345\": \"theme content\",\n    \"12345\": \"theme content\",\n    \"12345\": \"theme content\",\n},\n\n\/\/ ...\n\n        \/\/ ---------- Paste lists before this line! ----------\n    ])\n```\n\nFinally, go to https:\/\/ldjam.com\/events\/ludum-dare\/47\/theme, and paste the entire file into the web Console (F12). Press Enter and relax!\n\nNote: Don't refresh or close the page until \"Done! X ok, X failed.\" is printed, or you will lose your progress. It's normal for the pie chart to not update.\n\n## Making your own lists\n\nTo make your own lists, you'll need a JSON of all themes. You may find the URL by looking at the requests sent while loading https:\/\/ldjam.com\/events\/ludum-dare\/47\/theme. The URL should look like `https:\/\/api.ldjam.com\/vx\/theme\/idea\/vote\/get\/<some_number>`.\n\nAfter you have obtained the list, save it as `theme.json` somewhere. Then, save the following Node.js script as `gen_list.js` in the save folder as `theme.json`:\n\n```js\nconst fs = require('fs');\nconst process = require('process');\n\nlet themes = fs.readFileSync('themes.json', {\n    encoding: 'utf8',\n});\nthemes = JSON.parse(themes);\n\nconst blacklist = process.argv.slice(2);\nconst blacklistMap = {};\nfor (const word of blacklist) {\n    blacklistMap[word] = true;\n}\n\nconst trailingDots = \/(\\.)+$\/;\nconst wordSeparator = \/[\\W_]\/;\n\nconst words = {};\nconst killList = {};\n\nfor (const key in themes.ideas) {\n    const theme = themes.ideas[key];\n    for (let word of theme.split(wordSeparator)) {\n        word = word.replace(trailingDots, '');\n        word = word.toLowerCase();\n\n        if (word.length < 1) {\n            continue;\n        }\n\n        if (blacklistMap[word]) {\n            killList[key] = theme;\n            break;\n        }\n    }\n}\n\nprocess.stdout.write('\/\/ Themes that contain: ');\nprocess.stdout.write(blacklist.join(', '));\nprocess.stdout.write('\\n');\nprocess.stdout.write(JSON.stringify(killList, null, 4));\nprocess.stdout.write(',\\n');\n```\n\nYou can now generate your own lists by running this file from the command line!\n\n```\nnode gen_list.js keyword_1 keyword_2 keyword3\n```","title":"3000 is still too much? Slaughter the worst cliches with this script!","wayback_source":[]}