Skip to content

Instantly share code, notes, and snippets.

View emanueleDiVizio's full-sized avatar

Emanuele emanueleDiVizio

View GitHub Profile
@emanueleDiVizio
emanueleDiVizio / AndroidManifest.xml
Last active August 29, 2015 14:20
Base classes to handle GCM registration and notifications.
<manifest ...>
...
<uses-permission android:name="android.permission.WAKE_LOCK" />
<permission android:name="your.package.name.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="your.package.name.permission.C2D_MESSAGE" />
<uses-permission
android:name="com.google.android.c2dm.permission.RECEIVE" />
// This function takes a component...
import React, { Component } from 'react';
import { View, TextInput, Image, Animated, Keyboard } from 'react-native';
export const withKeyboardAvoidingBehaviour = (WrappedComponent) => {
// ...and returns another component...
return class extends Component {
constructor(props) {
@emanueleDiVizio
emanueleDiVizio / android_instructions_23.md
Last active July 9, 2018 13:16 — forked from agrcrobles/android_instructions_29.md
Setup Android development environment on a Mac

Here is a high level overview for what you need to do to get most of an Android environment setup and maintained.

Prerequisites (for Homebrew at a minimum, lots of other tools need these too):

  • XCode is installed (via the App Store)
  • XCode command line tools are installed (xcode-select --install will prompt up a dialog)
  • Java

Install Homebrew:

const List = ({ data }) => {
return (
<View>
<FlatList
data={data}
renderItem={renderFunction}
keyExtractor={item => item.id}
/>
</View>
);
const CoolButton = () => {
const onPress = () => {}
return (
<Button
title="Play!"
onPress={onPress}
/>
);
};
const CoolButton = () => {
const playerRef = useRef(null);
const onPress = () => {}
useEffect(() => {
playerRef.current = loadPlayer('filename.wav');
return () => {
playerRef.current.destroy();
};
const CoolButton = () => {
const playerRef = useRef(null);
const onPress = () => {
playerRef.current.play();
};
useEffect(() => {
playerRef.current = loadPlayer('filename.wav');
return () => {
const useAudioPlayer = (fileName) => {
const playerRef = useRef(null);
useEffect(() => {
playerRef.current = loadPlayer(fileName);
return () => {
playerRef.current.destroy();
};
}, []);
const CoolButton = () => {
const playerRef = useAudioPlayer('filename.wav');
const onPress = () => {
playerRef.current.play();
};
return (
<Button
title="Play!"
const useAudioPlayer = (fileName) => {
const playerRef = useRef(null);
useEffect(() => {
playerRef.current = loadPlayer(fileName);
return () => {
playerRef.current.destroy();
};
}, []);