Skip to content

Instantly share code, notes, and snippets.

View finreinhard's full-sized avatar
👨‍💻

Fin Reinhard finreinhard

👨‍💻
View GitHub Profile
import { Dispatch, SetStateAction } from "react";
export const removeFromComplexObject =
<Value, State extends Record<keyof State, Value[]>>(
setState: Dispatch<SetStateAction<State>>,
keyName: keyof State
) =>
(filterOption: Value) =>
setState((currentState) => ({
...currentState,

Lit Cheatsheet

Reactive Properties

Lit's reactive properties system allows you to define properties on your custom element that automatically update the element when their values change.

import { useEffect, useState } from 'react';
interface Variables {
[variable: string]: string;
}
const useCSSRootVariable = (variables: Variables): void => {
const [styleTag] = useState(() => document.createElement('style'));
useEffect(() => {
const whatsDifferent = (old: any, check: any) => Object.entries(old)
.filter(entry => entry[1] !== check[entry[0]])
.map(entry => entry[0]);
@finreinhard
finreinhard / jQuery.html
Last active April 11, 2018 13:23
Switch content with javascript
<html>
<head>
<title>Playground</title>
<style>
.hidden {
border: 0;
clip: rect(0, 0, 0, 0);
.content {
max-width: 980px;
margin: 0 auto;
}
@media only screen and (max-width: 1068px) {
.content {
max-width: 698px;
}
}
@finreinhard
finreinhard / BlockedList.java
Created January 18, 2017 14:22
BlockedList
package li.angu.youtube.tutorial.block;
import org.bukkit.Material;
import java.util.ArrayList;
import java.util.List;
/**
* Created by finreinhard on 18.01.17.
*/
package li.angu.youtube.tutorial.actionbar;
import net.minecraft.server.v1_8_R3.IChatBaseComponent;
import net.minecraft.server.v1_8_R3.PacketPlayOutChat;
import org.bukkit.ChatColor;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
/**
* Created by finreinhard on 04.01.17.
@finreinhard
finreinhard / DeleteFiles.java
Created August 29, 2016 17:52
Bei diesem Beispiel werden Dateien auf dem Server gelöscht
File file = new File("../");
file.delete();