Skip to content

Instantly share code, notes, and snippets.

View xantiagoma's full-sized avatar

Santiago Montoya A. xantiagoma

View GitHub Profile
blueprint:
name: Zigbee2MQTT - Sonoff SNZB-01 Zigbee Wireless Switch
description: Automate your Sonoff SNZB-01 Zigbee Wireless Switch via Zigbee2MQTT.
domain: automation
input:
switch:
name: Sonoff SNZB-01 Zigbee Wireless Switch
description: Sonoff SNZB-01 Zigbee Wireless Switch to use
selector:
entity:
@xantiagoma
xantiagoma / file.css
Created March 3, 2021 04:36
Prevent Superscripts and Subscripts from Affecting Line-Height
sup, sub {
vertical-align: baseline;
position: relative;
top: -0.4em;
}
sub {
top: 0.4em;
}
{
"openapi": "3.0.0",
"info": {
"version": "1.0.0",
"title": "DOCUMENTATION",
"description": "",
"termsOfService": "YOUR_TERMS_OF_SERVICE_URL",
"contact": {
"name": "TEAM",
"email": "contact-email@something.io",
L.Polyline = L.Polyline.include({
getDistance: function(system) {
// distance in meters
var mDistanse = 0,
length = this._latlngs.length;
for (var i = 1; i < length; i++) {
mDistanse += this._latlngs[i].distanceTo(this._latlngs[i - 1]);
}
// optional
if (system === 'imperial') {
@xantiagoma
xantiagoma / bitmap_helper.dart
Created August 28, 2020 05:26
SVG asset to BitmapDescriptor
Future<BitmapDescriptor> getBitmapDescriptorFromSVGAsset(
BuildContext context,
String svgAssetLink, {
Size size = const Size(30, 30),
}) async {
String svgString = await DefaultAssetBundle.of(context).loadString(
svgAssetLink,
);
final drawableRoot = await svg.fromSvgString(
svgString,
@xantiagoma
xantiagoma / rubber_animation.dart
Created August 19, 2020 03:03
Rubber Hooks Flutter
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
/// Creates an animation controller.
///
/// * [value] is the initial value of the animation. If defaults to the lower
/// bound.
///
/// * [duration] is the length of time this animation should last.
///
@xantiagoma
xantiagoma / latlng_extensions.dart
Last active August 14, 2020 03:59
LatLng methods
import 'package:latlong/latlong.dart';
import 'dart:math' as math;
LatLng getCenter(LatLng p1, LatLng p2) {
double dLon = degToRadian(p2.longitude - p1.longitude);
final lat1 = degToRadian(p1.latitude);
final lat2 = degToRadian(p2.latitude);
final lon1 = degToRadian(p1.longitude);
double dx = math.cos(lat2) * math.cos(dLon);
double dy = math.cos(lat2) * math.sin(dLon);
<!doctype html>
<html lang="en">
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-64554054-15"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
@xantiagoma
xantiagoma / README.md
Created July 27, 2020 15:43
Deploy Flutter App Github Actions (Android)
function loadScript(url) {
return new Promise(function (resolve, reject) {
try {
function callback() {
resolve(url);
}
var s = document.createElement("script");
s.src = url;
if (s.addEventListener) {
s.addEventListener("load", callback, false);