Skip to content

Instantly share code, notes, and snippets.

View cagartner's full-sized avatar

Carlos Augusto Gartner cagartner

View GitHub Profile
@cagartner
cagartner / webpack.base.conf.js
Created December 19, 2016 11:19 — forked from vedovelli/webpack.base.conf.js
webpack base config for vue cli with support for Bootstrap and Font-awesome
var path = require('path')
module.exports = {
entry: {
app: './src/main.js'
},
output: {
path: path.resolve(__dirname, '../dist/static'),
publicPath: '/static/',
filename: '[name].js'
@cagartner
cagartner / remove-woocommerce-styles-scripts.php
Created November 9, 2016 22:44 — forked from gregrickaby/remove-woocommerce-styles-scripts.php
Remove WooCommerce styles and scripts.
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below into functions.php
/**
* Manage WooCommerce styles and scripts.
*/
function grd_woocommerce_script_cleaner() {
// Remove the generator tag
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
@cagartner
cagartner / filters.php
Created October 27, 2016 19:59 — forked from rodurma/filters.php
Filtros estilo GMail
<?php
$input = 'nome:ps4 sku:SKU7889-988;OI99129 data:10/12/2016 nome:Playstation 4 nome:Nintendo Wii sku:TESTE123 9aos';
preg_match_all('/(?:([^: ]+):)([^: ]+(?:\s+[^: ]+\b(?!:))*)/', $input, $matches, PREG_SET_ORDER);
echo $input;
echo '<pre>';
print_r($matches);
echo '</pre>';
@cagartner
cagartner / parse-hash-bang-arguments-in-javascript.js
Created October 6, 2016 17:43 — forked from miohtama/parse-hash-bang-arguments-in-javascript.js
Parse hash bang HTTP GET query style arguments from an URL using Javascript
/**
* Parse hash bang parameters from a URL as key value object.
*
* For repeated parameters the last parameter is effective.
*
* If = syntax is not used the value is set to null.
*
* #x&y=3 -> { x:null, y:3 }
*
* @param aURL URL to parse or null if window.location is used
@cagartner
cagartner / functions.php
Created July 26, 2016 12:35 — forked from fuyuko/functions.php
Cheatsheet - WooCommerce Customization in functions.php
//Add a stylesheet after default style.css
wp_enqueue_style( 'my-css', get_template_directory_uri() . 'my-css.css', array('themename-style'));
//WooCommerce - Sort products by SKU
add_filter('woocommerce_get_catalog_ordering_args', 'custom_woocommerce_catalog_orderby');
function custom_woocommerce_catalog_orderby( $args ) {
$args['meta_key'] = '_sku';
$args['orderby'] = 'meta_value';
$args['order'] = 'asc';
return $args;
@cagartner
cagartner / functions.php
Created July 25, 2016 17:33 — forked from WPprodigy/functions.php
Remove the password strength meter from WooCommerce checkout
function wc_ninja_remove_password_strength() {
if ( wp_script_is( 'wc-password-strength-meter', 'enqueued' ) ) {
wp_dequeue_script( 'wc-password-strength-meter' );
}
}
add_action( 'wp_print_scripts', 'wc_ninja_remove_password_strength', 100 );
@cagartner
cagartner / functions.php
Created July 18, 2016 03:27 — forked from claudiosanches/functions.php
WooCommerce - Redirect login to shop page
<?php
function custom_woocommerce_login_redirect( $url ) {
return get_permalink( wc_get_page_id( 'shop' ) );
}
add_filter( 'woocommerce_login_redirect', 'custom_woocommerce_login_redirect' );

Validação para cartão de crédito.

Bin e padrões para validação de cartão de crédito.

Bandeira Começa com Máximo de número Máximo de número cvc Regex
Visa 4 13,16 3 ^4[0-9]{12}(?:[0-9]{3})
Mastercard 5 16 3 ^5[1-5][0-9]{14}
Diners 301,305,36,38 link 14,16 3 `^3(?:0[0-5]
@cagartner
cagartner / credit-card.md
Created July 18, 2016 03:25 — forked from claudiosanches/credit-card.md
Credit Card - Snippets

Credit Card

Credit Card numbers for test

Credit card type EBANX payment type code Credit card numbers
American Express amex 378282246310005 or 371449635398431
Aura aura 5078601870000127985 or 5078601800003247449
Diners Club diners 30569309025904 or 38520000023237
Discover discover 6011111111111117
@cagartner
cagartner / test.php
Created July 18, 2016 03:25 — forked from claudiosanches/test.php
Regex for test credit card brand
<?php
// Test cards
$cards = array(
'378282246310005', // American Express
'371449635398431', // American Express
'5078601870000127985', // Aura
'5078601800003247449', // Aura
'30569309025904', // Diners Club
'38520000023237', // Diners Club