Skip to content

Instantly share code, notes, and snippets.

View robdmoore's full-sized avatar

Rob Moore (MakerX) robdmoore

View GitHub Profile
@robdmoore
robdmoore / gist:dcd325e0ee73493ff1b7
Created June 18, 2014 14:38
PowerShell to get a publish settings file in a semi-automated way
$scriptpath = $(Split-Path $MyInvocation.MyCommand.Path)
cd $scriptpath
if (-not (ls *.publishsettings | Test-Any)) {
Write-Warning "Please save a .publishsettings file to this folder"
start .
Get-AzurePublishSettingsFile
exit 1
}
@robdmoore
robdmoore / _readme.md
Last active August 29, 2015 14:04
OctopusDeploy NuGet package contents that were used to deploy iOS over-the-air ipa and build iOS and Android via PhoneGapBuild

The following files were included in a NuGet package that we used OctopusDeploy to deploy an iOS over-the-air .ipa file and also build a Cordova/PhoneGap app using the PhoneGapBuild API:

@robdmoore
robdmoore / Add-ToHostsFile.ps1
Created July 23, 2014 08:17
Script to set up ASP.NET development environment in IIS with SQL Express using Network Service
# Originally from http://poshcode.org/3819
function Add-ToHostsFile {
<#
.DESCRIPTION
This function checks to see if an entry exists in the hosts file.
If it does not, it attempts to add it and verifies the entry.
.EXAMPLE
Add-ToHostsFile -IPAddress 192.168.0.1 -HostName MyMachine
@robdmoore
robdmoore / gist:efd01bd380c3c90ef3c3
Created August 31, 2014 07:03
XDT Transformation to add custom error page URLs to an ASP.NET application.
<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 / forms.showhide.js
Last active August 29, 2015 14:05
Foolproof validation with show/hide
$(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:44221cc1028ac038931b
Created December 15, 2014 09:23
Using GitVersion to publish tags to Git repository on various CI servers

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

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:d2b0fb0ae8f1ff104194
Last active August 29, 2015 14:22
Install App Insights into Virtual Machine using PowerShell
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 {

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

@robdmoore
robdmoore / gist:4618493
Last active December 11, 2015 15:08
Understanding the impact of NSubstitute's .Returns() static stack implementation
using System;
using NSubstitute;
using NSubstitute.Exceptions;
using NUnit.Framework;
namespace Tests
{
public class Class1
{
public interface Interface