Skip to content

Instantly share code, notes, and snippets.

View rodrigophpweb's full-sized avatar

Rodrigo Vieira Eufrasio da Silva rodrigophpweb

  • São Paulo
View GitHub Profile
@rodrigophpweb
rodrigophpweb / categories.php
Created May 13, 2024 18:01
Code Refactoring Categories A to Z
<?php
$letters = range('a', 'z'); // Array com todas as letras do alfabeto
foreach ($letters as $letter) {
$title = "Serviços que começam com a letra $letter - " . TITLE_GERAL;
$active = (isset($varCliente) && $varCliente == $letter) ? '<span class="active">' . $letter . '</span>' : $letter;
$href = ($letter != 'todos') ? "/servicos/{$varCidade}/{$letter}" : "/servicos/{$varCidade}";
echo "<a href=\"{$href}\" title=\"{$title}\">{$active}</a>";
}
?>
@rodrigophpweb
rodrigophpweb / request-ajax-list-activities.js
Created April 23, 2024 19:45
Ajax request code to list the activities of the units related to the event
const url = wp.ajaxurl; // Sua URL de solicitação
const urlComParametros = `${url}?action=listActivities&slug=${slug}&level=${level}&school=${school}&timestamp=${new Date().getTime()}`;
const updateActivities = (slug, level, school) => {
fetch(urlComParametros, {
method: 'POST',
credentials: 'same-origin',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Cache-Control': 'no-cache',
@rodrigophpweb
rodrigophpweb / consentMode.js
Last active April 10, 2024 14:49
Code for Mode Consent GTM
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments); // Use arguments object for rest parameters
}
var consentOptionsGranted = { // Use var instead of const
'ad_storage': 'granted',
'analytics_storage': 'granted',
'ad_user_data': 'granted',
<?php
$terms = get_queried_object();
// Verify what Term selected
//$whatTerm = get_the_terms(get_the_ID(), 'evento');
$term = get_term('evento');
if(is_front_page()){
//Load Images
$img_single = get_field('image_event', $term);
@rodrigophpweb
rodrigophpweb / calc-simple-national.js
Last active April 10, 2024 14:53
Calculo do Simples Nacional JavaScript usando anexo 3 e anexo 5
function calcularSimplesNacional(faturamento12Meses, gastoFolhaSalarial) {
const anexo3 = [
{ limite: 180000, aliquota: 0.06, deduzir: 0 },
{ limite: 360000, aliquota: 0.112, deduzir: 9360 },
{ limite: 720000, aliquota: 0.135, deduzir: 17640 },
{ limite: 1800000, aliquota: 0.16, deduzir: 35640 },
{ limite: 3600000, aliquota: 0.21, deduzir: 125640 },
{ limite: Infinity, aliquota: 0.33, deduzir: 648000 },
];
@rodrigophpweb
rodrigophpweb / login.php
Created December 4, 2022 17:34
Template Bootstrap form Login
<!-- Pills navs -->
<ul class="nav nav-pills nav-justified mb-3" id="ex1" role="tablist">
<li class="nav-item" role="presentation">
<a class="nav-link active" id="tab-login" data-mdb-toggle="pill" href="#pills-login" role="tab"
aria-controls="pills-login" aria-selected="true">Login</a>
</li>
<li class="nav-item" role="presentation">
<a class="nav-link" id="tab-register" data-mdb-toggle="pill" href="#pills-register" role="tab"
aria-controls="pills-register" aria-selected="false">Register</a>
</li>
@rodrigophpweb
rodrigophpweb / gist:6bdb9800f49fd70eb16d191a7fceffb1
Last active August 18, 2022 21:16
URL from Google Calendar
<?php
$urlGoogle = 'https://calendar.google.com/calendar/render?action=TEMPLATE';
$urlOutlook = 'https://outlook.office.com/calendar/0/deeplink/compose?allday=false&';
$target = '_blank';
$text = get_the_title();
$titleGoogle = 'Salvar atividade no Google Calendar';
$titleOutlook = 'Salvar atividade no Outlook Calendar';
$details = get_the_content();
$iconUrlGoogle = 'https://upload.wikimedia.org/wikipedia/commons/a/a5/Google_Calendar_icon_%282020%29.svg';
@rodrigophpweb
rodrigophpweb / classlist.js
Created August 10, 2022 18:35
Manipulando a classes através da propriedade classList e seus metódos.
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Utilização do classList</title>
<style>
* {
margin: 0;
@rodrigophpweb
rodrigophpweb / setAtributte-and-value.js
Created July 29, 2021 13:38
Function get all class with same name more width and height
function setDisplay(className, widthValue, heightValue) {
//Get All Class same name
var items = document.getElementsByClassName(className);
//Loop to Class
for (var i=0; i < items.length; i++) {
//Change Attributes Width and Height
items[i].style.width = widthValue;
items[i].style.height = heightValue;
}
{
"posts": {
"data": [
{
"permalink_url": "https://www.facebook.com/341729352806/posts/10158608413342807/",
"id": "341729352806_10158608413342807"
},
{
"permalink_url": "https://www.facebook.com/senacsaopaulo/videos/522710459064059/",
"id": "341729352806_522710459064059"