Skip to content

Instantly share code, notes, and snippets.

View dtorras's full-sized avatar

David Torras dtorras

  • Creagia
  • Igualada, Catalunya
  • X @dtorras
View GitHub Profile
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
@dtorras
dtorras / Authenticate.php
Created December 17, 2021 12:52 — forked from kresnasatya/Authenticate.php
Fixed problem Laravel Passport doesn't redirect back to authorization form after login
<?php
namespace App\Http\Middleware;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
class Authenticate extends Middleware
{
/**
* Get the path the user should be redirected to when they are not authenticated.
@dtorras
dtorras / web.php
Created May 13, 2022 09:41
Bizum payment with creagia/redsys-php
<?php
use Creagia\Redsys\Enums\ConsumerLanguage;
use Creagia\Redsys\Enums\PayMethod;
use Creagia\Redsys\Exceptions\DeniedRedsysPaymentNotification;
use Creagia\Redsys\RedsysNotification;
use Creagia\Redsys\Support\RequestParameters;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Route;