You can easily create and add custom code as a shortcode inside your WordPress blog posts, pages and other shortcode supported areas without creating any new plugin file or adding shortcode hacks in your theme functions etc. My Shortcodes is a free WordPress plugin that lets you create custom shortcode elements or you can download and install shortcodes made by other My Shortcodes users.
My Shortcodes provides you a highly flexible shortcode builder environment in your admin area Dashboard. It gives you dedicated areas for template view, javascript input, custom PHP library, external/CDN css and javascript sources which enables you to render the page or posts with the required scripts and styles to be placed where it belongs. not all in the shortcode replace area. Simply install and activate it then visit Dashboard -> My Shortcodes page and start building new shorcodes for your custom code.
Update: Shortcoder is also a very good plugin for creating shortcodes of HTML & Javascript snippets stored in them.