Skip to content

Instantly share code, notes, and snippets.

@benlk

benlk/reddits.js

Created Apr 12, 2015
Embed
What would you like to do?
A way to generate all the country code reddit domains, and then some.
// Why? Because I wanted to blacklist them in my /etc/hosts file.
// This does not cover the subredditname.reddit.com subdomains, but those redirect to www.reddit.com/r/subredditname
var letters = Array(
'a',
'b',
'c',
'd',
'e',
'f',
'g',
'h',
'i',
'j',
'k',
'l',
'm',
'n',
'o',
'p',
'q',
'r',
's',
't',
'u',
'v',
'w',
'x',
'y',
'z'
);
var fletter = '';
var sletter = '';
function lprint(letter, index, array) {
sletter = letter
console.log(fletter + sletter + '.reddit.com' );
}
function sletters(letter, index, array) {
fletter = letter;
array.forEach(lprint);
}
letters.forEach(sletters);
console.log('www.reddit.com');
console.log('secure.reddit.com');
@benlk

This comment has been minimized.

Copy link
Owner Author

@benlk benlk commented Apr 12, 2015

There's got to be a better way to do the generation that the three global variables that I have here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment