Not only OK with a Ruger semi-auto, generally REQUIRED when you field strip.
(Ruger has a limiter/stop on their firing pins, and they're adjusted at the factory to prevent damage to the chamber wall. This appears to be true with the 10/22 series of rifles, as well.)
I think the S&W 41 is also OK to dry fire.
The gun's manual should be your guide.
Most (but not all) other .22 / rimfires will be damaged (ding the chamber) when dry-fired, and that will lead to poor feeding and malfunctions.