Skip to content

Instantly share code, notes, and snippets.

View ronal2do's full-sized avatar

Ronaldo Lima ronal2do

View GitHub Profile
@networkingcat
networkingcat / yet_another_motion_automation.yaml
Last active April 28, 2024 14:58 — forked from quallenbezwinger/motion_controlled_scenes_enhanced.yaml
Homeassistant blueprint for motion-activated light scene
blueprint:
name: Yet Another Motion Automation
description: >
# YAMA V10
Turn on lights or scenes when motion is detected.
Four different scenes can be defined depending on time of day.
@LFSCamargo
LFSCamargo / AnimatedGate.tsx
Created May 30, 2019 01:48
Animated Twitter LaunchScreen
import * as React from 'react'
import { Animated, Easing, StatusBar, MaskedViewIOS, View, ViewStyle } from 'react-native'
import icons from '../../icons'
import lightTheme from '../../config/theme'
interface Props {
bootstraped: boolean
}
const AnimatedGate: React.FunctionComponent<Props> = (props) => {

Time Travel Debugging

Time Travel refers to the ability to record a tab and later replay it ([WebReplay][wrr]). The technology is useful for local development, where you might want to:

  • pause and step forwards or backwards
  • pause and rewind to a prior state
  • rewind to the time a console message was logged
  • rewind to the time an element had a certain style or layout
  • rewind to the time a network asset loaded
@sibelius
sibelius / removeCascadeMongoose.js
Created July 25, 2018 12:34
Remove cascade for mongoose
import mongoose from 'mongoose';
import connectDatabase from '../src/common/database';
// this is needed to load all models in mongoose.models
// eslint-disable-next-line
import * as M from '../src/models';
const removeCascade = async (modelName: string, _id: string) => {
const modelNames = Object.keys(mongoose.models);
@wbyoung
wbyoung / environment.js
Created July 23, 2018 17:59
Relay environment while exploring deferred queries
/* @flow */
import {
forOwn,
size,
get,
transform,
noop,
} from 'lodash';
@jordanmkoncz
jordanmkoncz / .react-navigation iOS 11 Navigation Bar with Large Title
Last active May 9, 2022 16:21
react-navigation iOS 11 Navigation Bar with Large Title
#
@mike-marcacci
mike-marcacci / Root.js
Last active July 10, 2019 13:18
Relay Modern SSR
// @flow
import React, { Component } from "react";
import PropTypes from "prop-types";
import App from "./components/App";
type Props = {
environment: *,
queryTracker?: *
};
@sibelius
sibelius / flow-redux.guideline.md
Created November 10, 2017 16:23
How to easily type Redux Props with Flow

How to easily type Redux Props with Flow

Add ExtractReturn helper

// https://hackernoon.com/redux-flow-type-getting-the-maximum-benefit-from-the-fewest-key-strokes-5c006c54ec87
// https://github.com/facebook/flow/issues/4002
// eslint-disable-next-line no-unused-vars
type _ExtractReturn<B, F: (...args: any[]) => B> = B;
export type ExtractReturn = _ExtractReturn&lt;*, F&gt;;
@danielfttorres
danielfttorres / CreateStoryMutation.js
Last active November 1, 2017 17:12
Some stuff for help to make Relay Modern mutation updates
// @flow
import Relay, { graphql } from 'react-relay'
import { mutationCreateUpdater} from './mutationUpdater'
const mutation = graphql`
mutation createStoryMutation($input: CreateStoryInput!) {
createStory(input: $input) {
story {
id
@acdlite
acdlite / Dataloader.js
Last active August 15, 2018 04:36
Idea for Dataloader component
// The `loader` prop is a Dataloader instance
// https://github.com/facebook/dataloader
class Dataloader extends React.Component {
state = {data: null, isLoaded: false};
componentWillMount() {
this.prefetchData(this.props);
}
componentWillReceiveProps(nextProps) {
if (this.props.id !== nextProps.id || this.props.loader !== nextProps.loader) {
this.setState({isLoaded: false});