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
View Default (Linux).sublime-keymap
[
{ "keys": ["f12"], "command": "reindent", "args": {"single_line": false} },
{ "keys": ["ctrl+space"], "command": "auto_complete" },
{ "keys": ["ctrl+space"], "command": "replace_completion_with_auto_complete", "context":
[
{ "key": "last_command", "operator": "equal", "operand": "insert_best_completion" },
{ "key": "auto_complete_visible", "operator": "equal", "operand": false },
{ "key": "setting.tab_completion", "operator": "equal", "operand": true }
]
},
View Checkbox.js
//
// MDL-style Checkbox component.
//
// - @see [MDL Checkbox](http://www.getmdl.io/components/index.html#toggles-section/checkbox)
// - [Props](#props)
// - [Defaults](#defaults)
// - [Built-in builders](#builders)
//
// Created by ywu on 15/12/13.
//
@mmazzarolo
mmazzarolo / configureStore.js
Created Apr 18, 2016
Cleaning up the messy seamless-immutable functions in redux-logger
View configureStore.js
import createLogger from 'redux-logger'
// Seamless-Immutable logger cleanup
const stateTransformer = (state) => {
if (typeof state === 'object' && state !== null && Object.keys(state).length) {
let newState = {}
for (var i of Object.keys(state)) {
if (state[i].asMutable) newState[i] = state[i].asMutable({ deep: true })
else newState[i] = state[i]
}
View TouchableView.js
import React, { PropTypes } from 'react'
import { Platform, View, TouchableNativeFeedback, TouchableOpacity } from 'react-native'
const IS_ANDROID = Platform.OS === 'android'
const IS_RIPPLE_EFFECT_SUPPORTED = Platform.Version >= 21 && IS_ANDROID
const TouchableView = ({ isRippleEnabled, children, style, ...props }) => {
if (IS_RIPPLE_EFFECT_SUPPORTED && !isRippleEnabled) {
const background = TouchableNativeFeedback.Ripple(null, false)
return (
View LoadingSpinner.js
/**
* @providesModule LoadingSpinner
*/
import React, { ActivityIndicatorIOS, Platform, ProgressBarAndroid, StyleSheet } from 'react-native'
const IS_ANDROID = Platform.OS === 'android'
export default ({ ...props }) => IS_ANDROID
? <ProgressBarAndroid style={styles.spinner} {...props} />
: <ActivityIndicatorIOS style={styles.spinner} {...props} />
@mmazzarolo
mmazzarolo / ContainerExample1.js
Created Aug 3, 2016
Authentication duck example
View ContainerExample1.js
// ACTIONCREATORS USAGE EXAMPLE 1
// When the action needed are all in a single duck (in this case authReducer)
import React, { Component, PropTypes } from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { actionCreators } from '../reducers/authReducer'
const mapStateToProps = (state, ownProps) => ({
// blablabla
})
@mmazzarolo
mmazzarolo / 0info.js
Last active Aug 11, 2016
NavigationExperimental setup
View 0info.js
// Redux navigations tore
{
key: '1',
index: 0,
children: [{ key: 'museumList', title: 'I musei' }],
isDrawerOpen: false
}
// Navigation structure
View redux_naming_example.js
import { find, findIndex, pullAt } from 'lodash'
import { actionTypes as appActionTypes } from 'reducers/appReducer'
export const actionTypes = {
CREATE_MENU_ENTRY_REQUEST: 'MENU/CREATE_MENU_ENTRY_REQUEST',
CREATE_MENU_ENTRY_SUCCESS: 'MENU/CREATE_MENU_ENTRY_SUCCESS',
CREATE_MENU_ENTRY_FAILURE: 'MENU/CREATE_MENU_ENTRY_FAILURE',
UPDATE_MENU_ENTRY_REQUEST: 'MENU/UPDATE_MENU_ENTRY_REQUEST',
UPDATE_MENU_ENTRY_SUCCESS: 'MENU/UPDATE_MENU_ENTRY_SUCCESS',
UPDATE_MENU_ENTRY_FAILURE: 'MENU/UPDATE_MENU_ENTRY_FAILURE',
@mmazzarolo
mmazzarolo / CustomDatePickerIOS.js
Created Sep 13, 2016
IOS ActionSheet DatePicker
View CustomDatePickerIOS.js
import React, { Component, PropTypes } from 'react'
import { DatePickerIOS, Text, TouchableOpacity, View } from 'react-native'
import { noop } from 'lodash'
import CustomModal from '../CustomModal'
import styles from './CustomDatePickerIOS.style'
export default class CustomDatePickerIOS extends Component {
static propTypes = {
visible: PropTypes.bool,
You can’t perform that action at this time.