Return to   |   Check out   |   How to Post Snippets  

Not registered? Thats okay! You can Submit a Snippet without being a member of this site!

***  2votes

This portion of the site is dedicated to source code snippets. Read more below to learn what languages are supported and how to properly place your snippet into a post. You can also include some information on what your code does, why it is significant, or any other info you think would be useful to users.

Alternatively, you can click on the Title of any post to view the full post, comment, and rate each snippet.

Example Usage:
Use the following example to post code, removing the spaces from the [ ] brackets.

[ sourcecode language="objc" ]
- (NSString *) exampleUsage
    return @"Follow this example!";
[ /sourcecode ]

Should look like this:

- (NSString *) exampleUsage
    return @"Follow this example!";

How to use:
You can also show an example of how to call your code, or how to use your code for users who may be beginners.

NSLog(@"Example String: %@", [self exampleUsage]);

Some other example shortcodes:

  • [ php ]your code here[ /php ]
  • [ css autolinks="false" classname="myclass" collapse="false" firstline="1" gutter="true" highlight="1-3,6,9" htmlscript="false" light="false" padlinenumbers="false" smarttabs="true" tabsize="4" toolbar="true" title="example-filename.php" ]your code here[ /css ]
  • [ code lang="js" ]your code here[ /code ]
  • [ sourcecode language="plain" ]your code here[ /sourcecode ]

The following languages are supported:

  • actionscript3
  • bash
  • coldfusion
  • cpp
  • csharp
  • css
  • delphi
  • erlang
  • fsharp
  • diff
  • groovy
  • javascript
  • java
  • javafx
  • matlab (keywords only)
  • objc
  • perl
  • php
  • text
  • powershell
  • python
  • r
  • ruby
  • scala
  • sql
  • vb
  • xml
Configuration Parameters:
The shortcodes also accept a variety of configuration parameters that you may use to customize the output. All are completely optional.
  • autolinks (true/false) — Makes all URLs in your posted code clickable. Defaults to true.
  • collapse (true/false) — If true, the code box will be collapsed when the page loads, requiring the visitor to click to expand it. Good for large code posts. Defaults to false.
  • firstline (number) — Use this to change what number the line numbering starts at. It defaults to 1.
  • gutter (true/false) — If false, the line numbering on the left side will be hidden. Defaults to true.
  • highlight (comma-seperated list of numbers) — You can list the line numbers you want to be highlighted. For example “4,7,19″.
  • htmlscript (true/false) — If true, any HTML/XML in your code will be highlighted. This is useful when you are mixing code into HTML, such as PHP inside of HTML. Defaults to false and will only work with certain code languages.
  • light (true/false) — If true, the gutter (line numbering) and toolbar (see below) will be hidden. This is helpful when posting only one or two lines of code. Defaults to false.
  • padlinenumbers (true/false/integer) — Allows you to control the line number padding. true will result in automatic padding, false will result in no padding, and entering a number will force a specific amount of padding.
  • toolbar (true/false) — If false, the toolbar containing the helpful buttons that appears when you hover over the code will not be shown. Defaults to true.
  • wraplines (true/false) — If true, line line wrapping will be disabled. This will cause a horizontal scrollbar to appear for long lines of code.

To learn more about the use of this code syntax system, check out the Support Docs on Posting Code.

Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

© Copyright 2011 Wright's Computer Services.   All rights reserved Suffusion theme by Sayontan Sinha