This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Setup-Install-VSCode | |
$url = "https://gist.githubusercontent.com/Grinderofl/0946997470f85f3a5598c5e20ef0c17d/raw/fa62828039e3b2431a7bacbf2618ac6fb6a1fa87/vscode-silent-update.ps1" | |
$taskName = "StfuVsCode" | |
$psFile = "vscode-silent-update.ps1" | |
$scriptPath = [io.path]::combine($env:LOCALAPPDATA, "Fixes", $psFile) | |
New-Item -Force -Path $scriptPath | |
Invoke-Webrequest $url -UseBasicParsing -OutFile $scriptPath | |
Import-Module ScheduledTasks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Works: | |
var jobs1 = (from job in _dbContext.Jobs | |
let latest = _dbContext.JobHistory | |
.OrderByDescending(x => x.CreatedOnUtc) | |
.FirstOrDefault(x => x.JobId == job.Id) | |
select new | |
{ | |
JobTypeIdentifier = job.JobType.Id, | |
JobTypeName = job.JobType.Name, | |
JobTypeDescription = job.JobType.Description, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ServiceConfiguration(typeof(RecentlyVisitedContentService))] | |
public class RecentlyVisitedContentService | |
{ | |
private static ApplicationEnvironmentContext EnvironmentContext => new ApplicationEnvironmentContext(); | |
private static string CookieKey => $".DotComRecents.{EnvironmentContext.CurrentEnvironment}.Cookie"; | |
private static int MaximumEntries => 100; | |
private readonly ICookieService _cookieService; | |
private readonly IContentRouteHelper _routeHelper; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Nr = NewRelic.Api.Agent.NewRelic; | |
private void ConfigureRebus(RebusConfigurerWithLogging configuration) | |
{ | |
// ... | |
configuration.Events(ConfigureEvents); | |
// ... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MemoryCacheTicketStore : ITicketStore | |
{ | |
private const string KeyPrefix = "AuthSessionStore-"; | |
private readonly IMemoryCache _cache; | |
public MemoryCacheTicketStore() | |
{ | |
_cache = new MemoryCache(new MemoryCacheOptions()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IEnumerable<YourType> GetYourTypes() | |
{ | |
yield return GetElement(); | |
foreach(var el in GetOtherElements()) | |
yield return el; | |
} | |
var types = GetYourTypes(); | |
if(!types.Any()) // possible multiple enumerations of enumerable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AssemblaClientSettings | |
{ | |
public string BaseUrl { get; set; } = "https://api.assembla.com/"; | |
public string ApiKey { get; set; } | |
public string ApiSecret { get; set; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ServiceCollectionExtensions | |
{ | |
private static readonly IProxyGenerator ProxyGenerator = new ProxyGenerator(true); | |
public static IServiceCollection AddTypedFactory<T>(this IServiceCollection services, ServiceLifetime lifetime = ServiceLifetime.Transient) where T : class | |
{ | |
services.TryAddSingleton<TypedFactoryInterceptor>(); | |
services.Add(new ServiceDescriptor(typeof(T), CreateProxy<T>, lifetime)); | |
return services; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class WebHostBuilderExtensions | |
{ | |
public static WebHostBuilder UseProspero(this WebHostBuilder builder, Action<ProsperoFeatures> featuresAction) | |
{ | |
builder | |
.UseKestrel() | |
.UseContentRoot(Directory.GetCurrentDirectory()) | |
.UseIISIntegration(); | |
builder.UseConventionAutofacServiceProvider(); // Finds Module subtypes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IPostcodeLookupService | |
{ | |
PostcodeLookup Lookup(string postcode); | |
} |