Skip to content

Instantly share code, notes, and snippets.

@DavidRogersDev
DavidRogersDev / Get-Bing.ps1
Last active November 26, 2023 10:34
Powershell script which downloads the Bing image of the day.
$today = Get-Date
$todayFormatted = $today.Year.ToString() + "-" + $today.Month.ToString("D2") + "-" + $today.Day.ToString("D2")
$Market = "en-AU"
$Resolution = "1920x1200"
$ImageFileName = "wallpaper-" + $todayFormatted + ".jpg"
$DownloadDirectory = "$env:USERPROFILE\Pictures\Bing Wallpaper"
$BingImageFullPath = "$($DownloadDirectory)\$($ImageFileName)"
if ((Test-Path $DownloadDirectory) -ne $True) {
@DavidRogersDev
DavidRogersDev / BlobReader.cs
Created December 30, 2014 00:36
Quick and dirty program that reads the text of some blobs which were written as log output from a webjob.
class Program
{
private static string Name = "myContainer";
private static string Key =
"R5+BFCGHDJSghjkngfdjklggjfdkj+gvhdfkgfdjkgfdhjgHJGKFDGF==";
static void Main(string[] args)
{
var storageCredentials = new StorageCredentials(Name, Key);
var cloudStorageAccount = new CloudStorageAccount(storageCredentials, false);
@DavidRogersDev
DavidRogersDev / SturtLibrary
Created October 20, 2014 02:21
Fun gist showing how to use my SeleniumCore library in F#.
open KesselRun.SeleniumCore
open KesselRun.SeleniumCore.Enums
open KesselRun.SeleniumCore.Infrastructure
open KesselRun.SeleniumCore.TestDrivers
open KesselRun.SeleniumCore.Infrastructure.Factories
[<EntryPoint>]
let main argv =
let mutable driverOptions = new DriverOptions()
@DavidRogersDev
DavidRogersDev / ExceptionAssert.cs
Created June 22, 2014 00:23
ExceptionAssert includes a Throws static method which is meant to replace the usage of the ExpectedException attribute as a more targeted way of testing for an exception.
public static class ExceptionAssert
{
public static void Throws<T>(Action code, string exceptionMessage = null, string message = null, params object[] args) where T : Exception
{
try
{
code.Invoke();
Assert.Fail("No exception was thrown by the code under test.");
}
@DavidRogersDev
DavidRogersDev / DatabaseSetup.cs
Last active August 29, 2015 14:01
A class for use in integration testing which creates and drops a database for every applicable test.
internal class DatabaseSetup
{
internal static string connStr = ConfigurationManager.ConnectionStrings["NameOfConnString"].ConnectionString;
private const string MasterSchema = "Master";
internal void InstallDatabase(string resourceName)
{
InstallDatabase(connStr, GetScript(resourceName));
}
@DavidRogersDev
DavidRogersDev / Tracing.cs
Last active May 22, 2018 06:21
An excellent tracing class pulled from Brock Allen's supremely cool MembershipReboot project. Just replace the name of the trace-source on line 82 from MembershipReboot appropriately.
/*
* Copyright (c) Brock Allen. All rights reserved.
* see license.txt
*/
using System;
using System.Diagnostics;
namespace BrockAllen.MembershipReboot
{
@DavidRogersDev
DavidRogersDev / BaseViewModel
Last active August 29, 2015 13:57
Base ViewModel - This sample base ViewModel class includes the various bits and pieces which all Viewmodels can leverage. It inherits from MVVMLight's ViewModelBase class.
using System;
using System.Linq.Expressions;
using System.Windows.Input;
using CameraDownload.Shared;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using NLog;
namespace CameraDownload.ViewModels
{