This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Reflection; | |
using System.Runtime.InteropServices; | |
using System.Runtime.InteropServices.ComTypes; | |
using System.Text.RegularExpressions; | |
namespace Framework.Core.Com | |
{ | |
static class ComWrapperExtension |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.InteropServices; | |
namespace Framework.Core.Com | |
{ | |
/// <summary> | |
/// VARIANT: this is equivalent to "Object" in VB. It's the universal variable type for COM. | |
/// </summary> | |
/// <remarks>The "vt" flag determines which of the other fields have meaning. vt is a VarEnum.</remarks> | |
[StructLayout(LayoutKind.Explicit, Size = 16)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let l = System.Collections.Generic.List<int>() | |
l.Add 1 | |
printfn "%O" l // System.Collections.Generic.List`1[System.Int32] | |
printfn "%A" l // seq [1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let wildcardMatch (pattern:string) (target:string) = | |
let rec wildcardMatch (pattern:char list) (target: char list) = | |
match pattern, target with | |
| '*'::('*'::_ as p) , _ -> wildcardMatch p target | |
| [], [] | ['*'], [] -> true | |
| [], _ | _, [] -> false | |
| '?'::p, _::t -> wildcardMatch p t | |
| x::p, y::t when x = y -> wildcardMatch p t | |
| '*'::x::p, y::t when x = y && t |> List.contains x |> not -> wildcardMatch p t | |
| '*'::_, _::t -> wildcardMatch pattern t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
func coins(amount int) map[int]int { | |
coins := []int{25, 10, 5, 2, 1} | |
remaining := amount |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let csv = """ID_Centrale;date;type;sstype;valeur | |
278;2022-02-10 16:00:00.0000000;EA;P;76128 | |
278;2022-02-10 16:00:00.0000000;EA;HPH;154196 | |
278;2022-02-10 16:00:00.0000000;EA;HCE;0 | |
278;2022-02-10 16:00:00.0000000;EAP;P;44 | |
278;2022-02-10 16:00:00.0000000;EAP;HPH;0 | |
278;2022-02-10 16:00:00.0000000;EAP;HCH;0 | |
278;2022-02-10 16:00:00.0000000;EAP;HPE;0 | |
751;2022-02-15 14:00:00.0000000;;index1;44853 | |
751;2022-02-15 14:00:00.0000000;;index2;405194 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let csv = """ID_Centrale;date;type;sstype;valeur | |
278;2022-02-10 16:00:00.0000000;EA;P;76128 | |
278;2022-02-10 16:00:00.0000000;EA;HPH;154196 | |
278;2022-02-10 16:00:00.0000000;EA;HCE;0 | |
278;2022-02-10 16:00:00.0000000;EAP;P;44 | |
278;2022-02-10 16:00:00.0000000;EAP;HPH;0 | |
278;2022-02-10 16:00:00.0000000;EAP;HCH;0 | |
278;2022-02-10 16:00:00.0000000;EAP;HPE;0 | |
751;2022-02-15 14:00:00.0000000;;index1;44853 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Recursive = | |
let convergesIn = | |
let rec convergesIn i previous f x = | |
match previous with | |
| Some p when p = f x -> i | |
| _ -> let y = f x in convergesIn (i + 1) (Some y) f y | |
convergesIn 0 None | |
module Functional = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r "nuget:FSharp.Data" | |
#r "nuget:xplot.googlecharts" | |
module Snd = | |
let map f (x, y) = x, f y | |
open XPlot.GoogleCharts | |
open FSharp.Data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
// Defer is a stack and pop each func | |
func main() { | |
defer func() { | |
fmt.Println("0") | |
if r := recover(); r != nil { |