Skip to content

Instantly share code, notes, and snippets.

View wallymathieu's full-sized avatar

Oskar Gewalli wallymathieu

View GitHub Profile
@wallymathieu
wallymathieu / AsyncResult.fs
Created October 25, 2017 10:13
Async result f#
[<AutoOpen>]
module AsyncResult
//from https://github.com/SuaveIO/suave/blob/master/src/Suave/WebPart.fs
type AsyncResult<'a,'e> = Async<Result< 'a,'e>>
let inline succeed x = async.Return (Ok x)
let bind (f: 'a -> AsyncResult<'b,'e>) (a: AsyncResult<'a,'e>) = async {
let! p = a
match p with
@wallymathieu
wallymathieu / Uris.cs
Created September 21, 2017 07:45
Sample combine URI in c#
using System;
namespace Namespace
{
/// <summary>
/// Uri helpers
/// </summary>
public static class Uris
{
/// <summary>
@wallymathieu
wallymathieu / Uri_trycreate_can_do_path_combine.cs
Last active November 25, 2016 10:17
Uri try create can do path combine
using System;
using NUnit.Framework;
namespace Tests
{
[TestFixture]
public class Uri_trycreate_can_do_path_combine
{
public static Uri ToUri(string baseUrl, string path)
{
@wallymathieu
wallymathieu / fake.fsx
Created October 8, 2016 15:18
Side by side comparison of cake and fake
let verboseBuild verbosity (defaults:MSBuildParams)=
{ defaults with Verbosity = Some(verbosity) }
let quietBuild = verboseBuild Quiet
let withTargets targets (defaults:MSBuildParams)=
{ defaults with Targets = targets }
let rebuildBuild = withTargets ["ReBuild"]
let buildModeConfiguration buildMode (defaults:MSBuildParams)=
{ defaults with
Properties =
@wallymathieu
wallymathieu / Enums.cs
Created September 22, 2016 08:04
decompose into flags
/// <summary>
/// Decompose a flags enum value into the individual flags.
/// </summary>
public static T[] DeComposeFlags<T>(Enum value)
{
var defaultV = default(T);
return Enum.GetValues(typeof(T))
.Cast<Enum>()
.Where(e=> !defaultV.Equals(e) && value.HasFlag(e))
.Cast<T>()
@wallymathieu
wallymathieu / CSharp_loose.flt
Created November 18, 2011 12:12
Winmerge filter (svn + git)
## This is a directory/file filter for WinMerge
## This filter suppresses various binaries found in Visual C# source trees
name: Visual C# loose
desc: Suppresses various binaries found in Visual C# source trees
## This is an inclusive (loose) filter
## (it lets through everything not specified)
def: include
## Filters for filenames begin with f:
@wallymathieu
wallymathieu / build.cmd
Last active May 11, 2016 09:13
with filepath from cmd path
REM http://ss64.com/nt/syntax.html
REM https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/percent.mspx?mfr=true
"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild" "%~dp0\Somesolution.sln"
@wallymathieu
wallymathieu / dump_with_cookies.txt
Created May 6, 2016 05:28
Trying to access api.nuget.org
Request URL:https://api.nuget.org/packages/with.1.0.8.nupkg
Request Method:GET
Status Code:504 Gateway Timeout
Remote Address:93.184.221.200:443
Response headers:
HTTP/1.1 504 Gateway Timeout
Content-Type: text/html
Date: Fri, 06 May 2016 05:20:04 GMT
Server: ECAcc (sto/EA34)
@wallymathieu
wallymathieu / analysing_code.md
Created February 27, 2016 22:19
Analysis of source code

Global Structure

Location of code

  • Is the code located such that reading at one location is sufficient to understand it? Or is it located in many locations?
  • Is there any external documentation (wiki, onenote or word files)?
  • Use of libraries with intuitive API

How do you start reading the code?

  • wiki
  • readme
var tigerWithTeethType = function(name){
var that = this;
tigerType.call(this,name); //
this.bite = function(){ /*some code to bite the programmer ;)*/ };
}