Skip to content

Instantly share code, notes, and snippets.

View ronal2do's full-sized avatar

Ronaldo Lima ronal2do

View GitHub Profile
@ronal2do
ronal2do / thermostat.yaml
Created December 23, 2020 13:53
Sets a Thermostat to a specifc temperature at a certain time everyday
# https://community.home-assistant.io/t/simple-set-thermostat-at-specific-time/255778
blueprint:
name: Set thermostat temperature at specific time
description: Sets a Thermostat to a specifc temperature at a certain time everyday
domain: automation
input:
time_to_set:
name: Time
selector:
time:
echo 'remove cache'
rm -rf $TMPDIR/react-*
rm -rf $TMPDIR/metro-*
watchman watch-del-all
npm cache verify
# echo 'removing derived data'
rm -rf ~/Library/Developer/Xcode/DerivedData
echo 'removing pods and node modules'
// Identify
const trackingOpts = { id, usernameOrEmail: email };
Analytics.identify(id, TrackingOpts);
// Simple event
Analytics.track(Analytics.events.BOOTSTRAP);
// Event with paramenters
Analytics.track(Analytics.events.USER_CREATED_ACCOUNT, trackingOpts);
@ronal2do
ronal2do / Analytics.ts
Created July 24, 2019 20:39
services/Analytics.ts
import Constants from 'expo-constants';
import * as Amplitude from 'expo-analytics-amplitude';
import { TrackingOptions, normalizeTrackingOptions } from './AnalyticsUtils';
import { ENV } from '../environment';
let isInitialized = false;
const apiKey = ENV.AMPLITUDE;
const { installationId, deviceName, deviceId, deviceYearClass, expoVersion, nativeAppVersion, nativeBuildVersion, platform, manifest: { version }} = Constants
export class App extends React.PureComponent {
render() {
return (
<View style={{width: '100%', height: '100%'}}>
<OtherComponent />
<SpecialComponent ref={(ref) => ComponentHelper.setReference(ref)}/>
</View>
)
}
}
# Fastfile
#
# Author: Ronaldo Lima <ronal2do@gmail.com>
#
# -----------------------------------------------------------
#
# Version bumping, the default type is `patch`
# Run:
# `fastlane ios bump`
# `fastlane ios beta [type:major|minor|patch]`
import { AsyncStorage } from 'react-native'
import react, { useEffect } from "react"
import { useState } from 'react'
import { useNetInfo } from './useNetInfo';
export const getData = async (key: string) => {
try {
const value = await AsyncStorage.getItem(key)
if (value !== null) {
return JSON.parse(value)
import React, { useReducer, useContext, ReactNode } from 'react'
import { Text, View, TouchableOpacity, StyleSheet } from 'react-native'
const initialArg = 0
type Action =
| { type: 'increment' }
| { type: 'decrement' }
| { type: 'set'; count: number }