Skip to content

Instantly share code, notes, and snippets.

View beatwiz's full-sized avatar
🥶
#crunching

Gustavo Silva beatwiz

🥶
#crunching
View GitHub Profile
@beatwiz
beatwiz / functions.php
Created August 21, 2019 14:55
Hide DIVI Projects CPT
<?php
/**
* This will hide the Divi "Project" post type.
* Thanks to georgiee (https://gist.github.com/EngageWP/062edef103469b1177bc#gistcomment-1801080) for his improved solution.
*/
add_filter( 'et_project_posttype_args', 'mytheme_et_project_posttype_args', 10, 1 );
function mytheme_et_project_posttype_args( $args ) {
return array_merge( $args, array(
'public' => false,
'exclude_from_search' => false,
@beatwiz
beatwiz / sheet.md
Last active August 10, 2019 16:36
Laravel + Nova Cheat Sheet

New Laravel Model (With Controller and Migration)

php artisan make:model Status -a

New Nova Card

php artisan nova:card provider/nova-clock

New Nova Value

php artisan nova:value NewCommits

New Nova Trend

@beatwiz
beatwiz / pt.json
Last active August 10, 2019 20:37
Laravel Nova PT-PT Language file
{
"Actions": "Ações",
"Details": "Detalhes",
"If you did not request a password reset, no further action is required.": "Se não pediu uma reposição da palavra-passe, nenhuma ação é necessária.",
"Reset Password": "Reposição da palavra-passe",
"Sorry! You are not authorized to perform this action.": "Desculpe! Não tem autorização para fazer esta ação.",
"You are receiving this email because we received a password reset request for your account.": "Está a receber este email porque recebemos um pedido de reposição de palavra-passe para a sua conta.",
"Confirm Password": "Confirmar palavra-passe",
"Dashboard": "Painel",
"Email Address": "Endereço de Email",

TimeMachine backup to a network shared folder

Create a sparse image on the desktop or anywhere else

Change 600 to whatever size needed

hdiutil create -size 600g -type SPARSEBUNDLE -fs "HFS+J" TimeMachine.sparsebundle

Copy the sparsebundle to the network and mount it

Tell TimeMachine to use the mounted volume

sudo tmutil setdestination /Volumes/TimeMachine
@beatwiz
beatwiz / readme.md
Last active April 23, 2019 07:20
My VSCode Windows Setup - PHP/PHP-CS/Node/Quasar/Vetur

My VSCode Windows Setup

Support for:

  • PHP
  • Laravel (Blade)
  • Twig2
  • PHP Sniffer Linter and Fixer for WordPress Coding Standard
  • PHP-CS-FIXER (Symfony) For some reason PHP Sniffer doesn't fix properly using the Symfony Coding Standard, so we use this fixer for that particular standard
  • NodeJS
  • Quasar Framework
@beatwiz
beatwiz / functions.php
Created March 30, 2018 12:20
[wp] Load WP jquery in the footer
<?php
function jquery_mumbo_jumbo() {
wp_dequeue_script( 'jquery' );
wp_dequeue_script( 'jquery-core' );
wp_dequeue_script( 'jquery-migrate' );
wp_enqueue_script( 'jquery', false, array(), false, true );
wp_enqueue_script( 'jquery-core', false, array(), false, true );
wp_enqueue_script( 'jquery-migrate', false, array(), false, true );
}
add_action( 'wp_enqueue_scripts', 'jquery_mumbo_jumbo' );
@beatwiz
beatwiz / print.js
Created March 26, 2018 12:53
[JS] Print DIV contents using a new window, while copying all CSS to the new window
var divToPrint = document.getElementById('toPrint')
var newWin = window.open('', 'Print-Window')
var allCSS = [].slice.call(document.styleSheets)
.reduce(function (prev, styleSheet) {
if (styleSheet.cssRules) {
return prev +
[].slice.call(styleSheet.cssRules)
.reduce(function (prev, cssRule) {
return prev + cssRule.cssText
}, '')
@beatwiz
beatwiz / functions.php
Last active March 22, 2018 16:11
[wordpress] change custom post "Enter title here" description
<?php
function change_titles_text( $title ) {
$screen = get_current_screen();
if ( 'expert' == $screen->post_type ) {
$title = 'Enter expert name';
}
if ( 'slide' == $screen->post_type ) {
$title = 'Enter slide name / tag';
@beatwiz
beatwiz / table.js
Created March 22, 2018 10:54
pdfmake custom table border width and color
{
table: {
widths: ['*', '*'],
body: [
[{ style: 'ptable', bold: true, text: 'Name' }, { style: 'ptable', text: institution.individual[0].name }]
]
},
layout: {
hLineColor: function (i, node) { return '#555555' },
hLineWidth: function (i, node) { return 0.1 },
@beatwiz
beatwiz / component.js
Last active May 3, 2018 11:52
html2pdfmake vue method
/*
kudos:
https://github.com/ymkins/html2pdfmake/blob/master/html2pdfmake.js
https://github.com/bpampuch/pdfmake/pull/1055
https://github.com/bpampuch/pdfmake/pull/1054
*/
var pdfMake = require('pdfmake/build/pdfmake.js')
var pdfFonts = require('pdfmake/build/vfs_fonts.js')
pdfMake.vfs = pdfFonts.pdfMake.vfs