Skip to content

Instantly share code, notes, and snippets.

Avatar
🤓
Updating knowledgebase...

Luis CasperBraske

🤓
Updating knowledgebase...
View GitHub Profile
@emanweb
emanweb / vendasporanoeestado.php
Last active May 24, 2022
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 https://gist.github.com/emanweb/3272d93d481e8c749edaa2cce2641b28
* @author Emanuel Costa
* @testedwith WooCommerce 6.3.1
* @inspiredby https://businessbloomer.com/?p=72853 (Rodolfo Melogli)
* @instructions Inclua esse código no functions.php to seu tema filho (child theme)
*/
// -----------------------
@CasperBraske
CasperBraske / Referência de filtros Marketplace-Melhor Envio.md
Last active Mar 25, 2021
Referência de filtros Marketplace/Melhor Envio
View Referência de filtros Marketplace-Melhor Envio.md

Utilidades

add_filter( 'arti_mpme_show_messages_in_cart', '__return_true' );

Mostra mensagens de debug ("depuração") no carrinho para usuários administradores rereferentes 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
emilfolino / cbsg.bash
Created Nov 29, 2019
Corporate Bullshit Generator
View cbsg.bash
curl -s http://pasta.phyrama.com:8083/cgi-bin/live.exe | grep -Eo '^<li>.*</li>' | sed s,\</\\?li\>,,g | shuf -n 1
@mikeschinkel
mikeschinkel / _readme.md
Last active Oct 17, 2021
Examples for how a __toArray() magic method could be useful in PHP.
View _readme.md

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: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var styleEl = document.getElementById('css-layout-hack');
if (styleEl) {
styleEl.remove();
return;
}
styleEl = document.createElement('style');
styleEl.id = 'css-layout-hack';
@sarthology
sarthology / regexCheatsheet.js
Created Jan 10, 2019
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
CasperBraske / SublimeLinter.sublime-settings
Created Apr 14, 2018
Correcting the error "SublimeLinter: WARNING: phpcs cannot locate 'phpcs'" on Ubuntu 16.04
View SublimeLinter.sublime-settings
// SublimeLinter Settings - User
{
"paths":
{
"linux": ["~/.config/composer/vendor/bin"]
}
}
@fernandoacosta
fernandoacosta / functions.php
Last active Jan 29, 2020 — 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
CasperBraske / toggle.js
Last active Dec 9, 2017
A bookmarklet to quickly toggle admin bar in WordPress .
View toggle.js
javascript: (function() {
var htmlStyle = document.documentElement.style;
var adminBarStyle = document.getElementById('wpadminbar').style;
if(undefined == window.hasAdminBar){
window.hasAdminBar = true;
}
var cssText, display;
@CasperBraske
CasperBraske / .bashrc
Created May 26, 2017
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
ORIG=$PS1