Skip to content

Instantly share code, notes, and snippets.

View Nexmean's full-sized avatar
🍰

Alexander Makarov Nexmean

🍰
View GitHub Profile
@Nexmean
Nexmean / toggleterm.lua
Created June 6, 2023 11:28
Make toggleterm don't affect neotree window
return {
"akinsho/toggleterm.nvim",
version = "*",
opts = {
size = function(term)
if term.direction == "horizontal" then
return vim.o.lines * 0.45
elseif term.direction == "vertical" then
return vim.o.columns * 0.4
end
@Nexmean
Nexmean / telescope_window_picker.md
Last active December 6, 2022 10:54
Window picker for telescope.nvim

Install plugin: https://github.com/s1n7ax/nvim-window-picker

Create command:

vim.api.nvim_create_user_command("Pick", function (e)
  local success, picked = pcall(function ()
    return require('window-picker').pick_window({
      autoselect_one = true,
      include_current_win = true,
 current_win_hl_color = '#89b4fa',
@Nexmean
Nexmean / TypedAlgebra.hs
Last active August 11, 2022 21:45
fused-effects TypedAlgebra for composing effects
{-# LANGUAGE
FunctionalDependencies
, UndecidableInstances
#-}
module Control.Carrier.DependsOn where
import Control.Algebra
import Control.Applicative
import Control.Carrier.Error.Either
import Control.Effect.State
@Nexmean
Nexmean / EitherC.hs
Created February 21, 2020 09:17
error in EitherC
type CarrierKind = (Type -> Type) -> Type -> Type
data ((t :: CarrierKind) :|: (u :: CarrierKind)) (m :: Type -> Type) (a :: Type) = EitherC
{ runLeft :: t m a
, runRight :: u m a }
deriving Functor
instance
( MonadBaseControl b (t m), MonadBaseControl b (u m)
, forall x . StM (t m) x ~ StM (u m) x )
@Nexmean
Nexmean / PartialJson.hs
Created February 6, 2020 11:02
Partial JSON parsing/encoding with only needed for program fields.
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE TypeApplications #-}
import Control.Lens
@Nexmean
Nexmean / parsing-kirill.hs
Last active January 24, 2020 15:36
очень меееееедлееееенно
-- Main.hs
module Main where
import Lib
import System.Clock
main :: IO ()
main = do
start <- getTime Monotonic
parseAndWrite source1 output
-- пример полиморфной рекурсии, который невозможно скомпилировать без универсального представления данных в рантайме
import System.IO
class ScalarProduct a where
scalarProduct :: a -> a -> Integer
data Nil = Nil
data Cons a = Cons Integer a