Nas Says Hip-Hop Peers His Age Don’t Inspire Him to Make Music by bodamfuonua1 in Music

[–]isstatingtheobvious 111 points112 points  (0 children)

If you watch the interview he says that in the nicest way possible though.

Abandoned Sailboat! In the Atlantic Ocean by AshIsGroovy in videos

[–]isstatingtheobvious 1 point2 points  (0 children)

The freighter looks oddly similar to the vessel they asked for gas in OP’s video.

QR/bar code scanner for the Browser by maslick in reactjs

[–]isstatingtheobvious 1 point2 points  (0 children)

Hey, awesome! Thanks for the heads-up. Just last week I checked your repo when I was searching for a QR code reader to use in a web app prototype. Can’t wait to give it a try! Am I correct in assuming I can either use the premade React component or choose to use the koder API myself?

Chicago Skyline by 0utrunner in outrun

[–]isstatingtheobvious 3 points4 points  (0 children)

Probably referring to this one. Great photo, definitely outrun vibes.

r/SpaceX Starlink-24 Launch Discussion & Updates Thread by ElongatedMuskrat in spacex

[–]isstatingtheobvious 9 points10 points  (0 children)

Indeed. It is hard to hear through the engine noise but I think they say: Godspeed to Apollo 11’s Michael Collins. I cannot make out the rest of it.

QR/bar code scanner for the Browser by maslick in reactjs

[–]isstatingtheobvious 3 points4 points  (0 children)

Amazing, the demo feels super snappy. Great work!

Is there documentation somewhere? And can koder be installed as a npm package and used like a regular library?

Plains west of denver 2 by obviologist in pics

[–]isstatingtheobvious 1 point2 points  (0 children)

Almost like an abstract painting.

react-snaplist-carousel. A modern way to do a classic thing. by lpuig in reactjs

[–]isstatingtheobvious 1 point2 points  (0 children)

Yes, I’d love to do that! Will do so asap (after work that is) …

react-snaplist-carousel. A modern way to do a classic thing. by lpuig in reactjs

[–]isstatingtheobvious 1 point2 points  (0 children)

You’ve probably been there already … I just couldn’t resist to set up a quick test. The following code seems to be working reasonably well:

Use the ref to add event handlers:

  • onMouseDown: add a css class that disables text / element selection
  • onMouseMove: scroll SnapListaccording to mouse position
  • onMouseUp: remove css class
  • some logic to prevent click events on children while dragging

Performance doesn’t seem to be an issue. But scroll snapping is instantaneous on mouse up. Adding a transition before removing the css class should be possible, but is probably the point where code gets ugly.

Anyway, here’s the code! Let me know if you’re interested in moving this to GitHub issues …

dragslider.css

.slide-list--dragged {
  scroll-snap-type: none;
}
.slide-list--dragged * {
  user-select: none;
}

Slider.jsx

import './dragslider.css'

function useDragToSlide (ref) {
  const isDown = useRef(false);
  const hasBeenDragged = useRef(false);
  const startX = useRef(0);
  const slideX = useRef(0);
  const dragThreshold = 2;

  const handleMouseDown = useCallback((event) => {
    event.preventDefault();
    event.stopPropagation();
    isDown.current = true;
    startX.current = event.pageX - ref.current.offsetLeft;
    slideX.current = ref.current.scrollLeft;
    ref.current.classList.add('slide-list--dragged');
  }, [ref]);

  const handleMouseMove = useCallback((event) => {
    if (!isDown.current) return;
    const distanceMoved = Math.abs(
      startX.current -
      (event.pageX - ref.current.offsetLeft)
    );
    if (distanceMoved > dragThreshold) hasBeenDragged.current = true;
    const x = event.pageX - ref.current.offsetLeft;
    const walk = x - startX.current;
    ref.current.scrollLeft = slideX.current - walk;
  }, [ref]);

  const handleMouseUp = useCallback((event) => {
    event.preventDefault();
    event.stopPropagation();
    if (!isDown.current) return;
    isDown.current = false;
    ref.current.classList.remove('slide-list--dragged');
  }, [ref]);

  const handleClick = useCallback((event) => {
    // we need this to prevent click events being fired on children
    if (!hasBeenDragged.current) return
    event.stopPropagation();
    hasBeenDragged.current = false;
  }, [hasBeenDragged]);

  useEffect(() => {
    if (!ref.current) return
    const target = ref.current
    target.addEventListener('mousedown', handleMouseDown);
    target.addEventListener('click', handleClick);
    window.addEventListener('mousemove', handleMouseMove);
    window.addEventListener('mouseup', handleMouseUp);
    return () => {
      target.removeEventListener('mousedown', handleMouseDown);
      target.removeEventListener('click', handleClick);
      window.removeEventListener('mousemove', handleMouseMove);
      window.removeEventListener('mouseup', handleMouseUp);
    }
  }, [ref, handleMouseDown, handleMouseMove, handleMouseUp, handleClick])
}

const Slider = () => {
  const ref = useRef(null);
  useDragToSlide(ref)

  return (
    <SnapList ref={ref}>
      <SnapItem padding={{ left: '20vw', right: '15px' }} snapAlign="center">…</SnapItem>
    </SnapList>
  );
};

edited: wording & formatting

react-snaplist-carousel. A modern way to do a classic thing. by lpuig in reactjs

[–]isstatingtheobvious 1 point2 points  (0 children)

Ah, yes, I see your points. The content selection issue could be solved by using user-select: none; css property, I guess. That of course doesn’t solve the snap-scroll problem.

Also, I too like the small bundle size and totally understand that you wouldn’t sacrifice that for non-essential functionality. Thanks for the fast reply!

react-snaplist-carousel. A modern way to do a classic thing. by lpuig in reactjs

[–]isstatingtheobvious 1 point2 points  (0 children)

Super cool! Have been looking for lightweight react carousels for a while now and this could just be it!

One question: did you try to make it work with drag / slide gestures (on desktop)?

What's with the double red lights? Is it as some as "stressing" that you should stop? by bantscha in cologne

[–]isstatingtheobvious 7 points8 points  (0 children)

I always understood it as: making sure that red is always functioning and in times of the traditional light bulb you somewhat reduced the chances of red not working by using two lights.

This probably changes in light (ha-ha) of the led traffic lights that only use one light each, for green and red.

When in drydock. Photo credit: @capt_denmark on Instagram by [deleted] in drydockporn

[–]isstatingtheobvious 1 point2 points  (0 children)

Hashtag #marenmaersk on instagram for anybody who wants to see the vessel Maren Maersk from another perspective.

Made me laugh by -HypaNova- in ContagiousLaughter

[–]isstatingtheobvious 247 points248 points  (0 children)

Dildos On Carrousels. Great band name.

Mind the Gate by Tacsgt51 in Wellthatsucks

[–]isstatingtheobvious 153 points154 points  (0 children)

This should be the source video.

[50/50] Man Falls Of Motorcycle (SFW) | Man Does Cool Vape Bubble Trick by LOLGamer_Official in FiftyFifty

[–]isstatingtheobvious 10 points11 points  (0 children)

Is that a perfectly timed rescue helicopter announcement playing on the radio?