Skip to content

Instantly share code, notes, and snippets.

View jsvini's full-sized avatar
🙌

Vinícius Alves jsvini

🙌
View GitHub Profile
@jsvini
jsvini / gist:8749171
Created February 1, 2014 07:21
instalar screen com vertical split centos
yum install ncurses-devel
--------------------------------------------
1. check
yum provides */stropts.h
2. install rpm
yum install compat-glibc-headers
@jsvini
jsvini / Makefile
Created February 4, 2014 00:58 — forked from turicas/Makefile
test:
clear
nosetests --with-coverage --cover-package name_utils test_name_utils.py
clean:
find -regex '.*\.pyc' -exec rm {} \;
find -regex '.*~' -exec rm {} \;
.PHONY: test clean
@jsvini
jsvini / gist:a8a5d0c1146a028bd6e5
Last active August 29, 2015 14:05
Validador de CPF com dígito verificador
// Valida CPF incluindo dígito verificador, retorna true ou false
// Formatos: 000.000.000.00 - 000.000.000-00 - 000,000,000.00 - 000,000,000-00 - 00000000000
// Compatibilidade: Chrome - Opera - Safari - Firefox >= 1.8 - IE >= 9
function ValidarCPF(a) {
var b, c, d, e, f;
a += "";
if (/[0-9]{3}(\.|\,)[0-9]{3}(\.|\,)[0-9]{3}(\-|\.)[0-9]{2}/.test(a)) a = a.replace(/[^\d]/g, "");
else if (!/[0-9]{11}/.test(a)) return !1;
@jsvini
jsvini / RegistrarLeadRDStation.php
Created December 7, 2016 19:47
Registrar um lead no RDStation com CURL
<?php
$data = array(
'token_rdstation' => 'SEU_TOKEN_PRIVADO', // seu token
'nome' => @$_POST['nome'],
'email' => @$_POST['email'],
'identificador' => 'teste-identificador' // identificador
);
@jsvini
jsvini / console_table_forms.js
Created June 20, 2019 12:42
console.table() all forms fields
$('form').each(function(){
var formData = $(this).serializeArray();
var compressed = {};
formData.forEach(function(field){
compressed[field.name] = (field.value)? field.value: '[empty]';
})
console.table(compressed);
});
Stack trace
TypeError: Uncaught exception 'TypeError' with message 'Argument 1 passed to FPF_Product_Fields::rest_api_init() must be an instance of WP_REST_Server, string given, called in /home/[REDACTED]/public_html/web/wp/wp-includes/class-wp-hook.php on line 287' in /home/[REDACTED]/public_html/web/app/plugins/flexible-product-fields/classes/fpf-product-fields.php:272
in FPF_Product_Fields::rest_api_init called at /home/[REDACTED]/public_html/web/wp/wp-includes/class-wp-hook.php (287)
in WP_Hook::apply_filters called at /home/[REDACTED]/public_html/web/wp/wp-includes/class-wp-hook.php (311)
in WP_Hook::do_action called at /home/[REDACTED]/public_html/web/wp/wp-includes/plugin.php (478)
in do_action called at /home/[REDACTED]/public_html/web/app/plugins/woocommerce-admin/src/ReportCSVExporter.php (125)
in Automattic\WooCommerce\Admin\ReportCSVExporter::map_report_controller called at /home/[REDACTED]/public_html/web/app/plugins/woocommerce-admin/src/ReportCSVExporter.php (76)
in Automattic\WooCommerce\Admin
@jsvini
jsvini / upload_vtex.md
Created June 12, 2018 20:42
VTEX upload de arquivos no Chrome sem FLASH

Segue um bookmarklet para realizar upload de arquivos sem Flash no CMS do VTEX.

Basta selecionar o código abaixo e arrastar para a barra de favoritos do Chrome, quando entrar na tela de upload do Vtex, clique no link que salvou na barra de favoritos e o botão para selecionar o arquivo vai aparecer.

<?php
// Arquivo:
// /wp-content/plugins/pagarme-payments-for-woocommerce/vendor/pagarme/ecommerce-module-core/src/Payment/Aggregates/Payments/AbstractPayment.php
// Add o código abaixo na linha 55