Skip to content

Instantly share code, notes, and snippets.

View trailmax's full-sized avatar

Max Vasilyev trailmax

View GitHub Profile
@trailmax
trailmax / gist:1c5daf72c162e56777f149a50ac6adcc
Created December 7, 2017 15:10
Conditional inclusion of nuget in .Net Core
<ItemGroup>
<Reference Include="System.ComponentModel.DataAnnotations" Condition="'$(TargetFramework)' == 'net4.5'" />
</ItemGroup>
@trailmax
trailmax / StringExtensions.cs
Last active March 28, 2019 01:10
String extensions
namespace System
{
public static class StringExtensions
{
public static bool Contains(this string source, string toCheck, StringComparison comp)
{
return source?.IndexOf(toCheck, comp) >= 0;
}
public static bool IsNullOrEmpty(this String @string)
@trailmax
trailmax / DecoratorKata.cs
Created April 4, 2019 10:37
Decorator Kata
using System;
namespace DecoratorKata
{
class Program
{
static void Main(string[] args)
{
var service = new RoundBracketsDecorator(
new SquareBracketsDecorator(
@trailmax
trailmax / SqlHelper.cs
Created September 19, 2019 11:50 — forked from i-e-b/SqlHelper.cs
A wrapper around System.Data.SqlClient to make it less weird.
using System;
namespace System.Data.SqlClient {
public class SqlHelper {
readonly string connectionString;
public SqlHelper(string connectionString) { this.connectionString = connectionString; }
public string StringCommand (string commandString, Action<SqlParameterCollection> bindingCommand) {
using (var connection = new SqlConnection(connectionString)) {
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"profiles":