Skip to content

Instantly share code, notes, and snippets.

View dimaspante's full-sized avatar
🚀

Dimas Pante dimaspante

🚀
View GitHub Profile
@dimaspante
dimaspante / mascara_telefone.js
Created August 5, 2026 13:40
Máscara simples em JS para telefones fixos e celulares
<script>
document.addEventListener("DOMContentLoaded", () => {
// Considera que o id do campo seja form-field-fone
const input = document.querySelector("#form-field-fone");
if (!input) return;
input.addEventListener("input", (e) => {
let value = e.target.value.replace(/\D/g, "");
@dimaspante
dimaspante / wp-swiper.css
Last active August 5, 2026 13:42
WP infinite fluid carousel
selector .swiper-wrapper {
-webkit-transition-timing-function: linear !important;
-o-transition-timing-function: linear !important;
-moz-transition-timing-function: linear !important;
transition-timing-function: linear !important;
}
@dimaspante
dimaspante / export_now.json
Last active December 22, 2025 12:54
Padrão para exportação de pedidos Woocommerce
{
"now": {
"version": "2.0",
"mode": "now",
"title": "",
"skip_empty_file": true,
"log_results": false,
"from_status": [],
"to_status": [],
"change_order_status_to": "",
@dimaspante
dimaspante / tips.sql
Created January 3, 2023 16:20
MySQL tips
/*! Convert field content to utf8 */
UPDATE table SET field = convert(cast(convert(field using latin1) as binary) using utf8
@dimaspante
dimaspante / clip-path.css
Created November 10, 2022 12:39
A CSS file which uses the clip-path property, allowing you to make complex shapes in CSS basically using polygons. Summarized from https://bennettfeely.com/clippy/
/**
* CSS file created using Bennett Feely's clip-path generator <https://bennettfeely.com/clippy/>
*/
.clipped-parallelogram {
-webkit-clip-path: polygon(25% 0%, 100% 0%, 75% 100%, 0% 100%);
clip-path: polygon(25% 0%, 100% 0%, 75% 100%, 0% 100%);
}
.clipped-trapezoid {
@dimaspante
dimaspante / post_notification.php
Last active May 9, 2022 19:13
Exemplo de post de notificação e-commerce Cielo + antifraude Braspag
<?php
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: POST");
header("Access-Control-Allow-Headers: Content-Type");
header("Content-Type: application/json");
require_once '../vendor/autoload.php';
use Cielo\API30\Ecommerce\Browser;
Index:
<?php
define("RECAPTCHA_V3_SITE_KEY", "XXX");
?>
<script src="https://www.google.com/recaptcha/api.js?render=<?php echo RECAPTCHA_V3_SITE_KEY; ?>"></script>
<script>
grecaptcha.ready(function() {
grecaptcha.execute('<?php echo RECAPTCHA_V3_SITE_KEY; ?>', {action: 'contato'}).then(function(token) {
document.getElementById('recaptchaResponse').value = token;
@dimaspante
dimaspante / resumable-download.php
Created February 2, 2021 14:07 — forked from kosinix/resumable-download.php
PHP - resumable download
<?php
class ResumeDownload {
private $file;
private $name;
private $boundary;
private $delay = 0;
private $size = 0;
function __construct($file, $delay = 0) {
if (! is_file($file)) {
@dimaspante
dimaspante / functions.php
Created December 17, 2020 18:46
Cria menus padrão com itens (WP)
<?php
if ( ! function_exists( 'my_theme_setup' ) ) {
function my_theme_setup() {
//Ref. https://developer.wordpress.org/reference/functions/wp_create_nav_menu/
$menu_name = 'Menu 1';
$menu_exists = wp_get_nav_menu_object( $menu_name );
if( !$menu_exists ) {
$menu_id = wp_create_nav_menu($menu_name);
@dimaspante
dimaspante / .htaccess
Created November 24, 2020 21:49
Default htaccess with security headers
Options -Indexes
RewriteEngine On
# Force https
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Disable folder navigation
RewriteCond %{REQUEST_FILENAME} !-f