Skip to content

Instantly share code, notes, and snippets.

flq / NonTopmostPopup.cs
Created Apr 5, 2011
WPF: Popup that is only topmost with respect to parent window. Taken from the comments at (Joe Gershgorin) which was in not easy to digest state
View NonTopmostPopup.cs
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Interop;
/// <summary>
/// Popup with code to not be the topmost control
flq /
Last active Jun 18, 2020
Fizzbuzzes in many colours.

A collection of FizzBuzz implementations over many languages. The specification goes something like this...

Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

The expected outcome is something like:

flq / HttpFileServer.cs
Created Apr 17, 2010
Smallest file web server
View HttpFileServer.cs
using System;
using System.IO;
using System.Net;
using System.Text;
using System.Web;
public class HttpFileServer : IDisposable
private readonly string rootPath;
private const int bufferSize = 1024*512; //512KB
flq / UiMessages.cs
Created Sep 20, 2013
Example setup for Membus to dispatch messages of a certain kind onto the UI thread...
View UiMessages.cs
// Use like BusSetup.StartWith<Conservative>().Apply<UiMessages>().Construct();
internal class UiMessages : ISetup<IConfigurableBus>
void ISetup<IConfigurableBus>.Accept(IConfigurableBus setup)
setup.ConfigurePublishing(obj =>
obj.MessageMatch(mi => mi.IsType<IUIMsg>()).PublishPipeline(new UiMsgDispatcher());
flq / CompileHub.cs
Last active Mar 8, 2019
Roslyn Refactoring
View CompileHub.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reactive.Linq;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.MSBuild;
namespace ReFuc
flq / dotnet_snippets.txt
Created Aug 16, 2018
Some nice .NET snippets
View dotnet_snippets.txt
.NET snippets
1. Deconstruct a regex match group collection
flq / josephus.hs
Last active Aug 16, 2018
Stuff I made in Haskell
View josephus.hs
module Josephus where
import Data.List
-- own, atrocious solution to josephus problem
lastSurvivor :: Int -> Int
lastSurvivor 1 = 1
lastSurvivor noOfPeople = fst . last $ unfoldr theSurvivors (1,(1,[])) where
theSurvivors (person, (count, theKilled))
| length theKilled == noOfPeople - 1 = Just (countOn, breakCondition)
flq / nasties.cs
Last active Dec 16, 2017
Ye olde NRE from a ctor call
View nasties.cs
using System;
using System.Runtime.Remoting.Proxies;
internal class Program
private static void Main(string[] args)
var c = new CrazyObject();
flq / GetWSDLs.ps1
Created Aug 17, 2017
Acccess discovery service, download all WSDLs for listed services
View GetWSDLs.ps1
function indent([parameter(ValueFromPipeline)]$Content)
$StringWriter = New-Object System.IO.StringWriter
$XmlWriter = New-Object System.XMl.XmlTextWriter $StringWriter
$xmlWriter.Formatting = "indented"
$xmlWriter.Indentation = 2
Write-Output $StringWriter.ToString()
flq / BitempTests.fs
Last active Dec 16, 2016
Bitemporal code samples
View BitempTests.fs
module BitempTests
type TimePoint<'S> = {
recorded : int;
actual : int;
state : 'S;
type HistoryEntry<'S> = {
time : int;
You can’t perform that action at this time.