Skip to content

Instantly share code, notes, and snippets.

View mcintyre321's full-sized avatar

Harry McIntyre mcintyre321

View GitHub Profile
@damianh
damianh / AspNetCore use specific controllers
Created August 9, 2018 13:38
Configure aspnet core to use only specific controllers and not do assembly scanning. Also supports internal types.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.Extensions.DependencyInjection;
namespace MyApp
{
@bkaradzic
bkaradzic / why_i_think_immediate_mode_gui_is_way_to_go_for_gamedev_tools.md
Last active October 30, 2024 03:09
Why I think Immediate Mode GUI is way to go for GameDev tools

Why I think Immediate Mode GUI is way to go for GameDev tools

Prerequisites

Before you continue, if you don't know what IMGUI is don't bother reading this post, just ignore it, don't write anything in comments section, etc. If you're curious about IMGUI see bottom of this post, otherwise continue whatever you were doing, this post it's not for you. Thanks!

If you know what IMGUI is, for context read following presentations and blog posts:

  • Insomniac’s Web Tools Postmortem
@mogauvin
mogauvin / linqpad-nunitlite.cs
Last active August 2, 2021 19:44 — forked from simoneb/linqpad-nunitlite.cs
NUnitLite in LINQPad
// LINQPad 4
// NUnit 3.4
void Main()
{
// change working folder by specifying the -work flag
// using either a single or double dash makes no difference
new AutoRun().Execute(new[]{"-noheader", @"-work=C:\src\Test\", "--verbose"});
}
// Define other methods and classes here
@qmfrederik
qmfrederik / RequestLoggerMiddleWare.cs
Last active November 22, 2018 16:41
A request logger for ASP.NET Core
// Copyright (c) 2016 Quamotion bvba
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
// (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
@davidfowl
davidfowl / dotnetlayout.md
Last active November 13, 2024 13:19
.NET project structure
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
 tests/
@dieseltravis
dieseltravis / CryptoHelper.cs
Last active October 31, 2023 07:26
sample app that uses PGP Encryption using Bouncy Castle's C# API
// Assembly BouncyCastle.Crypto, Version=1.8.1.0
using Org.BouncyCastle.Bcpg;
using Org.BouncyCastle.Bcpg.OpenPgp;
using Org.BouncyCastle.Security;
using System;
using System.IO;
using System.Text;
namespace EncryptionSample
{
@piers7
piers7 / Load-TeamCityProperties.ps1
Created September 4, 2013 05:12
Load TeamCity system properties into PowerShell variable scope
<#
.Synopsis
Loads TeamCity system build properties into the current scope
Unless forced, doesn't do anything if not running under TeamCity
#>
param(
$prefix = 'TeamCity.',
$file = $env:TEAMCITY_BUILD_PROPERTIES_FILE + ".xml",
[switch] $inTeamCity = (![String]::IsNullOrEmpty($env:TEAMCITY_VERSION))
)
@mcintyre321
mcintyre321 / gist:6230628
Created August 14, 2013 12:31
Example of a CodeView for AspMvc
public class IndexView : CodeView<IndexViewModel>
{
protected override void Render(CQ doc, IndexViewModel model, ViewContext viewContext)
{
doc["body"].Append("<div>" + viewContext.ViewBag.Message + "</div>");
}
}
@eddwo
eddwo / gist:5423102
Created April 19, 2013 20:44
Comment spam generator based on the template discovered by Scott Hanselman https://gist.github.com/shanselman/5422230
abstract class Comment
{
public abstract void Generate(StringBuilder builder);
public string Generate()
{
StringBuilder builder = new StringBuilder();
this.Generate(builder);
return builder.ToString();
}
@mrchief
mrchief / Deploy-Windows-Service-Via-MSBuild.proj.xml
Last active June 26, 2024 09:37
MSBuild Script to deploy Windows Service to remote or local machine
<Project DefaultTargets="CopyOutputs;DeployService" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<!-- These settings control what the service's name, description etc appear in services.msc task panel. -->
<PropertyGroup Label="ServiceMetaData">
<ServiceName>ShinyNewService</ServiceName>
<ServiceDisplayName>Shiny New Service</ServiceDisplayName>
<ServiceDescription>A shiny new service, that changes the world for the greater good.</ServiceDescription>
</PropertyGroup>
<Choose>