Skip to content

Instantly share code, notes, and snippets.

Updating knowledgebase...

Luis Braschi CasperBraske

Updating knowledgebase...
View GitHub Profile
emanweb / vendasporanoeestado.php
Last active May 24, 2022 12:08
Relatório de vendas por ano e estado brasilero para WooCommerce
View vendasporanoeestado.php
* @snippet Relatorio de vendas por ano e estado brasileiro @ WooCommerce Admin
* @sourcecode
* @author Emanuel Costa
* @testedwith WooCommerce 6.3.1
* @inspiredby (Rodolfo Melogli)
* @instructions Inclua esse código no functions.php to seu tema filho (child theme)
// -----------------------
CasperBraske / Referência de filtros Marketplace-Melhor
Last active August 7, 2022 22:05
Referência de filtros Marketplace/Melhor Envio
View Referência de filtros Marketplace-Melhor


add_filter( 'arti_mpme_show_messages_in_cart', '__return_true' );

Mostra mensagens de debug ("depuração") no carrinho para usuários administradores referentes ao cálculo do frete, como erros de configuração do vendedor e mensagens de retorno da API.

add_filter( 'arti_me_force_agency_list_update', '__return_true' );
emilfolino / cbsg.bash
Created November 29, 2019 06:42
Corporate Bullshit Generator
View cbsg.bash
curl -s | grep -Eo '^<li>.*</li>' | sed s,\</\\?li\>,,g | shuf -n 1
mikeschinkel /
Last active January 24, 2023 05:47
Examples for how a __toArray() magic method could be useful in PHP.

Examples for how a __toArray() magic method could be useful in PHP.

In a nutshell, __toArray() would not be as useful when you have full control over the entire codebase.

But where __toArray() would be extremely useful is in interfacing with existing code that expects arrays and wants those arrays to be a specific format. Using classes and type-hinted methods allow to encapsulate the intelligence into the class, and using __toArray() makes for a nature use-case.

View css-layout-hack.js
// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit:
javascript: (function() {
var styleEl = document.getElementById('css-layout-hack');
if (styleEl) {
styleEl = document.createElement('style'); = 'css-layout-hack';
sarthology / regexCheatsheet.js
Created January 10, 2019 07:54
A regex cheatsheet 👩🏻‍💻 (by Catherine)
View regexCheatsheet.js
let regex;
/* matching a specific string */
regex = /hello/; // looks for the string between the forward slashes (case-sensitive)... matches "hello", "hello123", "123hello123", "123hello"; doesn't match for "hell0", "Hello"
regex = /hello/i; // looks for the string between the forward slashes (case-insensitive)... matches "hello", "HelLo", "123HelLO"
regex = /hello/g; // looks for multiple occurrences of string between the forward slashes...
/* wildcards */
regex = /h.llo/; // the "." matches any one character other than a new line character... matches "hello", "hallo" but not "h\nllo"
regex = /h.*llo/; // the "*" matches any character(s) zero or more times... matches "hello", "heeeeeello", "hllo", "hwarwareallo"
CasperBraske / SublimeLinter.sublime-settings
Created April 14, 2018 20:49
Correcting the error "SublimeLinter: WARNING: phpcs cannot locate 'phpcs'" on Ubuntu 16.04
View SublimeLinter.sublime-settings
// SublimeLinter Settings - User
"linux": ["~/.config/composer/vendor/bin"]
fernandoacosta / functions.php
Last active January 29, 2020 17:04 — forked from SiR-DanieL/functions.php
Exibir produtos recentes quando nenhum produto for encontrado na busca
View functions.php
add_action( 'woocommerce_no_products_found', 'show_products_on_no_products_found', 20 );
function show_products_on_no_products_found() {
echo '<h2>' . __( 'Mas você pode gostar disso...', 'domain' ) . '</h2>';
echo do_shortcode( '[recent_products per_page="4"]' );
CasperBraske / toggle.js
Last active December 9, 2017 20:14
A bookmarklet to quickly toggle admin bar in WordPress .
View toggle.js
javascript: (function() {
var htmlStyle =;
var adminBarStyle = document.getElementById('wpadminbar').style;
if(undefined == window.hasAdminBar){
window.hasAdminBar = true;
var cssText, display;
CasperBraske / .bashrc
Created May 26, 2017 08:52
My .bashrc setup.
View .bashrc
source /opt/wp-completion.bash
export DEV=/var/www/html
export EDITOR=subl
export PS1="\[$(tput bold)\]\[\033[38;5;58m\]\u\[$(tput sgr0)\]\[\033[38;5;15m\]@\[$(tput sgr0)\]\[\033[38;5;58m\]\H\[$(tput sgr0)\]\[$(tput sgr0)\]\[\033[38;5;15m\] [\t] \w \\$\n> \[$(tput sgr0)\]"
# function to set terminal title
function set-title() {
if [[ -z "$ORIG" ]]; then