Skip to content

Instantly share code, notes, and snippets.

Working from home

Henrique Silvério HenriqueSilverio

Working from home
Block or report user

Report or block HenriqueSilverio

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View broker-manager.js
const BrokerManager = function BrokerManager () {
let connection = null
let channel = null
return Object.create({
async getConnection () {
if (!connection) {}
return connection
async getChannel () {
if (!channel) {}
View extract-from-playlist.js
(() => {
const tracksSelector = '.tracklist-row'
const $tracks = Array.from(document.querySelectorAll(tracksSelector))
const tracks = $tracks.reduce((result, track) => {
const { name, artist } = {
name: track.querySelector('.tracklist-name').innerText.trim(),
artist: track.querySelector('.tracklist-row__artist-name-link').innerText.trim()
return `${result}\n${name} - ${artist}`
}, '')
View get-children-products.php
function getChildrenProducts()
$productId = get_the_ID();
$product = wc_get_product($productId);
$childrenIds = $product->get_children();
if (empty($childrenIds)) {
return [];
View str_random.php
function str_random($length = 16)
$string = '';
$len = strlen($string);
while ($len < $length) {
$size = $length - $len;
HenriqueSilverio / 01--src-Contracts-Shortcode.php
Last active Oct 19, 2018
Object-Oriented approach to create shortcodes in WordPress plugins.
View 01--src-Contracts-Shortcode.php
namespace MyPlugin\Contracts;
interface Shortcode
public function getTag(): string;
public function start(): void;
HenriqueSilverio / permissions-seeder.php
Last active Sep 23, 2018
Laravel Roles and Capabilities seeder sample.
View permissions-seeder.php
use App\Models\Role;
use App\Models\Capability;
use Illuminate\Database\Seeder;
class PermissionsSeeder extends Seeder
private $roles = [[
'slug' => 'administrator',
HenriqueSilverio /
Last active Oct 3, 2018
Commands to build a fresh WordPress install using WP-CLI.

1. wp core download

2. wp core install

3. wp config create --dbname=wpdev --dbuser=homestead --dbpass=secret --dbcharset=utf8mb4 --dbcollate=utf8mb4_general_ci

4. wp config set WP_DEBUG true --raw --type=constant

5. wp core install --url={{ url }} --title={{ title }} --admin_user={{ user }} --admin_password={{ pass }} --admin_email={{ email }} --skip-email

View 01-text-field.js
class Field {
constructor(options = {}, validator = {}) {
this.props = {
type: options.type,
label: options.label,
placeholder: options.placeholder,
HenriqueSilverio /
Last active Jul 24, 2018
Passo a passo sobre como instalar e configurar o Redis em servidor Ubuntu.

Redis: Instalação e configuração


Para instalar o Redis vamos precisar dos pacotes build-essential e tcl.

Instale os pacotes com o seguinte comando:

sudo apt-get update

HenriqueSilverio /
Last active Oct 23, 2018
Instalação/Configuração de SSL/TLS no Nginx com Let’s Encrypt

SSL/TLS no Nginx com Let’s Encrypt

Instalar o cliente do Let’s Encrypt

Primeiro adicione o repositório do certbot com o seguinte comando:

add-apt-repository ppa:certbot/certbot

Em seguida instale o certbot e o plugin para o Nginx:

You can’t perform that action at this time.