Skip to content

Instantly share code, notes, and snippets.

View mauriciopazpp's full-sized avatar

Mauricio Paz mauriciopazpp

  • Guarapuava-PR / Brazil
  • 04:05 (UTC -12:00)
View GitHub Profile
@mauriciopazpp
mauriciopazpp / .zshrc
Created April 28, 2018 04:11
zsh config
View .zshrc
###################################################################################
# Welcome Info
###################################################################################
echo -ne "${red}Hoje é:\t\t${cyan}" `date`; echo ""
echo -e "${red}Kernel: \t${cyan}" `uname -smr`
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
###################################################################################
@mauriciopazpp
mauriciopazpp / php-7.2-fix-count-error.txt
Created May 21, 2018 19:39
PHP 7.2 - count(): Parameter must be an array or an object that implements Countable
View php-7.2-fix-count-error.txt
if (version_compare(PHP_VERSION, '7.2.0', '>=')) {
// Ignores notices and reports all other kinds... and warnings
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);
// error_reporting(E_ALL ^ E_WARNING); // Maybe this is enough
}
@mauriciopazpp
mauriciopazpp / php-nginx-install.txt
Created June 7, 2018 20:21
Prepare environment - Nginx - PHP
View php-nginx-install.txt
sudo apt-get update
/**
* Nginx
*/
sudo apt-get install nginx
/**
* mysql
*/
View install-phpmyadmin.txt
sudo apt-get update
/**
* phpmyadmin
*/
sudo apt-get install phpmyadmin php-mbstring php-gettext
/**
* Habilite as extensões
*/
@mauriciopazpp
mauriciopazpp / AlertError.js
Created July 10, 2018 23:57
AlertError react
View AlertError.js
import { Alert as AlertReact } from 'react-native'
export const AlertError = (title,
message = `Erro inesperado! Por favor tente novamente mais tarde`,
problem = null) => {
AlertReact.alert(
title,
problem ? `${message} \n ${problem}` : message,
[
{text: 'Ask me later', onPress: () => console.log('Ask me later pressed')},
@mauriciopazpp
mauriciopazpp / DrawerButton.js
Created July 11, 2018 02:22
DrawerButton react native
View DrawerButton.js
const DrawerButton = (props) => {
return (
<View>
<TouchableOpacity onPress={() => {props.navigation.navigate('DrawerOpen')}}>
<Image
source={require('../img/iconImage.png')}
style={styles.icon}
/>
</TouchableOpacity>
</View>
@mauriciopazpp
mauriciopazpp / tabs.js
Created July 20, 2018 02:14
React tabs
View tabs.js
const HomeTab = createMaterialTopTabNavigator({
Tab1: HomeScreen,
Tab2: HomeScreen02,
Tab3: HomeScreen03,
Tab4: HomeScreen04,
Tab5: HomeScreen05,
Tab6: HomeScreen06,
Tab7: HomeScreen07,
}, {
tabBarOptions: {
@mauriciopazpp
mauriciopazpp / module-resolver-react-native.js
Created July 20, 2018 02:15
module-resolver react-native
View module-resolver-react-native.js
"plugins": [
["module-resolver", {
"root": ["./app"],
"alias": {
"@api": "./app/src/api",
"@components": "./app/src/components",
"@screen": "./app/src/screens",
"@store": "./app/src/store",
"!config": "./app/config"
}
@mauriciopazpp
mauriciopazpp / blockInternetExplorer.php
Created July 20, 2018 18:12
Block internet explorer php
View blockInternetExplorer.php
<?php
preg_match('/MSIE (.*?);/', $_SERVER['HTTP_USER_AGENT'], $matches);
if(count($matches) < 2)
{
preg_match('/Trident\/\d{1,2}.\d{1,2}; rv:([0-9]*)/', $_SERVER['HTTP_USER_AGENT'], $matches);
}
@mauriciopazpp
mauriciopazpp / renderImageReactNativeWithCustomSize.js
Created July 31, 2018 23:47
Insert image using the width size of phone
View renderImageReactNativeWithCustomSize.js
_renderImage(image) {
let contentHeight = scaleModerate(375, 1)
let height = Dimensions.get('window').height - contentHeight
let width = Dimensions.get('window').width
image = (<Image style={[style.image, {height, width}]}
source={ backgroundImg }/>)
return image
}