Skip to content

Instantly share code, notes, and snippets.

🍉
Hey there! I am using GitHub.

Matteo Mazzarolo mmazzarolo

🍉
Hey there! I am using GitHub.
Block or report user

Report or block mmazzarolo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mmazzarolo
mmazzarolo / MyTextInput.js
Last active Oct 13, 2019
A simple wrapper on the React Native TextInput that fixes its ugly default Android style
View MyTextInput.js
import * as React from "react";
import { StyleSheet, TextInput } from "react-native";
const BLUE = "#428AF8";
const LIGHT_GRAY = "#D3D3D3";
class MyTextInput extends React.Component {
state = {
isFocused: false
};
@mmazzarolo
mmazzarolo / App.tsx
Created Sep 28, 2018
src/screens/LoginScreen.tsx
View App.tsx
import * as React from "react";
import { StyleSheet, Text, View } from "react-native";
class LoginScreen extends React.Component<{}> {
render() {
return (
<View style={styles.container}>
<Text>Welcome to the login screen!</Text>
</View>
);
@mmazzarolo
mmazzarolo / dev.sh
Created Jun 28, 2018
React-Native development script
View dev.sh
#!/bin/bash
# Starts the metro bundler and runs react-native in a single terminal (à la Expo).
# CTRL + C kills the metro bundler.
# Arguments:
# -p Development platform [ios (default), android].
# -s Starts scrcpy too. Android only. (https://github.com/Genymobile/scrcpy)
COLOR_RED='\033[0;31m'
COLOR_CYAN='\033[0;36m'
COLOR_PURPLE='\033[0;35m'
View mostaza-corso-async.md

Async/Await, Promises, callbacks

Event driven architecture, event loop

Callback
  • Come funzionano (esempio)
const fs = require('fs');
@mmazzarolo
mmazzarolo / twilio_with_ui.js
Last active Oct 11, 2017
WebTask - twilio_with_ui
View twilio_with_ui.js
'use latest';
/**
* A simple tasks that renders a page where an user can input a phone number and its recipient to send an SMS message using the Twilio APis.
* Please keep in mind that the following environment variables are required:
* TWILIO_SID: The SID token of your Twilio account
* TWILIO_AUTH_TOKEN: The auth token of your Twilio account
* TWILIO_FROM_NUMBER: The sender of the SMS (created in your Twilio account)
*/
@mmazzarolo
mmazzarolo / runonios.sh
Created Mar 8, 2017
Start React-Native app on IOS device by CLI
View runonios.sh
# 1. Make sure to globally install the npm ios-deploy module first:
npm i -g ios-deploy
# 2. Run the following command:
react-native run-ios --device
# Hint - You can also specify the device name if needed:
react-native run-ios --device "Paul's iPhone"
@mmazzarolo
mmazzarolo / CircleAnimation.js
Created Jan 28, 2017
Super simple circle animation overlay for React-Native
View CircleAnimation.js
/* @flow */
import React, { Component } from 'react'
import { View } from 'react-native-animatable'
import metrics from 'src/config/metrics'
type Props = {
isVisible: boolean,
backgroundColor: string,
animationTiming?: boolean
}
@mmazzarolo
mmazzarolo / CustomListItem.js
Created Oct 5, 2016
Container and component
View CustomListItem.js
import React, { PropTypes } from 'react'
import styles from './index.style.css'
const CustomListItem = ({ onClick, leftContent, rightContent, ...props }) => {
return (
<div className={styles.container} onClick={onClick} {...props}>
<div className={styles.left}>{leftContent}</div>
<div className={styles.right}>{rightContent}</div>
</div>
@mmazzarolo
mmazzarolo / hideOnScroll.js
Last active Jun 26, 2019
react-native-action-button hide on scroll
View hideOnScroll.js
// 1. Define a state variable for showing/hiding the action-button
state = {
isActionButtonVisible: true
}
// 2. Define a variable that will keep track of the current scroll position
_listViewOffset = 0
// 3. Add an onScroll listener to your listview/scrollview
<ListView
View beforeSaveService.spec
import Parse from 'parse/node'
import { afterEach, describe, it } from 'mocha'
import chai from 'chai'
import chaiAsPromised from 'chai-as-promised'
import { resetParse, getAdminUser } from '../../../test/parseHelper'
import errors from '../../utils/errors'
chai.use(chaiAsPromised)
const assert = chai.assert
You can’t perform that action at this time.