Skip to content

Instantly share code, notes, and snippets.

View mfal's full-sized avatar

Marco Falkenberg mfal

View GitHub Profile
@mfal
mfal / layout.tsx
Created February 18, 2025 14:35
Using the SettingsProvider
import { SettingsProvider } from "@mittwald/flow-react-components";
export default function Layout(props) {
return (
<SettingsProvider type="localStorage" storageKey="my-app">
{props.children}
</SettingsProvider>
);
}
type CollectionDiff<TModified, TNew = TModified, TDeleted = TModified> = {
new: TNew[];
modified: TModified[];
deleted: TDeleted[];
};
export const calcCollectionDiff = <L, R = L>(
left: Iterable<L> | Array<L>,
right: Iterable<R> | Array<R>,
getLeftKey: (item: L) => string,
<?php
namespace Mittwald\SpacesAuth\OAuth2;
use Mw\Spaces\OAuth2\EnvironmentOptions;
class ShopwareOptions extends EnvironmentOptions
{
public function getClientID()
{
return "spaces.de/oauth/cms/shopware/" . $this->getSpaceID();
@mfal
mfal / GreenBox.tsx
Last active March 5, 2025 16:03
Extend regular HTML Elements with React & TypeScript
// We extend from React.HTMLAttributes to get all the HTML attributes
// Don't extend React.HTMLProps!
export interface IGreenBoxProps extends React.HTMLAttributes<HTMLDivElement> {
title: string;
}
class GreenBox extends React.Component<IGreenBoxProps, void> {
public render() {
// If you don't spread children and title, the restProps
// still contain these props and compiler will say "no"
@mfal
mfal / deeper.sh
Created February 16, 2017 20:13
eval > docker > node >
#!/bin/sh
eval "$(docker run node:6-slim node -e "console.log('echo \"We must go deeper\"');")"