Skip to content

Instantly share code, notes, and snippets.

View esdras's full-sized avatar

Esdras Mayrink esdras

View GitHub Profile
call plug#begin('~/.local/share/nvim/plugged')
"
" Plugins from: https://hannadrehman.com/top-neovim-plugins-for-developers-in-2022
" Rust setup from: https://rsdlt.github.io/posts/rust-nvim-ide-guide-walkthrough-development-debug/
"
"
Plug 'rust-lang/rust.vim'
Plug 'scrooloose/nerdcommenter' "
Plug 'phaazon/hop.nvim' "keyword base navigation
# add to fix issue with mysql 7+
# https://github.com/rails/rails/pull/13247#issuecomment-158787912
# http://stackoverflow.com/questions/21075515/creating-tables-and-problems-with-primary-key-in-rails
class ActiveRecord::ConnectionAdapters::Mysql2Adapter
NATIVE_DATABASE_TYPES[:primary_key] = "int(11) auto_increment PRIMARY KEY"
alias :connect_no_sql_mode :connect
def connect
connect_no_sql_mode

Getting started with Webpack, TypeScript, Babel and React

Introduction

The Javascript world is full of buzzwords, there is four only in the title of this article. With all these tools coming and going so fast, it's tuff to keep up the pace. I'm a ruby developer and recently I felt the need to improve my productivity in frontend development. With rails we have the asset pipeline but it seems that the javascript world has better tools to offer. While I was doing my research I stumbled upon these tools and started to see the values they bring, hopefully those values will be clear to you at the end of this article.

If you're like me and are not familiar with these tools, it can be daunting to get started. There is so much to learn and it's tempting to go back and just use jQuery. I made this tutorial because I myself wanted to learn. This tutorial will help you to implement a hello world app using these tools.

defmodule MyApp.Users.Input do
@moduledoc false
@type params :: map() | Keyword.t()
alias MyApp.Utils
alias MyApp.Users.{User}
defmodule Create do
@moduledoc """
Input for `MyApp.Users.create/1`
@esdras
esdras / router.ex
Last active May 13, 2019 18:29
Phoenix Router - scope vs pipeline
# Router é feito com macros, pipeline e scopes são macros.
# O `scope` é um grupo de rotas que compartilham determinado prefixo.
# Você pode criar um escopo para agrupar as rotas do painel admin de uma aplicação
# e outro para a API json da sua aplicação, etc..
# rotas da área admin do sistema
scope "/admin", MeuAppWeb.Admin do
get "/foo/new", FooController, :new # vai ser compilado como: GET /admin/foo/new
end
@esdras
esdras / Sentry-Install-Ubuntu-16-04
Created November 30, 2018 18:54 — forked from RabbitMC/Sentry-Install-Ubuntu-16-04
Setup sentry on Ubuntu 16.04 server
# Project: https://github.com/getsentry/sentry
# Doc: https://docs.getsentry.com/on-premise/server/installation/python/
udo apt-get update
sudo apt-get install python-virtualenv
sudo apt-get install python-setuptools
sudo apt-get install python-pip
sudo apt-get install libxslt1-dev
sudo apt-get install gcc
@esdras
esdras / install_sentry.sh
Created November 30, 2018 18:54 — forked from bjmc/install_sentry.sh
Basic setup script for installing Sentry (http://getsentry.com) + Redis on new Ubuntu 14.04 Amazon EC2 instance
#! /bin/bash
export RUN_AS='ubuntu';
export INSTALL_DIR='/var/www/sentry';
HOSTNAME='http://mysentry.example.com'; # No trailing slash
DB_HOST='something.rds.amazonaws.com';
DB_PORT='5432';
DB_USER='sentry';
DB_NAME='sentry';
DB_PASSWORD='DB_PASSWORD';
@esdras
esdras / network-tweak.md
Created April 27, 2018 20:35 — forked from mustafaturan/network-tweak.md
Linux Network Tweak for 2 million web socket connections

Sample config for 2 million web socket connection

    sysctl -w fs.file-max=12000500
    sysctl -w fs.nr_open=20000500
    # Set the maximum number of open file descriptors
    ulimit -n 20000000

    # Set the memory size for TCP with minimum, default and maximum thresholds 
 sysctl -w net.ipv4.tcp_mem='10000000 10000000 10000000'
@esdras
esdras / run phoenix on amazon linux.sh
Last active November 14, 2016 23:05 — forked from eikes/run phoenix on amazon linux.sh
run phoenix on amazon linux
# app deps
sudo yum update -y
# utf8 all the things
echo '
export LC_ALL="en_US.UTF-8"
export LANG="en_US.UTF-8"
export LANGUAGE="en_US.UTF-8"
' >> ~/.bashrc
@esdras
esdras / sqlEmbeddedInVim.vim
Created September 20, 2016 22:03
SQL embedded in vim heredoc string
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Sql
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" use with vim-polyglot
" paste in vim-polyglot/after/syntax/ruby.vim
let s:bcs = b:current_syntax
unlet b:current_syntax
syn include @SQL syntax/pgsql.vim
let b:current_syntax = s:bcs
syntax region rubyHereDocSQL matchgroup=Statement start=+<<\z(SQL\)+ end=+^\z1$+ contains=@SQL