Bringing your code snippets to the next level!
A very long time ago we implemented a “snippet gallery” within the wiki. The idea was to create one of the most comprehensive collections of code snippets, code samples and tutorials that ever existed for the SAP ecosystem.
Today I want to ask each of you to do your part to achieve that goal. From now on when you are writing a forum message or a weblog that will have “code” PLEASE jump over here and add the snippet here first and then link to it. Or even drag this bookmarklet up to your browser toolbar (or create a new bookmark in your tool bar with the following:
javascript:location.href=’https://wiki.sdn.sap.com/wiki/pages/createpage.action?spaceKey=Snippets&fromPageId=9055′;
There’s a very simple reason for this, actually a couple of them.
- Easier readability
- Easier searching (remember to use the labels on your page)
- Syntax Highlighting
- Syntax Highlighting – wait did I mention that already?
We have implemented a brand new feature into the wiki for code, for those who have been in the community for the past several years you’ll recognize this I think 😉 it took us awhile but it’s finally here!
Here’s the “before”
and now the “after”
Usage:
{highlighter: language}
..code…
{highlighter}
Bash/shell: bash
C#: c-sharp
C++: cpp
CSS: css
Delphi: delphi
Groovy: groovy
JavaScript: jscript
Java: java
PHP: php
Plain Text: ( nothing)
Python: python
Ruby: ruby
Scala: scala
SQL: sql
Visual Basic: vb
XML: xml
Anyone up for creating some SAP specific ones? We based this macro off of this.


D.
Craig, anyway you can make the code snippets inserted in new posts automatically add to the snippet gallery instead of having the user to do this? I guess we'll end up filling the gallery much faster that way - may have something like a checkbox for auto-posting to the snippet gallery when a user is making a forum post...
Now I have a nice job to spend my weekend -:) With the Scripting languages I have wrote in my blogs, I'm going to spend a lot of my weekend time adding the to the new Code Gallery -;)
Greetings,
Blag.
Really cool... I'm up to it!