Skip to content

Instantly share code, notes, and snippets.

View alduro's full-sized avatar

Aldo Nievas alduro

  • Buenos Aires - Argentina
  • 08:30 (UTC -03:00)
View GitHub Profile
@alduro
alduro / gist:81574d4dd9d7156aaf4bf3a38107dc91
Created February 21, 2020 12:37
~/.config/nvim/init.vim
if has('vim_starting')
set runtimepath+=~/.config/nvim/
endif
" Coc setup
set hidden
set nobackup
set nowritebackup
" Better display for messages
set cmdheight=1
@alduro
alduro / gist:302e336fd2903ee2c990e239fae958ff
Created February 15, 2020 13:40
~/.config/nvim/init.vim
scriptencoding utf-8
if has('vim_starting')
set runtimepath+=~/.config/nvim/
endif
set guifont=Menlo\ Regular:h16
" ============================================================================ "
" === PLUGINS === "
" ============================================================================ "
@alduro
alduro / tmux
Last active October 3, 2019 14:47
set-option -g mouse on
set -sg escape-time 0
# Setting the prefix from C-b to C-a
set -g prefix C-a
# Free the original Ctrl-b prefix keybinding
unbind C-b
# Reload the file with Prefix r
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
[alias]
co = checkout
ci = commit
st = status
br = branch
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
type = cat-file -t
dump = cat-file -p
update-from = "!f() { git fetch $1 --prune; git merge --ff-only $1/$2 || git rebase --preserve-merges $1/$2; }; f"
[user]
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
export LANG="en_US.UTF-8"
export LC_COLLATE="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
export LC_MESSAGES="en_US.UTF-8"
export LC_MONETARY="en_US.UTF-8"
export LC_NUMERIC="en_US.UTF-8"
export LC_TIME="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
set nocompatible " be iMproved, required
filetype off " required
let mapleader = ','
set wildmenu
set autoread
set encoding=utf-8
" ----- Powerline ----------------------------------
set guifont=Meslo\ LG\ L\ DZ\ for\ Powerline:h14
let g:Powerline_symbols = 'fancy'
Part of the code in the controller
if changeset_order.valid? do
Repo.transaction fn ->
# Save Order
order = changeset_order
|> Repo.insert!
|> Repo.preload(:buyer)
# Save Order Products
@alduro
alduro / elixir
Last active April 16, 2017 19:22
def create(conn, _params) do
case Plug.Conn.read_body(conn) do
{:ok, body, conn} ->
{:ok, data} = Poison.decode(body)
{:error, reason} ->
render(ExRushlookApi.OrderView, "error.json", error: reason)
end
# Get Buyer
user = Repo.get_by!(User, email: "test@email.com) |> Repo.preload(:buyer)
8 def render("show.json", %{category: category}) do
9 category |> IO.inspect
10 %{id: category.id,
11 name: category.name,
12 slug: category.slug,
13 parent_id: category.parent_id,
14 products: render_many(category.products, ExRushlookApi.ProductView, "show.json", as: :product) }
15 |> add_subcategories(category)
16 end
17
def render("product.json", %{product: product}) do
%{id: product.id,
name: product.name,
description: product.description,
price: product.price}
|> add_options(product)
end
defp add_options(json, %{product: product}) do
options =