Skip to content

Instantly share code, notes, and snippets.

Avatar

Dima Vlasov DmitriyVlasov

View GitHub Profile
@DmitriyVlasov
DmitriyVlasov / effective-fsharp.md
Created Jun 11, 2021 — forked from swlaschin/effective-fsharp.md
Effective F#, tips and tricks
View effective-fsharp.md

Architecture

  • Use Onion architecture

    • Dependencies go inwards. That is, the Core domain doesn't know about outside layers
  • Use pipeline model to implement workflows/use-cases/stories

    • Business logic makes decisions
    • IO does storage with minimal logic
    • Keep Business logic and IO separate
  • Keep IO at edges

View mssql-calendar-table.sql
USE [master]
GO
IF OBJECT_ID('dbo.calendar') IS NOT NULL
DROP TABLE [dbo].[calendar];
IF OBJECT_ID('dbo.fn_generate_calendar') IS NOT NULL
DROP FUNCTION [dbo].[fn_generate_calendar];
GO
@DmitriyVlasov
DmitriyVlasov / MangoOfficeVpbx.m
Created Jul 11, 2019
Example Power BI Custom Connector for Mango Office VPBX
View MangoOfficeVpbx.m
// This file contains your Data Connector logic
section MangoOfficeVpbx;
[DataSource.Kind="MangoOfficeVpbx", Publish="MangoOfficeVpbx.UI"]
shared MangoOfficeVpbx.Contents = (optional dateTimeFrom as datetime, optional dateTimeTo as datetime, optional fields_list as list) =>
get_full_data( dateTimeFrom, dateTimeTo, fields_list );
//
// Mango Office Vpbx Configuration settings
//
@DmitriyVlasov
DmitriyVlasov / ffmpeg.md
Created Jun 23, 2019 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files
View ffmpeg.md

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

View Added-date-and-hour-colum.dax
// На большом объеме данных так работает плохо!!!
var date_time_text = format( 'fact_data'[moment]; "dd.MM.yyyy hh:00:00" )
var current_date = DATEVALUE( date_time_text )
var current_time = timeVALUE( date_time_text )
var curent_datetime = current_date + current_time
return curent_datetime
@DmitriyVlasov
DmitriyVlasov / Added-date-and-hour-colum.m
Last active May 22, 2019
Added Date and Hour Colum
View Added-date-and-hour-colum.m
let
Source =
Table.FromRecords(
{
[ moment = DateTime.LocalNow() ]
}
),
AddYearColumn = Table.AddColumn( Source, "year", each Date.Year( [moment] ), Int32.Type ),
AddMontholumn = Table.AddColumn( AddYearColumn, "month", each Date.Month( [moment] ), Int32.Type ),
AddDayColumn = Table.AddColumn( AddMontholumn, "day", each Date.Day( [moment] ), Int32.Type ),
@DmitriyVlasov
DmitriyVlasov / fable-repl.css
Last active Mar 29, 2019
Minimal application showing how to use Elmish
View fable-repl.css
html,
body {
font-size: 16px;
}
.main-container {
display: flex;
width: 100%;
height: 100%;
justify-content: center;
View getProductionCalendar.m
// Пример использования функции получения Производственного календаря:
//
// источник взят отсюда: http://data.gov.ru/opendata/7708660670-proizvcalendar
// На момент 24.05.2018 в календаре содержатся описание праздников с 1999 года по 2025 год.
//
// let
// PROD_СALENDAR_URL =
// "https://data.gov.ru/opendata/7708660670-proizvcalendar/data-20181017T0930-structure-20181017T0930.csv?encoding=UTF-8",
// ProductionCalendar = getProductionCalendar( PROD_СALENDAR_URL )
// in
View Power BI Sparkline Line.DAX
Sparkline Line =
// Static line color - use %23 instead of # for Firefox compatibility
VAR LineColor = "%2301B8AA"
// "Date" field used in this example along the X axis
VAR XMinDate = MIN('Table'[Date])
VAR XMaxDate = MAX('Table'[Date])
// Obtain overall min and overall max measure values when evaluated for each date
@DmitriyVlasov
DmitriyVlasov / ExampleDaxMeasureSVG.dax
Last active Aug 9, 2018
Example Create DAX Measure generate sparkline with SVG
View ExampleDaxMeasureSVG.dax
Sparkline Line =
// Sample get from: https://powerbi.microsoft.com/en-us/blog/power-bi-desktop-august-2018-feature-summary/
// Formared width: http://www.daxformatter.com/
// Issue: SparlineMeasure var won't work when referenced (all bars end up 100%)
// Issue: Refactor to avoid nested SUMMARIZEs
// Issue: Negative values currently will not appear
VAR SparklineMeasure =
SUM ( Sales[SalesAmount] ) // don't use this below per issue above
VAR SparklineMeasureTarget =