Skip to content

Instantly share code, notes, and snippets.

Avatar

Alistair Young cerebrate

View GitHub Profile
@cerebrate
cerebrate / gist:6695088
Created Sep 25, 2013
Today's faulty, pain-in-the-ass code.
View gist:6695088
<xctk:EditorDefinitionCollection x:Key="StandardPropertyEditors" x:Shared="False">
<xctk:EditorTemplateDefinition TargetProperties="{arkane:Nullable TypeName=system:Boolean}" >
<xctk:EditorTemplateDefinition.EditingTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding Value}" IsThreeState="True" />
</DataTemplate>
</xctk:EditorTemplateDefinition.EditingTemplate>
</xctk:EditorTemplateDefinition>
<xctk:EditorTemplateDefinition TargetProperties="{arkane:Nullable system:DateTime}">
<xctk:EditorTemplateDefinition.EditingTemplate>
@cerebrate
cerebrate / gist:6695095
Created Sep 25, 2013
The markup extension that's supposed to make today's faulty, pain-in-the-ass code work.
View gist:6695095
/// <summary>
/// XAML markup extension to make it possible to reference nullable types.
/// </summary>
[MarkupExtensionReturnType (typeof (Type))]
public class NullableExtension : TypeExtension
{
/// <summary>
/// Initializes a new instance of the NullableExtension class.
/// </summary>
public NullableExtension ()
@cerebrate
cerebrate / ApartmentAspect.cs
Last active Jan 3, 2016
ApartmentAspect for PostSharp.
View ApartmentAspect.cs
namespace ArkaneSystems.Arkane.Aspects
{
/// <summary>
/// An aspect to execute a function on a thread in the given COM apartment state.
/// </summary>
[Serializable]
public sealed class ApartmentAspect : MethodInterceptionAspect
{
private readonly ApartmentState desiredState;
private Exception returnException;
@cerebrate
cerebrate / UnlessDisposed
Created Jan 21, 2014
Automatically implement the "if disposed, throw exception" pattern.
View UnlessDisposed
namespace ArkaneSystems.Arkane.Aspects
{
/// <summary>
/// An aspect which blocks calls to all public methods of a class implementing <see cref="IDisposable"/> once the class has
/// been disposed, instead throwing <see cref="ObjectDisposedException"/>. The class upon which this aspect is placed must
/// use the common pattern in which a private boolean field named 'disposed' is used to hold the disposed state.
/// </summary>
/// <remarks>
/// Private methods, static methods, and finalizers can still run when the class is disposed, as they may
/// be required for cleanup.
View stargate-config
!
! Last configuration change at 10:05:35 CDT Wed Aug 17 2016 by avatar
! NVRAM config last updated at 09:31:51 CDT Wed Aug 17 2016 by avatar
!
version 12.4
no service pad
service timestamps debug datetime msec
service timestamps log datetime msec
service password-encryption
service linenumber
View keybase.md

Keybase proof

I hereby claim:

  • I am cerebrate on github.
  • I am cerebrate (https://keybase.io/cerebrate) on keybase.
  • I have a public key ASAggWBv-rBgDm8LNH1F4_vo9P0b6QN8-BjJnFO_MxvYzAo

To claim this, I am signing this object:

View gist:81ad9501ed2e6ee129b5aac192adc292
#!/bin/sh
echo "Seriously!? After I _told_ you what it could do?"
echo "Kinda makes me wish I'd put rm -rf / in here after all."
View version.el
(use-package vc
:config
(progn
;; show vc commands being executed
(setq vc-command-messages t)
;; confirm when chasing symlinks in a VC directory
(setq vc-follow-symlinks 'ask)
;; handled back-ends
View dogtector.ino
/*
Dogtector - operating code for the Dogtector
Copyright Alistair Young, 2017. All Rights Reserved.
*/
#include <ESP8266WiFi.h>
#include <Ticker.h>
#include <Adafruit_MQTT.h>
#include <Adafruit_MQTT_Client.h>
@cerebrate
cerebrate / Update-AUPackages.md
Created Jan 25, 2017
Update-AUPackages Report #powershell #chocolatey
View Update-AUPackages.md