Skip to content

Instantly share code, notes, and snippets.

View mttchpmn's full-sized avatar
✌️

Matt Chapman mttchpmn

✌️
View GitHub Profile
@mttchpmn
mttchpmn / PartialTestClassGenerator.cs
Created March 8, 2023 02:13
Unit Test Src Generator
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GenerationAssembly;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Text;
namespace CDD.Unit.Tests.SourceGenerators
using namespace System.Management.Automation
using namespace System.Management.Automation.Language
if ($host.Name -eq 'ConsoleHost')
{
Import-Module PSReadLine
}
#Import-Module PSColors
#Import-Module posh-git
Import-Module -Name Terminal-Icons
@mttchpmn
mttchpmn / .ideavimrc
Created June 10, 2021 21:52
IdeaVimrc
" Base Settings
set scrolloff=5
set relativenumber
set showmode
set showcmd
set smartcase
set incsearch
set hlsearch
@mttchpmn
mttchpmn / ts-debug.json
Created March 31, 2021 04:25
VSCode Launch.json file for debugging current Typescript file
{
"version": "0.2.0",
"configurations": [
{
"name": "Current TS File",
"type": "node",
"request": "launch",
"args": ["${relativeFile}"],
"runtimeArgs": ["--nolazy", "-r", "ts-node/register"],
"sourceMaps": true,
@mttchpmn
mttchpmn / toggleStringCase.java
Created March 7, 2021 09:49
toggleStringCase
private static String toggleStringCase(String str) {
var s = new StringBuilder();
for (int i = 0; i < str.length(); i++) {
var c = toggleCase(str.charAt(i));
s.append(c);
}
return s.toString();
}
@mttchpmn
mttchpmn / java.json
Created February 25, 2021 20:06
Java Snippets
{
"Getter and setter for Java class fields": {
"prefix": "getset",
"body": [
"public void set${1:field}(${2:type} value) {",
" this.${1/(.*)/${1:/downcase}/} = value;",
"}",
"public ${2} get${1}() {",
" return this.${1/(.*)/${1:/downcase}/};",
"}"
@mttchpmn
mttchpmn / WorkflowEngine.cs
Created February 13, 2021 00:43
C# Workflow Engine Class
using System;
using System.Collections.Generic;
namespace Sandbox
{
public interface IActivity
{
void Execute();
}
@mttchpmn
mttchpmn / DbCommand.cs
Created February 12, 2021 08:48
C# DbCommand Class
using System;
namespace Sandbox
{
public class DbCommand
{
private DbConnection _connection;
public string Command { get; set; }
public DbCommand(DbConnection connection, string command)
@mttchpmn
mttchpmn / DbConnection.cs
Created February 12, 2021 08:43
C# DbConnection Class
using System;
namespace Sandbox
{
public abstract class DbConnection
{
public string ConnectionString { get; set; }
public TimeSpan Timeout { get; set; }
public DbConnection(string connectionString)
@mttchpmn
mttchpmn / Stack.cs
Created February 9, 2021 20:29
C# Stack Class
using System;
using System.Collections.Generic;
namespace Sandbox
{
public class Stack<T>
{
private readonly List<T> _list = new List<T>();
public void Push(T obj)