Skip to content

Instantly share code, notes, and snippets.

View wallymathieu's full-sized avatar

Oskar Gewalli wallymathieu

View GitHub Profile
@wallymathieu
wallymathieu / Automated RubyGem Install
Created September 2, 2011 04:15 — forked from BenHall/Automated RubyGem Install
How to install RubyGems via an automated ruby script
#!c:/ruby/bin/ruby.exe
require 'rubygems'
require 'rubygems/gem_runner'
require 'rubygems/exceptions'
def install(lib)
begin
Gem::GemRunner.new.run ['install', lib]
rescue Gem::SystemExitException => e
end
@wallymathieu
wallymathieu / onion-1.fs
Last active September 20, 2022 19:32 — forked from akhansari/onion-1.fs
F# : Onion architecture in a nutshell
// 1. pure, don't think about IO at all
module Domain =
let add x y = x + y
// 2. think about IO but not its implementation
module App =
let add (getX: unit -> Async<int32>) y =
async {
let! x = getX ()
return Domain.add x y
@wallymathieu
wallymathieu / Program.fs
Created December 27, 2021 10:30
Typeprovider issue
open FSharpPlus
open FSharpPlus.TypeLevel
let x = TypeNat<2>.Value
// For more information see https://aka.ms/fsharp-console-apps
printfn "Hello from F#"
@wallymathieu
wallymathieu / SomeWebProject.csproj
Last active March 5, 2021 11:17
Recursive include of c# files in a project
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<!-- ...
based on https://stackoverflow.com/questions/7643615/how-can-i-get-msbuild-to-copy-all-files-marked-as-content-to-a-folder-preservin
-->
<WWWRoot>$(ProjectDir)wwwroot</WWWRoot>
</PropertyGroup>
<ItemGroup>
<!-- Specify a file collection WWWRootFiles: -->
<WWWRootFiles Include="..\wwwroot\**\*.*"></WWWRootFiles>
@wallymathieu
wallymathieu / Validation.fsx
Last active February 14, 2021 22:18 — forked from gusty/Validation.fsx
Applicative Validation easy with F#+
#r @"c:/packages/FSharpPlus.1.0.0-CI00099/lib/net45/FSharpPlus.dll"
open System
open FSharpPlus
// Validation definition
type Validation<'a,'e> = Success of 'a | Failure of 'e
with
// Validation is an instance of Applicative
static member inline Return x = Success x
@wallymathieu
wallymathieu / coverage.cobertura.xml
Created June 13, 2020 06:32
Coverage report 2020-06-13 F#+
This file has been truncated, but you can view the full file.
<?xml version="1.0" encoding="utf-8"?>
<coverage line-rate="0.1306" branch-rate="0.0974" version="1.9" timestamp="1592029460" lines-covered="512" lines-valid="3919" branches-covered="343" branches-valid="3519">
<sources>
<source>/Users/mathieu/src/fs/FSharpPlus/src/FSharpPlus/</source>
</sources>
<packages>
<package name="FSharpPlus" line-rate="0.1306" branch-rate="0.0974" complexity="5733">
<classes>
<class name="FSharpPlus.Internals.Id`1" filename="Internals.fs" line-rate="0" branch-rate="1" complexity="2">
@wallymathieu
wallymathieu / coverage.cobertura.xml
Created June 13, 2020 06:32
Coverage report 2020-06-13 F#+
This file has been truncated, but you can view the full file.
<?xml version="1.0" encoding="utf-8"?>
<coverage line-rate="0.1306" branch-rate="0.0974" version="1.9" timestamp="1592029460" lines-covered="512" lines-valid="3919" branches-covered="343" branches-valid="3519">
<sources>
<source>/Users/mathieu/src/fs/FSharpPlus/src/FSharpPlus/</source>
</sources>
<packages>
<package name="FSharpPlus" line-rate="0.1306" branch-rate="0.0974" complexity="5733">
<classes>
<class name="FSharpPlus.Internals.Id`1" filename="Internals.fs" line-rate="0" branch-rate="1" complexity="2">
@wallymathieu
wallymathieu / Trying-out-fleece.ipynb
Created May 24, 2020 15:12
Problem with microsoft.dotnet-interactive/1.0.115407 dotnet 5.0.100-preview.4.20258.7
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
[AttributeUsage(System.AttributeTargets.All, AllowMultiple = true, Inherited = true)]
public class ಠ_ಠAttribute : Attribute
{
public ILog Log { get; set; }
public ಠ_ಠAttribute()
{
Log.Info("This code is bad and you should feel bad");
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework Condition="$(Configuration)=='Test'">netcoreapp3.0</TargetFramework>
<TargetFramework Condition="$(Configuration)!='Test'">netstandard2.0</TargetFramework>
<IsPackable Condition="$(Configuration)=='Test'">false</IsPackable>
<DefineConstants Condition="$(Configuration)=='Test'">TESTS</DefineConstants>
</PropertyGroup>