I reckon that the issue is not whether it's permitted to show some pieces of code in forums, as it is not a question of copyright. Copyright arises when a material portion of the work is used. Here we are discussing minute portions, which may fall under 17 USC 107, which is the fair use clause. Fair use is allowed use of a work, reproducing it or copying it, where the use is for criticism, education or review, which are the causes here.

Moreover, if we examine the Israeli Copyright Act, then we understand that the exclusive rights in copyright are granted for the work or a substantial part thereof. Here we do not discuss substantial parts of the work.

I think that this falls under self-study or educational purposes, and therefore fair.

J.