Skip to content

Instantly share code, notes, and snippets.

View feanz's full-sized avatar

Richard Forrest feanz

View GitHub Profile
@feanz
feanz / RemoveStringExtensions.cs
Created January 9, 2015 16:01
Remove character extensions (string Exntensions)
public static string RemoveLastCharacter(this string input)
{
return input.Substring(0, input.Length - 1);
}
public static string RemoveLast(this string instr, int number)
{
return input.Substring(0, input.Length - number);
}
public static string RemoveFirstCharacter(this string input)
{
@feanz
feanz / ToFileSizeExtension.cs
Created January 9, 2015 15:57
To File Size Extensions method
public static class MiscExtensions
{
public static string ToFileSize(this long size)
{
if (size < 1024) { return (size).ToString("F0") + " bytes"; }
if (size < Math.Pow(1024, 2)) { return (size/1024).ToString("F0") + "KB"; }
if (size < Math.Pow(1024, 3)) { return (size/Math.Pow(1024, 2)).ToString("F0") + "MB"; }
if (size < Math.Pow(1024, 4)) { return (size/Math.Pow(1024, 3)).ToString("F0") + "GB"; }
if (size < Math.Pow(1024, 5)) { return (size/Math.Pow(1024, 4)).ToString("F0") + "TB"; }
if (size < Math.Pow(1024, 6)) { return (size/Math.Pow(1024, 5)).ToString("F0") + "PB"; }
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar
Enable-RemoteDesktop
cinst VisualStudio2013Ultimate -InstallArguments "/Features:'WebTools SQL'"
cinst MsSqlServer2014Express
cinst MsSqlServerManagementStudio2014Express
cinst fiddler4
cinst resharper
cinst GoogleChrome
cinst gitextensions
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar
Enable-RemoteDesktop
cinst VisualStudio2013Ultimate -InstallArguments "/Features:'WebTools SQL'"
cinst MsSqlServer2014Express
cinst MsSqlServerManagementStudio2014Express
cinst fiddler4
cinst resharper
cinst GoogleChrome
cinst gitextensions
@feanz
feanz / Spec.cs
Last active November 30, 2017 18:07
BDD Style test base class for specifications, in Nunit
public abstract class Spec
{
[TestFixtureSetUp]
public void Setup()
{
SpecSetup();
Given();
When();
@feanz
feanz / Inflector.cs
Created September 23, 2014 15:09
Inflector class for simple pluralisation and some other text stuff.
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace Inflector
{
public static class Inflector
{
#region Default Rules
static Inflector()
using System;
using System.Linq.Expressions;
using Moq.Language.Flow;
namespace Moq
{
public static class MoqExtensions
{
public static ISetup<T, TResult> SetupIgnoreArgs<T, TResult>(this Mock<T> mock,
Expression<Func<T, TResult>> expression)
@feanz
feanz / Options.cs
Created August 28, 2014 15:18
OptionsSet
//
// Options.cs
//
// Authors:
// Jonathan Pryor <[email protected]>
//
// Copyright (C) 2008 Novell (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@feanz
feanz / Microsoft.PowerShell_profile.ps1
Created August 18, 2014 16:13
Powersehll profile
Push-Location (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)
# Load posh-git module from current default module locaiton
Import-Module posh-git
# Set up a simple prompt, adding the git prompt parts inside git repos
function global:prompt {
$realLASTEXITCODE = $LASTEXITCODE
@feanz
feanz / .gitconfig
Last active October 16, 2021 07:03
My custom git config
[filter "lfs"]
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
clean = git-lfs clean -- %f
[user]
name = Richard Forrest
email = [email protected]
[core]
editor = 'C:/Program Files/vim/vim82/vim.exe'