Skip to content

Instantly share code, notes, and snippets.

View michelmany's full-sized avatar

Michel Many michelmany

View GitHub Profile
@michelmany
michelmany / remove-price-woocommerce.php
Last active August 29, 2015 14:24
REMOVE PREÇOS E BOTÃO DE ADICIONAR NO CARRINHO PARA USUÁRIOS NÃO LOGADOS
function cs_prices_only_for_logged_in_users() {
if ( ! is_user_logged_in() ) {
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
}
}
@michelmany
michelmany / image_link_default.php
Last active August 29, 2015 14:24
Wordpress - Deixa o link da imagem enviada como NONE para o default
server {
listen 80;
server_name CHANGEME.app;
root /var/www/vhosts/CHANGEME.app/public;
index index.html index.htm index.php;
charset utf-8;
location / {
@michelmany
michelmany / 0_reuse_code.js
Last active August 29, 2015 14:26
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<?PHP
$subdomains = str_replace('.seudominio.com.br','',$_SERVER['HTTP_HOST']);
$subdomains = explode('.',$subdomains);
var_dump($subdomains);
@michelmany
michelmany / How to use Images as Radio buttons.md
Created November 7, 2015 22:59 — forked from rcotrina94/How to use Images as Radio buttons.md
How to use images for radio buttons (input-radio).
@michelmany
michelmany / README.md
Created February 2, 2016 09:45 — forked from oodavid/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@michelmany
michelmany / bganimator.css
Created April 7, 2016 21:07
Animação de bg css3 degrade
background: linear-gradient(180deg, #6b1ba6, #a618bd);
background-size: 400% 400%;
-webkit-animation: BgFoliaAnimator 30s ease infinite;
-moz-animation: BgFoliaAnimator 30s ease infinite;
-o-animation: BgFoliaAnimator 30s ease infinite;
animation: BgFoliaAnimator 30s ease infinite;
@-webkit-keyframes BgFoliaAnimator {
0%{background-position:65% 0%}
50%{background-position:36% 100%}
100%{background-position:65% 0%}
@michelmany
michelmany / functions.php
Last active November 30, 2016 14:58
Localizes a registered script with data for a JavaScript variable. https://codex.wordpress.org/Function_Reference/wp_localize_script
// Register the script
wp_register_script( 'custom-scripts', get_stylesheet_directory_uri() . '/js/custom-scripts.js' );
// Localize the script with new data
$translation_array = array(
'some_string' => __( 'Some string to translate', 'plugin-domain' ),
'a_value' => '10'
);
wp_localize_script( 'custom-scripts', 'object_name', $translation_array );
@michelmany
michelmany / app.js
Last active April 22, 2023 00:42
Vue.js 2 Vee-validate (pt-br) CPF Validation
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import VeeValidator, { Validator } from 'vee-validate'
import CpfValidator from './components/validators/cpf.validator'
import Dictionary from './components/validators/dictionary'
import Produto from './components/produtos.vue'
Validator.extend('cpf', CpfValidator)