Skip to content

Instantly share code, notes, and snippets.

View henriquek3's full-sized avatar

Jean Freitas henriquek3

  • Cacoal, RO
View GitHub Profile
@henriquek3
henriquek3 / new_gist_file.php
Created April 21, 2022 04:50 — forked from dejanmarkovic/new_gist_file.php
10 wp-config Tweaks That You Should Know About
In this tutorial, we’ll show you 10 wp-config tweaks that you may not know yet.
Let’s go through them one by one.
Move Your Configurations File:
Moving wp-config outside the web root directory is one of the best security practices. Doing so keeps your important information, like your authentication keys and database login details, away from malicious scripts and hackers who can try to access your site’s database using default location of wp-config file.
Generally, WordPress looks for wp-config file in its web root. If it’s not available there, then it will automatically look one level above. So, just move this file one folder above the web-root folder. In this way, nobody will be able to access it without SSH or FTP access.
If you’re moving your wp-config file, it is recommended to create another wp-config file in the root folder that will point to the “real” wp-config.
@henriquek3
henriquek3 / updatae_wp.sql
Created June 16, 2021 00:34
Atualizar Links do Wordpress
UPDATE wp_options SET option_value = replace(option_value, 'oldurl.com', 'newurl.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'oldurl.com','newurl.com');
UPDATE wp_posts SET post_content = replace(post_content, 'oldurl.com', 'newurl.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'oldurl.com','newurl.com');
@henriquek3
henriquek3 / remove_pareteses.sql
Created July 24, 2020 02:13
Remover texto entre parenteses e o texto dentro
SELECT REPLACE(CUR_NOME, SUBSTRING(CUR_NOME, LOCATE('(', CUR_NOME),
LENGTH(CUR_NOME) - LOCATE(')', REVERSE(CUR_NOME)) - LOCATE('(', CUR_NOME) + 2),
'') AS CUR_NOME,
CUR_NOME
FROM atribuicaos;
-- ENGENHARIA CIVIL (34.3 PVH)
-- ENGENHARIA CIVIL
@henriquek3
henriquek3 / FirstName_LastName.sql
Created July 20, 2020 18:38
Primeiro e Ultimo nome em mysql
select substring_index(nome, ' ', 1) as PrimeiroNome,
substring_index(nome, ' ', -1) as UltimoNome
from professors;
@henriquek3
henriquek3 / cmder.with.jetbrains
Created June 3, 2020 00:12
Adicionar CMDER ao IDE Jetbrains
"cmd.exe" /k set CMDER_ROOT=C:\cmder&&set ConEmuDir=%CMDER_ROOT%\vendor\conemu-maximus5&&call "%CMDER_ROOT%\vendor\init.bat"
@henriquek3
henriquek3 / remove_parameter_http_route.js
Created October 24, 2019 14:06
Remover parametro da url com js
<script type="text/javascript">
function removeParam(parameter) {
var url = document.location.href;
var urlparts = url.split('?');
if (urlparts.length >= 2) {
var urlBase = urlparts.shift();
var queryString = urlparts.join("?");
var prefix = encodeURIComponent(parameter) + '=';
@henriquek3
henriquek3 / test-php-basic-auth.php
Created April 11, 2019 05:26 — forked from rchrd2/test-php-basic-auth.php
PHP basic auth example
<?php
function require_auth() {
$AUTH_USER = 'admin';
$AUTH_PASS = 'admin';
header('Cache-Control: no-cache, must-revalidate, max-age=0');
$has_supplied_credentials = !(empty($_SERVER['PHP_AUTH_USER']) && empty($_SERVER['PHP_AUTH_PW']));
$is_not_authenticated = (
!$has_supplied_credentials ||
$_SERVER['PHP_AUTH_USER'] != $AUTH_USER ||
$_SERVER['PHP_AUTH_PW'] != $AUTH_PASS
@henriquek3
henriquek3 / croppie_and_upper_files
Created January 16, 2019 11:46
Cortar Imagem com js e fazer upload.
window.addEventListener('load', function () {
var form = new FormData;
const croppieInit = function () {
const c = new Croppie(document.getElementById('my-img'), {
viewport: {
width: 64,
height: 64,
type: 'circle'
@henriquek3
henriquek3 / gist:c936429ea5cc409b398163e958c755b1
Created December 13, 2018 20:00 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@henriquek3
henriquek3 / errorBag.js
Created July 11, 2018 17:39
Percorrer Itens de um objeto
/**
* Percorrer Itens de um objeto
*
* responseText -> recebe uma resposta de Illuminate\Foundation\Http\FormRequest;
* https://pt.stackoverflow.com/questions/173293/como-percorrer-um-objeto-em-javascript/173300
* https://laravel.com/docs/5.5/validation
*
*/
let errorBag = JSON.parse(response.responseText);
console.log(errorBag);