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 / euler001.hs
Last active Dec 24, 2015
Euler Problems solved with Haskell
View euler001.hs
-- http://projecteuler.net/problem=1
sum [x | x <- [0..999], any (\d -> mod x d == 0) [3,5]]
@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 / spaceinvaders.hs
Created Sep 10, 2013
A subset of the Space invaders game with moving left/right, shooting with space. The "game" ends when exiting with x or all enemies being dead.h
View spaceinvaders.hs
module Main where
import Control.Monad
import Data.List (maximumBy,minimumBy,find,(\\))
import Data.Ord
import Graphics.UI.SDL as FX
type Point = (Int,Int)
type MovementPattern = [(Movement, [(Int, Int)] -> Bool)]
@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 / _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,
View git achievements
- Cloned from a remote repository
- Initialized an empty repository
- Pulled from a remote repository
- Made first commit
- Pushed to a remote repository
- Made first local branch
- Pushed a new branch
- Added a second remote
- Merged a branch into another one
- Deleted a local branch
@flq
flq / Program.cs
Created Sep 14, 2012
Prog to start a difftool and remap the files as they are deleted by git in order to open all files at once
View Program.cs
using System;
using System.Configuration;
using System.Diagnostics;
using System.IO;
namespace DifftoolStarter
{
class Program
{
static void Main(string[] args)
@flq
flq / zzz.ps1
Created Feb 9, 2012
Powershell function to bring your PC to sleep
View zzz.ps1
function zzz {
$source = @"
[DllImport("powrprof.dll")]
public static extern void SetSuspendState(bool hibernate, bool forceCritical, bool disableWakeEvent);
"@
$app = Add-Type -Namespace "Standby" -MemberDefinition $source -Name Sleep -PassThru;
$app::SetSuspendState($false,$true,$false);
}
@flq
flq / tax.cs
Created Sep 22, 2011
the tax thingy
View tax.cs
public decimal GetTaxes(decimal salary)
{
decimal tax = 0;
var progressiveTaxation = new[] { 0.1m, 0.14m, 0.23m, 0.3m, 0.33m, 0.45m };
var progressionSlices = new[] { 5070 - 0, 8660 - 5070, 14070 - 8660, 21240 - 14070, 40230 - 21240, decimal.MaxValue };
var progression = 0;
while (salary > 0)
@flq
flq / HelpController.cs
Created May 6, 2011
Current Fubu registry
View HelpController.cs
using FubuMVC.Core;
namespace CharmSim.Controllers
{
public class HelpController
{
public HelpViewModel Start()
{
return new HelpViewModel { Title = "Hello from Controller! " };
}
You can’t perform that action at this time.