Skip to content

Instantly share code, notes, and snippets.

View cagartner's full-sized avatar

Carlos Augusto Gartner cagartner

View GitHub Profile
@cagartner
cagartner / formatar_telefones
Last active January 2, 2016 00:09 — forked from KennedyTedesco/gist:6173723
Formatar telefones
<?php
/**
*
* Formata um número de telefone para o formato (11) 11111-1111
*
* @author Kennedy Tedesco
* @param string $numero
* @return string
*/
<?php
error_reporting(0);
class Calendar {
var $bgColor = "#FFFFFF";
var $mouseOverColor = "#9999FF";
var $lineColor = "#000000";
var $fontColor = "#000000";
var $eventBgColor = "#BBBBFF";
var $eventStyle = "";

Problem with VirtualBox 4.3.12

It seems there is some problems between Vagrant 1.6.2 and VirtualBox 4.3.12 (the latest at the time or writing this), switching back to VirutalBox 4.3.6 or VirtualBox 4.3.8 seems to eliminate the problem.

update 1: Try both Vagrant 1.6.2 and VirtualBox 4.3.12 on Mac and they seem to work fine!

update 2: You need to enable Virtual Machine option in your BIOS to make VirtualBox work as expected. Saw someone mention about this in Laravel forum about this and it is true.

Also, Vagrant version should be 1.6.2.

@cagartner
cagartner / gist:25c6dc3b42ec1edecdd6
Last active September 30, 2015 18:15 — forked from molotovbliss/gist:2562551
Magento Snippets

Magento Snippets

Set all categories to is_anchor 1

Find attribute_id

SELECT * FROM eav_attribute where attribute_code = 'is_anchor'

Update all of them with anchor_id from above (usually is ID 51)

UPDATE `catalog_category_entity_int` set value = 1 where attribute_id = 51
@cagartner
cagartner / magento-code-snippets.md
Last active September 30, 2015 18:11 — forked from arosenhagen/magento-code-snippets.md
[magento] - code snippets

Magento Code Snippets

Download extension manually using mage

./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name
@cagartner
cagartner / gist:7ed7c93e27dca30618d7
Created October 19, 2015 23:32 — forked from mikejolley/gist:2044101
WooCommerce - Show number of items in cart and total
<a class="cart-contents" href="<?php echo WC()->cart->get_cart_url(); ?>" title="<?php _e( 'View your shopping cart' ); ?>"><?php echo sprintf (_n( '%d item', '%d items', WC()->cart->cart_contents_count ), WC()->cart->cart_contents_count ); ?> - <?php echo WC()->cart->get_cart_total(); ?></a>
@cagartner
cagartner / gist:ab5c9346b4dd5679e388
Created January 21, 2016 10:57 — forked from belsrc/gist:672b75d1f89a9a5c192c
Simple Vue.js filters that I usually need
/**
* Changes value to past tense.
* Simple filter does not support irregular verbs such as eat-ate, fly-flew, etc.
* http://jsfiddle.net/bryan_k/0xczme2r/
*
* @param {String} value The value string.
*/
Vue.filter('past-tense', function(value) {
// Slightly follows http://www.oxforddictionaries.com/us/words/verb-tenses-adding-ed-and-ing
var vowels = ['a', 'e', 'i', 'o', 'u'];
@cagartner
cagartner / header.php
Created July 6, 2016 20:04 — forked from jameskoster/header.php
WooCommerce - My Account link
<?php if ( is_user_logged_in() ) { ?>
<a href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ); ?>" title="<?php _e('My Account','woothemes'); ?>"><?php _e('My Account','woothemes'); ?></a>
<?php }
else { ?>
<a href="<?php echo get_permalink( get_option('woocommerce_myaccount_page_id') ); ?>" title="<?php _e('Login / Register','woothemes'); ?>"><?php _e('Login / Register','woothemes'); ?></a>
<?php } ?>
@cagartner
cagartner / woocommerce-installments-example.php
Created July 18, 2016 01:54 — forked from claudiosanches/woocommerce-installments-example.php
WooCommerce - Displays the price in 3 installments without interest.
<?php
/**
* Plugin Name: WooCommerce Installments Example
* Plugin URI: http://claudiosmweb.com/
* Description: Added the price with 3 installments without interest.
* Author: claudiosanches
* Author URI: http://www.claudiosmweb.com/
* Version: 1.0
* License: GPLv2 or later
*/
@cagartner
cagartner / functions.php
Created July 18, 2016 03:13 — forked from claudiosanches/functions.php
WooCommerce - Custom tag cloud shortcode
<?php
/**
* Custom WooCommerce tag cloud shortcode.
*
* Use the follow shortcode in your pages: [my_wc_tag_cloud]
*/
function my_custom_wc_tag_cloud_shortcode() {
return wp_tag_cloud( array( 'taxonomy' => 'product_tag', 'echo' => false ) );
}