Skip to content

Instantly share code, notes, and snippets.

@kentcb
kentcb / Program.cs
Created November 12, 2017 22:21
Method Group Performance Test
using System;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Attributes.Jobs;
using BenchmarkDotNet.Engines;
using BenchmarkDotNet.Running;
namespace BenchmarkDotNetHarness
{
class Program
{
This file has been truncated, but you can view the full file.
[PCLMock.CodeGeneration.XmlBasedGenerator] Loading XML input file 'C:\Users\Kent\Repository\QUT\Src\UnitTests\Mocks.xml'.
[PCLMock.CodeGeneration.Models.Configuration] Created configuration with the following rules:
- Namespaces matching 'QUT\.(?<remainder>.*)' will be replaced with 'QUT.UnitTests.${remainder}'.
- Namespaces matching '(?<name>.+)' will be replaced with '${name}.Mocks'.
- Names matching 'I(?<name>[A-Z].*)' will be replaced with '${name}'.
- Names matching '(?<name>[A-Z].*)\<.*\>' will be replaced with '${name}'.
- Names matching '(?<name>.+)' will be replaced with '${name}Mock'.
- Interfaces matching 'QUT\.Services\..*' will be 'included.
- Interfaces matching 'QUT\.ViewModels\..*' will be 'included.
- Plugin with assembly-qualified name 'PCLMock.CodeGeneration.Plugins.Collections, PCLMock.CodeGeneration' will be applied.
  • My blog is here, repository here
  • Up until fairly recently, everything worked fine. I think my last blog post (around early July) broke things
  • Root page works and stylesheets are resolved correctly (e.g. http://kent-boogaart.com/public/css/poole.css)
  • Clicking on any blog post causes that same style sheet to be loaded incorrectly from http://kent-boogaart.com/blog/public/css/poole.css
  • Everything works fine when running Jekyll locally (3.1.6), only fails when deployed to GitHub pages
  • Here is the relevant line in my include
  • Here is the value of site.baseurl (/)
  • I've forced a re-publish to no avail (just in case this was a Jekyll bug that has since been patched)
  • Could maybe work around this by changing [the permalink](https://github.com/kentcb/kentcb.github.io
@kentcb
kentcb / App.xaml
Created February 19, 2017 00:02
Mahapps DataGrid Styling Issue
<Application x:Class="App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:MyApp"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
@kentcb
kentcb / Layout.cs
Created December 2, 2016 02:48
iOS Auto-layout C# fluent interface
// this code is a heavily modified (and tested) version of https://gist.github.com/praeclarum/6225853
// example usage
this.ContentView.ConstrainLayout(() =>
this.clientNameLabel.Left() == this.ContentView.Left() + Layout.StandardSuperviewSpacing &&
this.clientNameLabel.Top() == this.ContentView.Top() + Layout.StandardSiblingViewSpacing &&
this.createdLabel.Left() == this.clientNameLabel.Right() + Layout.StandardSiblingViewSpacing &&
this.createdLabel.CenterY() == this.ContentView.CenterY() &&
this.createdLabel.Right() == this.ContentView.Right() - Layout.StandardSuperviewSpacing &&
this.referenceLabel.Left() == this.clientNameLabel.Left() &&
@kentcb
kentcb / Sweetblue.log
Last active July 25, 2016 00:48
Log of Sweetblue output
07-25 10:16:20.420 D/btif_config_util(30154): btif_config_save_file(L188): in file name:/data/misc/bluedroid/bt_config.new
07-25 10:16:21.885 D/audio_hw_primary( 1406): disable_audio_route: reset and update mixer path: low-latency-playback
07-25 10:16:21.886 D/audio_hw_primary( 1406): disable_snd_device: snd_device(2: speaker)
07-25 10:16:24.671 D/audio_hw_primary( 1406): out_set_parameters: enter: usecase(1: low-latency-playback) kvpairs: routing=2
07-25 10:16:24.682 D/audio_hw_primary( 1406): select_devices: out_snd_device(2: speaker) in_snd_device(0: none)
07-25 10:16:24.682 D/msm8974_platform( 1406): platform_send_audio_calibration: sending audio calibration for snd_device(2) acdb_id(15)
07-25 10:16:24.682 D/audio_hw_primary( 1406): enable_snd_device: snd_device(2: speaker)
07-25 10:16:24.686 D/audio_hw_primary( 1406): enable_audio_route: apply and update mixer path: low-latency-playback
07-25 10:16:24.806 D/Mono (20193): DllImport attempting to load: '__Internal'.
07-25 10:16:24.806 D/Mono (20193):
@kentcb
kentcb / DDSortingRepro.cs
Created July 18, 2016 07:54
Repro of DynamicData sorting problem
public class ItemViewModel : ReactiveObject
{
private readonly string name;
private readonly ObservableAsPropertyHelper<int> sortOrder;
public ItemViewModel(string name, IObservable<int> sortOrder, IScheduler scheduler)
{
this.name = name;
this.sortOrder = sortOrder
.ToProperty(this, x => x.SortOrder, scheduler: scheduler);
public delegate DeviceViewModel DeviceViewModelFactory(IObservable<IDevice> device, IDeviceMetadata deviceMetadata, IObservable<Unit> timer);
public sealed class DeviceViewModel : ReactiveObject
{
public DeviceViewModel(
IObservable<IDevice> device,
IDeviceMetadata deviceMetadata,
IScheduler scheduler,
IObservable<Unit> timer)
{
@kentcb
kentcb / ReactiveContentViewBase.cs
Created July 14, 2016 00:48
A base class for XF Reactive views in lieu of a fix for https://github.com/reactiveui/ReactiveUI/issues/1133
namespace ReactiveUI.XamForms
{
using System;
using System.ComponentModel;
using System.Linq;
using System.Reactive;
using System.Reactive.Linq;
using Xamarin.Forms;
// The ReactiveContentView that comes with RxUI does not implement ICanActivate. As such, the activation-for-view-fetcher
@kentcb
kentcb / Logging.cs
Last active June 21, 2016 02:17
Quick and dirty logging
namespace Logging
{
using System;
using System.Diagnostics;
using System.Threading;
public static class Log
{
public static Action<string> LogSink
{