Sep 15

How to publish a open source nuget package

I have a piece of code that enables ELMAH SQlErrorLog to pull the connection string from the app settings. I needed that in order to make use of AppHarbor’s configuration variables.

In this article, I am going to document the process I went through to open source the code, and package it in a nuget package.

Create a new repository on GitHub


Make sure to tick the “Initialize this repository with a README”.

If your project is a .NET project, you can choose the VisualStudio .gitignore configuration.

Once your repository is created grab the url:


And execute “git clone <URL>”.

Move your project files in the new folder:



Prepare project to be published as a nuget package

First I needed to download the nuget.exe command line tool.

Then I run “nuget spec” in the folder where my .csproj file is. This generates a standard .nuspec file.

I included that file to the project and replaced the values:



Generating and publishing the package

I called “nuget pack WiseLabs.AppSettings.csproj” to generate the .nupkg file.

I called “nuget setApiKey API-Key”. (You can find your API key in your nuget.org account).

“nuget push WiseLabs.AppSettings.0.1.nupkg”

That’s it, your code is available as a package and can be installed in a project using “Install-Package WiseLabs.AppSettings”.

Pushing the code to github

At the root for the repository folder:

git add –A

git commit –am “First commit”

git push origin master

Aug 13

ABjection.js: simple javascript library to A/B test with Google Universal Analytics

I needed a simple way to write new A/B tests on a WordPress website and I couldn’t find one that was working specifically for Google Universal Analytics so I wrote one.


Basically, it comes down to this:

A/B testing with Google Universal Analytics

The code will look for any DOM element with the class .ab-call-to-action and will either apply the default variant or the variant1 variant. The variant being applied is saved in a cookie and is set to the custom Google Universal Analytics dimension so that you can segment your traffic by that custom dimension (which I called Experiment in Google Universal Analytics).

Good luck with your testing!