Skip to content

Instantly share code, notes, and snippets.

View claudiosanches's full-sized avatar
👨‍💻

Claudio Sanches claudiosanches

👨‍💻
View GitHub Profile
@claudiosanches
claudiosanches / gist:fa02e18296e5a1a7ecf6
Last active August 29, 2015 14:26 — forked from ezimuel/gist:9135151
Tesing SimpleXML and DOMDocument to prevent XXE attacks on XML
<?php
// The libxml entity loader is disabled by default
// even setting the libxml_disable_entity_loader to false doesn't works!
//
// @see http://uk3.php.net/manual/en/function.libxml-disable-entity-loader.php
// @see http://stackoverflow.com/a/10213239
$dir = __DIR__;
$content = 'This is a remote content!';
file_put_contents('content.txt', $content);
$sprites: sprite-map("sprites/*.png");
$sprites-retina: sprite-map("sprites-retina/*.png");
@mixin sprite-background($name) {
background-image: sprite-url($sprites);
background-position: sprite-position($sprites, $name);
background-repeat: no-repeat;
display: block;
height: image-height(sprite-file($sprites, $name));
width: image-width(sprite-file($sprites, $name));
<?php
/*
Template Name: Print Processing Orders :)
*/
if (!is_user_logged_in() || !current_user_can('manage_options')) wp_die('This page is private.');
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
@mixin linear-gradient($angle, $color-stops...) {
$_angle-with-vendor-prefix: "";
$_angle: "";
@if $angle == "to top" or $angle == "bottom" {
$_angle-with-vendor-prefix: bottom;
$_angle: to top;
} @else if $angle == "to right" or $angle == "left" {
$_angle-with-vendor-prefix: left;
$_angle: to right;
} @else if $angle == "to bottom" or $angle == "top" {
@claudiosanches
claudiosanches / functions.php
Created September 11, 2013 07:06
WooCommerce - Max and Min
/**
* This code should be added to functions.php of your theme
**/
add_filter('woocommerce_variable_price_html', 'custom_variation_price', 10, 2);
function custom_variation_price( $price, $product ) {
$price = '';
if ( !$product->min_variation_price || $product->min_variation_price !== $product->max_variation_price ) $price .= '<span class="from">' . _x('From', 'min_price', 'woocommerce') . ' </span>';
<?php
/*
Template Name: Print Processing Orders :)
*/
if (!is_user_logged_in() || !current_user_can('manage_options')) wp_die('This page is private.');
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
"abaixo","aca","acaso","acerca","acima","acola","acula","ademais","adentro","adiante","afinal","afora","agora","agorinha","ah","ainda","alem","algo","alguem","algum","alguma","algumas","alguns","ali","alias","alo","ambos","amiude","ante","antes","ao","aonde","aos","apenas","apesar","apos","apud","aquela","aquelas","aquele","aqueles","aqui","aquilo","as","assim","ate","atras","atraves","basicamente","bastante","bastantes","bem","bis","bom","ca","cada","cade","caso","certa","certamente","certas","certeiramente","certo","certos","chez","chi","comigo","como","comumente","conforme","confronte","conosco","conquanto","consequentemente","consigo","consoante","contanto","contigo","contra","contudo","convosco","cuja","cujas","cujo","cujos","da","dai","dali","dantes","daquela","daquelas","daquele","daqueles","daqui","daquilo","das","de","debaixo","defronte","dela","delas","dele","deles","demais","dentre","dentro","depois","desde","dessa","dessas","desse","desses","desta","destas","deste","destes","detras","deveras","dia
// SmoothScroll for websites v1.2.1
// Licensed under the terms of the MIT license.
// People involved
// - Balazs Galambosi (maintainer)
// - Michael Herf (Pulse Algorithm)
(function(){
// Scroll Variables (tweakable)
<?php
// Activate menu function
add_action( 'init', 'my_custom_menus' );
function my_custom_menus() {
register_nav_menus( array(
'main-menu' => 'Main Menu',
'footer-menu' => 'Footer Menu', 'top_menu' => 'Top Menu', 'resp_menu' => 'Responsive Menu'
) );
// Ensure cart contents update when products are added to the cart via AJAX (place the following in functions.php)
add_filter('add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment');
function woocommerce_header_add_to_cart_fragment( $fragments ) {
global $woocommerce;
ob_start();
?>
<a class="cart-contents" href="<?php echo $woocommerce->cart->get_cart_url(); ?>" title="<?php _e('View your shopping cart', 'woothemes'); ?>"><?php echo sprintf(_n('%d item', '%d items', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count);?> - <?php echo $woocommerce->cart->get_cart_total(); ?></a>