Skip to content

Instantly share code, notes, and snippets.

View michelmany's full-sized avatar

Michel Moraes michelmany

View GitHub Profile
@michelmany
michelmany / recaptchav3.css
Created May 25, 2020 19:14
Set the ReCaptcha v3 to the left of the screen.
.grecaptcha-badge {
width: 70px !important;
overflow: hidden !important;
transition: all 0.3s ease !important;
left: 4px !important;
}
.grecaptcha-badge:hover {
width: 256px !important;
}
@michelmany
michelmany / _webp.twig
Created May 12, 2020 12:36 — forked from geoffyuen/_webp.twig
Webp with fallback for Timber/Twig
{% spaceless %}
{#
This Timber twig will output an <picture> with fallbacks, srcset x2, alt, width and height
Usage:
`{% include '_webp.twig' with { class: "db ma0 center w-100", img: Image(post.acf_image), w: 507, h: 507 } %}`
@params
@michelmany
michelmany / isotope.init.js
Last active May 7, 2020 07:11
Init Isotope Layout JS with ES6 ( https://isotope.metafizzy.co/ )
const grid = document.querySelector(".sorteios__grid-items");
const gridFilterButtons = document.querySelectorAll(".sorteios__grid-filter button");
const iso = new Isotope(grid, {
itemSelector: ".sorteios__grid-item",
masonry: {
gutter: 10,
},
});
/**
* Convert font-size from px to rem with px fallback
*
* @param $size - the value in pixel you want to convert
*
* e.g. p {@include fontSize(12)}
*
*/
// Function for converting a px based font-size to rem.
@michelmany
michelmany / countries.json
Created April 9, 2020 06:15 — forked from keeguon/countries.json
A list of countries in JSON
[
{name: 'Afghanistan', code: 'AF'},
{name: 'Åland Islands', code: 'AX'},
{name: 'Albania', code: 'AL'},
{name: 'Algeria', code: 'DZ'},
{name: 'American Samoa', code: 'AS'},
{name: 'AndorrA', code: 'AD'},
{name: 'Angola', code: 'AO'},
{name: 'Anguilla', code: 'AI'},
{name: 'Antarctica', code: 'AQ'},
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
@michelmany
michelmany / docker-compose.yml
Created January 17, 2020 15:52
WordPress Docker Container
version: "3.3"
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
@michelmany
michelmany / set_default_custom_post_terms.php
Created February 7, 2019 16:20
WordPress - Set make primary using YOAST SEO. (Set default term for the post)
// **** Set default terms to all Case Studies Custom Posts
function set_default_custom_post_terms( $custom_post, $taxonomy, $first_term_slug, $second_term_slug, $primary_term ) {
$all_posts_ids = get_posts(array(
'fields' => 'ids',
'posts_per_page' => -1,
'post_type' => $custom_post
));
$first_term_id = get_term_by( 'slug', $first_term_slug, $taxonomy )->term_id;
@michelmany
michelmany / match-height.js
Created April 20, 2018 17:06 — forked from tomhodgins/match-height.js
Match Height is a jQuery-free pure JavaScript plugin that will measure the height of a group of elements and assign each of them the highest value.
/*
# The Mad CSScientist's Matching Height Plugin
written by Tommy Hodgins: http://codepen.io/tomhodgins/pen/pjmKNj
## Usage
This plugin will measure the height of a group of elements and assign each of them the highest value.
To group elements together, assign each element a `data-col` attribute with the same value. This way, the plugin can calculate the heights of different groups of elements on the same page.
@michelmany
michelmany / remover-acentos.js
Created October 24, 2017 21:31 — forked from marioplumbarius/remover-acentos.js
Funcao marota para remover acentos de strings. Foi utilizado expressao regular em cima de caracteres representados na base hexadecimal.
/**
* Remove acentos de caracteres
* @param {String} stringComAcento [string que contem os acentos]
* @return {String} [string sem acentos]
*/
function removerAcentos( newStringComAcento ) {
var string = newStringComAcento;
var mapaAcentosHex = {
a : /[\xE0-\xE6]/g,
e : /[\xE8-\xEB]/g,