Skip to content

Instantly share code, notes, and snippets.

import * as React from "react";
import { useMousePosition } from "~/hooks/useMousePosition";
/** Component to cover the area between the mouse cursor and the sub-menu, to allow moving cursor to lower parts of sub-menu without the sub-menu disappearing. */
export function MouseSafeArea(props: { parentRef: React.RefObject<HTMLDivElement> }) {
const { x = 0, y = 0, height: h = 0, width: w = 0 } = props.parentRef.current?.getBoundingClientRect() || {};
const [mouseX, mouseY] = useMousePosition();
const positions = { x, y, h, w, mouseX, mouseY };
return (
<div
@getnashty
getnashty / gist:4b86f42a4109fc4be68a04ee7ef9a078
Created July 23, 2018 21:01 — forked from justinabrahms/gist:5673408
Short script which will grep your project for unused requirejs imports. Usage: `/path/to/file.sh application/js/directory`
#/bin/bash
JS_FILES=$(find "$1" -name "*.js")
for FILE in $JS_FILES; do
short_name=`basename $FILE`
filename="${short_name%.*}"
git grep --quiet $filename 1>/dev/null
if [ "$?" == "1" ]; then
echo "Should delete: $FILE"