Skip to content

Instantly share code, notes, and snippets.

View asimmon's full-sized avatar

Anthony Simmon asimmon

View GitHub Profile
@asimmon
asimmon / demo-pillar-bootstrapper.cs
Created March 3, 2016 04:31
Sample bootstrapper class for Pillar
public class MyAppBootstrapper : PillarBootstrapper
{
private readonly Application _app;
public MyAppBootstrapper(Application app)
{
_app = app;
}
protected override void ConfigureContainer(ContainerBuilder builder)
@asimmon
asimmon / demo-pillar-viewmodel.cs
Created March 3, 2016 04:35
Demo ViewModel for Pillar that uses the navigation system
public class FirstViewModel : PillarViewModelBase
{
private readonly INavigator _navigator;
public FirstViewModel(INavigator navigator)
{
_navigator = navigator;
// Go to the second view after 5 seconds
GoToSecondViewModel();
@asimmon
asimmon / bbpr.user.js
Last active July 8, 2022 15:44
Bitbucket PR comment navigator
// ==UserScript==
// @name Better Bitbucket Pull Requests
// @namespace GSoft
// @author Anthony Simmon
// @version 1.0.0
// @match https://bitbucket.org/*/pull-requests/*
// @match https://bitbucket.org/*/branch/*
// ==/UserScript==
function BBPR_App () {
@asimmon
asimmon / zendesk-comment-permalinks.user.js
Last active October 18, 2019 18:07
Zendesk Comment Permalinks UserScript
@asimmon
asimmon / decorator.ts
Created September 7, 2021 13:57
Screeps profiler in TypeScript
import profiler from './screeps-profiler';
export function profile(target: Function): void;
export function profile(target: object, key: string | symbol, _descriptor: TypedPropertyDescriptor<Function>): void;
export default function profile(target: object | Function, key?: string | symbol, _descriptor?: TypedPropertyDescriptor<Function>): void {
if (typeof profiler === 'undefined') {
return;
}
if (key) {
@asimmon
asimmon / program.cs
Last active October 4, 2021 14:15
CQRS Mediator handle query performance
using System;
using System.Collections.Concurrent;
using System.Reflection;
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Order;
using BenchmarkDotNet.Reports;
using BenchmarkDotNet.Running;
@asimmon
asimmon / program.cs
Created October 8, 2021 14:31
Await benchmarks
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Reports;
using BenchmarkDotNet.Running;
var benchmarkOptions = DefaultConfig.Instance.WithSummaryStyle(SummaryStyle.Default.WithRatioStyle(RatioStyle.Trend));
_ = BenchmarkRunner.Run<AwaitBenchmarks>(benchmarkOptions);
@asimmon
asimmon / Program.cs
Created July 14, 2022 19:19
Azure App Configuration with .NET console app
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.AzureAppConfiguration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.FeatureManagement;
@asimmon
asimmon / MongoRunnerProvider.cs
Created October 11, 2022 02:28
Efficiently reuse IMongoRunner from EphemeralMongo
using EphemeralMongo;
public static class MongoRunnerProvider
{
private static readonly object _lockObj = new object();
private static IMongoRunner? _runner;
private static int _useCounter;
public static IMongoRunner Get()
{
@asimmon
asimmon / semgrep.yml
Created February 21, 2023 15:42
Azure DevOps Semgrep pipeline
# Create a branch policy in Azure Repos to protect your main branch
trigger: none
schedules:
- cron: "28 5 * * 6"
displayName: "Weekly run"
branches:
include: ["main", "master"]
always: true