The Southern Pacific Railroad used to cut diagonally through the Mission. The train stopped running in the 1930s / 1940s and the tracks were removed in the 1950s, but if you know where to look, you can see that many old buildings next to the line were constructed on an angle.
However, not all strange angular buildings are a result of the railroad. Clooney's (one of the Mission's legendary dive bars) is across the street from the former Valencia and 25th train station and is oddly angled, but has nothing to do with the rail line. It was moved in 1951 from the corner of San Jose Ave & 30th when the streets were widened in anticipation of the exit off 280.
Clooney's was called O'Reilly's Saloon at the turn of the 20th century and can be seen in photos taken after the 1906 earthquake. It has quite an exciting history that includes 12-year-olds breaking in, stealing Jeremiah O'Reilly's cash, and using it to buy revolvers (seriously).