Skip to content

Instantly share code, notes, and snippets.

View andreyuhai's full-sized avatar
🏠
Working from home

Burak andreyuhai

🏠
Working from home
View GitHub Profile
@andreyuhai
andreyuhai / install-vim-airline.md
Last active April 8, 2021 10:21
Install vim-airline plugin manually

Source

When you download the latest version of vim-airline as .zip and unzip it to a temporary directory, you get a vim-airline-master directory in the temp directory. Inside vim-airline-master you'll find autoload, doc and plugin directories.

You should either copy these three directories to your ~/.vim/ if they don't yet exist (don't overwrite existing directories with same names!) or copy the contents of the aforementioned three directories to existing directories under ~/.vim/

@andreyuhai
andreyuhai / elixir_ecto_array_diff_fragment.md
Last active July 28, 2021 13:48
Elixir Ecto pick elements from the first array that are not in the second array

How to get the difference of two arrays in an Ecto fragment?

You might want to get the difference between two arrays to update a row in Postresql, in your Elixir/Phoenix app. Here I explain how to do it.

SELECT
  coalesce(
    (
      SELECT
@andreyuhai
andreyuhai / _pizza_form.html.eex
Last active July 30, 2021 22:38
Pizzapp Snippets
<%= form_for @changeset, @action, fn f -> %>
<h3>Type</h3>
<%= select f, :type, @pizza_types %>
<%= error_tag f, :type %>
<div class="form-group">
<h3>Extras</h3>
<%= for extras <- inputs_for(f, :extras) do %>
<%= for extra <- @extras do %>
<div>
@andreyuhai
andreyuhai / .vimrc
Last active October 20, 2022 06:27
Vimrc
source $VIMRUNTIME/defaults.vim
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
@andreyuhai
andreyuhai / stable_marriage_problem.ex
Last active October 6, 2024 17:27
Stable marriage problem algorithm implementation in Elixir
defmodule StableMarriageProblem do
@moduledoc """
Implements the algorithm for stable marriage problem.
"""
@type person_id :: integer()
# Denotes a preference list for a single person
@type preference_list :: [person_id(), ...]