Skip to content

Instantly share code, notes, and snippets.

View petronioamaral's full-sized avatar

Petrônio Amaral petronioamaral

  • Dublin, Ireland
View GitHub Profile
@petronioamaral
petronioamaral / translate-string-with-function.php
Created May 1, 2024 17:33
WordPress | Translate string with PHP function
<?php
// option 1, to change text site wide
add_filter( 'gettext', 'fs_translate_strings_1', 20, 3 );
function fs_translate_strings_1( $translation, $text, $domain ) {
// STRING 1
$translation = str_ireplace( 'My Old Text', 'My New Text', $translation );
// STRING 2
$translation = str_ireplace( 'Old Text', 'New text', $translation );
return $translation;
@petronioamaral
petronioamaral / hosts_para_bloquear_adobe.txt
Last active January 6, 2023 19:20
hosts para bloquear adobe
127.0.0.1 localhost
127.0.0.1 activate.adobe.com
127.0.0.1 practivate.adobe.com
127.0.0.1 ereg.adobe.com
127.0.0.1 activate.wip3.adobe.com
127.0.0.1 wip3.adobe.com
127.0.0.1 3dns-3.adobe.com
127.0.0.1 3dns-2.adobe.com
127.0.0.1 adobe-dns.adobe.com
127.0.0.1 adobe-dns-2.adobe.com
@petronioamaral
petronioamaral / just-microsoft-office-file-type-list.php
Created October 6, 2022 10:13
List of MIME types as PHP array
<?php
/**
* List of Microsoft office file MIME types
* @date 2014-07-09
*/
return array(
'doc'=>'application/msword',
'dot'=>'application/msword',
@petronioamaral
petronioamaral / consolelog.js
Created June 14, 2022 15:09
Save output console.log to file
// Function that will call your webserver
logToServer = function (consoleMsg) {
// only do this if on device
// if (window.cordova) {
let jsonTxt = customStringify(consoleMsg);
var xmlHttp = new XMLHttpRequest();
xmlHttp.open(
"GET",
"http://wsite.localhost/console2server.php?msg=" + jsonTxt,
true
@petronioamaral
petronioamaral / Linux Commands - Apache.md
Last active February 28, 2022 16:46
Linux Commands - Apache
Enable version php = sudo a2enmod php5.6
Disable version php = sudo a2dismod php7.3

restart = udo systemctl restart apache2

check versions enabled = ls -l mods-*/*php*
test sintaxe apache = apache2ctl configtest
change version php = sudo update-alternatives --config php
@petronioamaral
petronioamaral / composer-autoload.md
Created November 11, 2021 22:11
composer autoload

"autoload": { "psr-4": { "App\": "src/" } }

composer dump-autoload

@petronioamaral
petronioamaral / add IP to port CSF directadmin
Created October 7, 2021 17:10
add IP to port CSF directadmin
tcp|in|d=3306|s=seuip
@petronioamaral
petronioamaral / aws_ses_delete-suppressed.md
Created August 20, 2021 16:37
delete email suppression list

aws sesv2 delete-suppressed-destination --email-address xxxx@xxxx.com.br --region sa-east-1

@petronioamaral
petronioamaral / gerar_screen.md
Last active July 11, 2021 00:09
gerar screen ssh

Gerar SCREEN_

screen -S gerartar
screen -ls //para ver
screen -x gerartar
Control AD sair sem finalizar
Control D ou exit para matar o scrreen

@petronioamaral
petronioamaral / populate_select.js
Last active April 13, 2021 21:10
populate city and neighborhood javascript pure
<script>
const estados = document.getElementById("estados_orcamento");
const selectCidades = document.querySelector('#cidades_orcamento');
const selectBairros = document.querySelector('#bairros_orcamento');
const selectEspecialistas = document.querySelector('#especialistas_orcamento');
estados.addEventListener("change", function() {
var options = estados.options[estados.selectedIndex].value;