Skip to content

Instantly share code, notes, and snippets.

View mmazzarolo's full-sized avatar
🐌
Busy — I'll be slow to respond!

Matteo Mazzarolo mmazzarolo

🐌
Busy — I'll be slow to respond!
View GitHub Profile
@mmazzarolo
mmazzarolo / FloatingActionMenuBehavior.java
Last active March 21, 2019 04:40
Floating Action Menu Behavior for Clans.FloatingActionButton
import android.content.Context;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.Snackbar;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewPropertyAnimatorListener;
import android.util.AttributeSet;
import android.view.View;
import com.github.clans.fab.FloatingActionMenu;
@mmazzarolo
mmazzarolo / FloatingActionMenuBehavior.java
Last active April 10, 2018 04:47
Floating Action Menu like Inbox
import android.content.Context;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.Snackbar;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.ViewPropertyAnimatorListener;
import android.util.AttributeSet;
import android.view.View;
import com.github.clans.fab.FloatingActionMenu;
@mmazzarolo
mmazzarolo / FirebaseRecyclerAdapter.java
Last active February 22, 2018 03:55
RecyclerView adapter that handles a Firebase location listener
package com.example.matteo.firebase_recycleview;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.ViewGroup;
import com.firebase.client.ChildEventListener;
import com.firebase.client.DataSnapshot;
import com.firebase.client.FirebaseError;
@mmazzarolo
mmazzarolo / Default (Linux).sublime-keymap
Last active January 23, 2020 23:32
My Sublime3 settings
[
{ "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 }
]
},
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 (
/**
* @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 / Checkbox.js
Last active March 30, 2016 13:47
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 April 18, 2016 11:53
Cleaning up the messy seamless-immutable functions in redux-logger
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]
}
@mmazzarolo
mmazzarolo / 0info.js
Last active August 11, 2016 00:05
NavigationExperimental setup
// Redux navigations tore
{
key: '1',
index: 0,
children: [{ key: 'museumList', title: 'I musei' }],
isDrawerOpen: false
}
// Navigation structure