Skip to content

Instantly share code, notes, and snippets.

@zecka
zecka / valet_new_drupal_site.sh
Created April 17, 2020 12:07
Create a new drupal site on Valet with MAMP on Mac OS
# =============================
# CHECK REQUIREMENTS
# =============================
requirement=1;
#check if pv command exist
if ! which pv >/dev/null; then
echo "You need to install pv"
requirement=0
fi
@zecka
zecka / html-purifier-example-use.php
Created May 27, 2020 12:51
Example use of HTMLPurifier PHP
<?php
// composer install ezyang/htmlpurifier
require 'vendor/autoload.php';
$config = HTMLPurifier_Config::createDefault();
$config->set('HTML.AllowedElements', 'a,i,b,p,div,strong,h1,h2,h3,h4,h5,ol,ul,li,br');
$config->set('HTML.AllowedAttributes', 'href,title,target,name');
$config->set('HTML.Attr.Name.UseCDATA', true);
$config->set('AutoFormat.RemoveEmpty.RemoveNbsp', true);
$config->set('Attr.AllowedFrameTargets', ['_blank']);
@zecka
zecka / wp-kses-outside-wordpress.php
Last active May 27, 2020 12:52
wp_kses outside wordpress (Dirty copy of wp_kses)
<?php
function get_charset()
{
return 'utf-8';
}
/**
* kses 0.2.2 - HTML/XHTML filter that only allows some elements and attributes
* Copyright (C) 2002, 2003, 2005 Ulf Harnhammar
@zecka
zecka / all-google-fonts-array.json
Created January 18, 2022 15:12
A complete list of google font in an array
["ABeeZee","Abel","Abhaya Libre","Abril Fatface","Aclonica","Acme","Actor","Adamina","Advent Pro","Aguafina Script","Akaya Kanadaka","Akaya Telivigala","Akronim","Aladin","Alata","Alatsi","Aldrich","Alef","Alegreya","Alegreya SC","Alegreya Sans","Alegreya Sans SC","Aleo","Alex Brush","Alfa Slab One","Alice","Alike","Alike Angular","Allan","Allerta","Allerta Stencil","Allison","Allura","Almarai","Almendra","Almendra Display","Almendra SC","Alumni Sans","Amarante","Amaranth","Amatic SC","Amethysta","Amiko","Amiri","Amita","Anaheim","Andada Pro","Andika","Andika New Basic","Angkor","Annie Use Your Telescope","Anonymous Pro","Antic","Antic Didone","Antic Slab","Anton","Antonio","Arapey","Arbutus","Arbutus Slab","Architects Daughter","Archivo","Archivo Black","Archivo Narrow","Are You Serious","Aref Ruqaa","Arima Madurai","Arimo","Arizonia","Armata","Arsenal","Artifika","Arvo","Arya","Asap","Asap Condensed","Asar","Asset","Assistant","Astloch","Asul","Athiti","Atkinson Hyperlegible","Atma","Atomic Age","Aubrey","A
export type GoogleFontName =
| "abeezee"
| "abel"
| "abhayalibre"
| "abrilfatface"
| "aclonica"
| "acme"
| "actor"
| "adamina"
| "adventpro"
@zecka
zecka / af-form-success-message.js
Created April 21, 2023 22:49
Acf advanced form show success message on top of form
acf.addAction('af/form/ajax/submission', (data, form) => {
// Reset data.type to prevet af perform success message injection onSuccess
// check --> advanced-forms/assets/js/forms.js
data.type = false
const $form = $('#'+form.key);
// Insert success message right before the form DOM element
$(data.success_message).insertBefore($form)
})