Last night I saw him riding his bike on the street, when I was walking to home.
You could just say Last night I saw him and that sentence would still make sense. So riding his bike on the street is modifying him. Since adjectives modify nouns (or verbals), that means it's a participle.
Nothing would prevent him speaking out against injustice.
You can't say Nothing would prevent him without the sentence feeling unfinished (unless a previous context fills in the blank). The sentence needs an object, and nouns answer for objects. Caveat: subject complements but the verb prevent doesn't work like that.
So speaking out against injustice functions independently - i.e. it doesn't grammatically modify anything, so it'd have to be a noun and thus a gerund.