Skip to content

Instantly share code, notes, and snippets.

View monecchi's full-sized avatar

Adriano Monecchi monecchi

View GitHub Profile
@monecchi
monecchi / dabblet.css
Created March 8, 2014 00:56
Respond Tutorial by Mat Helme on TreeHouse Blog:
/**
* Respond Tutorial by Mat Helme on TreeHouse Blog:
* http://blog.teamtreehouse.com/create-an-absolute-basic-mobile-css-responsive-navigation-menu
*/
/*RESET*/
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {margin:0; padding:0; border:0; outline:0; font-size:100%; vertical-align:baseline; background:transparent;} body {line-height: 1;}ol, ul{list-style:none;} blockquote, q{quotes:none;} blockquote:before, blockquote:after, q:before, q:after{content:'';content:none;} :focus{outline:0;} ins{text-decoration:none;} del{text-decoration:line-through;} table{border-collapse:collapse; border-spacing:0;}
/*MAIN*/
body {
@monecchi
monecchi / formspree.html
Created November 23, 2015 10:52 — forked from manfromanotherland/formspree.html
JS: Ajax send forms using the most excellent Formspree » http://formspree.io #snippet
<form id="contact-form" action="//formspree.io/your@email.com" method="post">
<input type="text" name="Name" placeholder="Name" required>
<input type="email" name="Email" placeholder="Email" required>
<textarea name="Message" cols="30" rows="6" placeholder="Message" required></textarea>
<!-- CONFIG -->
<input class="is-hidden" type="text" name="_gotcha">
<input type="hidden" name="_subject" value="Subject">
<input type="hidden" name="_cc" value="email@cc.com">
<!-- /CONFIG -->
<input class="submit" type="submit" value="Send">
@monecchi
monecchi / Easy Parallax effect on scroll (no plugin).markdown
Created December 4, 2015 03:30
Easy Parallax effect on scroll (no plugin)

Easy Parallax effect on scroll (no plugin)

Simple parallax effect with no need of plugins. Give an element absolutely positioned an #id or .class and fire up the javascript.

A Pen by Adriano Monecchi on CodePen.

License.

@monecchi
monecchi / fix_homebrew.rb
Created December 16, 2015 12:41 — forked from rpavlik/fix_homebrew.rb
Fix permissions on /usr/local for Homebrew
#!/usr/bin/ruby
#
# This script fixes /usr/local only.
#
# 6th January 2010:
# Modified the script to just fix, rather than install. - rpavlik
#
# 30th March 2010:
# Added a check to make sure user is in the staff group. This was a problem
# for me, and I think it was due to me migrating my account over several
@monecchi
monecchi / Add Custom CSS to Anchors links in WordPress
Created March 8, 2016 17:30 — forked from tahirtaous/Add Custom CSS to Anchors links in WordPress
How to Add Custom CSS Class Directly to Menu Item (Anchors) Links in WordPress Theme
// Redirect customers to another page with your personal thoughts and thank you message instead of woocommerce default thank you page.
add_action( 'template_redirect', 'wc_custom_redirect_after_purchase' );
function wc_custom_redirect_after_purchase() {
global $wp;
if ( is_checkout() && ! empty( $wp->query_vars['order-received'] ) ) {
wp_redirect( 'http://www.yoururl.com/your-page/' );
exit;
}
}
@monecchi
monecchi / gist:e601af119317e20242ee7af7aa616c37
Created April 1, 2016 21:05 — forked from webaware/gist:6260468
WooCommerce purchase page add-to-cart with quantity and AJAX, without customising any templates. See blog post for details: http://snippets.webaware.com.au/snippets/woocommerce-add-to-cart-with-quantity-and-ajax/
<?php
/**
* start the customisation
*/
function custom_woo_before_shop_link() {
add_filter('woocommerce_loop_add_to_cart_link', 'custom_woo_loop_add_to_cart_link', 10, 2);
add_action('woocommerce_after_shop_loop', 'custom_woo_after_shop_loop');
}
add_action('woocommerce_before_shop_loop', 'custom_woo_before_shop_link');
@monecchi
monecchi / functions.php
Created April 7, 2016 15:30 — forked from claudiosanches/functions.php
WooCommerce - Change product loop add to cart button
<?php
function custom_woocommerce_loop_add_to_cart_link( $html, $product ) {
return '<a href="' . get_permalink( $product->id ) . '" class="button">' . __( 'Texto do botão' ) . '</a>';
}
add_filter( 'woocommerce_loop_add_to_cart_link', 'custom_woocommerce_loop_add_to_cart_link', 10, 2 );
// Get The Page ID You Need
get_option( 'woocommerce_shop_page_id' );
get_option( 'woocommerce_cart_page_id' );
get_option( 'woocommerce_checkout_page_id' );
get_option( 'woocommerce_pay_page_id' );
get_option( 'woocommerce_thanks_page_id' );
get_option( 'woocommerce_myaccount_page_id' );
get_option( 'woocommerce_edit_address_page_id' );
get_option( 'woocommerce_view_order_page_id' );
get_option( 'woocommerce_terms_page_id' );
@monecchi
monecchi / gist:56a61a12dbef3d7ce0d6c846c963a550
Created April 18, 2016 06:38 — forked from corsonr/gist:c2781c9e0cc086c5047f
WooCommerce: Add customer username to edit/view order admin page
<?php
// Add WooCommerce customer username to edit/view order admin page
add_action( 'woocommerce_admin_order_data_after_billing_address', 'woo_display_order_username', 10, 1 );
function woo_display_order_username( $order ){
global $post;
$customer_user = get_post_meta( $post->ID, '_customer_user', true );
echo '<p><strong style="display: block;">'.__('Customer Username').':</strong> <a href="user-edit.php?user_id=' . $customer_user . '">' . get_user_meta( $customer_user, 'nickname', true ) . '</a></p>';