Skip to content

Instantly share code, notes, and snippets.

View evanricard's full-sized avatar
😟

Evan Ricard evanricard

😟
View GitHub Profile
@evanricard
evanricard / ag.txt
Created September 24, 2020 21:43
ag grep
Ag
ag -L -print-all-files runtime error
@evanricard
evanricard / hourglass.cs
Last active September 2, 2020 01:18
hackerrank 2darr
public static int maxHourGlass(int[][]arr)
{
int noRow = arr.GetUpperBound(0);
int noCol = arr[0].Length;
int max = getHourGlass(arr, 0, 0);
//arr has all the data now
//we will get a hour glass at each position excpept the last two
for (int i = 0; i <= noRow- 2; i++)
@evanricard
evanricard / Func-tionalCombinatorPredicates
Last active September 2, 2020 00:20
Gulag-derived predicate syntax
public static Func<T, bool> Not<T>(this Func<T, bool> predicate)
{
    return a => !predicate(a);
}
 
@evanricard
evanricard / 1598890610.txt
Created August 31, 2020 16:16
Created with Copy to Gist
using System;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
public class Program
{
public static void Main(String[] args)
@evanricard
evanricard / Deploy.md
Created July 9, 2020 23:05 — forked from alfonsogarciacaro/Deploy.md
Deploying an F# ASP.NET Core app (Giraffe) to Azure

Deploying an F# ASP.NET Core app to Azure

Last week I spent a lot of time trying to deploy an F# ASP.NET Core app (a Giraffe app, specifically) to Azure because the information to complete all the steps was scattered in several places. So I'm writing this hopefully it will save the pain to others :)

Preparation

The following steps are mostly taken from this guide and it's only necessary to do them once:

  1. Create an account in Azure (or use an existing one)
  2. Create a resource group (or use an existing one)
@evanricard
evanricard / AllInOne.ps1
Created July 5, 2020 20:32 — forked from NateLehman/AllInOne.ps1
F# PowerShell Module Scaffold
dotnet new sln -o DotnetCoreProj
cd DotnetCoreProj
dotnet new classlib -lang 'F#' -o src/MyPSModule
dotnet sln add src/MyPSModule/MyPSModule.fsproj
cd src/MyPSModule
dotnet add package PowerShellStandard.Library
@'
namespace MyPSModule
open System.Management.Automation
https://stackexchange.com/search?q
https://www.youtube.com/results?search_query=%s
https://github.com/search?q=%s
https://stackexchange.com/search?q
https://www.youtube.com/results?search_query=%s
https://github.com/search?q=%s
/// Structural inference for HTML tables
module FSharp.Data.Runtime.HtmlInference
open System
open System.Globalization
open FSharp.Data.Runtime
open FSharp.Data.Runtime.StructuralInference
open FSharp.Data.Runtime.StructuralTypes
type Parameters = {
let rangeCounter start stop =
let mutable current = start
fun () ->
let this = current
current <-
if current = stop then
start
else
current + 1
this