Skip to content

Instantly share code, notes, and snippets.

View abdivasiyev's full-sized avatar

Asliddinbek Azizovich abdivasiyev

View GitHub Profile
@abdivasiyev
abdivasiyev / optional.go
Created May 1, 2024 17:39
Optional arguments implementation
// Usage:
//
// SomeFn(1, "test", WithArg1("optional 1"), WithArg2(true))
//
package some_pkg
type Option func(*option)
type option struct {
arg1 string
@abdivasiyev
abdivasiyev / repository.go
Last active April 21, 2024 16:15
Repository for dynamic insertion
package repository
import (
"fmt"
"strings"
)
type Row interface {
SetPos(pos int)
Values() []any
package http
import (
"context"
"encoding/json"
"mime/multipart"
"net/http"
"github.com/go-chi/chi/v5"
"github.com/google/uuid"
@abdivasiyev
abdivasiyev / default.nix
Created February 3, 2024 18:37
default nix configuration
with import <nixpkgs> {}; rec {
helloNixEnv = stdenv.mkDerivation {
name = "hello-nix-env";
buildInputs = [ go ];
};
}
@abdivasiyev
abdivasiyev / ternary.go
Created June 28, 2023 14:40
Simple ternary operator implementation in Go with generics
package ternary
type operatorIf[T comparable] struct {
condition bool
value T
elseIf *operatorIf[T]
elseValue T
}
func If[T comparable](condition bool) *operatorIf[T] {
@abdivasiyev
abdivasiyev / nerd_fonts.sh
Created December 24, 2022 20:16 — forked from davidteren/nerd_fonts.md
Install Nerd Fonts via Homebrew [updated & fixed]
# Nerd Fonts for your IDE
# https://www.nerdfonts.com/font-downloads
brew tap homebrew/cask-fonts && brew install --cask font-3270-nerd-font
brew tap homebrew/cask-fonts && brew install --cask font-fira-mono-nerd-font
brew tap homebrew/cask-fonts && brew install --cask font-inconsolata-go-nerd-font
brew tap homebrew/cask-fonts && brew install --cask font-inconsolata-lgc-nerd-font
brew tap homebrew/cask-fonts && brew install --cask font-inconsolata-nerd-font
brew tap homebrew/cask-fonts && brew install --cask font-monofur-nerd-font
brew tap homebrew/cask-fonts && brew install --cask font-overpass-nerd-font

Mac install Nerd Font (Fire code)

brew cask
brew tap homebrew/cask-fonts 
brew install font-fira-code
brew install font-Fira-Code-nerd-font
brew install font-hack-nerd-font
@abdivasiyev
abdivasiyev / init.nvim
Created October 20, 2022 07:46
Neovim configuration
call plug#begin()
Plug 'jiangmiao/auto-pairs'
Plug 'preservim/nerdcommenter'
Plug 'preservim/tagbar'
Plug 'preservim/nerdtree'
Plug 'tpope/vim-fugitive'
Plug 'fatih/vim-go'
Plug 'scrooloose/syntastic'
Plug 'fatih/molokai'
Plug 'ctrlpvim/ctrlp.vim'
@abdivasiyev
abdivasiyev / .tmux.conf
Last active June 21, 2023 01:26
Tmux config
# Use Alt-arrow keys to switch panes
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Shift arrow to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window
@abdivasiyev
abdivasiyev / colors.go
Created August 2, 2022 09:45 — forked from i0bj/colors.go
Golang colors
package main
import "fmt"
var (
Info = Teal
Warn = Yellow
Fata = Red
)