Skip to content

Instantly share code, notes, and snippets.

View lucianobragaweb's full-sized avatar
🏠
Working from home

Luciano Braga lucianobragaweb

🏠
Working from home
View GitHub Profile
@lucianobragaweb
lucianobragaweb / Post.php
Created November 15, 2023 13:12
Laravel Observers
class Post extends Model {
protected static function boot() {
parent::boot();
self::observe(NomeDoObserver::class);
}
}
@lucianobragaweb
lucianobragaweb / onlyNumbers.php
Created July 17, 2023 01:37
Deixar apenas os números de uma String PHP
<?php
$cpf = '123.158.124-22';
$cpf = preg_replace("/[^0-9]/", "", $cpf);
echo($cpf); // Resultado: 12315812422
@lucianobragaweb
lucianobragaweb / if_ternario.blade.php
Created July 16, 2023 20:53
If ternário na View com Laravel/Blade
{ $value or "default" }
@lucianobragaweb
lucianobragaweb / dateToBr.js
Last active October 30, 2021 23:12
Converter data em formato americano para Brasileiro
function dateToBr(date) {
let splited = date.split('T')
let splitedDate = splited[0].split('-').reverse().join('/')
let hour = splited[1]
return `${splitedDate} ${hour}`
}
console.log(dateToBr('2021-10-21T05:51:03'))
# Remove apps if not will use
k3b, konversation, thunderbird
# Add sudo password
sudo passwd root
# Set the fastest mirror
sudo pacman-mirrors --fasttrack
"scripts": {
"postinstall": "npm run postinstall:electron && npx electron-builder install-app-deps",
"postinstall:web": "node postinstall-web",
"postinstall:electron": "node postinstall",
"ng": "ng",
"start": "npm run postinstall:electron && npm-run-all -p ng:serve electron:serve",
"build": "node clean && npm run postinstall:electron && npm run electron:tsc && ng build",
"build:dev": "npm run build -- -c dev",
"build:prod": "npm run build -- -c production",
"ng:serve": "ng serve",
@lucianobragaweb
lucianobragaweb / magnific-popup.js
Created September 17, 2020 16:27
Configuração Magnific Popup
(function($) {
$(window).load(function () {
// retrieved this line of code from http://dimsemenov.com/plugins/magnific-popup/documentation.html#api
$.magnificPopup.open({
items: {
src: 'https://www.youtube.com/watch?v=7eo8XpT4CmM'
},
type: 'iframe',
iframe: {
markup: '<div class="mfp-iframe-scaler">'+
@lucianobragaweb
lucianobragaweb / getVersion.js
Created May 2, 2020 13:10
Get App Version package.json
var pjson = require('./package.json');
console.log(pjson.version);
@lucianobragaweb
lucianobragaweb / Dockerfile
Last active May 2, 2020 13:14
Docker Compose
FROM php:7.2-fpm
# Copy composer.lock and composer.json
COPY composer.lock composer.json /var/www/
# Set working directory
WORKDIR /var/www
# Install dependencies
RUN apt-get update && apt-get install -y \
@lucianobragaweb
lucianobragaweb / Instructions.sh
Created January 15, 2020 20:29 — forked from GhazanfarMir/Instructions.sh
Install PHP7.2 NGINX and PHP7.2-FPM on Ubuntu 16.04
########## Install NGINX ##############
# Install software-properties-common package to give us add-apt-repository package
sudo apt-get install -y software-properties-common
# Install latest nginx version from community maintained ppa
sudo add-apt-repository ppa:nginx/stable
# Update packages after adding ppa