Skip to content

Instantly share code, notes, and snippets.

View gabcarvalhogama's full-sized avatar

Gabriel Carvalho Gama gabcarvalhogama

View GitHub Profile
<?php
/**
* Update the posts widget or portfolio widget query.
*
* @since 1.0.0
* @param \WP_Query $query The WordPress query instance.
*/
function custom_query_callback( $query ) {
// Obter a data de início da semana anterior
$start_of_last_week = strtotime('last monday', strtotime('-1 week'));
selector {
animation: shake-animation 4.72s ease infinite;
transform-origin: 50% 50%;
display: block;
}
@keyframes shake-animation {
0% {
transform: translate(0, 0);
}
@gabcarvalhogama
gabcarvalhogama / commands.php
Last active July 5, 2024 01:28 — forked from escopecz/commands.php
Script to run Mautic (https://mautic.org) commands from a URL. - Mautic 3
<?php
if (!isset($_GET['ILoveMauticReallyIDo'])) {
echo 'The secret phrase is wrong.';
die;
}
$link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$allowedTasks = array(
'cache:clear',
@gabcarvalhogama
gabcarvalhogama / scripts.js
Last active January 16, 2019 14:31
Filtro/Campo de Pesquisa para tabelas - JS
function tableFilter(input, tableSelector, index){
// Declare variables
var filter, table, tr, td, i;
filter = input.value.toUpperCase();
table = document.querySelector(tableSelector);
tr = table.getElementsByTagName("tr");
// Loop through all table rows, and hide those who don't match the search query
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[index];
@gabcarvalhogama
gabcarvalhogama / index.html
Last active January 16, 2019 14:31
Filtro/Campo de Pesquisa para tabelas - JS
<input type="text" onkeyup="tableFilter(this, '#table-categories', 0);" />
<table id="table-categories">
<thead>
<tr>
<th>Categoria</th>
<th>Qntd. de Postagens</th>
</tr>
</thead>
<tbody>
<tr>
@gabcarvalhogama
gabcarvalhogama / view-requests.php
Created January 14, 2019 13:20
Autoloading de Classes com SPL - PHP
<?php
require_once "autoload.php";
$sg = new SG(); //Sistemas de Gerenciamento
$sg->getRequestsByUser();
// ....
@gabcarvalhogama
gabcarvalhogama / autoload.php
Last active January 14, 2019 13:15
Autoloading de Classes com SPL - PHP
<?php
spl_autoload_register(function($class){
if(file_exists(DIR . "/class/$class.php"))
require_once DIR . "/class/$class.php";
});
for(i = 0; i < res.length; i++){
var marker = new google.maps.Marker({
position: {lat: parseFloat(res[i].latHotel), lng: parseFloat(res[i].lngHotel)},
draggable: true,
animation: google.maps.Animation.DROP,
map: map,
icon: image,
title: res[i].nameHotel
});
google.maps.event.addListener(marker, 'click', function(){
<?php
require_once("DB.class.php");
class Commerce extends DB{
public $ip;
public function getCommerceList($lat, $lng, $ct = null){
if(!empty($ct)):
$ct = strip_tags(addslashes($ct));
@gabcarvalhogama
gabcarvalhogama / upload.php
Created October 27, 2016 13:16
Upload.php - Upin
<?php
require_once("class/Upload.class.php");
#Instanciamos a classe Upload:
$Upin = new Upload;
$Upin->get(
"imagens/", //Pasta de uploads (previamente criada)
$_FILES["photos"]["name"], //Pega o nome dos arquivos, altere apenas "photos"
10, //Tamanho máximo
"jpeg,png,jpg,gif", //Extensões permitidas