"...We have located the enemy fleet under the command of Admiral Kompüter,
+ but do not yet have visual contact. We suggest the best course of action is to fire
+ at random into their vicinity and listen for the impact of the shells...
+
...Our intelligence sources indicate the composition of the enemy fleet is the same
+ as our own, and has likewise been forced to resort to the same tactics as ourselves. In accordance with
+ the rules of war, fire will be exchanged one shell at a time and vessels lost will be announced
+ immediately...
+
...As per your orders you have been placed directly in command of the fleet's guns. Select the target
+ location by clicking in the left-hand grid above. The right hand grid shows the status of our own fleet.
+ Information as to the remaining strength of the enemy will be relayed directly to your status bar...
+
...We believe this battle will not be over until one or other fleet is sunk in it's entirety. Our
+ gunners
+ await your commands. We're counting on you, Sir..."
diff --git a/Misc/ChromeExtensionSamples/05 Options/script.js b/Misc/ChromeExtensionSamples/05 Options/script.js
new file mode 100644
index 0000000..90b1e09
--- /dev/null
+++ b/Misc/ChromeExtensionSamples/05 Options/script.js
@@ -0,0 +1,10 @@
+window.addEventListener('load', function load(event) {
+ chrome.storage.local.get('name', function(result) {
+ if (result != undefined && result.name != undefined) {
+ document.getElementById('name').value = result.name;
+ }
+ });
+ document.getElementById('save').onclick = function() {
+ chrome.storage.local.set({'name': document.getElementById('name').value});
+ };
+});
diff --git a/Misc/ChromeExtensionSamples/README.md b/Misc/ChromeExtensionSamples/README.md
new file mode 100644
index 0000000..48f68cf
--- /dev/null
+++ b/Misc/ChromeExtensionSamples/README.md
@@ -0,0 +1,9 @@
+# Simple Chrome Extension Samples
+
+We all have our favorite web browser with our favorite extensions loaded, but have you ever considered writing your own? You've probably had at least one idea for something that it'd be nice to have, but there's nothing out there that quite does what you're looking for.
+
+As technology becomes more and more a part of our everyday lives, it's useful to understand how to manipulate it to suit our individual needs. These days, knowing at least a little coding is like learning word processing or writing a basic html page was 15 years ago. It's becoming a basic computer skill.
+
+In the past few months I've created a couple extensions to suit my own needs - unpolished but functional - and threw them in the Chrome Web Store just in case someone out there found them useful.
+
+[Here's what I've learned](https://grantwinney.com/making-your-first-chrome-extension/).
diff --git a/Misc/GetKnownFolders/CPlusPlus/CPlusPlus.sln b/Misc/GetKnownFolders/CPlusPlus/CPlusPlus.sln
new file mode 100644
index 0000000..70c7933
--- /dev/null
+++ b/Misc/GetKnownFolders/CPlusPlus/CPlusPlus.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29905.134
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConsoleApplication1", "ConsoleApplication1\ConsoleApplication1.vcxproj", "{7F46F518-04C9-4C56-B14D-78B198CE3207}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {7F46F518-04C9-4C56-B14D-78B198CE3207}.Debug|x64.ActiveCfg = Debug|x64
+ {7F46F518-04C9-4C56-B14D-78B198CE3207}.Debug|x64.Build.0 = Debug|x64
+ {7F46F518-04C9-4C56-B14D-78B198CE3207}.Debug|x86.ActiveCfg = Debug|Win32
+ {7F46F518-04C9-4C56-B14D-78B198CE3207}.Debug|x86.Build.0 = Debug|Win32
+ {7F46F518-04C9-4C56-B14D-78B198CE3207}.Release|x64.ActiveCfg = Release|x64
+ {7F46F518-04C9-4C56-B14D-78B198CE3207}.Release|x64.Build.0 = Release|x64
+ {7F46F518-04C9-4C56-B14D-78B198CE3207}.Release|x86.ActiveCfg = Release|Win32
+ {7F46F518-04C9-4C56-B14D-78B198CE3207}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {0AA3873B-9685-4238-9D3E-E55459E942B8}
+ EndGlobalSection
+EndGlobal
diff --git a/Misc/GetKnownFolders/CPlusPlus/ConsoleApplication1/ConsoleApplication1.cpp b/Misc/GetKnownFolders/CPlusPlus/ConsoleApplication1/ConsoleApplication1.cpp
new file mode 100644
index 0000000..a139cc2
--- /dev/null
+++ b/Misc/GetKnownFolders/CPlusPlus/ConsoleApplication1/ConsoleApplication1.cpp
@@ -0,0 +1,19 @@
+#include
+#include
+#include
+using namespace std;
+
+#pragma comment(lib, "shell32.lib")
+
+int main() {
+ PWSTR path = NULL;
+ HRESULT result = SHGetKnownFolderPath(FOLDERID_Documents, 0, NULL, &path);
+
+ if (result != S_OK)
+ std::cout << "Error: " << result << "\n";
+ else
+ wprintf(L"%ls\n", path);
+
+ cin.get(); // pause to view result
+ return 0;
+}
diff --git a/Misc/GetKnownFolders/CPlusPlus/ConsoleApplication1/ConsoleApplication1.vcxproj b/Misc/GetKnownFolders/CPlusPlus/ConsoleApplication1/ConsoleApplication1.vcxproj
new file mode 100644
index 0000000..93e7dcf
--- /dev/null
+++ b/Misc/GetKnownFolders/CPlusPlus/ConsoleApplication1/ConsoleApplication1.vcxproj
@@ -0,0 +1,155 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ {7F46F518-04C9-4C56-B14D-78B198CE3207}
+ Win32Proj
+ ConsoleApplication1
+ 10.0
+
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+ true
+
+
+ false
+
+
+ false
+
+
+
+
+
+ Level3
+ true
+ WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+
+
+
+
+
+
+ Level3
+ true
+ _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+
+
+
+
+
+
+ Level3
+ true
+ true
+ true
+ WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+ true
+ true
+
+
+
+
+
+
+ Level3
+ true
+ true
+ true
+ NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+ true
+ true
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Misc/GetKnownFolders/CPlusPlus/ConsoleApplication1/ConsoleApplication1.vcxproj.filters b/Misc/GetKnownFolders/CPlusPlus/ConsoleApplication1/ConsoleApplication1.vcxproj.filters
new file mode 100644
index 0000000..c45426d
--- /dev/null
+++ b/Misc/GetKnownFolders/CPlusPlus/ConsoleApplication1/ConsoleApplication1.vcxproj.filters
@@ -0,0 +1,22 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;hm;inl;inc;ipp;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+
+
+ Source Files
+
+
+
\ No newline at end of file
diff --git a/Misc/GetKnownFolders/CSharp/CSharp.sln b/Misc/GetKnownFolders/CSharp/CSharp.sln
new file mode 100644
index 0000000..679cd1f
--- /dev/null
+++ b/Misc/GetKnownFolders/CSharp/CSharp.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29905.134
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GetKnownFolder", "GetKnownFolder\GetKnownFolder.csproj", "{AD3B1D8E-7925-4313-BBD3-91AF5FC8D571}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {AD3B1D8E-7925-4313-BBD3-91AF5FC8D571}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AD3B1D8E-7925-4313-BBD3-91AF5FC8D571}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AD3B1D8E-7925-4313-BBD3-91AF5FC8D571}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AD3B1D8E-7925-4313-BBD3-91AF5FC8D571}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {E8D09A4B-9029-4BB4-B50A-2DEBD19BD0E8}
+ EndGlobalSection
+EndGlobal
diff --git a/Misc/GetKnownFolders/CSharp/GetKnownFolder/GetKnownFolder.csproj b/Misc/GetKnownFolders/CSharp/GetKnownFolder/GetKnownFolder.csproj
new file mode 100644
index 0000000..c73e0d1
--- /dev/null
+++ b/Misc/GetKnownFolders/CSharp/GetKnownFolder/GetKnownFolder.csproj
@@ -0,0 +1,8 @@
+
+
+
+ Exe
+ netcoreapp3.1
+
+
+
diff --git a/Misc/GetKnownFolders/CSharp/GetKnownFolder/Program.cs b/Misc/GetKnownFolders/CSharp/GetKnownFolder/Program.cs
new file mode 100644
index 0000000..b6639d6
--- /dev/null
+++ b/Misc/GetKnownFolders/CSharp/GetKnownFolder/Program.cs
@@ -0,0 +1,14 @@
+using System;
+using static System.Environment;
+
+namespace GetKnownFolder
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ Console.WriteLine(GetFolderPath(SpecialFolder.MyDocuments));
+ Console.ReadLine();
+ }
+ }
+}
diff --git a/Misc/GetKnownFolders/Python/GetKnownFolders.py b/Misc/GetKnownFolders/Python/GetKnownFolders.py
new file mode 100644
index 0000000..b981e77
--- /dev/null
+++ b/Misc/GetKnownFolders/Python/GetKnownFolders.py
@@ -0,0 +1,4 @@
+from win32com.shell import shell, shellcon
+print shell.SHGetFolderPath(0, shellcon.CSIDL_MYPICTURES, None, 0)
+print shell.SHGetFolderPath(0, shellcon.CSIDL_PERSONAL, None, 0)
+
diff --git a/Misc/TweetRandomFeedItem/README.md b/Misc/TweetRandomFeedItem/README.md
new file mode 100644
index 0000000..a205160
--- /dev/null
+++ b/Misc/TweetRandomFeedItem/README.md
@@ -0,0 +1,40 @@
+# Tweet a Random RSS Feed Item
+
+***Using [AWS Lambda](https://aws.amazon.com/lambda/) and [Tweetinvi](https://github.com/linvi/tweetinvi)***
+
+This project is a slight modification of [my last one](https://github.com/grantwinney/BlogCodeSamples/tree/master/Misc/TweetRandomPostFromAGhostBlog), replacing reading posts via the Ghost API to a more general parsing of RSS feeds. I wanted to create something that would work for *any* blog... or anything else that generates an RSS feed.
+
+## Usage
+
+This is a C# console you can run from AWS Lambda. Schedule it to run as often as you like using Lambda's [cron scheduling](https://docs.aws.amazon.com/lambda/latest/dg/tutorial-scheduled-events-schedule-expressions.html) capabilities.
+
+If you'd like to read more about it, [I wrote a blog post about it too](https://grantwinney.com/using-aws-lambda-to-tweet-random-posts-from-an-rss-feed/).
+
+### Getting the code
+
+1. Clone this repo: `git clone https://github.com/grantwinney/BlogCodeSamples.git`
+2. Find the project under "Misc/TweetRandomFeedItem" and build it, either in Visual Studio or at the command line.
+3. Find the `bin` directory on disk, and drill down until you get to the assemblies (dll files). Most likely: `bin/Debug/netcoreapp2.0`
+4. Zip up the contents of the inner-most directory, but not the directory itself. _(e.g. just select all the files_ inside _`netcoreapp2.0`.)_
+
+### Setting up AWS Lambda
+
+Now you need to create a new AWS Lambda job. [Check this out](https://victoria.dev/archive/running-a-free-twitter-bot-on-aws-lambda/#setting-up-aws-lambda) for a brief intro to setting up a job.
+
+1. Create a new function and choose `C# (.NET Core 2.0)` for the runtime. _(this may change as new versions are released)_
+2. The name of the function, and the role it makes you create, don't matter.
+3. Upload the zip file you created above.
+4. Set the handler as `TweetRandomFeedItem::TweetRandomFeedItem.Program::Main`
+5. Under "Basic settings", decrease the memory to 128MB and increase the timeout to a minute. For me, it generally takes about 15-20 seconds to run, and uses less than 100MB of memory. You may have to play with the settings a bit.
+6. Set the following environment variables:
+
+#### Environment Variables
+
+I use quite a few environment variables, so credentials and other settings can easily be changed between runs, without having to recompile the code and upload it again.
+
+| Field | Required | Description |
+| ------------- |:-------------:| -----|
+| `RSS_URI` | Yes | The RSS feed to read in, like: `https://grantwinney.com/rss/` |
+| `RSS_ITEM_RETRIEVAL_LIMIT` | No | Specify the number of posts you want to retrieve.
If you omit this, or leave the value empty, the app will read the entire RSS feed. |
+| `TWITTER_CONSUMER_KEY` `TWITTER_CONSUMER_SECRET` `TWITTER_USER_ACCESS_TOKEN` `TWITTER_USER_ACCESS_TOKEN_SECRET` | Yes | These values all come from your Twitter account. You need to create a new app to get these values, which allows you to post tweets. |
+| `TWITTER_MAX_TAG_COUNT` | No | Although tag spamming is somewhat prevalent on Facebook, and even more-so on Instagram, I don't see a lot of it on Twitter. If you tend to use a lot of tags for posts on your blog, then you can limit how many of those transfer to your tweet.
If you omit this, or leave the value empty, the app will use the first 3 tags. |
diff --git a/Misc/TweetRandomFeedItem/TweetRandomFeedItem.sln b/Misc/TweetRandomFeedItem/TweetRandomFeedItem.sln
new file mode 100644
index 0000000..365b549
--- /dev/null
+++ b/Misc/TweetRandomFeedItem/TweetRandomFeedItem.sln
@@ -0,0 +1,17 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TweetRandomFeedItem", "TweetRandomFeedItem\TweetRandomFeedItem.csproj", "{A65ED552-1655-436F-B2F5-C41F35DE00F3}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {A65ED552-1655-436F-B2F5-C41F35DE00F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A65ED552-1655-436F-B2F5-C41F35DE00F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A65ED552-1655-436F-B2F5-C41F35DE00F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A65ED552-1655-436F-B2F5-C41F35DE00F3}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+EndGlobal
diff --git a/Misc/TweetRandomFeedItem/TweetRandomFeedItem/Helper.cs b/Misc/TweetRandomFeedItem/TweetRandomFeedItem/Helper.cs
new file mode 100644
index 0000000..afde505
--- /dev/null
+++ b/Misc/TweetRandomFeedItem/TweetRandomFeedItem/Helper.cs
@@ -0,0 +1,24 @@
+using System;
+namespace TweetRandomFeedItem
+{
+ public class Helper
+ {
+ public static T GetEnv(string environmentVariable)
+ {
+ try
+ {
+ return (T)Convert.ChangeType(Environment.GetEnvironmentVariable(environmentVariable), typeof(T));
+ }
+ catch (ArgumentNullException)
+ {
+ Console.WriteLine($"The environment variable {environmentVariable} is required and missing.");
+ throw;
+ }
+ }
+
+ public static T GetEnv(string environmentVariable, string defaultValue)
+ {
+ return (T)Convert.ChangeType(Environment.GetEnvironmentVariable(environmentVariable) ?? defaultValue, typeof(T));
+ }
+ }
+}
diff --git a/Misc/TweetRandomFeedItem/TweetRandomFeedItem/Program.cs b/Misc/TweetRandomFeedItem/TweetRandomFeedItem/Program.cs
new file mode 100644
index 0000000..cf14f3a
--- /dev/null
+++ b/Misc/TweetRandomFeedItem/TweetRandomFeedItem/Program.cs
@@ -0,0 +1,86 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+using System.Xml;
+using Microsoft.SyndicationFeed;
+using Microsoft.SyndicationFeed.Rss;
+using Tweetinvi;
+
+namespace TweetRandomFeedItem
+{
+ class Program
+ {
+ const string DEFAULT_MAX_TAG_COUNT = "3";
+ const int TWITTER_URL_SIZE = 23;
+ const int MAX_TWEET_LENGTH = 280;
+
+ static Random random = new Random();
+
+ public static async void Main()
+ {
+ var message = CreateMessageFromRandomFeedItem();
+
+ await SendTweet(message);
+
+ Console.WriteLine($"Tweeted message:\r\n\r\n{message}");
+ }
+
+ static string CreateMessageFromRandomFeedItem()
+ {
+ var ghostUri = Helper.GetEnv("RSS_URI");
+ var maxTagCount = Helper.GetEnv("TWITTER_MAX_TAG_COUNT", DEFAULT_MAX_TAG_COUNT);
+ var maxItemsToRead = Helper.GetEnv("RSS_ITEM_RETRIEVAL_LIMIT", Int32.MaxValue.ToString());
+
+ var pattern = new Regex("[- ]");
+ var entries = new List();
+
+ using (var xmlReader = XmlReader.Create(ghostUri))
+ {
+ var feedReader = new RssFeedReader(xmlReader);
+
+ var itemsRead = 0;
+ while (feedReader.Read().Result && itemsRead < maxItemsToRead)
+ {
+ if (feedReader.ElementType == SyndicationElementType.Item)
+ {
+ entries.Add(feedReader.ReadItem().Result);
+ itemsRead++;
+ }
+ }
+ }
+
+ var selectedEntry = entries[random.Next(0, entries.Count - 1)];
+
+ var remainingSpaceForTags = MAX_TWEET_LENGTH - (selectedEntry.Title.Length + 1 + TWITTER_URL_SIZE);
+
+ var tags = selectedEntry.Categories.Take(maxTagCount).Select(x => $"#{pattern.Replace(x.Name, "_").Replace("#", "sharp").Replace(".", "dot")}");
+
+ var tagsFlat = "";
+ foreach (var t in tags)
+ {
+ if ($"{tagsFlat} {t}".Length > remainingSpaceForTags)
+ break;
+
+ tagsFlat += $" {t}";
+ }
+
+ return $"{selectedEntry.Title}{tagsFlat}\r\n{selectedEntry.Links.ToList()[0].Uri}";
+ }
+
+ static async Task SendTweet(string message)
+ {
+ var consumerKey = Helper.GetEnv("TWITTER_CONSUMER_KEY");
+ var consumerSecret = Helper.GetEnv("TWITTER_CONSUMER_SECRET");
+ var userAccessToken = Helper.GetEnv("TWITTER_USER_ACCESS_TOKEN");
+ var userAccessTokenSecret = Helper.GetEnv("TWITTER_USER_ACCESS_TOKEN_SECRET");
+
+ var userClient = new TwitterClient(consumerKey, consumerSecret, userAccessToken, userAccessTokenSecret);
+
+ await userClient.Tweets.PublishTweetAsync(message);
+
+ Console.WriteLine($"Tweeted message:\r\n{message}\r\n");
+ }
+ }
+}
diff --git a/Misc/TweetRandomFeedItem/TweetRandomFeedItem/TweetRandomFeedItem.csproj b/Misc/TweetRandomFeedItem/TweetRandomFeedItem/TweetRandomFeedItem.csproj
new file mode 100644
index 0000000..901ac4b
--- /dev/null
+++ b/Misc/TweetRandomFeedItem/TweetRandomFeedItem/TweetRandomFeedItem.csproj
@@ -0,0 +1,20 @@
+
+
+
+ Exe
+ netcoreapp2.0
+
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Misc/TweetRandomFeedItem/TweetRandomFeedItem/TweetRandomFeedItem.sln b/Misc/TweetRandomFeedItem/TweetRandomFeedItem/TweetRandomFeedItem.sln
new file mode 100644
index 0000000..92f7f4e
--- /dev/null
+++ b/Misc/TweetRandomFeedItem/TweetRandomFeedItem/TweetRandomFeedItem.sln
@@ -0,0 +1,17 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2017
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TweetRandomFeedItem", "TweetRandomFeedItem.csproj", "{E5CCB899-06D3-4062-98B4-9BAA87B08322}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {E5CCB899-06D3-4062-98B4-9BAA87B08322}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E5CCB899-06D3-4062-98B4-9BAA87B08322}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E5CCB899-06D3-4062-98B4-9BAA87B08322}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E5CCB899-06D3-4062-98B4-9BAA87B08322}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+EndGlobal
diff --git a/Misc/TweetRandomPostFromAGhostBlog/README.md b/Misc/TweetRandomPostFromAGhostBlog/README.md
new file mode 100644
index 0000000..49403e7
--- /dev/null
+++ b/Misc/TweetRandomPostFromAGhostBlog/README.md
@@ -0,0 +1,5 @@
+# Tweet a Random Post from a Ghost Blog
+
+Instead of repeating everything here, you can read all the details of how to use this and the libraries it depends on here:
+
+[Using AWS Lambda to tweet random posts from a Ghost blog](https://grantwinney.com/using-aws-lambda-and-tweetinvi-to-tweet-a-random-ghost-blog-post/)
diff --git a/Misc/TweetRandomPostFromAGhostBlog/TweetRandomFeedItem.sln b/Misc/TweetRandomPostFromAGhostBlog/TweetRandomFeedItem.sln
new file mode 100644
index 0000000..88f781d
--- /dev/null
+++ b/Misc/TweetRandomPostFromAGhostBlog/TweetRandomFeedItem.sln
@@ -0,0 +1,30 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30517.126
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TweetRandomFeedItem", "TweetRandomFeedItem\TweetRandomFeedItem.csproj", "{A65ED552-1655-436F-B2F5-C41F35DE00F3}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TweetRandomFeedItemTests", "TweetRandomFeedItemTests\TweetRandomFeedItemTests.csproj", "{E74EA8AD-34AD-488B-8D56-9A5B3D7DA940}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {A65ED552-1655-436F-B2F5-C41F35DE00F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A65ED552-1655-436F-B2F5-C41F35DE00F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A65ED552-1655-436F-B2F5-C41F35DE00F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A65ED552-1655-436F-B2F5-C41F35DE00F3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E74EA8AD-34AD-488B-8D56-9A5B3D7DA940}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E74EA8AD-34AD-488B-8D56-9A5B3D7DA940}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E74EA8AD-34AD-488B-8D56-9A5B3D7DA940}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E74EA8AD-34AD-488B-8D56-9A5B3D7DA940}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {55609BE2-7144-430D-A555-6E134855C7F0}
+ EndGlobalSection
+EndGlobal
diff --git a/Misc/TweetRandomPostFromAGhostBlog/TweetRandomFeedItem/Helper.cs b/Misc/TweetRandomPostFromAGhostBlog/TweetRandomFeedItem/Helper.cs
new file mode 100644
index 0000000..4075300
--- /dev/null
+++ b/Misc/TweetRandomPostFromAGhostBlog/TweetRandomFeedItem/Helper.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Text.RegularExpressions;
+
+namespace TweetRandomFeedItem
+{
+ public class Helper
+ {
+ static readonly Regex invalidChars = new("[- ]");
+
+ public static string SanitizeTagName(string tag)
+ {
+ return $"#{invalidChars.Replace(tag, "").Replace("#", "sharp").Replace(".", "dot")}";
+ }
+
+ public static T GetEnv(string environmentVariable)
+ {
+ try
+ {
+ return ConvertVariableType(environmentVariable, Environment.GetEnvironmentVariable(environmentVariable));
+ }
+ catch (ArgumentNullException)
+ {
+ Console.WriteLine($"The environment variable {environmentVariable} is missing.");
+ throw;
+ }
+ }
+
+ public static T GetEnv(string environmentVariable, string defaultValue)
+ {
+ try
+ {
+ return ConvertVariableType(environmentVariable, Environment.GetEnvironmentVariable(environmentVariable), defaultValue);
+ }
+ catch (ArgumentNullException)
+ {
+ Console.WriteLine($"The environment variable {environmentVariable} is missing.");
+ throw;
+ }
+ }
+
+ public static T ConvertVariableType(string variableKey, string variableValue, string defaultValue = null)
+ {
+ if (string.IsNullOrEmpty(variableValue))
+ {
+ if (defaultValue != null)
+ {
+ Console.WriteLine($"The environment variable {variableKey} returned a null value. Using default value of '{defaultValue}' instead.");
+ return (T)Convert.ChangeType(defaultValue, typeof(T));
+ }
+ else
+ Console.WriteLine($"The environment variable {variableKey} returned a null value.");
+ }
+
+ return (T)Convert.ChangeType(variableValue, typeof(T));
+ }
+ }
+}
diff --git a/Misc/TweetRandomPostFromAGhostBlog/TweetRandomFeedItem/Program.cs b/Misc/TweetRandomPostFromAGhostBlog/TweetRandomFeedItem/Program.cs
new file mode 100644
index 0000000..efd48b8
--- /dev/null
+++ b/Misc/TweetRandomPostFromAGhostBlog/TweetRandomFeedItem/Program.cs
@@ -0,0 +1,164 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net.Http;
+using System.Text;
+using System.Threading.Tasks;
+using GhostSharp;
+using GhostSharp.Entities;
+using GhostSharp.Enums;
+using GhostSharp.QueryParams;
+using Newtonsoft.Json;
+using Tweetinvi;
+using Tweetinvi.Core.Web;
+using Tweetinvi.Models;
+
+namespace TweetRandomFeedItem
+{
+ class Program
+ {
+ private const int TWITTER_URL_SIZE = 23;
+ private const int MAX_TWEET_LENGTH = 280;
+
+ private static readonly string API_URL = Helper.GetEnv("API_URL");
+ private static readonly string ADMIN_API_KEY = Helper.GetEnv("ADMIN_API_KEY");
+ private static readonly string TWITTER_CONSUMER_KEY = Helper.GetEnv("TWITTER_CONSUMER_KEY");
+ private static readonly string TWITTER_CONSUMER_SECRET = Helper.GetEnv("TWITTER_CONSUMER_SECRET");
+ private static readonly string TWITTER_USER_ACCESS_TOKEN = Helper.GetEnv("TWITTER_USER_ACCESS_TOKEN");
+ private static readonly string TWITTER_USER_ACCESS_TOKEN_SECRET = Helper.GetEnv("TWITTER_USER_ACCESS_TOKEN_SECRET");
+ private static readonly string[] TAGS_TO_TWEET = Helper.GetEnv("TAGS_TO_TWEET", "").Split(',');
+ private static readonly string[] TAGS_TO_REMOVE = Helper.GetEnv("TAGS_TO_REMOVE", "").Split(',');
+ private static readonly int POST_RETRIEVAL_LIMIT = Helper.GetEnv("POST_RETRIEVAL_LIMIT", "9999999");
+ private static readonly int TWITTER_MAX_TAG_COUNT = Helper.GetEnv("TWITTER_MAX_TAG_COUNT", "3");
+ private static readonly bool FACTOR_IN_AGE_OF_POST = Helper.GetEnv("FACTOR_IN_AGE_OF_POST", "false");
+
+ static readonly Random rnd = new Random();
+ static readonly GhostAdminAPI api = new GhostAdminAPI(API_URL, ADMIN_API_KEY);
+
+ public static async Task Main()
+ {
+ var allPosts = api.GetPosts(new PostQueryParams
+ {
+ Limit = POST_RETRIEVAL_LIMIT,
+ Fields = (FACTOR_IN_AGE_OF_POST ? PostFields.Id | PostFields.PublishedAt : PostFields.Id) | PostFields.Status,
+ }).Posts.Where(p => p.Status == "published").ToList();
+
+ if (!allPosts.Any())
+ {
+ Console.WriteLine("No posts! Nothing to tweet...");
+ return;
+ }
+
+ await SendTweet(CreateMessage(PickRandomPost(allPosts)));
+ }
+
+ static Post PickRandomPost(List posts)
+ {
+ var selectedIds = new HashSet();
+
+ while (true)
+ {
+ string randomPostId = "";
+ do
+ {
+ randomPostId = FACTOR_IN_AGE_OF_POST
+ ? GetRandomPostIdWeightedOnAge(posts)
+ : posts[rnd.Next(0, posts.Count())].Id;
+ }
+ while (selectedIds.Contains(randomPostId));
+
+ selectedIds.Add(randomPostId);
+
+ var randomPost = api.GetPostById(randomPostId);
+
+ if (!TAGS_TO_TWEET.Any() || randomPost.Tags.Select(tag => tag.Slug).Intersect(TAGS_TO_TWEET).Any())
+ return randomPost;
+ }
+ }
+
+ static string GetRandomPostIdWeightedOnAge(List posts)
+ {
+ var earliestPublishDate = posts.Last().PublishedAt;
+
+ var postsCount = posts.Count();
+ var postIdsAndPubWeights = posts.Select((p, i) => Tuple.Create(posts[i].Id, ((posts[i].PublishedAt ?? DateTime.MinValue) - earliestPublishDate).Value.Days * (postsCount - i)));
+ var totalPubWeights = postIdsAndPubWeights.Sum(p => p.Item2);
+ var randomPubWeight = rnd.Next(0, totalPubWeights);
+
+ foreach (var p in postIdsAndPubWeights)
+ {
+ if (randomPubWeight <= p.Item2)
+ return p.Item1;
+
+ randomPubWeight -= p.Item2;
+ }
+
+ return null; // req to compile, but won't happen unless there are no posts
+ }
+
+ static string CreateMessage(Post post)
+ {
+ var captionSources = new List { post.TwitterDescription, post.MetaDescription, post.Title };
+
+ var caption = captionSources.First(cs => !string.IsNullOrWhiteSpace(cs));
+
+ var remainingSpaceForTags = MAX_TWEET_LENGTH - (caption.Length + 1 + TWITTER_URL_SIZE);
+
+ var tags = post.Tags.Where(x => !TAGS_TO_REMOVE.Contains(x.Slug))
+ .Take(TWITTER_MAX_TAG_COUNT)
+ .Select(t => Helper.SanitizeTagName(t.Name));
+
+ var tagsFlat = "";
+ foreach (var t in tags)
+ {
+ if ($"{tagsFlat} {t}".Length > remainingSpaceForTags)
+ break;
+
+ tagsFlat += $" {t}";
+ }
+
+ return $"{caption}{tagsFlat}\r\n{post.Url}";
+ }
+
+ static async Task SendTweet(string message)
+ {
+ var client = new TwitterClient(TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET, TWITTER_USER_ACCESS_TOKEN, TWITTER_USER_ACCESS_TOKEN_SECRET);
+
+ //await userClient.Tweets.PublishTweetAsync(message);
+
+ // The TweetInvi library seems to be abandoned and PublishTweetAsync isn't working correctly,
+ // but someone posted a workaround: https://github.com/linvi/tweetinvi/issues/1147#issuecomment-1173174302
+ var result = await client.Execute.AdvanceRequestAsync(
+ (ITwitterRequest request) =>
+ {
+ var jsonBody = client.Json.Serialize(new TweetV2PostRequest { Text = message });
+
+ var content = new StringContent(jsonBody, Encoding.UTF8, "application/json");
+
+ request.Query.Url = "https://api.twitter.com/2/tweets";
+ request.Query.HttpMethod = Tweetinvi.Models.HttpMethod.POST;
+ request.Query.HttpContent = content;
+ }
+ );
+
+ if (result.Response.IsSuccessStatusCode)
+ Console.WriteLine($"Tweeted message:\r\n{message}\r\n");
+ else
+ Console.WriteLine($"Error posting tweet: {result.Content}\r\n\r\nOriginal tweet: {message}");
+ }
+ }
+
+ ///
+ /// There are a lot more fields according to:
+ /// https://developer.twitter.com/en/docs/twitter-api/tweets/manage-tweets/api-reference/post-tweets
+ /// but these are the ones we care about for our use case.
+ ///
+ public class TweetV2PostRequest
+ {
+ ///
+ /// The text of the tweet to post.
+ ///
+ [JsonProperty("text")]
+ public string Text { get; set; } = string.Empty;
+ }
+}
diff --git a/Misc/TweetRandomPostFromAGhostBlog/TweetRandomFeedItem/TweetRandomFeedItem.csproj b/Misc/TweetRandomPostFromAGhostBlog/TweetRandomFeedItem/TweetRandomFeedItem.csproj
new file mode 100644
index 0000000..fdabc1e
--- /dev/null
+++ b/Misc/TweetRandomPostFromAGhostBlog/TweetRandomFeedItem/TweetRandomFeedItem.csproj
@@ -0,0 +1,17 @@
+
+
+
+ Exe
+ net6.0
+
+
+
+ true
+
+
+
+
+
+
+
+
diff --git a/Misc/TweetRandomPostFromAGhostBlog/TweetRandomFeedItem/TweetRandomFeedItem.sln b/Misc/TweetRandomPostFromAGhostBlog/TweetRandomFeedItem/TweetRandomFeedItem.sln
new file mode 100644
index 0000000..92f7f4e
--- /dev/null
+++ b/Misc/TweetRandomPostFromAGhostBlog/TweetRandomFeedItem/TweetRandomFeedItem.sln
@@ -0,0 +1,17 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2017
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TweetRandomFeedItem", "TweetRandomFeedItem.csproj", "{E5CCB899-06D3-4062-98B4-9BAA87B08322}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {E5CCB899-06D3-4062-98B4-9BAA87B08322}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E5CCB899-06D3-4062-98B4-9BAA87B08322}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E5CCB899-06D3-4062-98B4-9BAA87B08322}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E5CCB899-06D3-4062-98B4-9BAA87B08322}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+EndGlobal
diff --git a/Misc/TweetRandomPostFromAGhostBlog/TweetRandomFeedItemTests/HelperTests.cs b/Misc/TweetRandomPostFromAGhostBlog/TweetRandomFeedItemTests/HelperTests.cs
new file mode 100644
index 0000000..7ca5f8a
--- /dev/null
+++ b/Misc/TweetRandomPostFromAGhostBlog/TweetRandomFeedItemTests/HelperTests.cs
@@ -0,0 +1,44 @@
+using NUnit.Framework;
+using TweetRandomFeedItem;
+
+namespace TweetRandomFeedItemTests
+{
+ public class Tests
+ {
+ [Test]
+ [TestCase("c#", "#csharp")]
+ [TestCase(".net", "#dotnet")]
+ [TestCase("testing-123", "#testing123")]
+ [TestCase("testing 123 456", "#testing123456")]
+ [TestCase("1-2 3", "#123")]
+ public void SanitizeTagName_ReplacesInvalidCharacters(string input, string expectedOutput)
+ {
+ Assert.AreEqual(expectedOutput, Helper.SanitizeTagName(input));
+ }
+
+ [Test]
+ [TestCase("phone#", "#phonesharp")]
+ [TestCase("this.that", "#thisdotthat")]
+ public void SanitizeTagName_MightHaveUnintendedEffects(string input, string expectedOutput)
+ {
+ Assert.AreEqual(expectedOutput, Helper.SanitizeTagName(input));
+ }
+
+ [Test]
+ [TestCase("programming")]
+ [TestCase("csharp_8")]
+ public void SanitizeTagName_LeavesValidTagsAlone(string tagName)
+ {
+ Assert.AreEqual($"#{tagName}", Helper.SanitizeTagName(tagName));
+ }
+
+ [Test]
+ [TestCase(null, "9999999", 9999999)]
+ [TestCase("", "9999999", 9999999)]
+ [TestCase("3", "9999999", 3)]
+ public void ConvertVariableType_ConvertsStringsToNumbers(string variableValue, string defaultValue, int expectedResult)
+ {
+ Assert.AreEqual(expectedResult, Helper.ConvertVariableType("n/a", variableValue, defaultValue));
+ }
+ }
+}
\ No newline at end of file
diff --git a/Misc/TweetRandomPostFromAGhostBlog/TweetRandomFeedItemTests/TweetRandomFeedItemTests.csproj b/Misc/TweetRandomPostFromAGhostBlog/TweetRandomFeedItemTests/TweetRandomFeedItemTests.csproj
new file mode 100644
index 0000000..c255cf7
--- /dev/null
+++ b/Misc/TweetRandomPostFromAGhostBlog/TweetRandomFeedItemTests/TweetRandomFeedItemTests.csproj
@@ -0,0 +1,19 @@
+
+
+
+ net6.0
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/WindowsXPVisualStudio/VB4.0/Form1.frm b/Misc/WindowsXPVisualStudio/VB4.0/Form1.frm
similarity index 100%
rename from WindowsXPVisualStudio/VB4.0/Form1.frm
rename to Misc/WindowsXPVisualStudio/VB4.0/Form1.frm
diff --git a/WindowsXPVisualStudio/VB4.0/Form1.frx b/Misc/WindowsXPVisualStudio/VB4.0/Form1.frx
similarity index 100%
rename from WindowsXPVisualStudio/VB4.0/Form1.frx
rename to Misc/WindowsXPVisualStudio/VB4.0/Form1.frx
diff --git a/WindowsXPVisualStudio/VB4.0/Project1.vbp b/Misc/WindowsXPVisualStudio/VB4.0/Project1.vbp
similarity index 100%
rename from WindowsXPVisualStudio/VB4.0/Project1.vbp
rename to Misc/WindowsXPVisualStudio/VB4.0/Project1.vbp
diff --git a/WindowsXPVisualStudio/VB4.0/untitled.rpt b/Misc/WindowsXPVisualStudio/VB4.0/untitled.rpt
similarity index 100%
rename from WindowsXPVisualStudio/VB4.0/untitled.rpt
rename to Misc/WindowsXPVisualStudio/VB4.0/untitled.rpt
diff --git a/WindowsXPVisualStudio/VB6.0/Module1.bas b/Misc/WindowsXPVisualStudio/VB6.0/Module1.bas
similarity index 100%
rename from WindowsXPVisualStudio/VB6.0/Module1.bas
rename to Misc/WindowsXPVisualStudio/VB6.0/Module1.bas
diff --git a/WindowsXPVisualStudio/VB6.0/Project1.RES b/Misc/WindowsXPVisualStudio/VB6.0/Project1.RES
similarity index 100%
rename from WindowsXPVisualStudio/VB6.0/Project1.RES
rename to Misc/WindowsXPVisualStudio/VB6.0/Project1.RES
diff --git a/WindowsXPVisualStudio/VB6.0/Project1.vbp b/Misc/WindowsXPVisualStudio/VB6.0/Project1.vbp
similarity index 100%
rename from WindowsXPVisualStudio/VB6.0/Project1.vbp
rename to Misc/WindowsXPVisualStudio/VB6.0/Project1.vbp
diff --git a/WindowsXPVisualStudio/VB6.0/frmAbout.frm b/Misc/WindowsXPVisualStudio/VB6.0/frmAbout.frm
similarity index 100%
rename from WindowsXPVisualStudio/VB6.0/frmAbout.frm
rename to Misc/WindowsXPVisualStudio/VB6.0/frmAbout.frm
diff --git a/WindowsXPVisualStudio/VB6.0/frmAbout.frx b/Misc/WindowsXPVisualStudio/VB6.0/frmAbout.frx
similarity index 100%
rename from WindowsXPVisualStudio/VB6.0/frmAbout.frx
rename to Misc/WindowsXPVisualStudio/VB6.0/frmAbout.frx
diff --git a/WindowsXPVisualStudio/VB6.0/frmBrowser.frm b/Misc/WindowsXPVisualStudio/VB6.0/frmBrowser.frm
similarity index 100%
rename from WindowsXPVisualStudio/VB6.0/frmBrowser.frm
rename to Misc/WindowsXPVisualStudio/VB6.0/frmBrowser.frm
diff --git a/WindowsXPVisualStudio/VB6.0/frmBrowser.frx b/Misc/WindowsXPVisualStudio/VB6.0/frmBrowser.frx
similarity index 100%
rename from WindowsXPVisualStudio/VB6.0/frmBrowser.frx
rename to Misc/WindowsXPVisualStudio/VB6.0/frmBrowser.frx
diff --git a/WindowsXPVisualStudio/VB6.0/frmDocument.frm b/Misc/WindowsXPVisualStudio/VB6.0/frmDocument.frm
similarity index 100%
rename from WindowsXPVisualStudio/VB6.0/frmDocument.frm
rename to Misc/WindowsXPVisualStudio/VB6.0/frmDocument.frm
diff --git a/WindowsXPVisualStudio/VB6.0/frmDocument.frx b/Misc/WindowsXPVisualStudio/VB6.0/frmDocument.frx
similarity index 100%
rename from WindowsXPVisualStudio/VB6.0/frmDocument.frx
rename to Misc/WindowsXPVisualStudio/VB6.0/frmDocument.frx
diff --git a/WindowsXPVisualStudio/VB6.0/frmMain.frm b/Misc/WindowsXPVisualStudio/VB6.0/frmMain.frm
similarity index 100%
rename from WindowsXPVisualStudio/VB6.0/frmMain.frm
rename to Misc/WindowsXPVisualStudio/VB6.0/frmMain.frm
diff --git a/WindowsXPVisualStudio/VB6.0/frmMain.frx b/Misc/WindowsXPVisualStudio/VB6.0/frmMain.frx
similarity index 100%
rename from WindowsXPVisualStudio/VB6.0/frmMain.frx
rename to Misc/WindowsXPVisualStudio/VB6.0/frmMain.frx
diff --git a/WindowsXPVisualStudio/VB6.0/frmSplash.frm b/Misc/WindowsXPVisualStudio/VB6.0/frmSplash.frm
similarity index 100%
rename from WindowsXPVisualStudio/VB6.0/frmSplash.frm
rename to Misc/WindowsXPVisualStudio/VB6.0/frmSplash.frm
diff --git a/WindowsXPVisualStudio/VB6.0/frmSplash.frx b/Misc/WindowsXPVisualStudio/VB6.0/frmSplash.frx
similarity index 100%
rename from WindowsXPVisualStudio/VB6.0/frmSplash.frx
rename to Misc/WindowsXPVisualStudio/VB6.0/frmSplash.frx
diff --git a/WindowsXPVisualStudio/VS2003/WindowsApplication1/WindowsApplication1.sln b/Misc/WindowsXPVisualStudio/VS2003/WindowsApplication1/WindowsApplication1.sln
similarity index 100%
rename from WindowsXPVisualStudio/VS2003/WindowsApplication1/WindowsApplication1.sln
rename to Misc/WindowsXPVisualStudio/VS2003/WindowsApplication1/WindowsApplication1.sln
diff --git a/WindowsXPVisualStudio/VS2003/WindowsApplication1/WindowsApplication1/AssemblyInfo.vb b/Misc/WindowsXPVisualStudio/VS2003/WindowsApplication1/WindowsApplication1/AssemblyInfo.vb
similarity index 100%
rename from WindowsXPVisualStudio/VS2003/WindowsApplication1/WindowsApplication1/AssemblyInfo.vb
rename to Misc/WindowsXPVisualStudio/VS2003/WindowsApplication1/WindowsApplication1/AssemblyInfo.vb
diff --git a/WindowsXPVisualStudio/VS2003/WindowsApplication1/WindowsApplication1/Form1.resx b/Misc/WindowsXPVisualStudio/VS2003/WindowsApplication1/WindowsApplication1/Form1.resx
similarity index 100%
rename from WindowsXPVisualStudio/VS2003/WindowsApplication1/WindowsApplication1/Form1.resx
rename to Misc/WindowsXPVisualStudio/VS2003/WindowsApplication1/WindowsApplication1/Form1.resx
diff --git a/WindowsXPVisualStudio/VS2003/WindowsApplication1/WindowsApplication1/Form1.vb b/Misc/WindowsXPVisualStudio/VS2003/WindowsApplication1/WindowsApplication1/Form1.vb
similarity index 100%
rename from WindowsXPVisualStudio/VS2003/WindowsApplication1/WindowsApplication1/Form1.vb
rename to Misc/WindowsXPVisualStudio/VS2003/WindowsApplication1/WindowsApplication1/Form1.vb
diff --git a/WindowsXPVisualStudio/VS2003/WindowsApplication1/WindowsApplication1/WindowsApplication1.vbproj b/Misc/WindowsXPVisualStudio/VS2003/WindowsApplication1/WindowsApplication1/WindowsApplication1.vbproj
similarity index 100%
rename from WindowsXPVisualStudio/VS2003/WindowsApplication1/WindowsApplication1/WindowsApplication1.vbproj
rename to Misc/WindowsXPVisualStudio/VS2003/WindowsApplication1/WindowsApplication1/WindowsApplication1.vbproj
diff --git a/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1.sln b/Misc/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1.sln
similarity index 100%
rename from WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1.sln
rename to Misc/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1.sln
diff --git a/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/App.xaml b/Misc/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/App.xaml
similarity index 100%
rename from WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/App.xaml
rename to Misc/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/App.xaml
diff --git a/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/App.xaml.cs b/Misc/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/App.xaml.cs
similarity index 100%
rename from WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/App.xaml.cs
rename to Misc/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/App.xaml.cs
diff --git a/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/MainWindow.xaml b/Misc/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/MainWindow.xaml
similarity index 100%
rename from WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/MainWindow.xaml
rename to Misc/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/MainWindow.xaml
diff --git a/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/MainWindow.xaml.cs b/Misc/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/MainWindow.xaml.cs
similarity index 100%
rename from WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/MainWindow.xaml.cs
rename to Misc/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/MainWindow.xaml.cs
diff --git a/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/Properties/AssemblyInfo.cs b/Misc/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/Properties/AssemblyInfo.cs
similarity index 100%
rename from WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/Properties/AssemblyInfo.cs
rename to Misc/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/Properties/AssemblyInfo.cs
diff --git a/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/Properties/Resources.Designer.cs b/Misc/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/Properties/Resources.Designer.cs
similarity index 100%
rename from WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/Properties/Resources.Designer.cs
rename to Misc/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/Properties/Resources.Designer.cs
diff --git a/Misc/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/Properties/Resources.resx b/Misc/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/Properties/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/Misc/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/Properties/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/Properties/Settings.Designer.cs b/Misc/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/Properties/Settings.Designer.cs
similarity index 100%
rename from WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/Properties/Settings.Designer.cs
rename to Misc/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/Properties/Settings.Designer.cs
diff --git a/Misc/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/Properties/Settings.settings b/Misc/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/Properties/Settings.settings
new file mode 100644
index 0000000..033d7a5
--- /dev/null
+++ b/Misc/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/Properties/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/WpfApplication1.csproj b/Misc/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/WpfApplication1.csproj
similarity index 100%
rename from WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/WpfApplication1.csproj
rename to Misc/WindowsXPVisualStudio/VS2010/WpfApplication1/WpfApplication1/WpfApplication1.csproj
diff --git a/MockingDependencies052014/MockingDependencies052014/Example1.cs b/MockingDependencies052014/MockingDependencies052014/Example1.cs
deleted file mode 100644
index 7e758a1..0000000
--- a/MockingDependencies052014/MockingDependencies052014/Example1.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-using System.IO;
-using System.Linq;
-using NUnit.Framework;
-
-namespace MockingDependencies052014
-{
- public class Example1
- {
- public const string LogFile = @"c:\test1.txt";
- public const string JobCompleteMessage = "Job Complete!";
-
- private readonly Logger1 logger;
-
- public Example1()
- {
- logger = new Logger1(LogFile);
- }
-
- public void PerformSomeAction()
- {
- // Do Something
-
- logger.LogMessage(JobCompleteMessage);
- }
- }
-
- public class Logger1
- {
- private readonly string logFile;
-
- public Logger1(string logFile)
- {
- this.logFile = logFile;
- }
-
- public void LogMessage(string message)
- {
- using (var file = new StreamWriter(logFile, true))
- {
- file.WriteLine(message);
- }
- }
- }
-
- [TestFixture]
- class Example1Tester
- {
- [Test]
- public void PerformSomeAction_LogsMessage_WhenActionSuccessfullyCompletes()
- {
- var vm = new Example1();
- vm.PerformSomeAction();
-
- var expectedValue = Example1.JobCompleteMessage;
- var actualValue = File.ReadAllLines(Example1.LogFile).Last();
-
- Assert.AreEqual(expectedValue, actualValue);
- }
- }
-}
\ No newline at end of file
diff --git a/MockingDependencies052014/MockingDependencies052014/Example1b.cs b/MockingDependencies052014/MockingDependencies052014/Example1b.cs
deleted file mode 100644
index 4063a58..0000000
--- a/MockingDependencies052014/MockingDependencies052014/Example1b.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-using System.IO;
-using Moq;
-using NUnit.Framework;
-
-namespace MockingDependencies052014
-{
- public class Example1b
- {
- private const string LogFile = @"c:\test1b.txt";
- public const string JobCompleteMessage = "Job Completed again!";
-
- private readonly ILogger1b logger;
-
- public Example1b()
- {
- this.logger = new Logger1b(LogFile);
- }
-
- public Example1b(ILogger1b logger)
- {
- this.logger = logger;
- }
-
- public void PerformSomeAction()
- {
- // Do Something
-
- logger.LogMessage(JobCompleteMessage);
- }
- }
-
- public interface ILogger1b
- {
- void LogMessage(string message);
- }
-
- public class Logger1b : ILogger1b
- {
- private readonly string logFile;
-
- public Logger1b(string logFile)
- {
- this.logFile = logFile;
- }
-
- public void LogMessage(string message)
- {
- using (var file = new StreamWriter(logFile, true))
- {
- file.WriteLine(message);
- }
- }
- }
-
- [TestFixture]
- class Example1bTester
- {
- private Mock logger;
-
- [SetUp]
- public void Setup()
- {
- logger = new Mock();
- }
-
- [Test]
- public void PerformSomeAction_LogsMessage_WhenActionSuccessfullyCompletes()
- {
- var vm = new Example1b(logger.Object);
- vm.PerformSomeAction();
-
- logger.Verify(x => x.LogMessage(Example1b.JobCompleteMessage), Times.Once());
- }
- }
-}
\ No newline at end of file
diff --git a/MockingDependencies052014/MockingDependencies052014/Example2a.cs b/MockingDependencies052014/MockingDependencies052014/Example2a.cs
deleted file mode 100644
index 1012f21..0000000
--- a/MockingDependencies052014/MockingDependencies052014/Example2a.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-using System.IO;
-using System.Linq;
-using System.Xml.Linq;
-using NUnit.Framework;
-
-namespace MockingDependencies052014
-{
- public class Example2a
- {
- public const string SettingsFile = @"c:\test2a.xml";
- public const int TheAnswerToLifeUniverseAndEverything = 42;
-
- private readonly XDocument xDoc;
-
- public Example2a()
- {
- // We need a file with a root element to read or we'll get an error
- File.WriteAllText(SettingsFile,
- @"");
-
- xDoc = XDocument.Load(SettingsFile);
- }
-
- public void WriteSettingsFile()
- {
- if (!xDoc.Descendants("someNodeName").Any())
- return;
-
- foreach (var desc in xDoc.Descendants("someNodeName"))
- desc.SetValue(TheAnswerToLifeUniverseAndEverything);
-
- xDoc.Save(SettingsFile);
- }
- }
-
- [TestFixture]
- class Example2aTester
- {
- [Test]
- public void WriteSettingsFile_SavesFile()
- {
- var vm = new Example2a();
-
- vm.WriteSettingsFile();
-
- var xDoc = XDocument.Load(Example2a.SettingsFile);
-
- var insertedValue = xDoc.Descendants().Single(x => x.Name == "someNodeName").Value;
- Assert.AreEqual(Example2a.TheAnswerToLifeUniverseAndEverything, int.Parse(insertedValue));
- }
- }
-}
\ No newline at end of file
diff --git a/MockingDependencies052014/MockingDependencies052014/Example2a_2.cs b/MockingDependencies052014/MockingDependencies052014/Example2a_2.cs
deleted file mode 100644
index f4bb436..0000000
--- a/MockingDependencies052014/MockingDependencies052014/Example2a_2.cs
+++ /dev/null
@@ -1,118 +0,0 @@
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Xml.Linq;
-using Moq;
-using NUnit.Framework;
-
-namespace MockingDependencies052014
-{
- public class Example2a_2
- {
- public const string SettingsFile = @"c:\test2a_2.xml";
- public const int TheAnswerToLifeUniverseAndEverything = 42;
-
- private readonly IXDocument xDoc;
-
- public Example2a_2()
- {
- File.WriteAllText(SettingsFile,
- @"");
-
- xDoc = XDocumentExt.Load(SettingsFile);
- }
-
- public Example2a_2(IXDocument iXDocument, string initialXmlString = null)
- {
- File.WriteAllText(SettingsFile,
- initialXmlString ?? @"");
-
- xDoc = iXDocument.LoadEx(SettingsFile);
- }
-
- public void WriteSettingsFile()
- {
- if (!xDoc.Descendants("someNodeName").Any())
- return;
-
- foreach (var desc in xDoc.Descendants("someNodeName"))
- desc.SetValue(TheAnswerToLifeUniverseAndEverything);
-
- xDoc.Save(SettingsFile);
- }
- }
-
- public interface IXDocument
- {
- IXDocument LoadEx(string fileName);
-
- void Save(string fileName);
-
- IEnumerable Descendants(XName name);
- }
-
- public class XDocumentExt : XDocument, IXDocument
- {
- public IXDocument LoadEx(string fileName)
- {
- return Load(fileName);
- }
-
- public new static IXDocument Load(string fileName)
- {
- return (IXDocument)XDocument.Load(fileName);
- }
-
- public new void Save(string fileName)
- {
- base.Save(fileName);
- }
-
- public new IEnumerable Descendants(XName name)
- {
- return base.Descendants(name);
- }
- }
-
- [TestFixture]
- class Example2a_2Tester
- {
- Mock xDoc;
-
- [SetUp]
- public void Setup()
- {
- xDoc = new Mock();
- }
-
- [Test]
- public void WriteSettingsFile_DoesNotSaveFile_WhenNoNodesAvailable()
- {
- xDoc.Setup(x => x.LoadEx(Example2a_2.SettingsFile))
- .Returns(xDoc.Object);
- xDoc.Setup(x => x.Descendants("someNodeName"))
- .Returns(new List());
-
- var vm = new Example2a_2(xDoc.Object);
-
- vm.WriteSettingsFile();
-
- xDoc.Verify(x => x.Save(Example2a_2.SettingsFile), Times.Never);
- }
-
- [Test]
- public void WriteSettingsFile_SavesFile_WhenNodesAvailable()
- {
- xDoc.Setup(x => x.LoadEx(Example2a_2.SettingsFile))
- .Returns(xDoc.Object);
- xDoc.Setup(x => x.Descendants("someNodeName"))
- .Returns(new List {new XElement("someNodeName")});
-
- var vm = new Example2a_2(xDoc.Object);
-
- vm.WriteSettingsFile();
-
- xDoc.Verify(x => x.Save(Example2a_2.SettingsFile), Times.Once());
- }
- }
-}
\ No newline at end of file
diff --git a/MockingDependencies052014/MockingDependencies052014/Example2b.cs b/MockingDependencies052014/MockingDependencies052014/Example2b.cs
deleted file mode 100644
index 0c2bfec..0000000
--- a/MockingDependencies052014/MockingDependencies052014/Example2b.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-using System.Net.Mail;
-using Moq;
-using NUnit.Framework;
-
-namespace MockingDependencies052014
-{
- public class Example2b
- {
- private readonly ISmtpClient client;
-
- public Example2b()
- {
- client = new SmtpClientEx("smtp.somehost.com", 465);
- }
-
- public Example2b(ISmtpClient client)
- {
- this.client = client;
- }
-
- public void ProcessShipment()
- {
- // Do some work related to processing shipments
-
- var message = new MailMessage("shipping@acme.com", "wecoyote@rr.com", "Your order has shipped!", "Your order has shipped!");
-
- client.Send(message);
- }
-
- public interface ISmtpClient
- {
- void Send(MailMessage message);
- }
-
- public class SmtpClientEx : SmtpClient, ISmtpClient
- {
- public SmtpClientEx(string host, int port)
- : base(host, port) { }
- }
-
- [TestFixture]
- public class Example2bTester
- {
- private Mock clientMock;
-
- [SetUp]
- public void Setup()
- {
- clientMock = new Mock();
- }
-
- [Test]
- public void ProcessShipment_SendsMessage()
- {
- var vm = new Example2b(clientMock.Object);
-
- vm.ProcessShipment();
-
- clientMock.Verify(x => x.Send(It.IsAny()), Times.Once());
- }
- }
- }
-}
diff --git a/MockingDependencies052014/MockingDependencies052014/Example3.cs b/MockingDependencies052014/MockingDependencies052014/Example3.cs
deleted file mode 100644
index a453ff6..0000000
--- a/MockingDependencies052014/MockingDependencies052014/Example3.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using NUnit.Framework;
-
-namespace MockingDependencies052014
-{
- public class Example3
- {
- public const string LogFile = @"c:\test3.txt";
- public const string LogFileTimeStamp = "Timestamp: ";
-
- public Example3()
- {
- File.WriteAllText(LogFile, LogFileTimeStamp);
- }
-
- public IEnumerable GetLogFileEntries(string logPath)
- {
- return File.ReadAllLines(logPath)
- .Where(x => x.StartsWith(LogFileTimeStamp));
- }
- }
-
- [TestFixture]
- public class Example3Tester
- {
- [Test]
- public void GetLogFileEntries_ReturnsLogEntries()
- {
- var vm = new Example3();
-
- var results = vm.GetLogFileEntries(Example3.LogFile);
-
- Assert.AreEqual(results.Count(), File.ReadAllLines(Example3.LogFile)
- .Count(x => x.StartsWith(Example3.LogFileTimeStamp)));
- }
- }
-}
diff --git a/MockingDependencies052014/MockingDependencies052014/Example3b.cs b/MockingDependencies052014/MockingDependencies052014/Example3b.cs
deleted file mode 100644
index b5b4574..0000000
--- a/MockingDependencies052014/MockingDependencies052014/Example3b.cs
+++ /dev/null
@@ -1,88 +0,0 @@
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using Moq;
-using NUnit.Framework;
-
-namespace MockingDependencies052014
-{
- public class Example3b
- {
- public const string LogFile = @"c:\test3b.txt";
- public const string LogFileTimeStamp = "Timestamp: ";
-
- private readonly IFile file;
-
- public Example3b()
- {
- file = new FileEx();
-
- file.WriteAllText(LogFile, LogFileTimeStamp);
- }
-
- public Example3b(IFile file)
- {
- this.file = file;
-
- file.WriteAllText(LogFile, LogFileTimeStamp);
- }
-
- public IEnumerable GetLogFileEntries(string logPath)
- {
- return file.ReadAllLines(logPath)
- .Where(x => x.StartsWith(LogFileTimeStamp));
- }
- }
-
- public interface IFile
- {
- IEnumerable ReadAllLines(string path);
-
- void WriteAllText(string path, string contents);
- }
-
- public class FileEx : IFile
- {
- public IEnumerable ReadAllLines(string path)
- {
- return File.ReadAllLines(path);
- }
-
- public void WriteAllText(string path, string contents)
- {
- File.WriteAllText(path, contents);
- }
- }
-
- [TestFixture]
- public class Example3bTester
- {
- private Mock fileMock;
-
- [SetUp]
- public void Setup()
- {
- fileMock = new Mock();
- }
-
- [Test]
- public void GetLogFileEntries_ReturnsLogEntries()
- {
- var fileContents = new List
- {
- "Timestamp: 03:30 - FileNotFoundException occurred",
- "Some informational message, blah.",
- "Timestamp: 13:22 - User MJ123 access denied."
- };
-
- fileMock.Setup(x => x.ReadAllLines(Example3b.LogFile))
- .Returns(fileContents);
-
- var vm = new Example3b(fileMock.Object);
-
- var results = vm.GetLogFileEntries(Example3b.LogFile);
-
- Assert.AreEqual(results.Count(), 2);
- }
- }
-}
diff --git a/MockingDependencies052014/MockingDependencies052014/packages.config b/MockingDependencies052014/MockingDependencies052014/packages.config
deleted file mode 100644
index c8aafd4..0000000
--- a/MockingDependencies052014/MockingDependencies052014/packages.config
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/MockingDependencies052014/README.md b/MockingDependencies052014/README.md
deleted file mode 100644
index 67ac575..0000000
--- a/MockingDependencies052014/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-Mocking Dependencies
-
-http://grantwinney.com/mocking-dependencies-buahaha-silly-dependency-um-not-that-kind-of-mocking/
\ No newline at end of file
diff --git a/MockingDependencies052014/packages/repositories.config b/MockingDependencies052014/packages/repositories.config
deleted file mode 100644
index bd40abb..0000000
--- a/MockingDependencies052014/packages/repositories.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/ObsoleteAttributeOnInterfaces022015/ObsoleteAttributeOnInterfaces/ObsoleteAttributeOnInterfaces.csproj b/ObsoleteAttributeOnInterfaces022015/ObsoleteAttributeOnInterfaces/ObsoleteAttributeOnInterfaces.csproj
deleted file mode 100644
index 0019e85..0000000
--- a/ObsoleteAttributeOnInterfaces022015/ObsoleteAttributeOnInterfaces/ObsoleteAttributeOnInterfaces.csproj
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {484E2C46-3024-4E03-8390-F80B54707048}
- Exe
- Properties
- ObsoleteAttributeOnInterfaces
- ObsoleteAttributeOnInterfaces
- v4.5
- 512
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ObsoleteAttributeOnInterfaces022015/ObsoleteAttributeOnInterfaces/Program.cs b/ObsoleteAttributeOnInterfaces022015/ObsoleteAttributeOnInterfaces/Program.cs
deleted file mode 100644
index 4c40469..0000000
--- a/ObsoleteAttributeOnInterfaces022015/ObsoleteAttributeOnInterfaces/Program.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using System;
-
-namespace ObsoleteAttributeOnInterfaces
-{
- public static class Program
- {
- public static void Main()
- {
- ISampleClass sc1 = new SampleClass();
- sc1.SomeOldMethod();
-
- ISampleClass sc2 = new SampleClass2();
- sc2.SomeOldMethod();
-
- ISampleClass sc3 = new SampleClass3();
- sc3.SomeOldMethod();
-
-
-
- SampleClass sc = new SampleClass();
- sc.SomeOldMethod();
-
- }
- }
-
- public interface ISampleClass
- {
- void SomeOldMethod();
- }
-
- public class SampleClass : ISampleClass
- {
- [Obsolete("This is the old way. No one uses it anymore. Shame on you!!", true)]
- public void SomeOldMethod()
- {
- // This is old. I should probably remove and refactor, but I'm too scared.
- }
- }
-
- public class SampleClass2 : ISampleClass
- {
- public void SomeOldMethod()
- {
- // Old, but not obsolete.
- }
- }
-
- public class SampleClass3 : ISampleClass
- {
- public void SomeOldMethod()
- {
- // Why mess with perfection?
- }
- }
-}
diff --git a/PassingDataBetweenForms/1_PushingDataBackToParentForm/Form2.cs b/PassingDataBetweenForms/1_PushingDataBackToParentForm/Form2.cs
deleted file mode 100644
index 07a7fbb..0000000
--- a/PassingDataBetweenForms/1_PushingDataBackToParentForm/Form2.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using System;
-using System.Windows.Forms;
-
-namespace PushingDataBackToParentForm
-{
- public partial class Form2 : Form
- {
- private Form1 form1;
-
- public Form2(Form1 form1)
- {
- InitializeComponent();
- this.form1 = form1;
- }
-
- private void btnSaveInput_Click(object sender, EventArgs e)
- {
- form1.SetName(txtName.Text);
-
- int age;
- if (int.TryParse(txtAge.Text, out age))
- form1.Age = age;
-
- this.Close();
- }
- }
-}
diff --git a/PassingDataBetweenForms/2_PushingDataBackToOneOfMultipleForms/DetailForm.cs b/PassingDataBetweenForms/2_PushingDataBackToOneOfMultipleForms/DetailForm.cs
deleted file mode 100644
index 5d5259d..0000000
--- a/PassingDataBetweenForms/2_PushingDataBackToOneOfMultipleForms/DetailForm.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-using System;
-using System.Windows.Forms;
-
-namespace PushingDataBackToOneOfMultipleForms
-{
- public partial class DetailForm : Form
- {
- private StudentForm studentForm;
- private EmployeeForm employeeForm;
- private SomeClass someClass;
-
- public DetailForm(StudentForm form)
- {
- InitializeComponent();
- studentForm = form;
- }
-
- public DetailForm(EmployeeForm form)
- {
- InitializeComponent();
- employeeForm = form;
- }
-
- public DetailForm(SomeClass someClass)
- {
- InitializeComponent();
- this.someClass = someClass;
- }
-
- private void btnSaveInput_Click(object sender, EventArgs e)
- {
- if (studentForm != null)
- studentForm.SetStudentName(txtName.Text);
- else if (employeeForm != null)
- employeeForm.EmployeeName = txtName.Text;
- else if (someClass != null)
- someClass.Name = txtName.Text;
-
- this.Close();
- }
- }
-}
diff --git a/PassingDataBetweenForms/2_PushingDataBackToOneOfMultipleForms/SomeClass.cs b/PassingDataBetweenForms/2_PushingDataBackToOneOfMultipleForms/SomeClass.cs
deleted file mode 100644
index 1d00854..0000000
--- a/PassingDataBetweenForms/2_PushingDataBackToOneOfMultipleForms/SomeClass.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-namespace PushingDataBackToOneOfMultipleForms
-{
- public class SomeClass
- {
- public void SomeMethod()
- {
- using (var detailForm = new DetailForm(this))
- {
- detailForm.ShowDialog();
- }
- }
-
- public string Name { get; set; }
- }
-}
diff --git a/PassingDataBetweenForms/3_PullingDataFromChildForm/3_PullingDataFromChildForm.csproj.user b/PassingDataBetweenForms/3_PullingDataFromChildForm/3_PullingDataFromChildForm.csproj.user
deleted file mode 100644
index a4a6cdf..0000000
--- a/PassingDataBetweenForms/3_PullingDataFromChildForm/3_PullingDataFromChildForm.csproj.user
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- ProjectFiles
-
-
\ No newline at end of file
diff --git a/PassingDataBetweenForms/3_PullingDataFromChildForm/DetailForm.cs b/PassingDataBetweenForms/3_PullingDataFromChildForm/DetailForm.cs
deleted file mode 100644
index 3d12347..0000000
--- a/PassingDataBetweenForms/3_PullingDataFromChildForm/DetailForm.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System;
-using System.Windows.Forms;
-
-namespace PullingDataFromChildForm
-{
- public partial class DetailForm : Form
- {
- public DetailForm()
- {
- InitializeComponent();
- }
-
- public string Name
- {
- get { return txtName.Text; }
- }
-
- public int Age
- {
- get
- {
- int result;
- Int32.TryParse(txtAge.Text, out result);
- return result;
- }
- }
-
- // Even this could be removed, if you set this button as the Accept
- // button on the Form, or set a DialogResult value on the button
- private void btnSaveInput_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- }
-}
diff --git a/PassingDataBetweenForms/3_PullingDataFromChildForm/EmployeeForm.cs b/PassingDataBetweenForms/3_PullingDataFromChildForm/EmployeeForm.cs
deleted file mode 100644
index b0a1136..0000000
--- a/PassingDataBetweenForms/3_PullingDataFromChildForm/EmployeeForm.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using System;
-using System.Windows.Forms;
-
-namespace PullingDataFromChildForm
-{
- public partial class EmployeeForm : Form
- {
- public EmployeeForm()
- {
- InitializeComponent();
- }
-
- private void btnGetUserInput_Click(object sender, EventArgs e)
- {
- using (var detailForm = new DetailForm())
- {
- detailForm.ShowDialog();
-
- EmployeeName = detailForm.Name;
- }
- }
-
- public string EmployeeName
- {
- set { lblName.Text = value; }
- }
- }
-}
diff --git a/PassingDataBetweenForms/3_PullingDataFromChildForm/SomeClass.cs b/PassingDataBetweenForms/3_PullingDataFromChildForm/SomeClass.cs
deleted file mode 100644
index c24569d..0000000
--- a/PassingDataBetweenForms/3_PullingDataFromChildForm/SomeClass.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-namespace PullingDataFromChildForm
-{
- public class SomeClass
- {
- public void SomeMethod()
- {
- using (var detailForm = new DetailForm())
- {
- detailForm.ShowDialog();
-
- Name = detailForm.Name;
- Age = detailForm.Age;
- }
- }
-
- public string Name { get; set; }
-
- public int Age { get; set; }
- }
-}
diff --git a/PassingDataBetweenForms/3_PullingDataFromChildForm/StudentForm.cs b/PassingDataBetweenForms/3_PullingDataFromChildForm/StudentForm.cs
deleted file mode 100644
index bd35054..0000000
--- a/PassingDataBetweenForms/3_PullingDataFromChildForm/StudentForm.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using System;
-using System.Windows.Forms;
-
-namespace PullingDataFromChildForm
-{
- public partial class StudentForm : Form
- {
- public StudentForm()
- {
- InitializeComponent();
- }
-
- private void btnGetUserInput_Click(object sender, EventArgs e)
- {
- using (var detailForm = new DetailForm())
- {
- detailForm.ShowDialog();
-
- SetStudentName(detailForm.Name);
- }
- }
-
- public void SetStudentName(string name)
- {
- lblStudentName.Text = name;
- }
- }
-}
diff --git a/PassingDataBetweenForms/README.md b/PassingDataBetweenForms/README.md
deleted file mode 100644
index 871025c..0000000
--- a/PassingDataBetweenForms/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-Passing data between two Forms in WinForms
-
-http://grantwinney.com/passing-data-between-two-forms-in-winforms/
\ No newline at end of file
diff --git a/README.md b/README.md
index 051bb45..029be5e 100644
--- a/README.md
+++ b/README.md
@@ -1,40 +1,56 @@
-# My Blog Code Samples
-
-This repository contains some of the (usually lengthier) code samples from my blog posts. I also tend to host shorter snippets on [Gist](https://gist.github.com/grantwinney) and [JsFiddle](https://jsfiddle.net/user/grantwinney/fiddles/), and embed them into posts.
-
-The following list of blog posts includes a link to the part of the repo with the relevant code for that post.
-
-* [An explanation of implicit and explicit conversion in C#](https://grantwinney.com/an-explanation-of-implicit-and-explicit-conversion-in-c/)
-[💾](https://github.com/grantwinney/BlogCodeSamples/tree/master/ImplicitExplicitOperators022015)
-* [An extension method for passing a column name to SqlDataReader.GetFieldValue in C#](https://grantwinney.com/an-extension-method-for-passing-a-column-name-to-sqldatareader-getfieldvalue-in-c/)
-[💾](https://github.com/grantwinney/BlogCodeSamples/tree/master/SqlDataReaderGetFieldValueByName)
-* [Async and PLINQ](https://grantwinney.com/async-and-plinq/)
-[💾](https://github.com/grantwinney/BlogCodeSamples/tree/master/AsyncAndPlinq112013)
-* [Cool markdown tricks for GitHub](https://grantwinney.com/cool-markdown-tricks-for-github/)
-[💾](https://github.com/grantwinney/BlogCodeSamples/tree/master/GitHubTipsTricks)
-* [Discover where the ISS is, where it will be, and who's on it with the ISS Notify API](https://grantwinney.com/day-11-iss-notify-api/)
-[💾](https://github.com/grantwinney/BlogCodeSamples/tree/master/IssNotifyApiWrapper)
-* [How do I convert my code from C# to VB.NET (or from VB.NET to C#)?](https://grantwinney.com/how-do-i-convert-my-code-from-c-to-vb-net-or-vice-versa/)
-[💾](https://github.com/grantwinney/BlogCodeSamples/tree/master/CSharpAndVbNetTogether)
-* [How to use an application config file with a .NET Standard app and NUnit 3)](https://grantwinney.com/how-to-use-an-app-config-file-with-a-net-standard-app-and-nunit-3/)
-[💾](https://github.com/grantwinney/BlogCodeSamples/tree/master/ReadingConfigFile)
-* [Keep your EUnit teardown logic as simple as possible!](https://grantwinney.com/keep-your-eunit-teardown-logic-as-simple/)
-[💾](https://github.com/grantwinney/BlogCodeSamples/tree/master/MeckTeardownTest)
-* [Mocking Dependencies (silly dependency! um... not that kind of mocking)](https://grantwinney.com/mocking-dependencies-buahaha-silly-dependency-um-not-that-kind-of-mocking/)
-[💾](https://github.com/grantwinney/BlogCodeSamples/tree/master/MockingDependencies052014)
-* [Passing data between two Forms in WinForms](https://grantwinney.com/passing-data-between-two-forms-in-winforms/)
-[💾](https://github.com/grantwinney/BlogCodeSamples/tree/master/PassingDataBetweenForms)
-* [Practical Examples of C# Attributes](https://grantwinney.com/5-examples-of-attributes-in-c-and-why-youll-want-to-make-your-own/)
-[💾](https://github.com/grantwinney/BlogCodeSamples/tree/master/AttributesExamples)
-* [Querying Amazon's product details with the Amazon Product Advertising API](https://grantwinney.com/querying-amazon-product-details-with-the-amazon-product-advertising-api/)
-[💾](https://github.com/grantwinney/BlogCodeSamples/tree/master/AmazonProductAdvertisingApiBlogPost)
-* [Running Windows XP in VirtualBox](https://grantwinney.com/running-windows-xp-in-virtualbox/)
-[💾](https://github.com/grantwinney/BlogCodeSamples/tree/master/WindowsXPVisualStudio)
-* [The effect of the Obsolete attribute on a class is ignored when there's an interface involved](https://grantwinney.com/the-effect-of-the-obsolete-attribute-on-a-class-is-ignored-when-theres-an-interface-involved/)
-[💾](https://github.com/grantwinney/BlogCodeSamples/tree/master/ObsoleteAttributeOnInterfaces022015)
-* [Using a TextBox and CollectionViewSource to Filter a ListView in WPF](https://grantwinney.com/using-a-textbox-and-collectionviewsource-to-filter-a-listview-in-wpf/)
-[💾](https://github.com/grantwinney/BlogCodeSamples/tree/master/CollectionViewSourceSample)
-* [Using Annotations to Assist ReSharper in Analyzing Your Code](https://grantwinney.com/using-annotations-to-help-resharper-analyze-your-code/)
-[💾](https://github.com/grantwinney/BlogCodeSamples/tree/master/UsingAnnotationsToAssistReSharper)
-* [When an assert isn't assertive enough (or using the wrong macro in an EUnit test)](https://grantwinney.com/when-an-assert-isnt-assertive-enough/)
-[💾](https://github.com/grantwinney/BlogCodeSamples/tree/master/EUnitAssertProblem)
+# Code Samples - Grant's Blog
+
+This repository contains some code samples from [my blog posts](https://grantwinney.com). I sometimes upload code to separate repos (like for [C# / .NET](https://github.com/grantwinney/CSharpDotNetExamples) and [WinForms](https://github.com/grantwinney/Surviving-WinForms)), or to [Gist](https://gist.github.com/grantwinney) or [JsFiddle](https://jsfiddle.net/user/grantwinney/fiddles/) for shorter snippets.
+
+The list below has a link to each blog post, followed by the relevant code for that post.
+
+# APIs
+
+* Discover where the ISS is, where it will be, and who's on it with the ISS Notify API ([blog](https://grantwinney.com/what-is-iss-notify-api/), [code](https://github.com/grantwinney/BlogCodeSamples/tree/master/APIs/IssNotifyApiWrapper))
+
+# Dev Tools
+
+* Can I compare files using VS Code? ([blog](https://grantwinney.com/how-to-compare-files-using-vs-code/), [code](https://github.com/grantwinney/BlogCodeSamples/tree/master/DevTools/CompareInVSCode))
+* Cool markdown tricks for GitHub ([blog](https://grantwinney.com/cool-markdown-tricks-for-github/), [code](https://github.com/grantwinney/BlogCodeSamples/tree/master/DevTools/GitHubTipsTricks))
+* Why doesn't VS 2022 show my WinForms UI at design time? ([blog](http://grantwinney.com/why-doesnt-vs2022-show-my-winforms-ui/), [code](https://github.com/grantwinney/BlogCodeSamples/tree/master/DevTools/WinFormsDesignerInVS2022))
+* What is a Git alias? ([blog](https://grantwinney.com/what-is-a-git-alias-and-how-do-i-use-it/), [code](https://github.com/grantwinney/BlogCodeSamples/tree/master/DevTools/GitAliasTemplate))
+
+# Frameworks
+
+## ASP.NET Core
+
+* Similar endpoints, swagger pages, and a DevOps fail ([blog](https://grantwinney.com/similar-endpoints-swagger-pages-and-a-devops-fail), [code](https://github.com/grantwinney/BlogCodeSamples/tree/master/Frameworks/AspNetCore/MinimalAPIWithSimilarEndpoints))
+
+## WinForms
+
+* Passing Data Between Forms in WinForms ([blog](https://grantwinney.com/passing-data-between-two-forms-in-winforms/), [code](https://github.com/grantwinney/BlogCodeSamples/tree/master/Frameworks/WinForms/PassingDataBetweenForms))
+
+## WPF
+
+* Filtering a ListView in WPF Using a TextBox and CollectionViewSource ([blog](https://grantwinney.com/wpf-filtering-listview-using-textbox-and-collectionviewsource/), [code](https://github.com/grantwinney/BlogCodeSamples/tree/master/Frameworks/WPF/CollectionViewSourceSample))
+
+# Languages
+
+## C#
+
+* An Extension Method to Pass a Column Name to SqlDataReader.GetFieldValue ([blog](https://grantwinney.com/csharp-extension-method-to-pass-column-name-to-getfieldvalue/), [code](https://github.com/grantwinney/BlogCodeSamples/tree/master/Languages/CSharp/SqlDataReaderGetFieldValueByName))
+* How do I convert my code from C# to VB.NET (or from VB.NET to C#)? ([blog](https://grantwinney.com/how-do-i-convert-my-code-from-c-to-vb-net-or-vice-versa/), [code](https://github.com/grantwinney/BlogCodeSamples/tree/master/CSharpAndVbNetTogether))
+* How to generate and verify TOTP 2FA codes (in C#) ([blog](https://grantwinney.com/a-sample-csharp-app-for-generating-and-verifying-totp-2fa-codes/), [code](https://github.com/grantwinney/BlogCodeSamples/tree/master/Languages/CSharp/2FAQrCode))
+* Obsolete Attribute on a Class is Ignored When an Interface is Involved ([blog](https://grantwinney.com/csharp-obsolete-attribute-on-class-ignored-when-interface-is-involved/), [code](https://github.com/grantwinney/BlogCodeSamples/tree/master/Languages/CSharp/ObsoleteAttributeOnInterfaces))
+* Using an application config file with a .NET Standard app and NUnit 3 ([blog](https://grantwinney.com/how-to-use-an-app-config-file-with-a-net-standard-app-and-nunit-3/), [code](https://github.com/grantwinney/BlogCodeSamples/tree/master/Languages/CSharp/ReadingConfigFile))
+* What is mocking a dependency? ([blog](https://grantwinney.com/what-is-mocking-a-dependency/), [code](https://github.com/grantwinney/BlogCodeSamples/tree/master/Languages/CSharp/MockingDependencies))
+* What is the NUnit constraint model and should you use it? ([blog](https://grantwinney.com/5-reasons-to-use-nunits-constraint-model), [code](https://github.com/grantwinney/BlogCodeSamples/tree/master/Languages/CSharp/NUnitConstraintModel))
+
+## Erlang
+
+* Calculate Easter and other holidays in Erlang ([blog](https://grantwinney.com/how-to-calculate-easter-and-other-holidays-in-erlang/), [code](https://github.com/grantwinney/BlogCodeSamples/tree/master/Languages/Erlang/CalculateHolidays))
+* Keep your EUnit teardown logic as simple as possible! ([blog](https://grantwinney.com/keep-your-eunit-teardown-logic-as-simple/), [code](https://github.com/grantwinney/BlogCodeSamples/tree/master/Languages/Erlang/MeckTeardownTest))
+* Modify a config file in Erlang ([blog](https://grantwinney.com/how-to-modify-a-config-file-in-erlang/), [code](https://github.com/grantwinney/BlogCodeSamples/tree/master/Languages/Erlang/ConfigFileModifier))
+
+# Misc
+
+* Creating Your First Chrome Extension ([blog](https://grantwinney.com/making-your-first-chrome-extension/), [code](https://github.com/grantwinney/BlogCodeSamples/tree/master/Misc/ChromeExtensionSamples))
+* Running Windows XP in VirtualBox ([blog](https://grantwinney.com/running-windows-xp-in-virtualbox/), [code](https://github.com/grantwinney/BlogCodeSamples/tree/master/Misc/WindowsXPVisualStudio))
+* Tweet random posts from a Ghost blog using AWS Lambda ([blog](https://grantwinney.com/using-aws-lambda-and-tweetinvi-to-tweet-a-random-ghost-blog-post/), [code](https://github.com/grantwinney/BlogCodeSamples/tree/master/Misc/TweetRandomPostFromAGhostBlog))
+* Tweet random blog posts from an RSS feed using AWS Lambda ([blog](https://grantwinney.com/using-aws-lambda-to-tweet-random-posts-from-an-rss-feed/), [code](https://github.com/grantwinney/BlogCodeSamples/tree/master/Misc/TweetRandomFeedItem))
+* Where should I store application data in Windows? ([blog](https://grantwinney.com/where-should-i-store-app-data-in-windows/), [code](https://github.com/grantwinney/BlogCodeSamples/tree/master/Misc/GetKnownFolders))
diff --git a/SqlDataReaderGetFieldValueByName/README.md b/SqlDataReaderGetFieldValueByName/README.md
deleted file mode 100644
index 539604f..0000000
--- a/SqlDataReaderGetFieldValueByName/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-An extension method for passing a column name to SqlDataReader.GetFieldValue in C#
-
-http://grantwinney.com/an-extension-method-for-passing-a-column-name-to-sqldatareader-getfieldvalue-in-c/
\ No newline at end of file
diff --git a/SqlDataReaderGetFieldValueByName/SqlDataReaderGetFieldValueByName/SqlDataReaderGetFieldValueByName.csproj b/SqlDataReaderGetFieldValueByName/SqlDataReaderGetFieldValueByName/SqlDataReaderGetFieldValueByName.csproj
deleted file mode 100644
index 72a2345..0000000
--- a/SqlDataReaderGetFieldValueByName/SqlDataReaderGetFieldValueByName/SqlDataReaderGetFieldValueByName.csproj
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-
- Debug
- AnyCPU
- {09DFC1D5-1CA7-411B-AC3C-483337207244}
- Library
- Properties
- SqlDataReaderGetFieldValueByName
- SqlDataReaderGetFieldValueByName
- v4.5
- 512
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/SqlDataReaderGetFieldValueByName/SqlDataReaderGetFieldValueByName/StudentDataAccess.cs b/SqlDataReaderGetFieldValueByName/SqlDataReaderGetFieldValueByName/StudentDataAccess.cs
deleted file mode 100644
index fd18649..0000000
--- a/SqlDataReaderGetFieldValueByName/SqlDataReaderGetFieldValueByName/StudentDataAccess.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using System.Data.SqlClient;
-
-namespace SqlDataReaderGetFieldValueByName
-{
- public class StudentDataAccess
- {
- public void GetStudents()
- {
- using (var conn = new SqlConnection("yourConnectionString"))
- {
- using (var cmd = new SqlCommand("SELECT name, age FROM students", conn))
- {
- conn.Open();
-
- using (var dr = cmd.ExecuteReader())
- {
- var name = dr.GetFieldValue("name");
-
- var age = dr.GetFieldValue("age");
- }
- }
- }
- }
- }
-
- public static class SqlReaderExtensions
- {
- ///
- /// Gets the value of the specified column as a type, given the column name.
- ///
- /// The expected type of the column being retrieved.
- /// The reader from which to retrieve the column.
- /// The name of the column to be retrieved.
- /// The returned type object.
- public static T GetFieldValue(this SqlDataReader reader, string columnName)
- {
- return reader.GetFieldValue(reader.GetOrdinal(columnName));
- }
- }
-}
diff --git a/UsingAnnotationsToAssistReSharper/README.md b/UsingAnnotationsToAssistReSharper/README.md
deleted file mode 100644
index 23569a1..0000000
--- a/UsingAnnotationsToAssistReSharper/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-ReSharper / Annotations sample
-
-http://grantwinney.com/using-annotations-to-help-resharper-analyze-your-code/
\ No newline at end of file
diff --git a/UsingAnnotationsToAssistReSharper/UsingAnnotationsToAssistReSharper.sln b/UsingAnnotationsToAssistReSharper/UsingAnnotationsToAssistReSharper.sln
deleted file mode 100644
index 843adca..0000000
--- a/UsingAnnotationsToAssistReSharper/UsingAnnotationsToAssistReSharper.sln
+++ /dev/null
@@ -1,22 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0.31101.0
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UsingAnnotationsToAssistReSharper", "UsingAnnotationsToAssistReSharper\UsingAnnotationsToAssistReSharper.csproj", "{112D4EA9-AC3D-40CB-B9DF-857C9C48E6D9}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {112D4EA9-AC3D-40CB-B9DF-857C9C48E6D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {112D4EA9-AC3D-40CB-B9DF-857C9C48E6D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {112D4EA9-AC3D-40CB-B9DF-857C9C48E6D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {112D4EA9-AC3D-40CB-B9DF-857C9C48E6D9}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/UsingAnnotationsToAssistReSharper/UsingAnnotationsToAssistReSharper/Annotations.cs b/UsingAnnotationsToAssistReSharper/UsingAnnotationsToAssistReSharper/Annotations.cs
deleted file mode 100644
index e140973..0000000
--- a/UsingAnnotationsToAssistReSharper/UsingAnnotationsToAssistReSharper/Annotations.cs
+++ /dev/null
@@ -1,624 +0,0 @@
-using System;
-
-#pragma warning disable 1591
-// ReSharper disable UnusedMember.Global
-// ReSharper disable UnusedParameter.Local
-// ReSharper disable MemberCanBePrivate.Global
-// ReSharper disable UnusedAutoPropertyAccessor.Global
-// ReSharper disable IntroduceOptionalParameters.Global
-// ReSharper disable MemberCanBeProtected.Global
-// ReSharper disable InconsistentNaming
-
-namespace JetBrains.Annotations
-{
- ///
- /// Indicates that the value of the marked element could be null sometimes,
- /// so the check for null is necessary before its usage
- ///
- ///
- /// [CanBeNull] public object Test() { return null; }
- /// public void UseTest() {
- /// var p = Test();
- /// var s = p.ToString(); // Warning: Possible 'System.NullReferenceException'
- /// }
- ///
- [AttributeUsage(
- AttributeTargets.Method | AttributeTargets.Parameter |
- AttributeTargets.Property | AttributeTargets.Delegate |
- AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
- public sealed class CanBeNullAttribute : Attribute { }
-
- ///
- /// Indicates that the value of the marked element could never be null
- ///
- ///
- /// [NotNull] public object Foo() {
- /// return null; // Warning: Possible 'null' assignment
- /// }
- ///
- [AttributeUsage(
- AttributeTargets.Method | AttributeTargets.Parameter |
- AttributeTargets.Property | AttributeTargets.Delegate |
- AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
- public sealed class NotNullAttribute : Attribute { }
-
- ///
- /// Indicates that the marked method builds string by format pattern and (optional) arguments.
- /// Parameter, which contains format string, should be given in constructor. The format string
- /// should be in -like form
- ///
- ///
- /// [StringFormatMethod("message")]
- /// public void ShowError(string message, params object[] args) { /* do something */ }
- /// public void Foo() {
- /// ShowError("Failed: {0}"); // Warning: Non-existing argument in format string
- /// }
- ///
- [AttributeUsage(
- AttributeTargets.Constructor | AttributeTargets.Method,
- AllowMultiple = false, Inherited = true)]
- public sealed class StringFormatMethodAttribute : Attribute
- {
- ///
- /// Specifies which parameter of an annotated method should be treated as format-string
- ///
- public StringFormatMethodAttribute(string formatParameterName)
- {
- FormatParameterName = formatParameterName;
- }
-
- public string FormatParameterName { get; private set; }
- }
-
- ///
- /// Indicates that the function argument should be string literal and match one
- /// of the parameters of the caller function. For example, ReSharper annotates
- /// the parameter of
- ///
- ///
- /// public void Foo(string param) {
- /// if (param == null)
- /// throw new ArgumentNullException("par"); // Warning: Cannot resolve symbol
- /// }
- ///
- [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)]
- public sealed class InvokerParameterNameAttribute : Attribute { }
-
- ///
- /// Indicates that the method is contained in a type that implements
- /// interface
- /// and this method is used to notify that some property value changed
- ///
- ///
- /// The method should be non-static and conform to one of the supported signatures:
- ///
- /// NotifyChanged(string)
- /// NotifyChanged(params string[])
- /// NotifyChanged{T}(Expression{Func{T}})
- /// NotifyChanged{T,U}(Expression{Func{T,U}})
- /// SetProperty{T}(ref T, T, string)
- ///
- ///
- ///
- /// public class Foo : INotifyPropertyChanged {
- /// public event PropertyChangedEventHandler PropertyChanged;
- /// [NotifyPropertyChangedInvocator]
- /// protected virtual void NotifyChanged(string propertyName) { ... }
- ///
- /// private string _name;
- /// public string Name {
- /// get { return _name; }
- /// set { _name = value; NotifyChanged("LastName"); /* Warning */ }
- /// }
- /// }
- ///
- /// Examples of generated notifications:
- ///
- /// NotifyChanged("Property")
- /// NotifyChanged(() => Property)
- /// NotifyChanged((VM x) => x.Property)
- /// SetProperty(ref myField, value, "Property")
- ///
- ///
- [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
- public sealed class NotifyPropertyChangedInvocatorAttribute : Attribute
- {
- public NotifyPropertyChangedInvocatorAttribute() { }
- public NotifyPropertyChangedInvocatorAttribute(string parameterName)
- {
- ParameterName = parameterName;
- }
-
- public string ParameterName { get; private set; }
- }
-
- ///
- /// Describes dependency between method input and output
- ///
- ///
- ///