Skip to content

Instantly share code, notes, and snippets.

View seankearon's full-sized avatar
💭
coding up a storm!

seankearon

💭
coding up a storm!
View GitHub Profile
@seankearon
seankearon / AzureStorageConnectionStringParser.cs
Last active July 13, 2022 14:31
Simple Azure Storage Connection String Parser
using System;
using System.Collections.Generic;
/// <summary> Based on Patric Macvey's answer here https://stackoverflow.com/a/60998564/2608 </summary>
public class AzureStorageConnectionStringParser
{
readonly Dictionary<string, string> _values = new Dictionary<string, string>();
readonly string _connectionString;
public AzureStorageConnectionStringParser(string connectionString)
# --------------------------------------------------------------------------------
# Registers an IP rule to allow access to a SQL Azure DB from the current machine's IP.
# --------------------------------------------------------------------------------
# SETUP
# --------------------------------------------------------------------------------
# This assumes you are running PowerShell 7 or greater.
#
# Install the Azure and Azure SQL modules.
#
# Install-Module -Name Az -AllowClobber -Scope CurrentUser
@seankearon
seankearon / Program.fs
Last active April 6, 2020 07:32
Using EF Core with CosmosDB in F#
open System
open Microsoft.EntityFrameworkCore
type [<CLIMutable>] LegacyForm = {
id: string // The form's UID.
Client: string
CompanyId: int
Number: string
InstallationAddress: string
@seankearon
seankearon / ModusTollens.cs
Last active January 12, 2020 11:03
Curry-Howard Exercise
// (A => B and not B) => not A
Not<A> ModusTollens<A, B>(
Func<A, B> A_implies_B,
Not<B> not_B)
{
Absurd A_to_Absurd(A a)
{
return not_B.Apply(A_implies_B(a));
}
return new Not<A>(A_to_Absurd);
@seankearon
seankearon / do it.bat
Created November 11, 2019 13:55
Set Git to use Beyond Compare
git config --global diff.tool bc3
git config --global difftool.bc3.path "C:\Program Files\Beyond Compare 4\bcomp.exe"
git config --global merge.tool bc3
git config --global mergetool.b3c.path "C:\Program Files\Beyond Compare 4\bcomp.exe"
git config --global difftool.prompt false
# PLUS: npm install --global --production windows-build-tools
choco install spotify -y
choco install visualstudiocode -y
choco install microsoftazurestorageexplorer -y
choco install sourcetree --version 1.9.10.0 -y
choco install webstorm -y
choco install jetbrainstoolbox -y
# not updated choco install jetbrains-rider -y
choco install balsamiqmockups3 -y
@seankearon
seankearon / gist:de261ac578de1a735b26f23b0ce78155
Created August 31, 2017 07:29 — forked from robertpi/gist:2964793
F# record implementing an interface
namespace MyNamespace
type IMyInterface =
abstract GetValue: unit -> string
type MyRecord =
{ MyField1: int
MyField2: string }
interface IMyInterface with
member x.GetValue() = x.MyField2
@seankearon
seankearon / CreateAndQuery.cs
Last active September 7, 2016 21:36
Marten Queries
using System;
using System.Collections.Generic;
using System.Linq;
using Marten;
using Xunit;
namespace marten_test
{
public class CreateAndQuery
{
function Invoke-Environment {
# Source: http://stackoverflow.com/a/4385011/2608
# and https://github.com/nightroman/PowerShelf/blob/master/Invoke-Environment.ps1
param
(
[Parameter(Mandatory=1)][string]$Command,
[switch]$Output,
[switch]$Force
)
$stream = if ($Output) { ($temp = [IO.Path]::GetTempFileName()) } else { 'nul' }
@seankearon
seankearon / 0_reuse_code.js
Last active August 29, 2015 14:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console