{"author_link":"\/users\/4m8g84jhqtgo","author_name":"4m8g84jhqtgo","author_uid":"4m8g84jhqtgo","comments":[],"epoch":1586692281,"event":"LD46","format":"md","ldjam_node_id":183831,"likes":32,"metadata":{"p_key":"138157","p_author":"4m8g84jhqtgo","p_authorkey":"1183827","p_urlkey":"354459","p_title":"No time to go through 6000 themes? Slaughter the worst cliches with this script!","p_cat":"LDJam ","p_event":"LD46","p_time":"1586692281","p_likes":"32","p_comments":"0","p_status":"WAYBACK","us_key":"1183827","us_name":"4m8g84jhqtgo","us_username":"4m8g84jhqtgo","event_start":"1587081600","event_key":"77","event_name":"Ludum Dare 46"},"node":{"_collation":{"body_sanitizer":"TextUtils::SanitizeHTML via existing importer","event":"LD46","removed_author":false},"_superparent":176557,"_trust":1,"author":183827,"body":"## 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* Control\/buttons: https:\/\/pastebin.com\/yLm4DadV\n* Virus: https:\/\/pastebin.com\/mYu0n5NR\n* Currency: https:\/\/pastebin.com\/XPBFb2tS\n* Die\/lose to win: https:\/\/pastebin.com\/J3ArHEdW\n* Thing is key: https:\/\/pastebin.com\/AfVXxjSS\n* You are bad: https:\/\/pastebin.com\/VnGLV4Y5\n* Colors: https:\/\/pastebin.com\/D1M3zWnR\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\/46\/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\/46\/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```\n\nStay healthy and flatten the curve!","comments":6,"comments-timestamp":"2020-04-12T16:36:58Z","created":"2020-04-12T11:45:10Z","files":[],"files-timestamp":0,"id":183831,"love":32,"love-timestamp":"2020-04-13T03:47:46Z","meta":[],"modified":"2020-04-13T03:47:46Z","name":"No time to go through 6000 themes? Slaughter the worst cliches with this script!","node-timestamp":"2020-04-12T11:51:21Z","parent":183830,"parents":[1,5,9,176557,183830],"path":"\/events\/ludum-dare\/46\/$183830\/no-time-to-go-through-6000-themes-slaughter-the-worst-cliches-with-this-script","published":"2020-04-12T11:51:21Z","scope":"public","slug":"no-time-to-go-through-6000-themes-slaughter-the-worst-cliches-with-this-script","subsubtype":"","subtype":"","type":"post","version":543529},"node_metadata":{"n_key":"183831","n_urlkey":"354459","n_parent":"183830","n_path":"\/events\/ludum-dare\/46\/$183830\/no-time-to-go-through-6000-themes-slaughter-the-worst-cliches-with-this-script","n_slug":"no-time-to-go-through-6000-theme","n_type":"post","n_subtype":"","n_subsubtype":"","n_author":"183827","n_created":"1586691910","n_modified":"1586749666","n_version":"543529","n_status":"WAYBACK"},"source_url":"https:\/\/ldjam.com\/events\/ludum-dare\/46\/$183830\/no-time-to-go-through-6000-themes-slaughter-the-worst-cliches-with-this-script","text":"## 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* Control\/buttons: https:\/\/pastebin.com\/yLm4DadV\n* Virus: https:\/\/pastebin.com\/mYu0n5NR\n* Currency: https:\/\/pastebin.com\/XPBFb2tS\n* Die\/lose to win: https:\/\/pastebin.com\/J3ArHEdW\n* Thing is key: https:\/\/pastebin.com\/AfVXxjSS\n* You are bad: https:\/\/pastebin.com\/VnGLV4Y5\n* Colors: https:\/\/pastebin.com\/D1M3zWnR\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\/46\/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\/46\/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```\n\nStay healthy and flatten the curve!","title":"No time to go through 6000 themes? Slaughter the worst cliches with this script!","wayback_source":[]}