Skip to content

Instantly share code, notes, and snippets.

Rob Moore robdmoore

Block or report user

Report or block robdmoore

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@robdmoore
robdmoore / _readme.md
Last active Mar 31, 2018
Wordpress -> Jekyll converter
View _readme.md

Following https://mdavies.net/2014/11/27/migrating-wpjekyll/#migrate-from-wordpress you can convert your posts across to Jekyll format, but it adds superfluous metadata and also doesn't correctly handle Wordpress shorttags. This program helps with that.

Fair warning: it's deliberately dirty / hacky code. I ran it with the posts in a Git repo and inspected file-by-file tweaking as I went.

@robdmoore
robdmoore / ThreadsafeBddfyTextReporter.cs
Last active Feb 15, 2017
Xunit2 compatible Bddfy output reporter
View ThreadsafeBddfyTextReporter.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using TestStack.BDDfy;
using TestStack.BDDfy.Configuration;
namespace {SomeProject}.Tests.TestHelpers
{
View LICENSE.md

All public gists in this account are Public Domain unless a separate license is included in the Gist.

@robdmoore
robdmoore / setup.sql
Last active Mar 17, 2016
Automated install of SQL Express from commandline
View setup.sql
# If you want to give owner access to the whole server to a particular user account this is how
exec sp_addrolemember 'db_owner', 'NT AUTHORITY\NETWORK SERVICE';
GO
# If you want to idempotently ensure a particular database with name DatabaseName exists this is how
IF NOT db_id('DatabaseName') IS NOT NULL BEGIN
PRINT 'Creating database...'
CREATE DATABASE [DatabaseName]
PRINT 'Created database.'
@robdmoore
robdmoore / gist:d2b0fb0ae8f1ff104194
Last active Aug 29, 2015
Install App Insights into Virtual Machine using PowerShell
View gist:d2b0fb0ae8f1ff104194
function Install-AppInsights($instrumentationKey) {
mkdir c:\tempappinsights -Force
pushd c:\tempappinsights
try {
(New-Object Net.WebClient).DownloadFile('http://appinsightsstatusmonitor.blob.core.windows.net/statusmonitor/ApplicationInsights.ps1.zip',"c:\tempappinsights\ApplicationInsights.ps1.zip")
Expand-ZipFile C:\tempappinsights\ApplicationInsights.ps1.zip c:\tempappinsights
. C:\tempappinsights\ApplicationInsights.ps1
ApplicationInsightsConfig $instrumentationKey
Start-DscConfiguration -Path C:\tempappinsights\ApplicationInsightsConfig -ComputerName localhost
} finally {
View gist:18ecb3e555b1e40ce978

Keybase proof

I hereby claim:

  • I am robdmoore on github.
  • I am robdmoore (https://keybase.io/robdmoore) on keybase.
  • I have a public key whose fingerprint is 7EC9 85C2 A5C2 4121 3EFB 4258 4730 FEAF BA2E 9A78

To claim this, I am signing this object:

@robdmoore
robdmoore / gist:44221cc1028ac038931b
Created Dec 15, 2014
Using GitVersion to publish tags to Git repository on various CI servers
View gist:44221cc1028ac038931b

TeamCity

Command Line > Custom Script

"C:\Program Files (x86)\Git\bin\git.exe" tag "%dep.YOUR_CI_BUILD_CONFIG.GitVersion.SemVer%"
"C:\Program Files (x86)\Git\bin\git.exe" push https://%GitUsername%:%GitPassword%@%GitUrl% "%dep.YOUR_CI_BUILD_CONFIG.GitVersion.SemVer%"

Bamboo

Executable > Git Version

@robdmoore
robdmoore / forms.showhide.js
Last active Aug 29, 2015
Foolproof validation with show/hide
View forms.showhide.js
$(function() {
$("form").each(function() {
$(this).find("[data-val-requiredif]").each(function() {
var $field = $(this);
var comparisonValue = $field.data("val-requiredif-dependentvalue");
var operator = $field.data("val-requiredif-operator");
var passonnull = $field.data("val-requiredif-passonnull");
var dependentPropertyName = $field.data("val-requiredif-dependentproperty");
var dependentProperties = $("[name=" + dependentPropertyName + "]");
@robdmoore
robdmoore / gist:efd01bd380c3c90ef3c3
Created Aug 31, 2014
XDT Transformation to add custom error page URLs to an ASP.NET application.
View gist:efd01bd380c3c90ef3c3
<system.webServer>
<httpErrors errorMode="Custom" existingResponse="Replace" xdt:Transform="Insert">
<remove statusCode="404" />
<error statusCode="404" path="/error/404" responseMode="ExecuteURL" />
<remove statusCode="500" />
<error statusCode="500" path="/error/500" responseMode="ExecuteURL" />
<remove statusCode="403" />
<error statusCode="403" path="/error/403" responseMode="ExecuteURL" />
</httpErrors>
</system.webServer>
@robdmoore
robdmoore / gist:f82d74d4c377d4f3755e
Created Aug 31, 2014
List all documents in an Azure DocumentDB Document Collection
View gist:f82d74d4c377d4f3755e
class Program
{
static void Main(string[] args)
{
Task.WaitAll(new[] {DoStuff()});
}
private static async Task DoStuff()
{
var client = new DocumentClient(new Uri("https://<documentdbtenant>.documents.azure.com:443/"),
You can’t perform that action at this time.