Skip to content

Instantly share code, notes, and snippets.

Christian Weiss cwe1ss

Block or report user

Report or block cwe1ss

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Windows10-Setup.ps1
# Based on
# https://gist.github.com/jessfraz/7c319b046daa101a4aaef937a20ff41f
# https://gist.github.com/NickCraver/7ebf9efbfd0c3eab72e9
#--- Uninstall unnecessary applications that come with Windows out of the box ---
# Microsoft
Get-AppxPackage Microsoft.3DBuilder | Remove-AppxPackage
Get-AppxPackage Microsoft.BingFinance | Remove-AppxPackage
View bump-version.ps1
[CmdletBinding(SupportsShouldProcess)]
param (
# Only one of these may be used.
[Parameter(ParameterSetName='Major')]
[switch]$Major,
[Parameter(ParameterSetName='Minor')]
[switch]$Minor,
[Parameter(ParameterSetName='Patch')]
[switch]$Patch,
[Parameter(ParameterSetName='Version')]
View FeatureFolderViewLocationExpander.cs
public class FeatureFolderViewLocationExpander : IViewLocationExpander
{
public void PopulateValues(ViewLocationExpanderContext context)
{
/* no-op */
}
public IEnumerable<string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable<string> viewLocations)
{
// {0} - Action Name
@cwe1ss
cwe1ss / Startup.cs
Last active Jan 23, 2020
Castle.Facilities.AspNetCoreIntegration
View Startup.cs
public IServiceProvider ConfigureServices(IServiceCollection services)
{
// Configure regular ASP.NET Core services
services.AddMvc();
// ...
// Send configuration to Castle Windsor
Container.Populate(services);
Container.BeginScope();
return Container.Resolve<IServiceProvider>();
@cwe1ss
cwe1ss / ProjectsMissingInSolution.ps1
Created Sep 30, 2015
ProjectsMissingInSolution.ps1
View ProjectsMissingInSolution.ps1
$ErrorActionPreference = "Stop"
# Parameters
$baseFolder = (Get-Item (Get-Location)).Parent.FullName + "\"
$slnName = "All.sln"
$excludePatterns = @("Some\Exclusion")
# ################################################################
View gist:cbf39bac616877166dc1
public class HomeController : Controller
{
private readonly IAppCookies _cookies;
public HomeController(IAppCookies cookies)
{
_cookies = cookies;
}
public ActionResult Index()
View gist:674ae2a002cf16f5d2fa
public interface IAppCookies
{
string UserEmail { get; set; }
DateTime? LastVisit { get; set; }
}
public class AppCookies : IAppCookies
{
private readonly ICookieContainer _cookieContainer;
View gist:508b330300c644ca640f
public static class Mocks
{
public static Mock&lt;HttpRequestBase&gt; HttpRequest()
{
var httpRequest = new Mock&lt;HttpRequestBase&gt;();
httpRequest.Setup(x =&gt; x.Cookies).Returns(new HttpCookieCollection());
return httpRequest;
}
public static Mock&lt;HttpResponseBase&gt; HttpResponse()
View CookieContainer
public class CookieContainer : ICookieContainer
{
private readonly HttpRequestBase _request;
private readonly HttpResponseBase _response;
public CookieContainer(HttpRequestBase request, HttpResponseBase response)
{
// "Check" is a helper class, I've got from the "Kigg" project
Check.IsNotNull(request, "request");
Check.IsNotNull(response, "response");
View ICookieContainer
public interface ICookieContainer
{
bool Exists(string key);
string GetValue(string key);
T GetValue<T>(string key);
void SetValue(string key, object value, DateTime expires);
}
You can’t perform that action at this time.