Skip to content

Instantly share code, notes, and snippets.

import { html, LitElement } from "lit-element";
import { useState, useReducer } from "lit-element-state-decoupler";
import { pureLit } from "pure-lit";
import { LitElementWithProps } from "pure-lit/types";
type ListProps = { items: string[] };
const add = (state: string) => ({
update: (payload: string) => payload,
add: () => state,
import {
html,
css
} from "lit";
import {
pureLit
} from "pure-lit"
const blockStyle = css`:host { display: block; }`
import {
LitElement,
customElement,
html,
css,
property
} from "lit-element";
const blockStyle = css`:host { display: block; }`
@MatthiasKainer
MatthiasKainer / tell-me-when-site-is-back.sh
Last active September 27, 2021 10:07
[MacOS][workflow] Notify me when a website is back again. Call like this: `./tell-me-when-site-is-back.sh https://matthias-kainer.de &` (replace my homepage with yours...)
#!/bin/bash
URL="$1"
while true; do
OUTPUT_FILE=$(mktemp)
HTTP_CODE=$(curl --silent --output $OUTPUT_FILE --write-out "%{http_code}" "$URL")
if [ $? -lt 399 ]
then
osascript -e "display notification \"$URL is back\""
break
@MatthiasKainer
MatthiasKainer / greet.js
Created December 16, 2022 12:44
simple example for a CPU heavy webworker without blocking the browser
function heavyComputation(n) {
if (n <= 1) {
return n;
}
return heavyComputation(n - 1) + heavyComputation(n - 1);
}
onmessage = function (e) {
console.log('Worker: Message received from main script', e.data);
#include <CoDrone.h> // The codrone library that holds all the background files for this
void setup()
{
CoDrone.begin(115200);
//connect with drone controller have adress
// CoDrone.pair();
//connect with the nearest drone
CoDrone.pair(Nearest);