Skip to content

Instantly share code, notes, and snippets.

View zergiocosta's full-sized avatar
👽

Sergio Costa zergiocosta

👽
View GitHub Profile
@zergiocosta
zergiocosta / instrucoes.md
Last active March 25, 2021 20:45
Instruções para criar lojas no Google Play e App Store

Criando uma conta no iOS Developer Program

Para começar, é necessário criar uma conta no iOS Developer Program, um serviço obrigatório para distribuir apps na App Store.

A inscrição na plataforma tem custo anual de US$99 e pode ser feita por uma pessoa ou empresa.

Se a sua empresa possuir uma equipe de desenvolvimento, é possível fazer a inscrição de todos os membros por uma taxa anual de US$299.

Para realizar a inscrição como uma empresa, é necessário um D-U-N-S Number, código de identificação mundial de nove dígitos que é como um CNPJ internacional.

@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;
@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 / custom_error_msgs.php
Last active September 3, 2020 15:43
Changing login error message (wp-admin)
<?php
// Insert into your functions.php and have fun by creating login error msgs
function guwp_error_msgs() {
// insert how many msgs you want as array items. it will be shown randomly (html is allowed)
$custom_error_msgs = [
'<strong>YOU</strong> SHALL NOT PASS!',
'<strong>HEY!</strong> GET OUT OF HERE!',
];
// get and returns a random array item to show as the error msg
return $custom_error_msgs[array_rand($custom_error_msgs)];
@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 / csv.helper.ts
Last active June 9, 2020 17:53
Small TypeScript helper to export a html table content as a .csv file
export class CSVHelper {
public exportFromTable(table, filename): void {
let csv = [],
tableRows = table.querySelectorAll("tr")
for (let i = 0; i < tableRows.length; i++) {
let row = [],
cols = tableRows[i].querySelectorAll("td, th")
@zergiocosta
zergiocosta / .htaccess
Created March 4, 2020 18:49
HTACCESS ref
# ######################################################################
# # CROSS-ORIGIN #
# ######################################################################
# ----------------------------------------------------------------------
# | Cross-origin images |
# ----------------------------------------------------------------------
# Send the CORS header for images when browsers request it.
#
@zergiocosta
zergiocosta / metatags.php
Last active January 28, 2018 10:16
How to work even better with meta tags on WP (This should be inside <head> tag)
<?php
/**
* Sets up theme default paths
*/
if(!defined('WP_SITE_URL')) { define('WP_SITE_URL', get_bloginfo('url')); }
if(!defined('WP_THEME_URL')) { define('WP_THEME_URL', get_stylesheet_directory_uri()); }
// General Variables
$mtitle_default = get_bloginfo('name');
$title_default = get_bloginfo('name');
@zergiocosta
zergiocosta / iOSPermission.md
Last active August 29, 2017 16:17
info.plist Permissions for iOS 10+

Calendar :

Key : Privacy - Calendars Usage Description
Value : $(PRODUCT_NAME) calendar events

Reminder :

Key : Privacy - Reminders Usage Description
Value : $(PRODUCT_NAME) reminder use

Contact :

Key : Privacy - Contacts Usage Description

@zergiocosta
zergiocosta / gist:f2f12e701bd348aaf2ecc8d354b3be28
Created August 24, 2017 14:22
Install CocoaPods on MacOS 10.11+
$ mkdir -p $HOME/Software/ruby
$ export GEM_HOME=$HOME/Software/ruby
$ gem install cocoapods
[...]
1 gem installed
$ export PATH=$PATH:$HOME/Software/ruby/bin
$ pod --version
0.37.2