Skip to content

Instantly share code, notes, and snippets.

View jjcodes78's full-sized avatar
🎯
Focusing

Jorge Gonçalves Junior jjcodes78

🎯
Focusing
View GitHub Profile
@jjcodes78
jjcodes78 / static-livereload-bss.js
Created April 1, 2020 18:15
Browsersync LR Server
// starts a hot reload server from a folder
browser-sync start --server 'public' --files '**/*.*'
@jjcodes78
jjcodes78 / config.json
Created March 20, 2020 18:33
VSCode configuration
{
// Define o tema do VSCode
"workbench.colorTheme": "Shades of Purple",
// Configura tamanho e família da fonte
"editor.fontSize": 18,
"editor.lineHeight": 24,
"editor.fontFamily": "Fira Code",
"editor.fontLigatures": true,
"explorer.compactFolders": false,
@jjcodes78
jjcodes78 / formatar_cnpj_cpf.md
Created July 27, 2019 03:54 — forked from davidalves1/formatar_cnpj_cpf.md
Função para formatar CNPJ e CPF, disponível em PHP e JS

PHP

function formatCnpjCpf($value)
{
  $cnpj_cpf = preg_replace("/\D/", '', $value);
  
  if (strlen($cnpj_cpf) === 11) {
    return preg_replace("/(\d{3})(\d{3})(\d{3})(\d{2})/", "\$1.\$2.\$3-\$4", $cnpj_cpf);
  } 
 
class MikrotikModel {
// atributos do model
protected $attributes = [];
// instância da API
protected $api;
// comando base
protected $baseComm = "/";
:global addNetmapRules do={
:for i from=0 to ($count - 1) do={
:local pRange "$($portStart + ($i * $portsPerAddr))-$($portStart + (($i + 1) * $portsPerAddr) - 1)"
/ip firewall nat add chain=src-nat action=netmap protocol=tcp \
src-address=($srcStart + ($i * 256)) to-address=$toAddr to-ports=$pRange
/ip firewall nat add chain=src-nat action=netmap protocol=udp \
src-address=($srcStart + ($i * 256)) to-address=$toAddr to-ports=$pRange
}
}
@jjcodes78
jjcodes78 / CiscoLicseGen.py
Created July 5, 2019 02:10
Cisco Lcnse Generator - IOL / IOU
#! /usr/bin/python
print "\n*********************************************************************"
print "Cisco IOU License Generator - Kal 2011, python port of 2006 C version"
import os
import socket
import hashlib
import struct
# get the host id and host name to calculate the hostkey
hostid=os.popen("hostid").read().strip()
hostname = socket.gethostname()

Instalar a dependência:

composer require league/flysystem-aws-s3-v3

No arquivo de config: filesystems.php

Criar um array novo em disks

@jjcodes78
jjcodes78 / broadcasting.php
Created May 20, 2019 00:41
Laravel WebSockets Config
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'encrypted' => env('WS_ENCRYPTED', true),
'host' => env('WS_HOST', '127.0.0.1'),
'port' => env('WS_PORT', 6001),
@jjcodes78
jjcodes78 / PivotTest.php
Last active November 5, 2018 04:43
Simple (Client x Employer x Occupation) pivot testing
<?php
namespace Tests\Feature;
use App\Client;
use App\Employer;
use App\Occupation;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;
@jjcodes78
jjcodes78 / project.deploy.sh
Created June 2, 2018 18:59
Codeship deploy script (/home/user/.deploy)
#!/usr/bin/env bash
#---------------------------------------------------------------
# Continuous Integration (CI) - Deployment Shell Script
# Build for deploy Laravel applications after CI check
# Author: Jorge -JJSQUADY- Junior
# July, 2017
#
# Transfer this file to server
# and run it: bash <name_of_this_script>
#---------------------------------------------------------------