Skip to content

Instantly share code, notes, and snippets.

View gilbertoalbino's full-sized avatar

Gilberto Albino gilbertoalbino

View GitHub Profile
@gilbertoalbino
gilbertoalbino / tailwindcss-componentizacao.scss
Created November 20, 2019 01:00
Exemplo de componentização de seletores no TailwindCSS usando SCSS
.btn-city {
@apply block w-full rounded-full border border-gray-200 py-6;
@apply bg-gray-200 text-red-600 text-3xl text-center leading-tight;
&:focus {
@apply outline-none;
}
&:hover {
@apply bg-white border-gray-500;
@gilbertoalbino
gilbertoalbino / tailwindcss-componentizacao.css
Last active November 20, 2019 15:23
Exemplo de componentização de seletores no TailwindCSS usando SCSS
.btn-city {
@apply block w-full rounded-full border border-gray-200 py-6;
@apply bg-gray-200 text-red-600 text-3xl text-center leading-tight;
}
.btn-city:focus {
@apply outline-none;
}
<template>
<div class="cities">
<div v-for="(city, index) in cities">
<label :for="'city'+ index">Cidade {{ index + 1 }}</label>
<input v-focus
type="text"
:id="'city' + index"
v-model="cities[index]"
placeholder="Insira outra cidade">
</div>
@gilbertoalbino
gilbertoalbino / prototype.HTMLElement.js
Last active March 14, 2020 12:18
Prototype for extending HTMLElement capabilities of finding node by text
HTMLElement.prototype.getElementsByInnerText = function (text, escape) {
var nodes = this.querySelectorAll("*");
var matches = [];
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].innerText == text) {
matches.push(nodes[i]);
}
}
if (escape) {
return matches;
@gilbertoalbino
gilbertoalbino / blog-mysql-importacao-1.sh
Last active March 24, 2020 19:23
Importação Mysql Linha de Comando #1
mysql -h SERVER -u USERNAME -p < caminho/do/arquivo/nome_arquivo.sql
@gilbertoalbino
gilbertoalbino / blog-mysql-importacao-2.sh
Created March 24, 2020 19:22
Importação Mysql Linha de Comando #1
mysql -h SERVER -u USERNAME DATABASE -p < caminho/do/arquivo/nome_arquivo.sql
@gilbertoalbino
gilbertoalbino / blog-mysq-importacao-3.sh
Created March 24, 2020 19:34
Importação Mysql Linha de Comando #3
source caminho/do/arquivo/nome_arquivo.sql;
@gilbertoalbino
gilbertoalbino / block.js
Created September 13, 2020 20:30
block.js
var wpddb = {}
wpddb.contentTag = 'p';
wpddb.contentClass = 'wpddb-content';
(function (blocks, editor, element) {
var el = wp.element.createElement;
var RichText = editor.RichText;
blocks.registerBlockType('wpddb/promotion', {
title: 'WPDDB Promotion',
@gilbertoalbino
gilbertoalbino / media-queries-b4.scss
Created November 9, 2020 21:36 — forked from akolinski/media-queries-b4.scss
Media queries using SASS in Bootstrap 4
// -- Default media queries
// Extra small devices (Mobile phones, 0px and up)
// No media query needed since this is the default in Bootstrap
// Small devices (landscape phones, 576px and up)
@include media-breakpoint-up(sm) { ... }
// Medium devices (tablets, 768px and up)
@include media-breakpoint-up(md) { ... }
@gilbertoalbino
gilbertoalbino / Laravel-Container.md
Created November 22, 2020 22:19
Laravel's Dependency Injection Container in Depth

Laravel's Dependency Injection Container in Depth

Translations: Korean (by Yongwoo Lee)

Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.

Introduction to Dependency Injection

I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).