Skip to content

Instantly share code, notes, and snippets.

View joseftw's full-sized avatar
😍

Josef Ottosson joseftw

😍
View GitHub Profile
@joseftw
joseftw / Result
Last active October 5, 2022 00:32
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>();
}
dotnet ef migrations Add AddedStorageDto --context TournamentDbContext --startup-project ..\JOS.Tournament.Api
@joseftw
joseftw / remove-bloat.ps1
Last active July 28, 2024 15:15
Script to remove windows 10 bloatware
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
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)))));
}
}
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 April 10, 2016 14:46
Shows how to "inject" own types to the AvailableContentTypes attribute at runtime in EPiServer
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 July 26, 2019 11:56
Support for "injecting" AllowedTypes in EPiServer when ContentTypes doesn't know about each other. Raw
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;