Skip to content

Instantly share code, notes, and snippets.

View tomunderhill's full-sized avatar

Tom Underhill tomunderhill

  • TomUnderhill.co.uk
View GitHub Profile
@tomunderhill
tomunderhill / devmachine.ps1
Last active January 27, 2022 11:12 — forked from kasuken/devmachine.ps1
Boxstarter script for a dev machine
#####################
# PREREQUISITES
#####################
Set-ExplorerOptions -showHiddenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
#####################
# SOFTWARE
#####################
$backupRoot = Get-ChildItem -Path "C:\backup"
$datafilesDest = "c:\databases"
$logfilesDest = "c:\databases"
$server = ".\SQL17"
## For each folder in the backup root directory...
#
foreach($folder in $backupRoot)
{
# Get the most recent .bak files for all databases...
using Sitecore.ContentSearch.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Web;
using System.Collections.Specialized;
namespace MyProject
{
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
using Microsoft.WindowsAzure.Storage.RetryPolicies;
using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
namespace Acme.Web.Services
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
using Microsoft.WindowsAzure.Storage.RetryPolicies;
using System;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Web;
namespace Acme.Web.Services
//how to mock an HttpRequest for testing a controller
var mockHttpContext = new Mock<HttpContextBase>();
var mockRequest = new Mock<HttpRequestBase>();
mockRequest.Setup(x => x.QueryString).Returns(new NameValueCollection() {});
mockHttpContext.Setup(x => x.Request).Returns(mockRequest.Object);
_rssFeedPageController = new RssFeedPageController(contentRepositoryMock.Object, serviceFactoryMock.Object, extractionMock.Object, htmlStripMock.Object, "http://dev.mywebsite.co.uk");
_rssFeedPageController.ControllerContext = new ControllerContext(mockHttpContext.Object, new RouteData(), _rssFeedPageController);
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
//Given an array of integers, return a new array such that each element at index i of the new array
@tomunderhill
tomunderhill / BoxStarterWork.txt
Last active December 8, 2017 16:25
BoxStarter script for work machine
# Allow reboots
$Boxstarter.RebootOk=$true
$Boxstarter.NoPassword=$false
$Boxstarter.AutoLogin=$true
# Basic setup
#Update-ExecutionPolicy Unrestricted
#Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
#Enable-RemoteDesktop
#Disable-InternetExplorerESC