Skip to content

Instantly share code, notes, and snippets.

View ramoncardena's full-sized avatar

Ramon Cardena ramoncardena

View GitHub Profile
@ramoncardena
ramoncardena / sonoff_wb01_zha.yaml
Created January 4, 2024 19:00
Sonoff WB01 Blueprint
---
blueprint:
name: Sonoff Zigbee Switch
description: Automate the Sonoff Zigbee WB01
domain: automation
input:
sonoff_button:
name: Sonoff Switch
selector:
device:
@ramoncardena
ramoncardena / db.dart
Created November 20, 2019 11:04
Futter service to manage Firebase Cloud Firestore datastores. The classes in db.dart allow us to manage collections, documents, or collections with the name of the user.
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'dart:async';
import 'package:rxdart/rxdart.dart';
import './globals.dart';
class Document<T> {
final Firestore _db = Firestore.instance;
final String path;
DocumentReference ref;
@ramoncardena
ramoncardena / React-16.8-Lifecycle.md
Last active February 19, 2019 16:59
React 16.8 Lifecycle Methods

React 16.8 Lifecycle Methods

Reference for React components defined as classes.

Mounting Updating Unmounting
constructor()
static getDerivedStateFromProps()
@ramoncardena
ramoncardena / MessageBox.js
Last active October 14, 2021 05:22
React component - Message Box with boxColor, textColor and msgType props.
import React from 'react';
import styled from 'styled-components';
import { Icon } from 'react-icons-kit';
import { alertTriangle } from 'react-icons-kit/feather/alertTriangle';
import { info } from 'react-icons-kit/feather/info';
const Box = styled.div`
display: flex;
flex-direction: row;
justify-content: flex-start;
@ramoncardena
ramoncardena / alternateLang.js
Last active December 17, 2018 12:35
Function to generate hreflang meta tags (React/React Router v4)
import Url from 'url-parse';
import * as config from '../config';
function alternateLangs(url, currentLng) {
// Load all languages and filter current language
const languages = Array.from(config.ALL_LANGUAGES).filter(
lng => lng !== currentLng
);
// Load url object for current location
const currentUrl = new Url(url);
@ramoncardena
ramoncardena / keybase.md
Created February 3, 2018 23:32
Keybase proof

Keybase proof

I hereby claim:

  • I am ramoncardena on github.
  • I am rcardena (https://keybase.io/rcardena) on keybase.
  • I have a public key ASDqn-P08g3PHBDFNL7zyjSMqe1W9555hbPUX5H-HT5Z7Qo

To claim this, I am signing this object: