DevOps Zone is brought to you in partnership with:

Paulund is a website dedicated to writing tutorials and code snippets about Web Development, the main subjects are PHP, Wordpress, jQuery, CSS3 and HTML5. Paul is a DZone MVB and is not an employee of DZone and has posted 128 posts at DZone. You can read more from them at their website. View Full User Profile

Troubleshooting: Share Your Code

09.11.2013
| 1503 views |
  • submit to reddit

There are lots of times when you need to share code snippets, a good example is when you are troubleshooting a problem and need to ask for help. Instead of just explaining the problem you have to someone, it's 1,000 times easier to show them what the problem is.

I get a couple emails a day from people asking for help with problems they are having with CSS or JavaScript. An example would be something like "I can't get your code snippet to work ... what is the problem?" There is no way I'll be able to help with a question like that because I can't see what is wrong or don't know if they have made any changes to the code.

If you are asking for help with your code, some people will just paste the code to you in an email or on a forum, this is a bit more helpful as I can take this code, run it and see if I can find out what's going wrong. But this relies on me having all the exact code that they're using, which might be lost while copying and pasting code from their editor, to an email, or to my editor.

The best way of asking for help with your front-end code is to be able to share your exact code. But this is hard to do as most development problems should occur on your local machine with all the code on your local computer. The solution to this is to use web editor that allows you to share your code and the result, something like jsFiddle or CodePen.

  • Go to jsFiddle or CodePen
  • Enter the HTML, CSS and Javascript.
  • Hit run to test you can recreate the problem.
  • Save to a URL
  • Share the URL

This way, the person you are sharing with can see the exact code you are using and can see the same problem you are trying to solve.

Here are some of the services you can use for free to share your code.

jsFiddle

jsfiddle
jsFiddle

CodePen

CodePen
CodePen

CSSDeck

CSSDesk
CSSDeck

JS Bin

JS Bin
JS Bin

Dabblet

dabblet
Dabblet

Published at DZone with permission of Paul Underwood, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)