Skip to content

Instantly share code, notes, and snippets.

@dovidweisz
dovidweisz / patchReactUse.js
Created November 24, 2020 18:43
Patch react-use types for Typescript 4
const fs = require("fs");
const path = require("path");
/**
*
* Patching react-use for Typescript 4.1
*
* The latest version of typescript causes changs the name of a type used by react-use.
*
* https://github.com/streamich/react-use/issues/1646
type ReplaceParam<T extends {}, P extends keyof T, R> = Omit<T, P> & { P: R };
@dovidweisz
dovidweisz / flattenRoutes.ts
Created June 10, 2020 14:02
Flatten React Router routes into one array
import { RouteConfig } from "react-router-config";
function flattenRoutes(routes: RouteConfig[]): RouteConfig[] {
return [
...routes,
...routes.reduce<RouteConfig[]>(
(accum, route) => [...accum, ...(route.routes ? flattenRoutes(route.routes) : [])],
[]
),
];
docker container run -v ${VOLUME_NAME}:/dest/path/of/mount --entrypoint="" -it ${IMAGE_NAME}:latest bash
export class TranslationWidget extends Component {
constructor(props, c) {
super(props, c);
this.state = {
items: this.props.value
};
}
onChange(key, value) {
this.setState({
@dovidweisz
dovidweisz / SassMeister-input-HTML.html
Last active June 15, 2016 22:00 — forked from shirah/SassMeister-input-HTML.html
Generated by SassMeister.com.
<div class="div1"></div>
<div class="div2"></div>
<div class="div3"></div>
<div class="div4"></div>
<div class="div5"></div>
<div class="div6"></div>
<div class="div7"></div>
<div class="div8"></div>
<div class="div9"></div>
<div class="div10"></div>
@dovidweisz
dovidweisz / opacitator.scss
Last active March 22, 2024 10:45
Generated by SassMeister.com.
// ----
// Sass (v3.4.21)
// Compass (v1.0.3)
// ----
@function opacitator($color){
$hi: 1;
$lo: 0;
$tol: 0.01;
$rgbs: (red($color) green($color) blue($color));