Created
April 12, 2015 20:10
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There's got to be a better way to do the generation that the three global variables that I have here.