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
;; container - An existing container at the sotrage account | |
;; blob-connection-string - Connectionstring for the strage account | |
;; This is used from environ to have different configurations | |
{:dev {:env {:container "<containerName>" | |
:blob-connection-string "DefaultEndpointsProtocol=https;AccountName=<name>;AccountKey=<key>;EndpointSuffix=core.windows.net"}}} |
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
<# | |
.SYNOPSIS | |
Query a CosmoDb. | |
.DESCRIPTION | |
This command will query a cosmos db and return the results as an object. | |
.PARAMETER EndPoint | |
The endpoint to the CosmosDb Account. |
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
public static string ExportPrivateKey(X509Certificate2 certificateWithPrivateKey) | |
{ | |
var parameterList = RsaParametersToList(certificateWithPrivateKey.GetRSAPrivateKey().ExportParameters(true)); | |
var parameterBytes = SerializeList(parameterList); | |
var base64 = Convert.ToBase64String(parameterBytes); | |
var builder = new StringBuilder(); | |
builder.Append("-----BEGIN RSA PRIVATE KEY-----\n"); | |
for (int i = 0; i < base64.Length; i += 64) |
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
// This creates the certificate | |
AzureServiceTokenProvider azureServiceTokenProvider = new AzureServiceTokenProvider(); | |
KeyVaultClient keyVaultClient = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(azureServiceTokenProvider.KeyVaultTokenCallback)); | |
var vaultBaseUrl = "https://youvault.vault.azure.net/"; | |
var policy = new CertificatePolicy | |
{ | |
IssuerParameters = new IssuerParameters | |
{ | |
Name = "self" |
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
public class InMemoryJsonProvider : IFileProvider | |
{ | |
private IFileInfo _file; | |
public InMemoryJsonProvider(string json) | |
{ | |
_file = new MemoryFileInfo(json); | |
} | |
public IDirectoryContents GetDirectoryContents(string subpath) |
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
{- | |
Först har vi då en funktion. Den är inte så jäkla återanvändbar. Den tar en lista med strängar | |
och returnerar en lista med strängar | |
-} | |
sayHello :: List String -> List String | |
sayHello Nil = Nil | |
sayHello (name : names) = | |
("Hello, " <> name) : sayHello names | |
-- Den stegar igenom listan med rekursion och lägger till "Hello, " före |
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
import { Map, List } from "immutable"; | |
// createStory :: String -> Option -> Option -> Option -> Artifact -> Story | |
const createStory = ( | |
storyText, | |
option1, | |
option2, | |
option3, | |
requiredArtifact = null | |
) => |
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
// Jag har den här enkla map-klassen. Det är egentligen inte så stora fördelar | |
//med den men den har en map-funktion och det använder vi en hel del i vår | |
// lösning. Den har inte så mycket att göra med början på den här historien | |
// men den är rätt viktig senare! | |
class SimpleMap<T> { | |
private values: { [index: string]: T }; | |
constructor() { | |
this.values = {}; | |
} |
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
// Först gör vi en enum som beskriver dom olika sätt saker kan vara sorterade på | |
// inte så många kanske | |
enum Ordering { | |
GreaterThan = 1, | |
LessThan = -1, | |
Equal = 0 | |
} | |
// Sen gör vi ett interface för att beskriva att en typ är möjlig att jämföra | |
// Skickar vi in två objekt så skall funktionen sen svara om det är större än |
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
type Program<T> = Read<T> | Write<T> | Done<T>; | |
interface Read<T> { | |
kind: "Read"; | |
next: (data: T) => Program<T>; | |
} | |
interface Write<T> { | |
kind: "Write"; | |
valToWrite: string; |
NewerOlder