Skip to content

Instantly share code, notes, and snippets.

@akselqviller
Last active November 18, 2015 13:57
Show Gist options
  • Save akselqviller/537b3a29a6746cd94afd to your computer and use it in GitHub Desktop.
Save akselqviller/537b3a29a6746cd94afd to your computer and use it in GitHub Desktop.
C# keywords poet-omatic
var pageContent = new System.Net.WebClient().DownloadString("https://msdn.microsoft.com/en-us/library/x53a06bb.aspx");
var keywords = new Regex(@".aspx"">(\w+)</a>").Matches(pageContent).Cast<Match>()
.Select(m => m.Groups[1].Value).OrderBy(s => s).ToList();
var rand = new Random();
var poem = string.Join("\n",
Enumerable.Range(0, 3).Select(l => String.Join(" ",
Enumerable.Range(0, rand.Next(1, 5))
.Select(w => keywords[rand.Next(keywords.Count)]))));
poem.Dump();
@akselqviller
Copy link
Author

Run with LINQPad

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