Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / my_isnan.c
Last active October 27, 2019 21:56
Portable alternative to isnan() in math.h
int my_isnan(double x)
{
volatile double tmp = x; /* Prevent optimization by compiler. */
return tmp != x;
}
@wolf99
wolf99 / my_isinf.c
Last active October 27, 2019 21:50
Portable alternative to isinf() in math.h
int my_inf(double x)
{
volatile double tmp = x; /* Prevent optimization by compiler. */
if ((tmp == x) && ((tmp - x) != 0.0))
return x < 0.0 ? -1 : 1;
return 0;
}
@wolf99
wolf99 / tasks.json
Last active May 22, 2019 09:57
Visual Studio Code tasks.json for GCC
// Available variables which can be used inside of strings.
// ${workspaceRoot}: the root folder of the team
// ${file}: the current opened file
// ${fileBasename}: the current opened file's basename
// ${fileDirname}: the current opened file's dirname
// ${fileExtname}: the current opened file's extension
// ${cwd}: the current working directory of the spawned process
{
"version": "0.1.0",
@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 / 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 / BoilerplateException.cs
Last active August 3, 2017 10:08
A boilerplate C# exception class
using System;
using System.Runtime.Serialization;
using System.Security.Permissions;
namespace FooProgram
{
// Recommended practice to derive from Exception rather than ApplicationException
// Recommended practice to make exceptions serializable
[Serializable]
public class BoilerplateException : Exception, ISerializable