I hereby claim:
- I am matthiaskainer on github.
- I am matthias_kainer (https://keybase.io/matthias_kainer) on keybase.
- I have a public key ASAZ47c1zOdTW7ilmSrksXxnL-jFRtZW6JlRi3Vh0WHm5Ao
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
// ==UserScript== | |
// @name GSlack | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Using the css from https://github.com/paveyry/Slack-Theme-for-Hangouts-Chat/ | |
// @author You | |
// @match https://chat.google.com/* | |
// @grant none | |
// ==/UserScript== |
const unsigned char LED_RED = 3; | |
const unsigned char LED_GREEN = 5; | |
const unsigned char LED_BLUE = 6; | |
void setup() { | |
Serial.begin(9600); | |
pinMode(LED_GREEN, OUTPUT); | |
pinMode(LED_BLUE, OUTPUT); | |
pinMode(LED_RED, OUTPUT); | |
} |
#include <Adafruit_NeoPixel.h> | |
#ifdef __AVR__ | |
#include <avr/power.h> | |
#endif | |
#define PIN 4 | |
Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, PIN, NEO_GRB + NEO_KHZ800); | |
void setup() { | |
strip.begin(); | |
strip.setBrightness(20); |
@customElement("demo-element") | |
export class DemoElement extends LitElement { | |
state: DispatcherType<DemoElementState>; | |
constructor() { | |
super() | |
// register dispatcher in the constructor | |
this.state = useDispatcher<DemoElementState>(this, { actions: [] }) | |
} |
pureLit("dispatch-todo", (element) => { | |
const { publish, getState } = useState(element, { todos: [] } as TodoState); | |
return html` | |
<h2>Your todos</h2> | |
<todo-add | |
@add="${(e: CustomEvent) => | |
publish({ todos: [...getState().todos, e.detail] })}" | |
></todo-add> | |
<todo-list | |
.items="${getState().todos}" |
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); |
(element) => { | |
const { publish, getState } = useState(element, TodoReducer, { todos: [] }); | |
return html` | |
<button @click="${() => publish("add", "lala")}"> | |
Add value | |
</button> | |
<textarea>${getState().join(",")}</textarea> | |
` | |
} |
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 |
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 |