Skip to content

Instantly share code, notes, and snippets.

View regevbr's full-sized avatar
👨‍💻
Coding...

Regev Brody regevbr

👨‍💻
Coding...
View GitHub Profile
@regevbr
regevbr / gist:047092e6f76fb2777a4ed8f4fe698bb8
Last active December 25, 2023 22:10
mini-climate-card-bundle.js
;
(function () {
"use strict";
function _taggedTemplateLiteral(strings, raw) {
if (!raw) {
raw = strings.slice(0);
}
return Object.freeze(Object.defineProperties(strings, {
raw: {
// tslint:disable:no-empty-interface
// Library
// (Based in part on https://bitbucket.org/espalier-spreadsheet/espalier/src/b9fef3fd739d42cacd479e50f20cb4ab7078d534/src/lib/type-funcs.ts?at=master&fileviewer=file-view-default#type-funcs.ts-23
// with inspiration from https://github.com/gcanti/fp-ts/blob/master/HKT.md)
// https://stackoverflow.com/questions/51815782/typescript-array-of-different-generic-types/51816182#51816182
interface ExistentialType<URI> {
readonly _URI: URI
}
@regevbr
regevbr / light-entity-card.js
Last active March 9, 2022 08:39
light entity card fixed
(function(){"use strict";function j(a,b){return b||(b=a.slice(0)),Object.freeze(Object.defineProperties(a,{raw:{value:Object.freeze(b)}}))}function k(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function l(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?k(Object(b),!0).forEach(function(c){m(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):k(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function m(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function n(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function o(a){return function(){var b=this,c=arguments;return new Promise(func
@regevbr
regevbr / mini-humidifier-bundle.js
Last active March 9, 2022 08:34
mini hmidifier card fixed
(function(){"use strict";function j(a,b){return b||(b=a.slice(0)),Object.freeze(Object.defineProperties(a,{raw:{value:Object.freeze(b)}}))}function k(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function l(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?k(Object(b),!0).forEach(function(c){m(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):k(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function m(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function n(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function o(a){return function(){var b=this,c=arguments;return new Promise(func
@regevbr
regevbr / mini-climate-card-bundle.js
Last active March 11, 2022 16:54
mini climate card fixed
(function(){"use strict";function j(a,b){return b||(b=a.slice(0)),Object.freeze(Object.defineProperties(a,{raw:{value:Object.freeze(b)}}))}function k(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function l(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?k(Object(b),!0).forEach(function(c){m(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):k(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function m(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function n(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function o(a){return function(){var b=this,c=arguments;return new Promise(func
@regevbr
regevbr / mini-climate-card-bundle.js
Created November 7, 2021 17:47
mini-climate-card-bundle icons fix
(function(){"use strict";function a(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function b(b){for(var d,e=1;e<arguments.length;e++)d=null==arguments[e]?{}:arguments[e],e%2?a(Object(d),!0).forEach(function(a){c(b,a,d[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(b,Object.getOwnPropertyDescriptors(d)):a(Object(d)).forEach(function(a){Object.defineProperty(b,a,Object.getOwnPropertyDescriptor(d,a))});return b}function c(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function d(a,b){return b||(b=a.slice(0)),Object.freeze(Object.defineProperties(a,{raw:{value:Object.freeze(b)}}))}function e(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function f(a){return function(){var b=this,c=arguments;return new Promise(func
@regevbr
regevbr / simple-thermostat.js
Created November 5, 2021 06:42
simple-thermostat icon fix
!function(){const e={DEBUG:!1};try{if(process)return process.env=Object.assign({},process.env),void Object.assign(process.env,e)}catch(e){}globalThis.process={env:e}}();var e="simple-thermostat";const t="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,i=(e,t,i=null)=>{for(;t!==i;){const i=t.nextSibling;e.removeChild(t),t=i}},n=`{{lit-${String(Math.random()).slice(2)}}}`,s=`\x3c!--${n}--\x3e`,o=new RegExp(`${n}|${s}`);class r{constructor(e,t){this.parts=[],this.element=t;const i=[],s=[],r=document.createTreeWalker(t.content,133,null,!1);let l=0,u=-1,h=0;const{strings:p,values:{length:f}}=e;for(;h<f;){const e=r.nextNode();if(null!==e){if(u++,1===e.nodeType){if(e.hasAttributes()){const t=e.attributes,{length:i}=t;let n=0;for(let e=0;e<i;e++)a(t[e].name,"$lit$")&&n++;for(;n-- >0;){const t=p[h],i=d.exec(t)[2],n=i.toLowerCase()+"$lit$",s=e.getAttribute(n);e.removeAttribute(n);const r=s.split(o);this.parts.push({type:"attribute",index:u,name:i,strings:
@regevbr
regevbr / textEmailsUpdater.ts
Last active July 28, 2019 21:29
mautic auto generate email text version
'use strict';
import * as textVersion from 'html-to-text';
import * as mysql from 'mysql';
import * as _ from 'underscore';
const connection = mysql.createConnection({
host: '<host>',
user: '<user>',
password: '<password>',
database: 'mautic',
@regevbr
regevbr / _scaffoldGetProp.ts
Last active April 22, 2024 13:52
scaffold type safe get function up to a desired order
'use strict';
// tslint:disable:max-line-length
// based on https://www.reddit.com/r/typescript/comments/aynx0o/safe_deep_property_access_in_typescript
import * as fs from 'fs';
const method = 'getProp';
const TAB = ` `;
@regevbr
regevbr / squissHelloWorld.ts
Last active May 18, 2019 10:33
squiss-ts hello world
import {Squiss, Message} from 'squiss-ts';
const awsConfig = {
accessKeyId: '<accessKeyId>',
secretAccessKey: '<secretAccessKey>',
region: '<region>',
};
const squiss = new Squiss({
awsConfig,