Skip to content

Instantly share code, notes, and snippets.

View fracz's full-sized avatar

Wojciech Frącz fracz

  • Poland
View GitHub Profile
@fracz
fracz / Readme.md
Last active July 27, 2021 10:21
SUPLA Events by @fracz

SUPLA Events (unofficial)

This is a SUPLA Cloud extension that enables basic events support. Installation includes changing some sources of SUPLA Cloud instance (yes, you need to have your own SUPLA Cloud, it cannot use it on a shared official platform at supla.org).

Event specification consist of a condition (what should happen in order for the event to be perceived as occured) and a webhooks, that is, URLs to call in such cases. The condition is a Twig expression with a simple state function provided. state(XX) returns a state of a channel with ID XX. The returned value depends on the channel function. You will find the example states for specific functions helpful. Take a look at example config.yml for different possibilities.

Event specification might also contain a time_conditions, that is cron expression (or array of them) specifying when the event should be active. If the time conditio

@ryan0x44
ryan0x44 / Example1.java
Last active April 5, 2023 12:43
Java Checkstyle Cyclomatic Complexity Example
public class Example1 {
public static void main(String[] args) {
int a = 0;
if (a >= 0) {
System.out.println(">= 0");
if (a != 0) {
System.out.println("!= 0");
}
} else {
System.out.println("< 0");
@morrisonlevi
morrisonlevi / Why ES6 arrow functions won't work in PHP.md
Last active February 2, 2018 09:19
Using the syntax for ES6 arrow functions wouldn't work in PHP. Here's why and how we could work around it.

In EcmaScript 2015 (ES6) the expression (x) => x * 2 means to create an anonymous function with one parameter x that will return x * 2. For example:

(x) => x * 2
// is equivalent to:
function(x) { return x * 2; }

A modified example from [documentation by Mozilla Developer Network][1] page demonstrates how they are useful:

var a = [

"Hydrogen",