Skip to content

Instantly share code, notes, and snippets.

View r-martins's full-sized avatar

Ricardo Martins r-martins

View GitHub Profile
@r-martins
r-martins / creditcard.js
Created February 21, 2024 08:18
Extending jQuery creditCard
/*region extending cards and card types from jqueryPayment to support new types*/
const typesPagBank = [
{
title: 'MasterCard',
type: 'mastercard',
pattern: '^(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}$',
gaps: [4, 8, 12],
lengths: [16],
code: {
name: 'CVC',
@r-martins
r-martins / ps-payment-info.json
Created July 13, 2022 04:38
Exemplo additional_info PagSeguro
{
"transaction_id":"F3BAF8D0-5E50-4DF6-A2BF-F71BFFD1CA7C",
"sender_hash":"53dea26365b88a7204b99b90ef091688f7c3bbdf1583dc8a680dc779b71997f8",
"credit_card_token":"e2ae0986e8ed49dfb2c0aa4d3b94ea6b",
"credit_card_owner":"Ricardo Martins",
"rm_pagseguro_cc_cpf":"01234567890",
"credit_card_owner_birthdate":"10\/07\/1990",
"installment_quantity":2,
"installment_value":"5.27",
"method_title":"Cart\u00e3o de Cr\u00e9dito via PagSeguro UOL",
@r-martins
r-martins / IntallPerconaOSX.md
Last active May 30, 2022 18:29 — forked from amura2406/IntallPerconaOSX.md
Steb-by-Step to Install Percona Server (Alternative to MySQL) on Mac OS X 10.11.6 (El Capitan)

Install percona-server.

Install from homebrew

brew install percona-server

Initialize the DB

unset TMPDIR
mysqld --initialize --datadir=/usr/local/var/mysql --user= --port=3307 --general-log-file=/var/log/percona/percona-error.log
@r-martins
r-martins / ubuntu.txt
Created October 3, 2012 22:33
Resolvendo problema de Ç (cedilha) No Ubuntu
Alguns programas (que usam GTK) no Ubuntu nao funcionam a Ç cedilha com ' + c.
Pra resolver:
Problem with cedilla:
After many versions of Ubuntu assigning accented c (“ć”) instead of c with a cedilla (“ç”) when typing ‘ + c in deadkeys keyboard layouts, since Ubuntu 11.10 GTK changed the default in an U.S. English locale back to the cedilla. However, non-GTK applications (e.g., Skype) still have the old behavior. To fix them, edit as root the file /usr/share/X11/locale/en_US.UTF-8/Compose and change all instances of ć with ç, and all instances of Ć with Ç.
You might need to repeat this operation from time to time, when you upgrade your system and it takes the configuration files back to their original contents.
@r-martins
r-martins / csp_whitelist.xml
Created June 25, 2020 00:49
Whitelist CSP PagSeguro Domains
<?xml version="1.0"?>
<csp_whitelist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Csp:etc/csp_whitelist.xsd">
<policies>
<policy id="script-src">
<values>
<value id="pagseguro-static" type="host">https://stc.pagseguro.uol.com.br</value>
<value id="pagseguro-static-sandbox" type="host">https://sandbox.stc.pagseguro.uol.com.br</value>
</values>
</policy>
<policy id="frame-src">
@r-martins
r-martins / Data.php
Created April 30, 2020 01:52
Exemplo de uso de helpers em layout xml
<?php
/**
* PagSeguro Transparente Magento
* Helper Class - responsible for helping on gathering config information
*
* @category RicardoMartins
* @package RicardoMartins_PagSeguro
* @author Ricardo Martins
* @copyright Copyright (c) 2015 Ricardo Martins (http://r-martins.github.io/PagSeguro-Magento-Transparente/)
* @license https://opensource.org/licenses/MIT MIT License
var secret = pm.variables.get("secret")
var merchant_id = pm.variables.get("store_id")
var Header = require('postman-collection').Header
var requestMethod = pm.request.method
// console.log(contentMd5)
@r-martins
r-martins / magento-design-exception.txt
Created October 17, 2015 03:08
Magento Design Exception - Para Mobile
iP(hone|od)|(a|A)ndroid.*(m|M)(obile|ini)|(a|A)ndroid 3|BlackBerry|IEMobile|Windows Mobile|Windows Phone|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune|Googlebot-Mobile
@r-martins
r-martins / ec2-swap.txt
Created December 9, 2012 19:33
creating swap on amazon ec2 micro
http://www.prowebdev.us/2012/05/amazon-ec2-linux-micro-swap-space.html
@r-martins
r-martins / xmllint.txt
Created December 5, 2012 13:33
Encontrando erros de formatação em XML's
for file in `find . -name "*.xml"`; do xmllint --noout $file; done
fará uma busca por todos os arquivos xml recursivamente e mostrará se houver algum com erro de sintaxe, tags nao fechadas, etc