Recent snippets

  • C# motion detection source code: How to achieve tripwire with a USB webcam

    Tripwire is a special part of motion detection that can be used to monitor and alert on specific changes. More specifically: tripwire means the detection of intrusion. This code snippet presents how to create a C# software by using prewritten computer vision components (http://www.camera-sdk.com/) allowing you to get notified when your USB webcam triggers an intrusion. For instance, by using this application, you can use your camera to alarm when a people enters into the shop/office, or even to count how many people entered, etc. After the necessary using lines and objects you need to implement the Main method and the necessary functions for connecting to a USB webcamera. The startBt_Click method is used to start the tripwire functionality. Thereafter you can see how to handle the enter and exit events. Nothing could be more simple! :)

    0 people like this

    Posted: 11 hours ago by chewie-wookiee

  • Lightweight HKT Encoding

    Lightweight HKT encoding using a tiny amount of SRTP constraint solving for assigning the encoding to underlying types

    3 people like this

    Posted: 6 days ago by Eirik Tsarpalis

  • F# lambda as C# expression

    Expression<Func<'a, 'b>> as expr builder

    2 people like this

    Posted: 6 days ago by habib sadullaev

Popular snippets

  • Load XAML

    This example shows how to load a Xaml file allowing to use WPF from F#. It also shows how to access WPF objects and register event handlers.

    104 people like this

    Posted: 8 years ago by Antonio Cisternino

  • Partition a sequence until a predicate is satiated

    This function is given a partition predicate and a sequence. Until the predicate returns false, a list will be filled with elements. When it is, both the list and the remainder of the sequence will be returned. Note that this example preserves the laziness of the unchecked sequence elements.

    68 people like this

    Posted: 8 years ago by Rick Minerich

  • Dynamic operator using Reflection

    Demonstrates how to implement the dynamic operator (?) using .NET Reflection. The implementation supports calling constructors, propreties and methods using simple overload resolution (based on parameter count). It handles instance as well as static members.

    63 people like this

    Posted: 8 years ago by Tomas Petricek

  • Top-Down-Operator-Precedence Parser

    F# implementation of a generic Top-Down-Operator-Precedence Parser as described in this paper http://portal.acm.org/citation.cfm?id=512931 Example starts at line ~300

    86 people like this

    Posted: 8 years ago by fholm

  • Projecting lists

    Three functions showing how to implement projection for functional lists. First version uses naive recursion and the second one is tail-recursive using the accumulator parameter. The third version extends this with continuation passing.

    65 people like this

    Posted: 8 years ago by Tomas Petricek

  • Adapter pattern

    Invoke the methods from incompatible types

    102 people like this

    Posted: 7 years ago by Tao Liu

Snippets by tags

recursion (29) fparsec (15) lists (13) design patterns (18) mailboxprocessor (27) async (95) wpf (20) seq (52) json (14) staging (18) reflection (18) fold (19) game (30) tryfsharp (48) generic programming (13) kata (17) f# (42) html (15) silverlight (22) array (20)

View all...

Database contains 2322 snippets out of which 1579 is public.