Skip to content

Instantly share code, notes, and snippets.

View jqueryalmeida's full-sized avatar

Jquery Almeida jqueryalmeida

View GitHub Profile
//EXPLICANDO EM DETALHES O PROCESSAMENTO DO LAÇO ABAIXO
O que acha que será impresso no laço abaixo?
// INÍCIO
// Variáveis
$fat = 5;
$resul = 1;
// Laço
@jqueryalmeida
jqueryalmeida / part1.md
Created November 5, 2020 10:50 — forked from aaronsummers/part1.md
Ajax filter for WordPress posts

Ajax post filter for WordPress

Part 1

  • First create a post grid ( 3 Column )
  • Add our CSS
    • Post grid
  • Filter
@jqueryalmeida
jqueryalmeida / remove_wp_54_favicon.php
Created April 2, 2020 10:25 — forked from webdados/remove_wp_54_favicon.php
Do not show WordPress 5.4 default WP blue favicon
<?php
//Inspiration: https://gist.github.com/florianbrinkmann/a879099f3d28c5e1d64f2aeea042becf
add_action( 'do_faviconico', function() {
//Check for icon with no default value
if ( $icon = get_site_icon_url( 32 ) ) {
//Show the icon
wp_redirect( $icon );
} else {
//Show nothing
header( 'Content-Type: image/vnd.microsoft.icon' );
@jqueryalmeida
jqueryalmeida / test-php-basic-auth.php
Created March 10, 2020 11:28 — 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
@jqueryalmeida
jqueryalmeida / wpt-font-injection.js
Created March 6, 2020 10:29 — forked from Nooshu/wpt-font-injection.js
Modify `font-display` settings via WPT script injection
(function(){
// create our custom link tag for the stylesheet
var url = "https://www.example.com/static/app.css"; // IMPORTANT: this is the CSS that contains your @font-face rules
var head = document.getElementsByTagName('head')[0];
var link = document.createElement('link');
link.type = "text/css";
link.rel = "stylesheet"
link.href = url;
// append the stylesheet to the head
@jqueryalmeida
jqueryalmeida / wp-config.php
Created February 21, 2020 09:33 — forked from MikeNGarrett/wp-config.php
Disable admin-ajax on the front-end of WordPress sites and cache the resulting 404.
<?php
if(
strpos( $_SERVER['HTTP_REFERER'], 'wp-admin' ) === false &&
strpos( $_SERVER['REQUEST_URI'], 'admin-ajax.php' ) !== false
) {
header( 'Cache-Control: max-age=30000, must-revalidate' );
header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', strtotime( '+5000 minutes' ) ) . ' GMT' );
header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s', strtotime( '-5000 minutes' ) ) . ' GMT' );
header( $_SERVER["SERVER_PROTOCOL"]." 404 Not Found" );
die;
@jqueryalmeida
jqueryalmeida / Extenso.php
Created February 17, 2020 12:19 — forked from knoonrx/Extenso.php
Converte números e exibe por extenso em php Fonte: http://www.dirceuresende.com/blog/escrevendo-numero-por-extenso-no-php/
<?php
/**
* Created by PhpStorm.
* User: Rodrigo Brandão Oxigenweb
* Date: 21/03/2016
* Time: 11:07
*/
class Extenso
{
public static function removerFormatacaoNumero( $strNumero )
@jqueryalmeida
jqueryalmeida / dicionario-git.md
Created February 12, 2020 16:13 — forked from victorsenam/dicionario-git.md
Dicionário básico de Git e GitHub para iniciantes

Dicionário Git e GitHub

Os conceitos vão ser apresentados da forma mais básica possível para que se possa entender a ideia primordial do software. Os comandos serão baseados num terminal UNIX. Ou seja, funcionarão em linux e mac.

Links interessantes

http://rogerdudler.github.io/git-guide/index.pt_BR.html

Repositório

O repositório é a pasta do projeto. Todo repositório tem uma pasta oculta .git. Isso é o que mostra para o git e para você que existe um repositório naquela pasta.

@jqueryalmeida
jqueryalmeida / functions.php
Created January 16, 2020 20:32 — forked from alexander-young/functions.php
Defer Javascript in WordPress
function defer_parsing_of_js($url)
{
if (is_admin()) return $url; //don't break WP Admin
if (false === strpos($url, '.js')) return $url;
if (strpos($url, 'jquery.js')) return $url;
return str_replace(' src', ' defer src', $url);
}
add_filter('script_loader_tag', 'defer_parsing_of_js', 10);
@jqueryalmeida
jqueryalmeida / wl-api.php
Created December 7, 2019 12:17 — forked from ivandoric/wl-api.php
Creating WordPress Rest API Custom Endpoints
<?php
/**
* Plugin Name: Custom API
* Plugin URI: http://chrushingit.com
* Description: Crushing it!
* Version: 1.0
* Author: Art Vandelay
* Author URI: http://watch-learn.com
*/