Skip to content

Instantly share code, notes, and snippets.

View zergiocosta's full-sized avatar
👽

Sergio Costa zergiocosta

👽
View GitHub Profile
@zergiocosta
zergiocosta / path-helper.php
Created August 7, 2020 17:46
Make WordPress relative URLS
<?php
function make_paths_relative($buffer) {
$home_url = esc_url(home_url('/'));
$home_url_relative = wp_make_link_relative($home_url);
$home_url_escaped = str_replace('/', '\/', $home_url);
$home_url_escaped_relative = str_replace('/', '\/', $home_url_relative);
$buffer = str_replace($home_url, $home_url_relative, $buffer);
@zergiocosta
zergiocosta / cpf-validation.js
Created September 9, 2020 22:24
Validar CPF
function isCpfValid(strCPF) {
strCPF = strCPF.replace(/\./g, '').replace('-', '');
var Soma;
var Resto;
Soma = 0;
if (strCPF == "00000000000") return false;
for (i=1; i<=9; i++) Soma = Soma + parseInt(strCPF.substring(i-1, i)) * (11 - i);
Resto = (Soma * 10) % 11;
@zergiocosta
zergiocosta / react-native+0.61.5.patch
Created December 3, 2020 13:42
Fix image issue on iOS 14
diff --git a/node_modules/react-native/Libraries/Image/RCTUIImageViewAnimated.m b/node_modules/react-native/Libraries/Image/RCTUIImageViewAnimated.m
index 21f1a06..2444713 100644
--- a/node_modules/react-native/Libraries/Image/RCTUIImageViewAnimated.m
+++ b/node_modules/react-native/Libraries/Image/RCTUIImageViewAnimated.m
@@ -272,6 +272,9 @@ - (void)displayDidRefresh:(CADisplayLink *)displayLink
- (void)displayLayer:(CALayer *)layer
{
+ if (!_currentFrame) {
+ _currentFrame = self.image;