Skip to content

Instantly share code, notes, and snippets.

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

Aristóteles Coutinho aristotelesbr

🏠
Working from home
View GitHub Profile

Reset mysql root password in Mac OS:

First Stop MySQL:

  1. Go to: 'System Preferences' >> 'MySQL' and stop MySQL

OR,

  1. sudo /usr/local/mysql/support-files/mysql.server start
  2. sudo /usr/local/mysql/support-files/mysql.server stop
@aristotelesbr
aristotelesbr / prepend_example.rb
Last active October 9, 2018 01:00
Last example
class AccountUser
prepend Account
def default_attributes
{
cpf: ''
}
end
end
class AccountStore
@aristotelesbr
aristotelesbr / module_example.rb
Last active October 9, 2018 00:50
module example
# Module.rb
module Account
def default_attributes
super.merge(common_attributes)
end
def common_attributes
{
name: '',
state: '',
@aristotelesbr
aristotelesbr / class_example.rb
Last active October 9, 2018 00:48
Example for post (working with modules from Ruby)
class A
def foo
'foo'
end
def bar
'bar'
end
end
@aristotelesbr
aristotelesbr / sutup.rb
Last active September 20, 2018 20:14
Configurando o ambiente de desenvolvimento Ruby on Rails no Linux com Rbenv (Linux Mint)
# Link para o video
# https://youtu.be/LnIWld2uZ-E
# Adicionando repósitorios NODE e YARN'''
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
# Instalando algumas dependencias
@aristotelesbr
aristotelesbr / NERDTree.mkd
Created September 7, 2018 18:56 — forked from m3nd3s/NERDTree.mkd
My Vim Cheat Sheet

NERDTree

o.......Open files, directories and bookmarks....................|NERDTree-o|
go......Open selected file, but leave cursor in the NERDTree.....|NERDTree-go|
t.......Open selected node/bookmark in a new tab.................|NERDTree-t|
T.......Same as 't' but keep the focus on the current tab........|NERDTree-T|
i.......Open selected file in a split window.....................|NERDTree-i|
gi......Same as i, but leave the cursor on the NERDTree..........|NERDTree-gi|
s.......Open selected file in a new vsplit.......................|NERDTree-s|
gs......Same as s, but leave the cursor on the NERDTree..........|NERDTree-gs|

O.......Recursively open the selected directory..................|NERDTree-O|

@aristotelesbr
aristotelesbr / VagrantFile.rb
Created September 26, 2017 09:49
VagrantFile
RUBY_VERSION="2.4.0"
RAILS_VERSION="5.0.2"
MYSQL_PASSWORD="123456"
GIT_USER_NAME="Costa Nonato"
GIT_USER_EMAIL="costa@nonato.com"
NODE_VERSION="6"
echo
...
** Execute deploy
** Invoke deploy:starting (first_time)
** Execute deploy:starting
** Invoke deploy:check (first_time)
** Execute deploy:check
** Invoke git:check (first_time)
** Invoke git:wrapper (first_time)
** Execute git:wrapper
00:00 git:wrapper
@aristotelesbr
aristotelesbr / protocolo.js
Created July 23, 2017 04:48
Exemplo nestend_attributes com rails
$("#tipo_doc").change(function() {
let id = this.value;
$("#campos").html(" ")
$.ajax({
headers: {
'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content')
},
url: '/protocolos/campos',
type: 'POST',
dataType: 'json',
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.0.3/vue.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<title>JS Bin</title>
<style id="jsbin-css">