Skip to content

Instantly share code, notes, and snippets.

View danielpereirabp's full-sized avatar

Daniel Pereira danielpereirabp

View GitHub Profile
FROM php:8.0-fpm
# Arguments defined in docker-compose.yml
ARG user
ARG uid
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
curl \
$ composer create-project --prefer-dist laravel/laravel project-name
$ cd project-name
$ sudo chown -R $USER:$USER .
https://phpdocker.io/generator
$ docker-compose up -d
$ docker exec -it container-name chgrp -R www-data storage bootstrap/cache
$ docker exec -it container-name chmod -R ug+rwx storage bootstrap/cache
@danielpereirabp
danielpereirabp / .zshrc
Created May 27, 2019 11:49
Docker Alias Functions
function git () {
(docker run -ti --rm -v ${HOME}:/root -v $(pwd):/git alpine/git "$@")
}
function composer () {
(docker run -ti --rm -v $(pwd):/app composer "$@")
}
function php56 () {
(docker run -ti --rm -v $(pwd):/app php:5.6-cli "$@")
@danielpereirabp
danielpereirabp / dev-env.md
Last active April 15, 2019 12:09
Development Environment

VSCODE

ESLINT

DOCKER

@danielpereirabp
danielpereirabp / nginx-proxy
Created June 22, 2018 19:19
Nginx Proxy - SPA (Vue 2) + API/ADMIN (Laravel 5.6)
server {
listen 80;
server_name domain.com.br;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8181;
  1. Setup Your Socks Proxy

ssh -D 127.0.0.1:1080 [email protected] -p 2002

  1. Add The Proxy to Your SSH Config

Add this to your ~/.ssh/config:

Host bitbucket.org IdentityFile ~/.ssh/gitkey

@danielpereirabp
danielpereirabp / trigger_check_create_order.sql
Last active February 28, 2018 17:42
Create trigger to stop insert
CREATE TABLE orders (
id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
total DECIMAL(8,2) NOT NULL,
delivery_date DATE NOT NULL,
status SMALLINT(6) NOT NULL DEFAULT '0',
client_id INT(10) UNSIGNED NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
@danielpereirabp
danielpereirabp / git-lf-clrf
Created July 20, 2017 12:37
Disable “LF will be replaced by CLRF” warning in Git on Windows
If you’ve ever used Git in windows, you may have seen something like this every time you add files to Git:
warning: LF will be replaced by CRLF in www/index.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in www/templates/dash.html.
The file will have its original line endings in your working directory.
If you want to turn it off, type this:
git config --global core.safecrlf false
@danielpereirabp
danielpereirabp / groupby.es
Created January 25, 2017 10:47
Elasticsearch Group By
POST /questoes_sf/questao/_search
{
"size": 0,
"query": {
"term": {
"instituicao.dominio": "na"
}
},
"aggs": {
"group_by_comparador": {
@danielpereirabp
danielpereirabp / git.txt
Created September 28, 2016 11:35 — forked from armoucar/git.txt
comandos git
Instalação do GIT no ubuntu:
sudo apt-get install git-core git-svn ssh gitk
ssh-keygen -t rsa
git config --global user.name "Arthur Moura Carvalho"
git config --global user.email "[email protected]"
git config --global color.status "auto"
git config --global color.branch "auto"
git config --global color.interactive "auto"
git config --global color.diff "auto"