Skip to content

Instantly share code, notes, and snippets.

Frank Quednau flq

Block or report user

Report or block flq

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@flq
flq / _intro.md
Last active Jul 10, 2019
Fizzbuzzes in many colours.
View _intro.md

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:

1,2,Fizz,4,Buzz,Fizz,7,8,Fizz,Buzz,
11,Fizz,13,14,FizzBuzz,16,17,Fizz,19,Buzz,
Fizz,22,23,Fizz,Buzz,26,Fizz,28,29,FizzBuzz,
@flq
flq / NonTopmostPopup.cs
Created Apr 5, 2011
WPF: Popup that is only topmost with respect to parent window. Taken from the comments at http://chriscavanagh.wordpress.com/2008/08/13/non-topmost-wpf-popup/ (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
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
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
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
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
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
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();
Console.WriteLine(c.Hello());
Console.ReadLine();
}
@flq
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
$Content.WriteContentTo($XmlWriter)
$XmlWriter.Flush()
$StringWriter.Flush()
Write-Output $StringWriter.ToString()
@flq
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.