Skip to content

Instantly share code, notes, and snippets.

View ajukraine's full-sized avatar
🇺🇦
Following the white rabbit

Bohdan Makohin ajukraine

🇺🇦
Following the white rabbit
View GitHub Profile
@ajukraine
ajukraine / AtLeast21Controller.cs
Created August 1, 2022 21:11
Authorization sample in C# (ASP.NET Core)
[Authorize(Policy = "AtLeast21")]
public class AtLeast21Controller : Controller
{
public IActionResult Index() => View();
}
@ajukraine
ajukraine / .vimrc
Created May 24, 2022 21:39
Another try for one-pager Vim config
" Don't try to be Vi compatible
" Enables Vim features, which are not compatible with Vi
set nocompatible
" Setup autoreload of config when it's saved
autocmd! BufWritePost $MYVIMRC ++nested source <afile>
autocmd! SourcePost $MYVIMRC ++nested call LightlineReload()
" Source custom wrapper around Vim Plug
" It automatically downloads and installs it on 1st usage
@ajukraine
ajukraine / init.lua
Created April 30, 2022 16:35
Another NeoVim config
-- Setup bootstrap of vim-plug
local vimplug_install_path = vim.fn.stdpath('config') .. '/autoload/plug.vim'
local vimplug_github_url = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
if vim.fn.filereadable(vim.fn.expand(vimplug_install_path)) == 0 then
vim.fn.execute('!curl -fLo ' .. vimplug_install_path .. ' --create-dirs ' .. vimplug_github_url)
end
-- Setup sourcing of config file when saved
local packer_group = vim.api.nvim_create_augroup('Config', { clear = true })
@ajukraine
ajukraine / init.lua
Created April 16, 2022 20:51
Competition for fastest startup time among status line plugins
local Plug = vim.fn['plug#']
vim.call('plug#begin')
Plug 'dstein64/vim-startuptime'
-- Option 1: control
Plug 'itchyny/lightline.vim'
-- Option 2: lualine
@ajukraine
ajukraine / .vimrc
Created February 13, 2022 01:59
New Vim init script
set encoding=utf-8
scriptencoding utf-8
set nocompatible
syntax on
set mouse=a
set laststatus=2
set wildmenu
set hidden
@ajukraine
ajukraine / .vimrc
Created September 23, 2021 09:24
Personal Emacs and Vim configurations
set shell=/bin/bash
let s:vimrc_folder = fnamemodify(resolve(expand('<sfile>:p')), ':h')
execute 'source ' . s:vimrc_folder . '/.vimrc-vimplug'
call VimplugBegin(s:vimrc_folder)
""" Color schemes
Plug 'embark-theme/vim', { 'as': 'embark' }
Plug 'artanikin/vim-synthwave84'
open FsCheck
let swap i j (arr : array<'a>) =
let tmp = arr.[i]
arr.[i] <- arr.[j]
arr.[j] <- tmp
let partition arr =
let pivot = Array.last arr
let mutable runningIndex = 0
class DatabaseInfo
{
public LightningEnvironment Environment;
public string Name;
public int Counter;
public DatabaseInfo(LightningEnvironment env, string dbName)
{
Environment = env;
Name = dbName;
let mod3 x = x%3 = 0
let mod5 x = x%5 = 0
let (|Fizz|_|) x = if mod3 x then Some() else None
let (|Buzz|_|) x = if mod5 x then Some() else None
let fizzBuzzOne =
function
| Fizz & Buzz -> "FizzBuzz"
| Fizz -> "Fizz"
var EventHubClient = require('azure-event-hubs').Client;
var Promise = require('bluebird');
var connectionString = 'Endpoint=sb://[...].servicebus.windows.net/;SharedAccessKeyName=[...];SharedAccessKey=[...]';
var eventHubPath = '[...]';
var errorHandler = (partitionId, err) => console.warn(`==> RX ERROR (${partitionId}): ${err}`);
var messagesCounter = 0;
var messageHandler = (partitionId, msg) => {