Skip to content

Instantly share code, notes, and snippets.

@benlk
Created April 12, 2015 20:10
Show Gist options
  • Save benlk/ac36301ee090198136e0 to your computer and use it in GitHub Desktop.
Save benlk/ac36301ee090198136e0 to your computer and use it in GitHub Desktop.
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
Copy link
Author

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