Skip to content

Instantly share code, notes, and snippets.

View michelmany's full-sized avatar

Michel Many michelmany

View GitHub Profile
@michelmany
michelmany / gist:21cc831551ac9cc222029816a915dba4
Created July 13, 2021 15:09 — forked from martinsanne/gist:72f48bad22d99032ba0e
WordPress ACF Multisite location rule
<?php
/**
*
* Adds location rule to target specific sites in a WordPress Multisite environment
* http://www.advancedcustomfields.com/resources/custom-location-rules/
*
*/
function acf_location_rule_type_blog( $choices ) {
@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 / 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'},
@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 marioluan/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,
@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 / 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).
<?PHP
$subdomains = str_replace('.seudominio.com.br','',$_SERVER['HTTP_HOST']);
$subdomains = explode('.',$subdomains);
var_dump($subdomains);
@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
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 / {