Skip to content

Instantly share code, notes, and snippets.

View marcosfreitas's full-sized avatar
🔥
Looking forward

Marcos Freitas marcosfreitas

🔥
Looking forward
View GitHub Profile
@marcosfreitas
marcosfreitas / price.php
Last active August 29, 2015 13:56
Override price.php file - woocommerce - price do not returns decimal zero - put this script in "your-theme/woocommerce/loop/price.php"
<?php
/**
* Loop Price
* Overriding original price.php
* @author Marcos Freitas - WooThemes
* @package WooCommerce/Templates
* @version 1.6.4
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@marcosfreitas
marcosfreitas / woocommerce-implements-ajax.php
Created February 18, 2014 14:08
woocommerce structure to apply ajax into add_to_cart button while updates the cart automatically
<?php
/**
* Part of archive-product.php - add_to_cart button
* Template to apply ajax in button add to cart
* Original way to do add_to_cart button
*/
echo apply_filters( 'woocommerce_loop_add_to_cart_link',
sprintf( '<a href="%s" rel="nofollow" data-product_id="%s" data-product_sku="%s" class="button %s product_type_%s"><i class="icon icon-white icon-shopping-cart"></i> %s</a>',
esc_url( $product->add_to_cart_url() ),
esc_attr( $product->id ),
@marcosfreitas
marcosfreitas / simplexml-youttube-tempo-execucao.php
Created February 20, 2014 14:58
script que pega os vídeos enviado ao youtube por um determinado usuário.
<?php
$start = microtime(true);
header('Content-Type: text/html; charset=ISO-8859-1');
echo '<h3 style="color: #2e8ece; font-family: sans-serif; font-weight: normal !important; margin: 10px; width: 100%; text-align: center; clear:both;">Tempo inicial de execução do script: '.$start.'</h3>';
ini_set('display_errors', 1);
error_reporting(E_ALL);
?>
@marcosfreitas
marcosfreitas / facebook-delete-all-group-members.js
Last active September 22, 2016 10:10 — forked from babrath/fb_delete_allgroupmembers.js
This code works! Facebook disabled the native console brownser, but if you install the "Firebug" extension and run this script, it will work for you! This script does not delete the group, just remove all the other members and then terminates execution.
// first go to https://www.facebook.com/groups/XXXX/members/
// then paste this in the javascript console
// IF YOU WANT NOT TO INSTALL THE FIREBUG EXTENSION, YOU CAN ACTIVATE THE USE OF THE CONSOLE HERE: https://www.facebook.com/selfxss
deleteAll = [];
deleteAll.elms = [];
deleteAll.canClick = function (el) {
return (typeof el != 'undefined') && (typeof el.click != 'undefined');
}
@marcosfreitas
marcosfreitas / pagseguro-parcela18x-1.2.php
Last active August 29, 2015 14:02
Add the price with 18 installments with interest calculated using the factor of pagseguro.
<?php
/**
* Plugin Name: Woocommerce PagSeguro Price and 18 installments
* Description: Add the price with 18 installments with interest calculated using the factor of pagseguro.
* Adiciona o valor do produto dividido em 18 parcelas, que é a quantidade máxima no pagseguro.
* Esse cálculo é feito com os fatores correspondentes a cada bandeira de cartão. Dados originais do pagseguro.
* Author: Marcos Freitas http://fb.me/marcoosfreitas
* Version: 1.2
* -- changed names of functions and the order of the product price
* License: GPLv2 or later
@marcosfreitas
marcosfreitas / load-module-joomla-php.php
Created June 27, 2014 15:48
How to load a module created on Joomla calling by the name and title.
<?php
/**
* Carregando um módulo pelo nome
*/
if(!empty($anunciante_gk5)):
$modName = "mod_news_pro_gk5";
$modTitle = $anunciante_gk5;
$document = JFactory::getDocument();
$renderer = $document->loadRenderer('module');
@marcosfreitas
marcosfreitas / pega-img-string.php
Created July 17, 2014 16:56
Maneira para obter a tag img de uma string com php
<?php
/*É preciso tratar a string da descrição do câmbio pq o html vem sujo com IDs duplicados*/
$item['n_content'] = trim((string) $attr->description);
/*
exemplo de conteúdo:
<img src='http://imguol.com/c/noticias/2014/07/17/17jul2014---um-aviao-de-passageiros-da-malaysia-airlines-com-295-pessoas-bordo-caiu-na-ucrania-na-regiao-de-fronteira-com-a-russia-de-acordo-com-informacoes-da-agencia-russa-de-noticias-interfax-1405612628026_142x100.jpg' align="left" />
Veja o Álbum de fotos
*/
/* ==========================================================================
Buttons Class Configurations
========================================================================== */
/*
* Redefinition to bootstrap buttons
*/
.btn, .btn[disabled], .btn:focus, .btn:hover, .btn:active{
color: #333;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
@marcosfreitas
marcosfreitas / woocommerce-categories-list.php
Created August 13, 2014 15:08
Pega a lista de categorias do woocommerce de acordo com os parâmetros repassados na página de uma determinada categoria e forma um dropdown
/**
* Dropdown de categorias para design responsivo
* Pegando as categorias dos produtos de acordo com os argumentos passados
*/
$args = array( 'number' => $number, 'orderby' => $orderby, 'order' => $order, 'hide_empty' => true, 'include' => $ids );
$product_categories = get_terms( 'product_cat', $args );
?>
<ul id="list-widget-responsive">
<li id="" class="widget widget-responsive woocommerce widget_product_categories">
@marcosfreitas
marcosfreitas / jck-woothumbs-fix.js
Last active August 29, 2015 14:07
JCK WOOTHUMBS 4.0.0 - Manual Fix for Maximum call stack size exceeded error. If you have the license for the suport, don't do this, upgrade your version. But you don't have... :)
/* @author: Marcos Freitas */
/*
* Into function triggerSlider() replace the call for the function triggerEffects()
*/
// passing the limite of recursive executions
triggerEffects(10);
/*