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); |
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
#!/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 { | |
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
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
#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); |
OlderNewer