This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
LitElement, | |
customElement, | |
html, | |
css, | |
property | |
} from "lit-element"; | |
const blockStyle = css`:host { display: block; }` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
html, | |
css | |
} from "lit"; | |
import { | |
pureLit | |
} from "pure-lit" | |
const blockStyle = css`:host { display: block; }` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package de.matthiaskainer.spring.net.resttemplate.logging | |
import mu.KotlinLogging | |
import org.springframework.http.HttpRequest | |
import org.springframework.http.client.ClientHttpRequestExecution | |
import org.springframework.http.client.ClientHttpRequestInterceptor | |
import org.springframework.http.client.ClientHttpResponse | |
import java.io.BufferedReader | |
import java.io.IOException | |
import java.io.InputStreamReader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const clickReducer = (state: number) => ({ | |
add: (payload: number) => state + (payload as number ?? 0) | |
}) | |
pureLit( | |
"todo-list", | |
(element: LitElementWithProps<ListProps>) => html`<ul> | |
${element.items.map( | |
(item) => | |
html`<li |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(element) => { | |
const { publish, getState } = useState(element, TodoReducer, { todos: [] }); | |
return html` | |
<button @click="${() => publish("add", "lala")}"> | |
Add value | |
</button> | |
<textarea>${getState().join(",")}</textarea> | |
` | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const TodoReducer: Reducer<TodoState> = (state) => ({ | |
add: (payload: string) => ({ ...state, todos: [...state.todos, payload as string] }), | |
remove: (payload: string) => ({ | |
...state, | |
todos: [...state.todos.filter((todo) => todo !== payload)], | |
}) | |
}) | |
pureLit("reducer-todo", (element) => { | |
const { publish, getState } = useReducer(element, TodoReducer, { todos: [] } as TodoState); |
NewerOlder