Skip to content

Instantly share code, notes, and snippets.

@baio
baio / akkling
Created July 14, 2020 09:12
akkling
// When update message types on persistent actor it will fail silently on start
@baio
baio / Pattern matching
Created September 25, 2019 21:52
C# 8
using UIDef.Lists.Data.Core;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using UIDef.Core.Domain;
using System;
using UIDef.Lists.Data.Core.Domain;
using CSharpFunctionalExtensions;
using UIDef.Lists.Requests.GetFromatters;
using UIDef.Core.MediatR.CRUDHandlers.GetList;
@baio
baio / xtranslate.pipe.ts
Created October 15, 2018 15:59
Xtranslate with OnPush
import { ChangeDetectorRef, Inject, InjectionToken, OnDestroy, Optional, Pipe, PipeTransform } from '@angular/core';
import { Subscription } from 'rxjs';
import { XTranslateService } from './xtranslate.service';
export const TRANSLATE_PREFIX = new InjectionToken<string>('TRANSLATE_PREFIX');
/**
* Allows to avoid define full path to translate constatnt every time.
* @example
* ```
# BUILD image
FROM node:stretch
LABEL author="Max Putilov"
# Install powershell >>>>>
RUN apt-get update
RUN apt-get install -y curl gnupg apt-transport-https
# Import the public repository GPG keys
RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
# Register the Microsoft Product feed
@baio
baio / angular module build
Created October 23, 2017 22:22
angular module build
# build librarys and place rsult to dist folder
# Clean up previous distributions if folders exist
if (Test-Path dist) {
Remove-Item dist -Recurse -Force
}
if (Test-Path build) {
Remove-Item build -Recurse -Force
}
@baio
baio / deploy.cmd
Created August 16, 2017 20:16
Deployment script to build F# compiled azure functions
@if "%SCM_TRACE_LEVEL%" NEQ "4" @echo off
cls
:: ----------------------
:: KUDU Deployment Script
:: Version: 1.0.15
:: ----------------------
:: Prerequisites
:: -------------
var ENV_RUNTIME = {
"appConfig": {
"stickHeader": "xxx"
}
}
{
"appConfig": {
"stickHeader": "xxx"
}
}
@baio
baio / reader.fsx
Created July 18, 2017 22:28
F# monads
namespace ReaderM
type ReaderM<'d,'out> =
'd -> 'out
module Reader =
// basic operations
let run dep (rm : ReaderM<_,_>) =
@baio
baio / flow-example.ts
Created March 30, 2017 14:33
flow example
showElectivesBlockItem$ = this.actions$.let(s =>
Flow.ofActions(s, A.isShowTechAction)
.filter(R.propEq("type", "electives-block"))
.switchMap(this.academicTerm.loadElementCourses)
.mapOk(items => ({ items }))
.flatMap(SA.modal(AcademicTermListItemUOTsComponent))
.do((x: {id: string}) => SA.navigate(["/", "courses", "my", x.id ]))
.mapTo(<any>data.CANCEL_RESULT_ACTION)
.toRx()
)