Framework-agnostic, ad-hoc image cropper

Today, I’m releasing a framework-agnostic, in-browser image cropper. The motivation is that I need this on a regular basis in multiple projects, across multiple frameworks and – while I’m aware of existing tools like Cropper.js and others – quite frankly, to me they seem too complex to setup especially depending on the front-end framework I’m dealing with. I needed this problem reduced to a simple JS call.

Continue reading

Dynamic custom data via OAuth with Laravel Socialite

If you’ve ever done authentication in a Laravel-based project then you probably had to deal with the Socialite extension, which enables OAuth-based authentication using third-party services (like Google or Facebook). Passing dynamic data to the external OAuth system and getting that data back to your application, using Socialite, is something neither easily done nor well documented and given that I’ve seen a lot of people wasting time on this, I

Continue reading

Remember last value in React functional components

Sometimes it can be very useful to save previous values of props (or state) in a React component. Perhaps this is easier to be imagined in a class component, but in a functional component, less so. However, we can use the useRef() React hook to achieve that quite efficiently. Less talk, more code (typescript)… const someFunctionalComponent = (p: {index: number}) => { // Keep the last positive value around. const

Continue reading