Skip to content

Instantly share code, notes, and snippets.

View tocsoft's full-sized avatar

Scott Williams tocsoft

View GitHub Profile

Keybase proof

I hereby claim:

  • I am tocsoft on github.
  • I am tocsoft (https://keybase.io/tocsoft) on keybase.
  • I have a public key whose fingerprint is 54AE 557F 361C AF97 BF20 A75B BF04 E060 7DB9 74C7

To claim this, I am signing this object:

@tocsoft
tocsoft / TheadingHelper.cs
Created November 14, 2016 13:48
VS extension threading helpers
public class Threads : IThreads
{
public bool DisableThreadSwitching { get; set; } = false;
/// <summary>
/// await this and continuing code will run on a background thread
/// </summary>
/// <returns></returns>
public IThreadSwitcher SwitchToBackgroundThread()
{
@tocsoft
tocsoft / GeneralFormatTests.cs
Created December 17, 2016 13:20
GenericxUnit tests for multiple color spaces
// <copyright file="GeneralFormatTests.cs" company="James Jackson-South">
// Copyright (c) James Jackson-South and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
namespace ImageSharp.Tests
{
using System;
using System.IO;
using System.Numerics;
@tocsoft
tocsoft / ImageSharpLogo.cs
Last active February 25, 2017 18:15
image sharp logo
using System;
using System.Collections.Generic;
using System.Numerics;
using ImageSharp;
using SixLabors.Shapes;
namespace ConsoleApplication
{
public class Program
{
@tocsoft
tocsoft / hide.css
Created March 15, 2017 08:55
Hide element on desktop
// when window width > 600px then #menu will be hidden
@media screen and (min-width: 600px) {
#menu{
visibility: hidden;
display: none;
}
}
@tocsoft
tocsoft / ImageComparer.cs
Created March 16, 2017 15:51
Compare 2 images using ImageSharp
namespace ImageSharp.Tests
{
using System;
using ImageSharp;
using Xunit;
/// <summary>
/// Class to perform simple image comparisons.
/// </summary>
public static class ImageComparer
@tocsoft
tocsoft / Code.cs
Created May 30, 2017 21:07
Text Transformation With ImageSharp
private void DrawText(Graphics graphics)
{
using(Font font = new Font("Arial", 20, FontStyle.Regular, GraphicsUnit.Pixel))
{
// draw string as text without transformation
using(Brush brush = new SolidBrush(Color.Blue))
graphics.DrawString("Draw as text without transformation", font, brush, new PointF(10,10));
// draw string as text with transformation
GraphicsContainer container = graphics.BeginContainer();
@tocsoft
tocsoft / ObjectExtensions.cs
Created April 3, 2018 09:03
Object Hasher
using Microsoft.CSharp.RuntimeBinder;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Dynamic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
@tocsoft
tocsoft / InstallProfile.ps1
Last active May 22, 2020 16:25
Installs my standard powershell profile and any extra tooling I always expect to be installed
$install = $true
if (Test-Path -Path $PROFILE) {
$title = 'Profile already exists, we are about to over write it with the one github'
$question = 'Are you sure you want to proceed?'
$choices = '&Yes', '&No'
$decision = $Host.UI.PromptForChoice($title, $question, $choices, 1)
if ($decision -ne 0) {
$install = $false
}