Skip to content

Instantly share code, notes, and snippets.

@wolf99
wolf99 / Broken nested numbered lists.md
Last active February 3, 2024 12:02
Broken nested numbered lists

Broken Nested Numbered Lists

  1. This is a list item 1.1. This should be a nested list item
  2. This is a list item
  • This is a list item
    • This is a nested list item
  • This is a list item
@wolf99
wolf99 / How to replace Wall Vents in New Houses.md
Last active February 3, 2024 12:06
How to replace Wall Vents in New Houses

How to replace Wall Vents in New Houses

Warning: Read through everything before starting! Some parts have a long lead time and you do not want open holes in your wall while you wait for delivery!

These are the vent covers we replaced the existing ones with. They are delivered from China so take a few weeks to get here. Read on for more details.

https://www.fruugo.ie/decorative-air-vent-cover-round-ventilation-grill-outlet-with-built-in-screen-mesh-adjustable-outlet-for-wall-ceiling-new/p-232968729-498267363

@wolf99
wolf99 / BoilerplateSingleton.cs
Created September 1, 2017 11:43
C# singleton class pattern
namespace Foo
{
/// <summary>
/// A class showing the bolierplate code for a singleton
/// </summary>
public sealed class BoilerplateSingleton // sealed to prevent derivatives adding non-singleton copies
{
// this class is a singleton, this field holds the single instatiated
// object. It is instantiated lazily, only being created when a
// reference to the object is requested via the Instance property
@wolf99
wolf99 / FilePathToFileUrl.cs
Created August 9, 2017 14:51
method to convert a file path to a URI
// The System.Uri class can convert paths to URIs using new Uri(pathString).AbsoluteUri;
// However, that does not work if the path contains some characters, e.g. the percent
// sign or spaces. This method corrects that, it is taken from, explained and MIT
// licensed, here: https://stackoverflow.com/a/35734486/1292918
public static string FilePathToFileUrl(string filePath)
{
StringBuilder uri = new StringBuilder();
foreach (char v in filePath)
{
@wolf99
wolf99 / PaddedVersionToString.vb
Created June 9, 2017 12:38
A ToString() extension to the System.Version class, that allows specification of padding of the version parts
Option Strict On
Option Explicit On
Imports System.Text
Imports System.Runtime.CompilerServices
Module PaddedVersionToString
''' <summary>
''' Converts the value of the current Version object to its equivalent
''' String representation. Specified counts indicate the number of
@wolf99
wolf99 / BoilerplateINotifyPropertyChanged.cs
Created May 31, 2017 10:26
A boilerplate C# implementation of INotifyPropertyChanged
using System;
using System.ComponentModel; // For INotifyPropertyChanged interface
using System.Runtime.CompilerServices; // For CallerMemberName, could use nameof() otherwise
namespace FooProgram
{
public class BoilerplateNotify : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
@wolf99
wolf99 / TobyForTabsFaq.md
Last active April 12, 2020 16:48
TobyForTabs - FAQ For Fun

What is Toby?

Toby is grouchy. Toby wonders why you think you need so many damn tabs open at the same time anyway.

How does Toby work?

By finishing stuff (and with coffee). Then I can close some of those tabs.

Who uses Toby?

Hello magazine says that people that like to be in control of everything all of the time (like browser tabs) might be using Toby.

What are the benfits of using Toby?

@wolf99
wolf99 / isthreads.c
Created May 12, 2017 09:41
Quick C program to detect if standard C threads are supported by checking the `__STDC_NO_THREADS__` macro
#include <stdio.h>
int main (int argc, char *argv[])
{
// Get the compiler name and version, where easily obtained, for a more
// informative output
char *compilerName;
char *compilerVersion;
#if defined(__clang__)
compilerName = "Clang/LLVM";
@wolf99
wolf99 / GetDictionaryOfProperties.cs
Last active May 5, 2017 08:15
C# function to get a Dictionary of the names and values of the properties of a given object
using System.Reflection
public class Gists
{
public Dictionary<string, object> GetDictionaryOfProperties(o As Object)
{
Dictionary<string,string> Properties;
Properties = (from x in o.GetType().GetProperties() select x).ToDictionary
( x => x.Name, x => x.GetGetMethod().Invoke (o, null));
@wolf99
wolf99 / GetDictionaryOfProperties.vb
Last active May 5, 2017 08:15
VB.NET function to get a Dictionary of the names and values of the properties of a given object
Option Strict On
Option Explicit On
Imports System.Reflection
Module Gists
Public Function GetDictionaryOfProperties(ByRef o As Object) As Dictionary(Of String, Object)
Dim Properties As Dictionary(Of String, Object) = New Dictionary(Of String, Object)
#If Not USE_LOOP