Can I use company logos in my portfolio?
Just for aesthetic purposes I want to add the logo of the company I worked for near the paragraph where I talk about my work there. The same goes for a Stack Exchange or Dribbble logo. Is that legal?
I usually read about how you can't use logos in a way that it seems they are endorsing you, but is using a Stack Exchange logo near a paragraph where I clearly state that I'm a member of the website classify as endorsement?
The reproduction or publication of any company's intellectual property, which includes logos, should only be done with the permission of the company(s) involved. If a company owns a logo which is registered then it is against the law in some countries (including the UK) to reproduce it anywhere without seeking consent. If the logo is trademarked, then it is not illegal (in the UK) to use it, but you should ask to use it and they may want to see how you will display it before allowing you to publish. Any other logo you use, if in doubt, ask first.
As a graphic designer employed by a large wholesaler I have to deal with hundreds of company logos, some registered, some trademarked and I regularly receive information and agreements on how the logos and product images are to be reproduced for print or screen. I think a large web company like Linkedin will have a prior agreement with most companies to use their logos throughout the site.