Skip to content

Instantly share code, notes, and snippets.

@locopine
locopine / macro.md
Created July 12, 2022 09:39 — forked from brunogaspar/macro.md
Recursive Laravel Collection Macros

What?

If a nested array is passed into a Laravel Collection, by default these will be threaded as normal arrays.

However, that's not always the ideal case and it would be nice if we could have nested collections in a cleaner way.

This is where this macro comes in handy.

Setup

@locopine
locopine / slash-search.js
Created June 28, 2022 22:16 — forked from caspark/slash-search.js
Google slash search
// ==UserScript==
// @name Google Slash Search
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.google.com/search*
// @grant none
// ==/UserScript==
@locopine
locopine / .env-Swoole
Created April 26, 2022 02:15 — forked from kiddtang/.env-Swoole
Youtube - Boosts your Laravel Sail
OCTANE_SERVER=swoole
OCTANE_HTTPS=true
@locopine
locopine / max_key_length_is_767_bytes.md
Created April 1, 2022 16:12
Laravel + MySQL <= 5.6.x - Syntax error or access violation: 1071 Specified key was too long;

Por quê MySQL retorna exceção ao executar migração em ambiende MySQL <= v5.6.x.

Illuminate\Database\QueryException 

  SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table `users` add unique `users_email_unique`(`email`))

Após longo debate com o suporte de uma famosa empresa de hospedagem e colocado em uma fila de espera para ter o DB migrado para versão MySQL >= v. 5.7, fiz minha própria analise para entender o porquê de tal comportamento. Consultei informações na web e me deparei com alguns comentários referente a cálculo de bytes, como pode ser visto no site Stack Exchange mais especificamente na parte de Database Administrators, onde no final de uma das respostas uma observação feita chamou minha atenção: "Also, have a look at why varchar(255) is a bad idea."!

Conventinal Commit Messages

See how a minor change to your commit message style can make a difference. Examples

Have a look at CLI util git-conventional-commits to ensure this conventions and generate changelogs

Commit Formats

Default

@locopine
locopine / git-force-clone.sh
Created March 23, 2022 22:27 — forked from nottrobin/git-force-clone.sh
git force-clone: clone a repository; if it already exists locally, reset it to a clone of the remote.
#! /usr/bin/env bash
set -euo pipefail
_usage() {
echo "
Usage:
git-force-clone -b branch remote_url destination_path
Example:
@locopine
locopine / .jsbeautifyrc
Last active March 19, 2022 23:56
Beautifier for javascript e etc...
{
"__comment1":"js-beaultify - https://github.com/beautify-web/js-beautify",
"__comment2":"blade",
"blade.php": {
"brace_style": "collapse",
"indent_char": " ",
"indent_scripts": "normal",
"indent_size": 6,
"max_preserve_newlines": 1,
"other": " ",
@locopine
locopine / xrandr.sh
Created February 25, 2022 20:18 — forked from debloper/xrandr.sh
Add system unrecognized but monitor supported resolution in X
#!/bin/bash
# Copyright (c) 2021 Soumya Deb <debloper@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@locopine
locopine / linux-mint_repair_boot_error.md
Last active February 22, 2022 23:09
Sobre vida para Dell Precision M4600 com placa gráfica falhando...

Seguir tutorial do video acrescido da adição/modificação no grub confome abaixo:

  1. manter "SHIFT" pressionado após inicialização BIOS;
  2. pressionar tecla "e" para editar grub;
  3. na linha iniciando com "linux" alterar "quiet splash" com "nouveau.modeset=0"; e
  4. pressionar "F10" para reiniciar.

Após entrara pelo CD Live, acessar "disco de instalação" em "/etc/default/grub" e editar as seguinte linhas:

@locopine
locopine / linux-mint-erros inicializacao.md
Created February 11, 2022 14:39
Linux Mint - Erros na inicialização

Referrer: # Tópico: Argumentos de Instalação (caso falhe)

Argumentos de Instalação (caso falhe)

« Online: 26 de Outubro de 2005, 16:00 »

tenho um processador AMD Atlhon 64 e desde a versão 5.04 tinha problema de travamentos e agora descobri que era por não ter colocado estes parâmetros na inicialização do CD/DVD de instalação. Adicione as opções no final da linha que já existe, sem alterar as demais opções: Citar

https://help.ubuntu.com/community/BootOptions