Skip to content

Instantly share code, notes, and snippets.

Avatar

Steffen Forkmann forki

View GitHub Profile
View gist:3d8f8bac50689b6f0380
let name = Something.Data.Methods
|> Seq.filter (fun x-> x.C > 0UL)
|> Seq.sortBy (fun x-> 999999999999UL - x.C)
|> Seq.take 50
|> Seq.iter dump_minfo
@shishkin
shishkin / semver.fs
Created Aug 30, 2014
Making incorrect version specifications impossible with F# typesystem
View semver.fs
type VersionNumber =
| Major of major: int
| Minor of major: int * minor: int
| Patch of major: int * minor: int * patch: int
type Version =
| Release of VersionNumber
| PreRelease of VersionNumber * string
static member create (x) = Release (Major x)
@shishkin
shishkin / FunctionalErrorHandling.cs
Created Dec 16, 2013
Functional error handling
View FunctionalErrorHandling.cs
using System;
using System.Collections.Generic;
using System.Linq;
using FSharpx;
using Microsoft.FSharp.Core;
using NUnit.Framework;
namespace FunctionalErrorHandling
{
public static class Extensions
View gist:7813579
#I "../packages/FSharp.Charting.0.90.5"
#I "../packages/Deedle.0.9.12"
#I "../packages/RProvider.1.0.5/"
#load "FSharp.Charting.fsx"
#load "Deedle.fsx"
#load "RProvider.fsx"
open System
open System.IO
open Deedle
View FileSetCE.fs
type FileSetBuilder() =
member x.Delay f = f
member x.Run f = f() |> Scan
member x.Yield (()) = { Include "" with Includes = [] }
[<CustomOperation ("take", MaintainsVariableSpace = true)>]
member x.Take (fs, pattern: string) = fs ++ pattern
[<CustomOperation ("notTake", MaintainsVariableSpace = true)>]
member x.NotTake (fs: FileIncludes, pattern: string) = fs -- pattern
View code-review-checklist.md

General

  1. Unit tests: Review unit tests first. Unit tests are a fantastic way to grasp how code is meant to be used by others and to learn what the expected behavior is. Are there any test gaps that should be there?
  2. Method arguments" Make sure arguments to methods make sense and are validated. Mentally test boundary conditions and edge cases.
  3. Null References" (Yah yah, we know. Use F# and this goes away. We get it already.) Null references are a bitch and it’s worth looking out for them specifically.
  4. Conventions Consistency" Make sure naming, formatting, etc. follow our conventions and are consistent. I like a codebase that’s fairly consistent so you know what to expect.
  5. Disposables: Make sure disposable things are disposed. Look for usages of resources that should be disposed but are not.
  6. Security: There is a whole threat and mitigation review process that falls under this bucket. In simple terms, ask yourself how this code could be exploited. The [STRIDE Threat Mo