Skip to content

Instantly share code, notes, and snippets.

Avatar
💭

Josef joseftw

💭
View GitHub Profile
View Result
public class Result
{
protected Result(bool success, string message = null) : this(success, message, Enumerable.Empty<Error>()) { }
protected Result(bool success, string message, IEnumerable<Error> errors)
{
Success = success;
Message = message;
Errors = errors ?? Enumerable.Empty<Error>();
}
View Migration different project multiple contexts
dotnet ef migrations Add AddedStorageDto --context TournamentDbContext --startup-project ..\JOS.Tournament.Api
@joseftw
joseftw / remove-bloat.ps1
Last active Jan 10, 2018
Script to remove windows 10 bloatware
View remove-bloat.ps1
DISM /Online /Remove-ProvisionedAppxPackage /PackageName:Microsoft.BingWeather_4.22.3254.0_neutral_~_8wekyb3d8bbwe
DISM /Online /Remove-ProvisionedAppxPackage /PackageName:Microsoft.DesktopAppInstaller_1.10.16004.0_neutral_~_8wekyb3d8bbwe
DISM /Online /Remove-ProvisionedAppxPackage /PackageName:Microsoft.GetHelp_10.1706.1981.0_neutral_~_8wekyb3d8bbwe
DISM /Online /Remove-ProvisionedAppxPackage /PackageName:Microsoft.Getstarted_6.5.2851.0_neutral_~_8wekyb3d8bbwe
DISM /Online /Remove-ProvisionedAppxPackage /PackageName:Microsoft.Messaging_2017.1026.259.0_neutral_~_8wekyb3d8bbwe
DISM /Online /Remove-ProvisionedAppxPackage /PackageName:Microsoft.Microsoft3DViewer_2.1801.4012.0_neutral_~_8wekyb3d8bbwe
DISM /Online /Remove-ProvisionedAppxPackage /PackageName:Microsoft.MicrosoftOfficeHub_2017.715.118.0_neutral_~_8wekyb3d8bbwe
DISM /Online /Remove-ProvisionedAppxPackage /PackageName:Microsoft.MicrosoftSolitaireCollection_3.17.8162.0_neutral_~_8wekyb3d8bbwe
DISM /Online /Remove-ProvisionedAppxPackage /PackageName:Micr
View ToQueryString
public static class NameValueCollectionExtensions {
public static string ToQueryString(this NameValueCollection nameValueCollection) {
return string.Join("&", nameValueCollection
.AllKeys
.SelectMany(key => (nameValueCollection.GetValues(key) ?? Enumerable.Empty<string>())
.Select(val => string.Concat(key, "=", WebUtility.UrlEncode(val)))));
}
}
View InitializationModule.cs
using System;
using System.Collections.Generic;
using System.Linq;
using EPiServer.DataAbstraction;
using EPiServer.DataAbstraction.RuntimeModel;
using EPiServer.DataAnnotations;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;
using EPiServer.ServiceLocation;
using Feature.CoolPage;
@joseftw
joseftw / DependencyResolverInitialization.cs
Created Apr 10, 2016
Shows how to "inject" own types to the AvailableContentTypes attribute at runtime in EPiServer
View DependencyResolverInitialization.cs
using System.Web.Mvc;
using EPiServer.DataAbstraction.RuntimeModel;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;
using EPiServer.ServiceLocation;
using ModularAllowedTypes.Business.Rendering;
using EPiServer.Web.Mvc;
using EPiServer.Web.Mvc.Html;
using StructureMap;
@joseftw
joseftw / DependencyResolverInitialization.cs
Last active Jul 26, 2019
Support for "injecting" AllowedTypes in EPiServer when ContentTypes doesn't know about each other. Raw
View DependencyResolverInitialization.cs
using System.Web.Mvc;
using EPiServer.DataAbstraction.RuntimeModel;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;
using EPiServer.ServiceLocation;
using ModularAllowedTypes.Business.Rendering;
using EPiServer.Web.Mvc;
using EPiServer.Web.Mvc.Html;
using StructureMap;