line_graphic_business_08

ENLIGHTERJS – SYNTAX LANGUAGES

EASILY HIGHLIGHT AND FORMAT CODE SNIPPETS

AVR Assembler

.include "m8def.inc"

.def temp1 = r16
.def temp2 = r17
.def temp3 = r18
.def flag  = r19

.def SubCount = r21
.def Sekunden = r22
.def Minuten  = r23
.def Stunden  = r24

.org 0x0000
        rjmp    main                ; Reset Handler
.org OVF0addr
        rjmp    timer0_overflow     ; Timer Overflow Handler

.include "lcd-routines.asm"

main:
        ldi     temp1, HIGH(RAMEND)
        out     SPH, temp1
        ldi     temp1, LOW(RAMEND)  ; Stackpointer initialisieren
        out     SPL, temp1

        ldi temp1, 0xFF    ; Port D = Ausgang
        out DDRD, temp1

        rcall   lcd_init
        rcall   lcd_clear


        ldi     temp1, (1<<CS02) | (1<<CS00)   ; Teiler 1024
        out     TCCR0, temp1

        ldi     temp1, 1<<TOIE0     ; TOIE0: Interrupt bei Timer Overflow
        out     TIMSK, temp1

        clr     Minuten             ; Die Uhr auf 0 setzen
        clr     Sekunden
        clr     Stunden
        clr     SubCount
        clr     Flag                ; Merker löschen

        sei

loop:
        cpi     flag,0
        breq    loop                ; Flag im Interrupt gesetzt?
        ldi     flag,0              ; flag löschen

        rcall   lcd_clear           ; das LCD löschen
        mov     temp1, Stunden      ; und die Stunden ausgeben
        rcall   lcd_number
        ldi     temp1, ':'          ; zwischen Stunden und Minuten einen ':'
        rcall   lcd_data
        mov     temp1, Minuten      ; dann die Minuten ausgeben
        rcall   lcd_number
        ldi     temp1, ':'          ; und noch ein ':'
        rcall   lcd_data
        mov     temp1, Sekunden     ; und die Sekunden
        rcall   lcd_number

        rjmp    loop

C

// http://andidittrich.de/index.php/2012/04/xbox-360-controller-advanced-rapid-fire-mod/
#include "Trigger.h"
#include "Calibration.h"

// KEY STATES
enum{KEYUP=0, KEYDOWN=1, FALLINGEDGE =2, RISINGEDGE=3, KEYDOWN_LONG=4};

// SYTMEM STATE
enum{OFFLINE, RAPIDFIRE_SLOW, RAPIDFIRE_FAST, RAPIDFIRE_BURST};

// switch observer
volatile uint8_t switchState0 = 2;
volatile uint8_t switchState1 = 127;
volatile uint8_t switchStateChange = 0;

// system state
volatile uint8_t systemState = OFFLINE;

// led blink counter
volatile uint8_t ledBlinkCounter = 0;

// burstmode delay counter
volatile uint8_t burstmodeDelayCounter = 0;

// switch observer ISR - 48ms steady state required -> 122Hz Update Rate
ISR (TIMER1_OVF_vect){
	// increment burstmode counter
	//burstmodeDelayCounter = burstmodeDelayCounter+1;

	// LED BLink Action
	if (systemState == RAPIDFIRE_FAST){
		ledBlinkCounter = ledBlinkCounter+1;

		// ~ 12 Hz Blink rate
		if (ledBlinkCounter%20 == 0){
			toggleStatusLed();
		}
	}

	// LED BLink Action
	if (systemState == RAPIDFIRE_BURST){
		ledBlinkCounter = ledBlinkCounter+1;

		// ~ 18 Hz Blink rate
		if (ledBlinkCounter < 50){
			if (ledBlinkCounter%10 == 0){
				toggleStatusLed();
			}
		}else{
			showStatusLed(0);
		}
	}

	// SIGNAL A OBERVING (SWITCH)
	if (bit_is_clear(PINB, PB4)){
		// increment -> KEY PRESSED
		if (switchState0<5){
			switchState0++;
		}else{
			// FALLING EDGE DETECTED
			if (switchStateChange==KEYUP){
				switchStateChange = KEYDOWN;
			}
		}
		if (switchState1<255){
			switchState1++;
		}else{
			switchStateChange = KEYDOWN_LONG;
		}
	}else{
		// decrement -> KEY RELEASED
		if (switchState0>0){
			switchState0--;
		}else{
			// RISING EDGE DETECTED
			if (switchStateChange==KEYDOWN){
				switchStateChange = FALLINGEDGE;
			}
		}
		if (switchState1>0){
			switchState1--;
		}
	}
};

C# (CSharp)

// Source: https://en.wikipedia.org/wiki/C_Sharp_syntax#Attributes
public class EdibleAttribute : Attribute
{
    public EdibleAttribute() : base()
    {
 
    }
 
    public EdibleAttribute(bool isNotPoisonous)
    {
        this.IsPoisonous = !isNotPoisonous;
    }
 
    public bool IsPoisonous { get; set; }
}


// Source:  https://en.wikipedia.org/wiki/C_Sharp_syntax#Events
public class MainWindow : System.Windows.Controls.Window
{
    private Button button1;
 
    public MainWindow()
    {
        button1 = new Button();
        button1.Text = "Click me!";
 
        /* Subscribe to the event */
        button1.ClickEvent += button1_OnClick;
 
        /* Alternate syntax that is considered old: 
           button1.MouseClick += new MouseEventHandler(button1_OnClick); */
    }
 
    protected void button1_OnClick(object sender, MouseEventArgs e)
    {
        MessageBox.Show("Clicked!");
    }
}

C++ (CPP)

// SOURCE: http://www.cplusplus.com/doc/tutorial/classes/

// classes example
#include <iostream>
#define DOIT 1
using namespace std;

class CRectangle {
    int x, y;
  public:
    void set_values (int,int);
    int area () {return (x*y);}
};

void CRectangle::set_values (int a, int b) {
  x = a;
  y = b;
}

/*
void CRectangle::set_valueA (int a) {
  x = a;
}
*/

int main () {
  CRectangle rect;
  rect.set_values (3,4);
  cout << "area: " << rect.area();
  
  CRectangle rect2 = new CRectangle();
  
  int x = 0x54b4c2;
  int y = 291;
  int z = 0b1110101;
  
  
  #ifdef DOIT
  cout << __FILE__ << __LINE__;
  #endif
  
  return 0;
}

CSS

/*!
---
description: EnlighterJS Theme-Base - All Themes are derived from these styles!

...
*/


p {
    font-family: "Times New Roman";
    font-size: 20px;
}
@media screen {
    p {
        font-family: verdana, sans-serif;
        font-size: 17px;
    }
}

@media print {
    p {
        font-family: georgia, serif;
        font-size: 14px;
        color: blue;
    }
}

html {
  font-family: sans-serif;
  -webkit-text-size-adjust: 100%;
      -ms-text-size-adjust: 100%;
}

input.number,
select.number,
input[type="number"]::-webkit-outer-spin-button {
  height: auto;
}

@media (min-width: 800) {
  .navbar-right .dropdown-menu {
    right: 0;
    left: auto;
  }
  .navbar-right .dropdown-menu-left {
    right: auto;
    left: 0;
  }
}
.btn-group-vertical > .btn:focus {
  outline: 0;
}

.nav-pills > li.active > a:focus {
  color: #fff;
  background-color: #428bca;
}

/*
---
description: EnlighterJS Theme-Base - All Themes are derived from these styles! Don't edit this file if you wan't to change styles! Use a derived theme!

license: MIT-style

authors:
  - Andi Dittrich
...
*/

/* BASE Styles */
.EnlighterJS, .EnlighterJSWrapper{
	font-family: Monaco, Courier, Monospace;
	font-size: 10px;
	line-height: 16px;
	overflow: auto;
	white-space: pre-wrap;
	word-wrap: break-word;
	margin: 0px;
	padding: 0px;
}

/* Wrapper/Container - contains all elements of an instance */
.EnlighterJSWrapper{
	position: relative;
}

/* RAW Styles */
.EnlighterJSWrapper pre{
	font-family: inherit;
	background-color: #ffffff;
	padding: 5px 5px 5px 10px;
	margin: 0px 0px 20px 0px;
	line-height: 18px;
	font-size: 12px;
	color: #444444;
	border: none;
	border-radius: 0px;
	clear: none;
	white-space: pre-wrap;
	word-wrap: break-word;
}

/* Inline specific styles */
span.EnlighterJS {
	padding: 3px 5px 1px 5px;
	border: solid 1px #e0e0e0;
	color: #333333;
	background-color: #f7f7f7;
	margin: 0px 2px 0px 2px;
}

/* LIST specific styles */
ol.EnlighterJS, ul.EnlighterJS{
	color: #939393;
	font-size: 10px;
	background-color: #f2f2f2;
	color: #939393;
	margin: 0px 0px 20px 0px;
	padding: 0px;
	text-indent: 0px;
	list-style: decimal-leading-zero outside;
}

/* line styles */
ol.EnlighterJS li, ul.EnlighterJS li {
	margin: 0px;
	background-color: #ffffff;
	border: solid 0px #ffffff;
	padding: 0px 5px 0px 14px;
	line-height: 14px;
	color: #939393;
	list-style: none;
	font-size: inherit;
}
ol.EnlighterJS li{
	list-style: decimal-leading-zero outside;
	margin: 0px 0px 0px 40px;
}

/* no-linenumber style */
ul.EnlighterJS, ul.EnlighterJS li{
	list-style: none;
	display: block;
}
ul.EnlighterJS li:AFTER{
	content: ' ';
}

/* top+bottom offsets */
ol.EnlighterJS li:FIRST-CHILD, ul.EnlighterJS li:FIRST-CHILD{
	padding-top: 5px;
}
ol.EnlighterJS li:LAST-CHILD, ul.EnlighterJS li:LAST-CHILD{
	padding-bottom: 5px;
}

/* special line highlight color */
ol.EnlighterJS li.specialline, ul.EnlighterJS li.specialline {
	background-color: #F4F8FC;
}

/* default symbol style */
.EnlighterJS span {
	color: #000000;
	margin: 0px;
	padding: 0px;
	line-height: inherit;
	font-size: 12px;
}

/* TAB Panel - containing "buttons" to switch between multiple codeblocks */
.EnlighterJSTabPane .controls {
}
.EnlighterJSTabPane .controls ul{
	margin: 0px 0px 0px 40px;
	padding: 0px;
}
.EnlighterJSTabPane .controls li {
	float: left;
	display: block;
	list-style: none;
	padding: 3px 10px 3px 10px;
	margin: 0px 5px 0px 5px;
	background-color: #f2f2f2;
	border-radius: 5px;
	font-size: 12px;
	color: #000000;
	font-family: Courier, monospace;
	cursor: pointer;
}

.EnlighterJSTabPane .controls .clearfixList{
	clear: left;
}
.EnlighterJSTabPane .pane {
	padding: 5px 0px 0px 0px;
	clear: left;
}

/* Toolbar - containing buttons */
.EnlighterJSToolbar{
	position: absolute;
	display: none;
	right: 0px;
	top: 0px;
	height: 40px;
	width: auto;
	padding: 15px;
}
/* Button Container */
.EnlighterJSToolbar > a{
	float: right;
	display: block;
	border-radius: 3px;
	z-index: 10;
	background-color: #ffffff;
	color: #717171;
	cursor: pointer;
	font-size: 12px;
	padding: 0px;
	border: solid 1px #e0e0e0;
	margin: 0px 0px 0px 15px;
	text-decoration: none;
	width: 23px;
	height: 23px;
	background-position: 0px 0px;
	background-size: contain;
	margin-left: 8px;
}
.EnlighterJSToolbar > a:HOVER{
	border-color: #b0b0b0;
}

/* Raw Button Identifiers */
.EnlighterJSRawButton, .EnlighterJSWindowButton{}

/* Show Toolbar on MouseOver */
.EnlighterJSToolbar > a:HOVER{
	text-decoration: none;
}

/* Show Toolbar on Mouseover */
.EnlighterJSWrapper:hover .EnlighterJSToolbar{
	display: block;
}
.EnlighterJSToolbar .clear{
	clear: right;
	content: ' ';
	display: block;
}

DIFF

--- enlighter/trunk/readme.txt	2014-06-06 23:40:41 UTC (rev 928010)
+++ enlighter/trunk/readme.txt	2014-06-06 23:41:44 UTC (rev 928011)
@@ -4,7 +4,7 @@
 Donate link: http://andidittrich.de/go/enlighterjs
 Requires at least: 3.5
 Tested up to: 3.9.1
-Stable tag: 2.1
+Stable tag: 2.2
 License: MIT X11-License
 License URI: http://opensource.org/licenses/MIT
 
@@ -21,7 +21,7 @@
 * Support for all common used languages
 * Theme Customizer
 * Inline Syntax Highlighting
-* Visual-Editor (TinyMCE) Integration
+* **Full** Visual-Editor (TinyMCE) Integration
 * Easy to use Text-Editor mode through the use of Shortcodes
 * Advanced configuration options (e.g. CDN usage) are available within the options page.
 * Supports code-groups (displays multiple code-blocks within a tab-pane)
@@ -198,15 +198,27 @@
 
 1. CSS highlighting Example (GIT Theme)
 2. Visual Editor Integration
-3. Options Page - Appearance Settings
-4. Options Page - Advanced Settings
-5. Theme Customizer - General styles
-6. Theme Customizer - Language Token styling
-7. Special options for use with a CDN (Content Delivery Network)
-8. Tab-Pane Example (multiple languages)
+3. Visual Editor Code Settings
+4. Visual Editor Inline/Block Formats
+5. Options Page - Appearance Settings
+6. Options Page - Advanced Settings
+7. Theme Customizer - General styles
+8. Theme Customizer - Language Token styling
+9. Special options for use with a CDN (Content Delivery Network)
+10. Tab-Pane Example (multiple languages)
 
 == Changelog ==
 
+= 2.3 =
+* Added Tab / Tab-Shift keyhandler to re-indent code within an Enlighter-Codeblock (the `tabfocus` plugin will be deactivated! - you can't use the tab key anymore to leave the editor window)
+
+= 2.2 =
+* Added "Code Insert Dialog" to avoid copy-auto-formatting issues - feature requested on [WordPress Forums](http://wordpress.org/support/topic/code-indent-removed-by-wordpress-editor?replies=9#post-5652635)
+* Added "Enlighter Settings Button" to control the Enlighter Settings (highlight, show-linenumbers, ..) directly from the Visual-Editor - just click into a codeblock and the button will appear (requires WordPress >=3.9)
+* Added Enlighter Toolbar Menu-Buttons
+* New Visual-Editor integration style
+* Bugfix: Added missing codeblock-name for "C#"
+
 = 2.1 =
 * Added EnlighterJS 2.2
 * Added language support for C# (csharp) [provided by Joshua Maag](https://github.com/joshmaag)
@@ -281,6 +293,9 @@
 
 == Upgrade Notice ==
 
+= 2.2 =
+Full Visual-Editor (TinyMCE4) Integration including codeblock-settings (WordPress >= 3.9 required)
+
 = 2.0 =
 Added Inline-Syntax-Highlighting as well as some other cool feature - please go to the settings page and click "Apply Settings"

Generic

// R Language Example using Generic Highlighting
// Source: https://en.wikipedia.org/wiki/R_%28programming_language%29


library(caTools)         # external package providing write.gif function
jet.colors <- colorRampPalette(c("#00007F", "blue", "#007FFF", "cyan", "#7FFF7F",
                                 "yellow", "#FF7F00", "red", "#7F0000"))
m <- 1000                # define size
C <- complex( real=rep(seq(-1.8,0.6, length.out=m), each=m ),
              imag=rep(seq(-1.2,1.2, length.out=m), m ) )
C <- matrix(C,m,m)       # reshape as square matrix of complex numbers
Z <- 0                   # initialize Z to zero
X <- array(0, c(m,m,20)) # initialize output 3D array
for (k in 1:20) {        # loop with 20 iterations
  Z <- Z^2+C             # the central difference equation
  X[,,k] <- exp(-abs(Z)) # capture results
}
write.gif(X, "Mandelbrot.gif", col=jet.colors, delay=800)

HTML

<head>
		<!-- Include EnlighterJS Styles -->
		<link rel="stylesheet" type="text/css" href="../Build/EnlighterJS.yui.css" />
		
		<!-- Include MooTools Framework -->
		<script type="text/javascript" src="mootools-core-1.4.5-full-nocompat.js"></script>
		
		<!-- Include EnlighterJS -->
		<script type="text/javascript" src="../Build/EnlighterJS.yui.js" ></script>
		
		<!-- Initialize EnlighterJS --> 
		<script type="text/javascript">
		window.addEvent('domready', function() {
			// highlight all pre tags
			$$('pre').light({
				altLines : 'hover',
				indent : 2,
				editable: false
			});
		});
		</script>

<!-- Syntax highlight using Languages/Js.js and default theme --> 
<pre data-enlighter-language="css">var myClass = new Class({})</pre> 
 
<!-- Syntax highlight using Languages/Php.js and theme from Themes/Twilight.css --> 
<pre data-enlighter-language="php" data-enlighter-theme="twilight"><?php php_info() ?></pre>

INI / Conf Syntax

; An XML-RPC faultCode
xmlrpc_error_number = 0

; When PHP displays or logs an error, it has the capability of formatting the
; error message as HTML for easier reading. This directive controls whether
; the error message is formatted as HTML or not.
; Note: This directive is hardcoded to Off for the CLI SAPI
; Default Value: On
; Development Value: On
; Production value: On
; http://php.net/html-errors
html_errors = On

docref_root = "/phpmanual/"

; http://php.net/docref-ext
docref_ext = .html


[Session]
; Handler used to store/retrieve data.
; http://php.net/session.save-handler
session.save_handler = files

; Whether to use strict session mode.
; Strict session mode does not accept uninitialized session ID and regenerate
; session ID if browser sends uninitialized session ID. Strict mode protects
; applications from session fixation via session adoption vulnerability. It is
; disabled by default for maximum compatibility, but enabling it is encouraged.
; https://wiki.php.net/rfc/strict_sessions
session.use_strict_mode = 0

; Whether to use cookies.
; http://php.net/session.use-cookies
session.use_cookies = 1

; http://php.net/session.cookie-secure
;session.cookie_secure =

; This option forces PHP to fetch and use a cookie for storing and maintaining
; the session id. We encourage this operation as it's very helpful in combating
; session hijacking when not specifying and managing your own session id. It is
; not the be-all and end-all of session hijacking defense, but it's a good start.
; http://php.net/session.use-only-cookies
session.use_only_cookies = 1

Java

public class Hello{
	public static void main(String[] args)
		throws IOException{
	
		System.out.println("Hello World!");
	}
}


// Source:  http://en.wikipedia.org/wiki/Java_%28programming_language%29
// OddEven.java
import javax.swing.JOptionPane;
 
public class OddEven<t>{
    /**
     * "input" is the number that the user gives to the computer
     */
    private int input; // a whole number("int" means integer)
 
    /**
     * This is the constructor method. It gets called when an object of the OddEven type
     * is being created.
     */
    public T OddEven() {
        /*
         * In most Java programs constructors can initialize objects with default values, or create
         * other objects that this object might use to perform its functions. In some Java programs, the
         * constructor may simply be an empty function if nothing needs to be initialized prior to the
         * functioning of the object. In this program's case, an empty constructor would suffice.
         * A constructor must exist; however, if the user doesn't put one in then the compiler
         * will create an empty one.
         */
         return null;
    }
 
    /**
     * This is the main method. It gets called when this class is run through a Java interpreter.
     * @param args command line arguments (unused)
     */
    public static void main(final String[] args) {
       /*
        * This line of code creates a new instance of this class called "number" (also known as an
        * Object) and initializes it by calling the constructor. The next line of code calls
        * the "showDialog()" method, which brings up a prompt to ask you for a number
        */
       OddEven<number> number = new OddEven()<number>;
       number.showDialog();
    }
 
    public void showDialog() {
        /*
         * "try" makes sure nothing goes wrong. If something does,
         * the interpreter skips to "catch" to see what it should do.
         */
        try {
            /*
             * The code below brings up a JOptionPane, which is a dialog box
             * The String returned by the "showInputDialog()" method is converted into
             * an integer, making the program treat it as a number instead of a word.
             * After that, this method calls a second method, calculate() that will
             * display either "Even" or "Odd."
             */
            this.input = Integer.parseInt(JOptionPane.showInputDialog("Please enter a number."));
            this.calculate();
        } catch (final NumberFormatException e) {
            /*
             * Getting in the catch block means that there was a problem with the format of
             * the number. Probably some letters were typed in instead of a number.
             */
            System.err.println("ERROR: Invalid input. Please type in a numerical value.");
        }
    }
 
    /**
     * When this gets called, it sends a message to the interpreter.
     * The interpreter usually shows it on the command prompt (For Windows users)
     * or the terminal (For *nix users).(Assuming it's open)
     */
    private void calculate() {
        if ((this.input % 2) == 0) {
            JOptionPane.showMessageDialog(null, "Even");
        } else {
            JOptionPane.showMessageDialog(null, "Odd");
        }
    }
}
</number></number></t>

JavaScript / jQuery / MooTools

// Comments
/* This
 is a
 block
 * comment
 */

/** Numbers */
345;    // an "integer", although there is only one numeric type in JavaScript
34.5;   // a floating-point number
3.45e2; // another floating-point, equivalent to 345
0377;   // an octal integer equal to 255
0xFF;   // a hexadecimal integer equal to 255, the letters A-F may be upper- or lowercase

/** Strings */
var greeting = "Hello, world!";
var another_greeting = 'Greetings, people of Earth.';
var escaped_strings = "Hello from an \" escaped string" + 'this should \' work';

/** Regex */
var regex = new RegExp("pattern" [, "flags"]);
var literal = /pattern/gimy;

/** Snippet */
var Language = new Class({
	
	Implements: [Options],
	options: {
		matchType: "standard",
		strict: false
	},
	language: '',
	defaultTheme: 'standard',
	
	patterns: new Hash(),
	keywords: new Hash(),
	rules:    new Hash(),
	delimiters: new Hash({
		start: null,
		end: null
	}),

	/************************
	 * Common Regex Rules
	 ***********************/
	common: {	
		slashComments: /(?:^|[^\\])\/\/.*$/gm, // Matches a C style single-line comment.
		poundComments: /#.*$/gm,                 // Matches a Perl style single-line comment.
		multiComments: /\/\*[\s\S]*?\*\//gm,     // Matches a C style multi-line comment.
		aposStrings:   /'[^'\\]*(?:\\.[^'\\]*)*'/gm, // Matches a string enclosed by single quotes.
		quotedStrings: /"[^"\\]*(?:\\.[^"\\]*)*"/gm, // Matches a string enclosed by double quotes.
		strings:       /'[^'\\]*(?:\\.[^'\\]*)*'|"[^"\\]*(?:\\.[^"\\]*)*"/gm, // Matches both.
		properties:    /\.([\w]+)\s*/gi,   // Matches a property: .property style.
		methodCalls:   /\.([\w]+)\s*\(/gm, // Matches a method call: .methodName() style.
		functionCalls: /\b([\w]+)\s*\(/gm,   // Matches a function call: functionName() style.
		brackets:      /\{|\}|\(|\)|\[|\]/g, // Matches any of the common brackets.
		numbers:       /\b((?:(\d+)?\.)?[0-9]+|0x[0-9A-F]+)\b/gi // Matches integers, decimals, hexadecimals.
	},
	
	/************************
	 * Language Constructor
	 ***********************/
	initialize: function(lighter, theme, options, tokens) {
		this.setOptions(options);
		this.tokens = tokens || [];
		options = this.options;
		
		// Set Lighter/Language/Theme relationship.
		this.lighter = lighter;
		this.theme = new Theme[theme || this.defaultTheme](lighter, this);
		
		// Add delimiter rules if not in strict mode
		if (!options.strict) {
			if (this.delimiters.start) this.addLanguage('delimBeg', this.delimiters.start, 'de1');
			if (this.delimiters.end)   this.addLanguage('delimEnd', this.delimiters.end,   'de2');
		}
		
		// Set Keyword Rules from this.keywords object.
		this.keywords.each(function(keywordSet, ruleName) {
			if (keywordSet.csv != '') {
				this.addLanguage(ruleName, this.csvToRegExp(keywordSet.csv, "g"), keywordSet.alias);
			}
		}, this);
		
		// Set Rules from this.patterns object.
		this.patterns.each(function(regex, ruleName) {
			this.addLanguage(ruleName, regex.pattern, regex.alias);
		}, this);
		
		// Set builder object for matchType.
		this.builder = new Hash({
			'standard': this.findMatches,
			'lazy':     this.findMatchesLazy
		});
		
		/** Process source code based on match type. */
		var codeBeg = 0,
		    codeEnd = lighter.code.length,
		    codeSeg = '',
		    delim   = this.delimiters,
		    matches = [],
		    match   = null,
		    endMatch = null;
		
		if (!options.strict) {
			// Find matches through the complete source code.
			matches.extend(this.builder[options.matchType].pass(lighter.code, this)());
		} else if (delim.start && delim.end) {
			// Find areas between language delimiters and find matches there.
			while ((match = delim.start.exec(lighter.code)) != null ) {
				delim.end.lastIndex = delim.start.lastIndex;
				if ((endMatch = delim.end.exec(lighter.code)) != null ) {
					matches.push(new Token(match[0], 'de1', match.index));
					codeBeg = delim.start.lastIndex;
					codeEnd = endMatch.index-1;
					codeSeg = lighter.code.substring(codeBeg, codeEnd);
					matches.extend(this.builder[options.matchType].pass([codeSeg, codeBeg], this)());
					matches.push(new Token(endMatch[0], 'de2', endMatch.index));
				}
			}
		}
		this.tokens = matches;
	},
	
	/************************
	 * Regex Helper methods.
	 ***********************/
	addLanguage: function(languageName, RegEx, className) {
		this.rules[languageName] = RegEx;
		this.theme.addAlias(languageName, className);
	},
	csvToRegExp: function(csv, mod) {return new RegExp('\\b(' + csv.replace(/,\s*/g, '|') + ')\\b', mod);},
	delimToRegExp: function(beg, esc, end, mod, suffix) {
		beg = beg.escapeRegExp();
		if (esc) esc = esc.escapeRegExp();
		end = (end) ? end.escapeRegExp() : beg;
		pat = (esc) ? beg+"[^"+end+esc+'\\n]*(?:'+esc+'.[^'+end+esc+'\\n]*)*'+end : beg+"[^"+end+'\\n]*'+end;
		return new RegExp(pat+(suffix || ''), mod || '');
	},
	strictRegExp: function() {
		var regex = '(';
		for (var i = 0; i < arguments.length; i++) {
			regex += arguments[i].escapeRegExp();
			regex += (i < arguments.length - 1) ? '|' : '';
		}
		regex += ')';
		return new RegExp(regex, "gim");
	},
	
	/************************
	 * Match finding Methods
	 ***********************/
	findMatches: function(code, offset) {
		var tokens       = [],
		    startIndex  = 0,
		    matchIndex  = code.length
		    insertIndex = 0,
		    match      = null,
		    type       = null,
		    newToken    = null,
		    rule       = null,
		    rules      = {},
		    currentMatch = null,
		    futureMatch  = null;
		
		offset = (offset) ? offset : 0;
		this.rules.each(function(regex, rule) {
			rules[rule] = {pattern: regex, enabled: true, lastIndex: 0};
		}, this);
		    
		while(startIndex < code.length) {
			matchIndex = code.length;
			match = null;
			for (rule in rules) {
				rules[rule].pattern.lastIndex = startIndex;
				currentMatch = rules[rule].pattern.exec(code);
				if (currentMatch === null) {
					delete rules[rule];
				} else {
					if (currentMatch.index < matchIndex) {
			      match      = currentMatch;
			      type       = rule;
			      matchIndex = currentMatch.index;
			    } else if (currentMatch.index == matchIndex && match[0].length < currentMatch[0].length) {
						match      = currentMatch;
						type       = rule;
						matchIndex = currentMatch.index;
					}
			    rules[rule].nextIndex = rules[rule].pattern.lastIndex - currentMatch[0].length;
			  }
			}
			if (match != null) {
				index = (match[1] && match[0].contains(match[1])) ? match.index + match[0].indexOf(match[1]) : match.index;
				newToken = new Token(match[1] || match[0], type, index+offset);
				tokens.push(newToken);
				
				futureMatch = rules[type].pattern.exec(code);
	      if (!futureMatch) {
	      	rules[type].nextIndex = code.length;
	      } else {
	      	rules[type].nextIndex = rules[type].pattern.lastIndex - futureMatch[0].length;
	      }
				
				var min = code.length;
				for (rule in rules) {
					if (rules[rule].nextIndex < min) {
						min = rules[rule].nextIndex;
					}
				}
				startIndex = Math.max(min, newToken.end - offset);
			} else {
				break;
			}
		}
		return tokens;
	},
	findMatchesLazy: function(code, offset) {
		var tokens = this.tokens,
		    match = null
		    index = 0;
		
		offset = (offset) ? offset : 0;
		
		this.rules.each(function(regex, rule) {
			while ((match = regex.exec(code)) != null) {
				index = (match[1] && match[0].contains(match[1])) ? match.index + match[0].indexOf(match[1]) : match.index;
				tokens.push(new Token(match[1] || match[0], rule, index + offset));
			}
		}, this);
		return this.purgeTokens(tokens);
	},
	purgeTokens: function(tokens) {
		tokens = tokens.sort(this.compareTokens);
		for (var i = 0, j = 0; i < tokens.length; i++) {
			if (tokens[i] == null) continue;
			for (j = i+1; j < tokens.length && tokens[i] != null; j++) {
				if      (tokens[j] == null)            {continue;}
				else if (tokens[j].isBeyond(tokens[i])) {break;}
				else if (tokens[j].overlaps(tokens[i])) {tokens[i] = null;}
				else if (tokens[i].contains(tokens[j])) {tokens[j] = null;}
			}
		}
		return tokens.clean();
	},
	compareTokens: function(token1, token2) {return token1.index - token2.index;}
});

var Token = new Class({

	initialize: function(match, type, index) {
		this.text   = match;
		this.type   = type;
		this.index  = index;
		this.length = this.text.length;
		this.end    = this.index + this.length;
	},
	contains: function(token) {return (token.index >= this.index && token.index < this.end);},
	isBeyond: function(token) {return (this.index >= token.end);},
	overlaps: function(token) {return (this.index == token.index && this.length > token.length);},
	toString: function() {return this.index+' - '+this.text+' - '+this.end;}
});

JSON

{
  "Herausgeber": "Xema",
  "Nummer": "1234-5678-9012-3456",
  "Deckung": 2e+6,
  "Währung": "EURO",
  "Inhaber": {
    "Name": "Mustermann",
    "Vorname": "Max",
    "männlich": true,
    "Hobbys": [ "Reiten", "Golfen", "Lesen" ],
    "Alter": 42,
    "Kinder": [],
    "Partner": null
  }
}

{ "X1": 123, "Y1": 81.123, "Z1": false,
    "T": [
        { "x": 1, "y": 2},
        { "x": 1, "y": 2},
        { "x": 1, "y": 2},
    ]
}

LESS

@base: #f938ab;

.box-shadow(@style, @c) when (iscolor(@c)) {
  -webkit-box-shadow: @style @c;
  box-shadow:         @style @c;
}
.box-shadow(@style, @alpha: 50%) when (isnumber(@alpha)) {
  .box-shadow(@style, rgba(0, 0, 0, @alpha));
}
.box {
  color: saturate(@base, 5%);
  border-color: lighten(@base, 30%);
  div { .box-shadow(0 0 5px, 30%) }
}

#menu a {
  color: #111;
  .bordered;
}

.post a {
  color: red;
  .bordered;
}

.screen-color {
  @media screen {
    color: green;
    @media (min-width: 768px) {
      color: red;
    }
  }
  @media tv {
    color: black;
  }
}

@base: 5%;
@filler: @base * 2;
@other: @base + @filler;

color: #888 / 4;
background-color: @base-color + #111;
height: 100% / 2 + @filler;



.weird-element {
  content: ~"^//* some horrible but needed css hack";
}

@base: #f04615;
@width: 0.5;

.class {
  width: percentage(@width); // returns `50%`
  color: saturate(@base, 5%);
  background-color: spin(lighten(@base, 25%), 8);
}




/* HEADER
----------------------------------- */
header{
	a{
		font-size: 13px;
	}


	.navbar-collapse li:hover ul{
		display: block;
	}

	.navbar-beyond{
		height: 70px;
		.transition(500ms);

		.navbar-brand span{
			font-size: 11px;
		}
	}

	.navbar-beyond-light{
		height: 45px;
		border-bottom: solid 1px #e7e7e7;
		background-color: @color_bluegrey1 !important;

		.navbar-brand{
			color: #505050 !important;

			&:hover, &:hover span{
				color: #505050 !important;
			}

			span{
				display: none;
			}
		}
	}

	.navbar-beyond-dark{
		background-color: rgba(0,0,0,0.85);
		border-bottom: none;

		.navbar-brand{
			color: #f0f0f0 !important;

			&:hover, &:hover span{
				color: #f0f0f0 !important;
			}
		}

		.nav>li>a {
			color: #d0d0d0 !important;
		}

		.navbar-collapse{
			padding: 10px 0px 0px 0px;
		}
	}
}

MarkDown

XmlToJsObject
===========

XmlToJsObject is a free, easy-to-use utility to convert XML-Documents/XML-Strings to Javacript-Objects

![Screenshot](http://static.andidittrich.de/XmlToJsObject/screenshot.jpg)

Features
--------

* Easy XML to JS-Object conversion like JSON to JS-Object
* Written in Pure-Javascipt (standalone - no framework like jQuery or MooTools required!)
* Supports XML-Documents (from AJAX/XHR Requests) as well as XML-Strings
* Smart-Mode automatically merges nodes+attributes for a much easier handling of config files
* Ultra lightweight: only 3.9kB of Code (uncompressed); 1.64kB (yui compressed)
* Well commented sourcecode allows easy user modifications/custom extensions
* Native integration into MooTools (Object.fromXML)

Demo
----
The following Examples require the `JSON.stringify` method (supported by all modern browsers)

* [Example](http://static.andidittrich.de/XmlToJsObject/Example.html)
* [MooTools Example](http://static.andidittrich.de/XmlToJsObject/Example.MooTools.html)
* [Minimal Example](http://static.andidittrich.de/XmlToJsObject/Example.Minimal.html)

Available Methods
-----------------

### XmlToJsObject
Pure Javascript Implementation

```js
XmlToJsObject(data [, smartMode=true])
```
**Description:** Converts a XML-String, XMLNode or XMLDocument into a Javascript-Object

**data**
Type: mixed ( [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String), [XMLDocument](https://developer.mozilla.org/en-US/docs/Web/API/Node), [XMLNode](https://developer.mozilla.org/en-US/docs/Web/API/Node) )
A valid XML-String, XMLNode or XMLDocument Node containing various child nodes and attributes
	
**smartMode**
Type: [Boolean](http://www.w3schools.com/js/js_datatypes.asp)
Optional (default=**true**) - Merge attribute names with node-names

### Object.fromXML (MooTools)
Native MooTools implementation: automatically available when using MooTools on your page!

```js
Object.fromXML(data [, smartMode=true])
```
**Description:** Converts a XML-String, XMLNode or XMLDocument into a Javascript-Object

**data**
Type: mixed ( [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String), [XMLDocument](https://developer.mozilla.org/en-US/docs/Web/API/Node), [XMLNode](https://developer.mozilla.org/en-US/docs/Web/API/Node) )
A valid XML-String, XMLNode or XMLDocument Node containing various child nodes and attributes
	
**smartMode**
Type: [Boolean](http://www.w3schools.com/js/js_datatypes.asp)
Optional (default=**true**) - Merge attribute names with node-names

	
Tested With
-----------
* Firefox 27.0.1
* Chrome 33.0.1750.117
* Internet Explorer 11.0.9600.16518
* Safari 5.1.7 (Windows)
* Android 4.3 (WebView)


Browser compatibility
---------------------
The XmlToJsObject Utility requires the [DOMParser](http://www.w3schools.com/dom/dom_parser.asp) object. If you want to support earlier versions of the InternetExplorer you can write a [fallback](http://www.w3schools.com/dom/dom_parser.asp) using `new ActiveXObject("Microsoft.XMLDOM")` instead of the DOMParser.

Compatibility Reference: [https://developer.mozilla.org/en-US/docs/Web/API/DOMParser](https://developer.mozilla.org/en-US/docs/Web/API/DOMParser)

* Chrome 1.0+
* Safari osx+ios (WebKit) 3.2+
* Internet Explorer 9+
* Firefox 1.7+
* Opera 8+
* Android-Webview 4.3 (Webkit Engine)


License
-------

XmlToJsObject is licensed under [The MIT License (X11)](http://opensource.org/licenses/MIT)

Matlab

function [X]=fkt1000(t, x)

    lambda=-1000;
    X = lambda*( x - exp(-t) ) - exp(-t);

end

function fRichtungsfeld(fhandle)
    % create meshgrid
    [t,x] = meshgrid(-1:0.2:1, -1:0.2:1);

    % exec function
    z = feval(fhandle, t, x);

    % draw figure
    figure;
    quiver(t, x, ones(size(t)), z);
    axis([-1,1,-1,1]);
    xlabel('t');
    ylabel('x');
    title('Richtungsfeld, dx=dt=0.2');
    legend('Richtungsfeld');
end

classdef Uebung5< handle
   % Static Methods
   methods(Static=true)

       %%  Aufgabe 15
       function Aufgabe15()
            A = [
                0.9635, 1.4266;
                1.4266, 0.0365
                ];

            x0 = [
                  0;
                  1
                 ];

             p = PowerMethod(A);
             iter = NumericIterator(p, x0);

             % error < 10^-5
             iter.addAbortConditionListener(ErrorCalculationListener(10^-5));

             % start iteration
             iter.start();

             % print result
             fprintf('Eigenwert: %10.10f\nEigenvektor:\n', p.getEigenwert());
             Array.print(iter.getResult());

            % Approximation Error < 1.000000e-005 @ 19 Iterations
            % Eigenwert: 2.0000066033
            % Eigenvektor:
            %         0.8090129
            %         0.5877909
       end



       %% Aufgabe 16
       function Aufgabe16()
           % referenz f�r tf=0.95
           ref = fAufgabe16Ref();

           % startwert
           x0 = 1;
           t0 = 0;
           tf = 0.95;

           % output buffer
           buffer = {};
           j = 1;

           % schrittzahl, diskrete werte
           n = [20, 100, 200, 1000, 2000, 10000, 20000, 100000];

           % draw table
           gui = table('Aufgabe 16');

           % Verfahren anwenden
           for i=1:1:length(n)
                % schrittweite
                h = (tf-t0)/(n(i)-1);

                % set table output
                buffer{j, 1} = n(i);
                buffer{j, 2} = sprintf('%d', h);

                duration = 0;

                % euler
                e = RungeKuttaMethod(@fAufgabe16, @fRKTEuler, t0, tf, h, x0);
                buffer{j, 3} = sprintf('%d', abs(ref-e.getResult())/ref);
                duration = duration + e.getDuration();

                % heun
                e = RungeKuttaMethod(@fAufgabe16, @fRKTHeun, t0, tf, h, x0);
                buffer{j, 4} = sprintf('%d', abs(ref-e.getResult())/ref);
                duration = duration + e.getDuration();

                % mod euler
                e = RungeKuttaMethod(@fAufgabe16, @fRKTMEuler, t0, tf, h, x0);
                buffer{j, 5} = sprintf('%d', abs(ref-e.getResult())/ref);
                duration = duration + e.getDuration();

                % klassik RKV, just 4 fun 😉
                e = RungeKuttaMethod(@fAufgabe16, @fRKTClassicRKM, t0, tf, h, x0);
                buffer{j, 6} = sprintf('%d', abs(ref-e.getResult())/ref);
                duration = duration + e.getDuration();

                % set duration
                buffer{j, 7} = sprintf('%d', duration);

                % increment table row counter
                j=j+1;

                % tabelle updaten
                gui.repaint(buffer);
           end

           % OUTPUT
           % Result <h=5.000000e-002>: 6.460597267358655100
           % Result <h=5.000000e-002>: 12.511638996887264000
           % Result <h=5.000000e-002>: 12.048026035562726000
           % Result <h=5.000000e-002>: 14.271173509689078000
           % Result <h=9.595960e-003>: 17.964107899072395000
           % Result <h=9.595960e-003>: 32.643393403424028000
           % Result <h=9.595960e-003>: 32.155786064836953000
           % Result <h=9.595960e-003>: 33.992428065470925000
           % Result <h=4.773869e-003>: 25.392669207249959000
           % Result <h=4.773869e-003>: 40.020849205774859000
           % Result <h=4.773869e-003>: 39.753729672927300000
           % Result <h=4.773869e-003>: 40.667817564725581000
           % Result <h=9.509510e-004>: 41.312660057741127000
           % Result <h=9.509510e-004>: 48.111744657920021000
           % Result <h=9.509510e-004>: 48.088683279107258000
           % Result <h=9.509510e-004>: 48.159528454354081000
           % Result <h=4.752376e-004>: 45.338580595642853000
           % Result <h=4.752376e-004>: 49.276209783713618000
           % Result <h=4.752376e-004>: 49.269803171533532000
           % Result <h=4.752376e-004>: 49.289181554821702000
           % Result <h=9.500950e-005>: 49.333345578779792000
           % Result <h=9.500950e-005>: 50.230354244304941000
           % Result <h=9.500950e-005>: 50.230075076019553000
           % Result <h=9.500950e-005>: 50.230908884512381000
           % Result <h=4.750238e-005>: 49.894671915844583000
           % Result <h=4.750238e-005>: 50.350966085905696000
           % Result <h=4.750238e-005>: 50.350895538095877000
           % Result <h=4.750238e-005>: 50.351105912323895000
           % Result <h=9.500095e-006>: 50.355123772675057000
           % Result <h=9.500095e-006>: 50.447664014784309000
           % Result <h=9.500095e-006>: 50.447661168458090000
           % Result <h=9.500095e-006>: 50.447669645483884000
       end

       %% Aufgabe 17
       function Aufgabe17()
            x0 = [
                  1;
                  0
                 ];

            % startwerte
            t0 = 0;
            tf = 50;

            % schrittzahl
            n = 1000;

            % schrittweite
            h = (tf-t0)/(n-1);

            % Classic RKM
            e = RungeKuttaMethod(@fAufgabe17, @fRKTClassicRKM, t0, tf, h, x0);

            % cell array holen
            result = e.getResults();

            % cell array in 2 lineare double arrays konvertieren
            x1 = [];
            x2 = [];

            for i=1:1:length(result)
                x = result{i};
                x1(i) = x(1);
                x2(i) = x(2);
            end

            % phasenraum zeichnen
            figure('Name', 'Aufgabe 17 - Phasenraum �ber x1, x2');
            plot(x1, x2);
            xlabel('x1');
            ylabel('x2');

            % x1(t) zeichnen
            figure('Name', 'Aufgabe 17 - Abh�ngigkeiten von t');
            subplot(2,1,1);
            axis([0 50 -1 1]);
            plot(t0:h:tf, x1);
            xlabel('t');
            ylabel('x1');

            % x2(t) zeichnen
            subplot(2,1,2);
            axis([0 50 -1 1]);
            plot(t0:h:tf, x2);
            xlabel('t');
            ylabel('x2');
       end

   % END STATIC METHODS
   end

% END CLASS
end

NSIS

/*
  Everybody
  needs a
  multi-line
  comment!
*/

; Includes ---------------------------------
!include MUI2.nsh

; Settings ---------------------------------
Name "installer_name"
OutFile "installer_name.exe"
RequestExecutionLevel user
CRCCheck on
!ifdef x64
  InstallDir "$PROGRAMFILES64\installer_name"
!else
  InstallDir "$PROGRAMFILES\installer_name"
!endif

; Pages ------------------------------------
!insertmacro MUI_PAGE_COMPONENTS 
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

; Languages --------------------------------
!insertmacro MUI_LANGUAGE "English"

; Sections ---------------------------------
Section "section_name" section_index
	# your code here
SectionEnd

; Descriptions -----------------------------
LangString DESC_section_index ${LANG_English} "section_description"

!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  !insertmacro MUI_DESCRIPTION_TEXT ${section_index} $(DESC_section_index)
!insertmacro MUI_FUNCTION_DESCRIPTION_END

; Functions --------------------------------
Function .onInit
	StrCpy $0 "Notepad"
	MessageBox MB_YESNO "Do you want to run $0?" IDYES +2
	Quit
	nsExec:Exec "notepad.exe"
FunctionEnd
	<!-- TESTCASE STOP -->

No Highlight

<building name="GlobalDynamics Main Building" id="0xFA8A91C6617DFA1B">
	<group level="2">
		<room number="123">Conference Room A</room>
		<room number="124">Conference Room B</room>
		<room number="125">Conference Room C</room>
		<room number="126">Conference Room D</room>
	</group>
	<group level="2">
		<room number="17">John's Office</room>
		<room number="19">Eric's Office</room>
	</group>
	<group level="1">
		<room number="091">Mainframe Housing A</room>
		<room number="092">Mainframe Housing B</room>
		<room number="090">Mainframe Power Supply Station</room>
		<room number="089">Mainframe Backup Power Supply Station</room>
	</group>
	<group level="8">
		<room number="1717" role="cto">CTO Office</room>
		<room number="1819" role="ceo">CEO Office</room>
		<room number="1820" role="cfo">CFO Office</room>
	</group>
</building>

PHP

<?php
// Comments

/*
This is
a comment
block
*/

/** Keywords */

die() echo() empty() exit() eval() include() include_once() isset() list() require() require_once() return() print() unset()

__CLASS__ __DIR__ __FILE__ __FUNCTION__ __METHOD__ __NAMESPACE__

abstract and array() as break case catch cfunction class clone const continue declare default do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach function global goto if implements interface instanceof namespace new old_function or private protected public static switch throw try use var while xor

/** String's */
echo 'this is a simple string';

echo 'You can also have embedded newlines in 
strings this way as it is \'
okay to do'; // Don't you agree

// Outputs: Arnold once said: "I'll be back"
echo 'Arnold once said: "I\'ll be back"';

// Heredoc
$str = <<<EOD
Example of string
spanning multiple lines
using heredoc syntax.
EOD;

// Nowdoc
$str = <<<'EOD'
Example of string
spanning multiple lines
using nowdoc syntax.
EOD;

/** Numbers */

$a = 1234; // decimal number
$a = -123; // a negative number
$a = 0123; // octal number (equivalent to 83 decimal)
$a = 0x1A; // hexadecimal number (equivalent to 26 decimal)
$a = 1.234; 
$b = 1.2e3; 
$c = 7E-10;


/**
 * Displays GitHub Style Buttons using GitHub API v3
 * @url http://github-buttons.andidittrich.de/
 * @see https://developer.github.com/v3/
 * @author Andi Dittrich $lt;http://andidittrich.de$gt;
    * @license Dual-Licensed under "The MIT License (X11)" and "Apache 2.0 License"
 * @version 1.2
 *
 */
class GitHubButtons{

	// global cache dir
	private $_cacheDir;

	function __construct($cacheDir = '.'){
		// store cache dir
		$this->_cacheDir = $cacheDir;
	}

	/**
	 * Defines the default options -
	 * @param array $options
	 * @return multitype:
	 */
	private function mergeOptions($options){
		$defaults = array(
				// large or small button ?
				'large' => false,

				// GitHub username
				'owner' => null,

				// GitHub repository name
				'repo' => null,

				// Button type (star, fork, watch, follow)
				'type' => 'star',

				// custom button text
				'text' => null,

				// enabled/disable counter - manual set the value
				'count' => true,

				// enable caching by default
				'cache' => true,

				// cache lifetime in seconds (2h default)
				'cacheLifetime' => 7200,

				// text/count if GitHub API is unavailable
				'errorText' => 'NA'
		);
		return array_merge($defaults, $options);
	}

	/**
	 * Generate the HTML Output
	 * @param array $options
	 */
	public function button($options){
		// set default options
		$options = $this->mergeOptions($options);

		// vars
		$text = '';
		$count = null;
		$buttonLink = 'https://github.com/' . $options['owner'] . '/';
		$counterLink = 'https://github.com/' . $options['owner'] . '/';
		$apiUrl = '';
        $responseSelector = '';

		// star, fork, follow, watch are supported
		switch ($options['type']){
			case 'star':
                $apiUrl = 'repos/' . $options['owner'] . '/' . $options['repo'];
				$text = 'Star';
				$buttonLink .= $options['repo'];
				$counterLink .= $options['repo'] . '/stargazers';
                $responseSelector = 'stargazers_count';
				break;

			case 'fork':
                $apiUrl = 'repos/' . $options['owner'] . '/' . $options['repo'];
				$text = 'Fork';
				$buttonLink .= $options['repo'];
				$counterLink .= $options['repo'] . '/network';
                $responseSelector = 'forks_count';
				break;

			case 'watch':
                $apiUrl = 'repos/' . $options['owner'] . '/' . $options['repo'];
				$text = 'Watchers';
				$buttonLink .= $options['repo'];
				$counterLink .= $options['repo'] . '/watchers';
                $responseSelector = 'subscribers_count';
				break;

			case 'follow':
				$counterLink .= 'followers';
				$text = 'Follow @' . $options['owner'];
				$apiUrl = 'users/'.$options['owner'];
                $responseSelector = 'followers';
				break;
		}

		// user defined text ?
		if ($options['text']!=null){
			$text = $options['text'];
		}

		// user defined count ?
		if (is_numeric($options['count'])){
			$count = $options['count'];
		}else{
			// fetch count
			$response = $this->doApiRequest($apiUrl, $options['cache'], $options['cacheLifetime'], $responseSelector);

			// valid ?
			if (is_numeric($response)){
				$count = $response;
			}else{
				$count = $options['errorText'];
			}
		}

		// large button ?
		$large = ($options['large']===true ? ' github-btn-large' : '');

		return '';
	}

	/**
	 * Do Single HTTP GET Request including caching
	 * @param unknown $url
	 * @return string
	 */
	private function doApiRequest($url, $cacheEnabled, $cacheLifetime, $selector){
		// cache url
		$cachefilename = $this->_cacheDir . '/github.'.sha1($url.$selector).'.cache.json';

		// 1h cachetime
		if ($cacheEnabled && file_exists($cachefilename) && filemtime($cachefilename) > (time()-$cacheLifetime)){
			return file_get_contents($cachefilename);
		}

		$opts = array('http' =>
				array(
						'method'  => 'GET',
						'protocol_version' => '1.1',
						'user_agent' => 'GitHubButtons/1.1',
						'header'  => array(
								'Content-type: application/x-www-form-urlencoded;charset=UTF-8',
								'Connection: close',
								'Accept: application/vnd.github.v3+json'
						)
				)
		);

		// send request
		$data = false;
		try{
			$data = @file_get_contents('https://api.github.com/'.$url, false, stream_context_create($opts));
		}catch(Exception $error){}

		// success ?
		if ($data===false){
			return false;
		}else{
			// decode data
			$jdata = json_decode($data, true);

            // extract
            $cnt = $jdata[$selector];

			if ($cacheEnabled){
				// cache data
				file_put_contents($cachefilename, $cnt);
			}

			// return resposne data
			return $cnt;
		}
	}

	// singleton instance
	private static $__instance;

	// get singelton instance
	public static function getInstance($cacheDir=null){
		// check if singelton instance is avaible
		if (self::$__instance==null){
			// create new instance if not
			self::$__instance = new self($cacheDir);
		}
		return self::$__instance;
	}
}

?>

Python

# SOURCE: http://de.wikipedia.org/wiki/Python_%28Programmiersprache%29
def stack():
  l = []
  def pop(): return l.pop()
  def push(element): l.append(element)
  def isempty(): return len(l) == 0
  return pop, push, isempty
 
POP, PUSH, ISEMPTY = stack()

while True:
    try:
        num = raw_input("Eine Zahl eingeben: ")
        num = int(num)
        break
    except ValueError:
        print("Eine _Zahl_, bitte!")
        
'''
Multiline String Comment Style1
Hello
'''        

def curry(func, knownargument):
    return lambda unknownargument: func(unknownargument, knownargument)
    
"""
Multiline String Comment Style2
Hello
""" 

def quicksort(liste):
    if len(liste) <= 1:
        return liste
    pivotelement = liste.pop()
    links  = [element for element in liste if element < pivotelement]
    rechts = [element for element in liste if element >= pivotelement]
    return quicksort(links) + [pivotelement] + quicksort(rechts)     

using webapp.runner do (config):
    config.time_zone = 'UTC'
    config.log_level = 'debug'

# @SOURCE: http://docs.python.org/2/tutorial/classes.html     
class Mapping:
    def __init__(self, iterable):
        self.items_list = []
        self.__update(iterable)

    def update(self, iterable):
        for item in iterable:
            self.items_list.append(item)

    __update = update   # private copy of original update() method

class MappingSubclass(Mapping):

    def update(self, keys, values):
        # provides new signature for update()
        # but does not break __init__()
        for item in zip(keys, values):
            self.items_list.append(item)    

RAW

<!--?xml version="1.0" encoding="UTF-8"?-->
<building name="GlobalDynamics Main Building" id="0xFA8A91C6617DFA1B">
	<group level="2">
		<room number="123">Conference Room A</room>
		<room number="124">Conference Room B</room>
		<room number="125">Conference Room C</room>
		<room number="126">Conference Room D</room>
	</group>
	<group level="2">
		<room number="17">John's Office</room>
		<room number="19">Eric's Office</room>
	</group>
	<group level="1">
		<room number="091">Mainframe Housing A</room>
		<room number="092">Mainframe Housing B</room>
		<room number="090">Mainframe Power Supply Station</room>
		<room number="089">Mainframe Backup Power Supply Station</room>
	</group>
	<group level="8">
		<room number="1717" role="cto">CTO Office</room>
		<room number="1819" role="ceo">CEO Office</room>
		<room number="1820" role="cfo">CFO Office</room>
	</group>
</building>

Ruby

=begin
Multi-line comment test.
Below are various syntax specific statements
to test the parser with.
=end

# Keywords
alias    and     begin   BEGIN
break    case    class   def      defined?   do
else     elsif   END     end      ensure     false
for      if      in      module   next       nil
not      or      redo    rescue   retry      return
self     super   then    true     undef      unless
until    when    while   yield

# String Tests
'no interpolation, backslash notation not applied'
"applied #{interpolation}, and backslashes\n"
%q(no interpolation)
%Q(applied #{interpolation} and backslashes)
%(interpolation and backslashes)
`echo command interpretation with interpolation and backslashes`
%x(echo command interpretation with interpolation and backslashes)
myString = <<DOC
Multi line string in here doc form.
  Output will match format of heredoc.
DOC

# Regular Expressions
/pattern/
/pattern/iomx
%r{pattern}
%r{pattern}iomx

#Symbols
:Object
:myVariable
::notASymbol

# Number Tests
123                       # Fixnum
-123                      # Fixnum (signed)
1_123                     # Fixnum (underscore is ignored)
-543                      # Negative Fixnum
123_456_789_123_456_789   # Bignum
123.45                    # Float
1.2e-3                    # Float
0xaabb                    # (Hexadecimal) Fixnum
0377                      # (Octal) Fixnum
-0b1010                   # (Binary [negated]) Fixnum
0b001_001                 # (Binary) Fixnum
?a                        # ASCII character code for 'a' (97)
?\C-a                     # Control-a (1)
?\M-a                     # Meta-a (225)
?\M-\C-a                  # Meta-Control-a (129)

# Names
fred  anObject  _x  three_two_one # Local Variables
@name  @_  @Size                  # Instance Variables
@@name  @@_  @@Size               # Class Variables
def MyClass                       # Constants
PI = 3.1415926
class BigBlob
$params  $PROGRAM  $!  $_  $-a  $-. #Global variables

# Example snippet
class HistoryController < ApplicationController
  before_filter :find_node
  before_filter :repository_member_required
 
  caches_action_content :index
 
	# Single Line Comment
  def index
    @changesets = current_repository.changesets.paginate_by_path(@node.path, :page => params[:page])
    if api_format?
      render :layout => false
    else
      @users = User.find_all_by_logins(@changesets.collect(&:author).uniq).index_by(&:login)
    end
  end
  
  protected
    def find_node
      full_path = if params[:paths].last.to_s =~ /\.atom$/
        request.format = :atom
        params[:paths].first(params[:paths].size - 1)
      else
        params[:paths]
      end
      @node = current_repository.node(full_path * "/")
      unless @node.accessible_by?(current_user)
        status_message :error, "You do not have access to this path."
        false
      else
        true
      end
    end
end

Rust

#!Source: Rust Reference https://doc.rust-lang.org/stable/reference.html

/// string literal
let a = "foobar";
let b = "foo\
         bar";

assert_eq!(a,b);

"foo"; r"foo";                     // foo
"\"foo\""; r#""foo""#;             // "foo"

"foo #\"# bar";
r##"foo #"# bar"##;                // foo #"# bar

"\x52"; "R"; r"R";                 // R
"\\x52"; r"\x52";                  // \x52
b"hello";                          // byte string
b'H';                              // byte

/// integer literal
123i32;                            // type i32
123u32;                            // type u32
123_u32;                           // type u32
0xff_u8;                           // type u8
0o70_i16;                          // type i16
0b1111_1111_1001_0000_i32;         // type i32
0usize;                            // type usize

/// Floating-point literals
123.0f64;        // type f64
0.1f64;          // type f64
0.1f32;          // type f32
12E+99_f64;      // type f64
1_234.0E+18f64   // type f64
let x: f64 = 2.; // type f64


/// lambda expression
fn ten_times<F>(f: F) where F: Fn(i32) {
    let mut i = 0i32;
    while i < 10 {
      f(i);
      i += 1;
    }
}
ten_times(|j| println!("hello, {}", j));


/// Directives
// Specify the crate name.
#![crate_name = "projx"]

// Specify the type of output artifact.
#![crate_type = "lib"]

// Turn on a warning.
// This can be done in any module, not just the anonymous crate module.
#![warn(non_camel_case_types)]

#![feature(rand, collections, std_misc, duration, duration_span)]

/// Match expressions
let x = 1;

match x {
1 => println!("one"),
2 => println!("two"),
3 => println!("three"),
4 => println!("four"),
5 => println!("five"),
_ => println!("something else"),
}

let x = 1;

match x {
e @ 1 ... 5 => println!("got a range element {}", e),
_ => println!("anything"),
}

let y = match *x { 0 => "zero", _ => "some" };
let z = match x { &0 => "zero", _ => "some" };

assert_eq!(y, z);

/// If let expressions
let dish = ("Ham", "Eggs");

// this body will be skipped because the pattern is refuted
if let ("Bacon", b) = dish {
    println!("Bacon is served with {}", b);
}

// this body will execute
if let ("Ham", b) = dish {
    println!("Ham is served with {}", b);
}

/// Trait objects
trait Printable {
  fn stringify(&self) -> String;
}

impl Printable for i32 {
  fn stringify(&self) -> String { self.to_string() }
}

fn print(a: Box<Printable>) {
println!("{}", a.stringify());
}

fn main() {
    print(Box::new(10) as Box<Printable>);
}

fn to_vec<A: Clone>(xs: &[A]) -> Vec<A> {
    if xs.is_empty() {
       return vec![];
    }
    let first: A = xs[0].clone();
    let mut rest: Vec<A> = to_vec(&xs[1..]);
    rest.insert(0, first);
    rest
}

/// Tuple types
type Pair<'a> = (i32, &'a str);
let p: Pair<'static> = (10, "hello");
let (a, b) = p;
assert!(b != "world");
assert!(p.0 == 10);

/// Use declarations
use std::option::Option::{Some, None};
use std::collections::hash_map::{self, HashMap};

fn foo<T>(_: T){}
    fn bar(map1: HashMap<String, usize>, map2: hash_map::HashMap<String, usize>){}

    fn main() {
    // Equivalent to 'foo(vec![std::option::Option::Some(1.0f64),
    // std::option::Option::None]);'
    foo(vec![Some(1.0f64), None]);

    // Both `hash_map` and `HashMap` are in scope.
    let map1 = HashMap::new();
    let map2 = hash_map::HashMap::new();
    bar(map1, map2);
}

SQL

/*Source:  http://en.wikipedia.org/wiki/SQL*/

SELECT `Book.title` AS `Title`,
 COUNT(*) AS `Authors`
 FROM `Book` JOIN `Book_author`
 ON `Book`.`isbn` = `Book_author`.`isbn`
 GROUP BY `Book`.`title`;
 
DELETE FROM `My_table`
 WHERE `field2` = 'N'; 
 
 
CREATE TABLE tbl_1(id INT);
 INSERT INTO tbl_1(id) VALUES(1);
 INSERT INTO tbl_1(id) VALUES(2);
COMMIT;
 UPDATE tbl_1 SET id=200 WHERE id=1;
SAVEPOINT id_1upd;
 UPDATE tbl_1 SET id=1000 WHERE id=2;
ROLLBACK TO id_1upd;
 SELECT id FROM tbl_1;
 
START TRANSACTION;
 UPDATE Account SET amount=amount-200 WHERE account_number=1234;
 UPDATE Account SET amount=amount+200 WHERE account_number=2345;
 
IF ERRORS=0 COMMIT;
IF ERRORS<>0 ROLLBACK;  

Shell Script

#!/bin/sh

# Bin locations
# ------------------------------------
MYSQL_BIN=/usr/bin/mysql

# Config
# ------------------------------------
MYSQL_CONF="$HOME/.mysql.cnf"

# Uncompress Backup and run restore
# ------------------------------------
$MYSQL_BIN --defaults-extra-file=$MYSQL_CONF $1 < $2

# allow input
# three arguments: PROTOCOL SRC-IP PORT
firewall_allow_input() {
   if [ $# -eq 3 ]; then
      /sbin/iptables -A INPUT -p $1 -s $2 -d $IP_EXTERNAL --dport $3 -m state --state NEW -j ACCEPT
      return 0
   else
      echo "$0: syntax error for firewall_allow_input $1 $2 $3"
      echo "$0: arguments: PROTOCOL DST-IP PORT"
      return 1
   fi
}

case "$1" in
start)
   firewall_start
   exit 0
;;

stop)
   firewall_stop
   exit 0
;;

test)
   firewall_test
   exit 0
;;

restart)
   firewall_restart
   exit 0
;;

status)
   firewall_status
   exit 0
;;

*)
   echo "$0: Iptables Firewall"
   echo "$0: { start | stop | restart | status | test }"
   exit 0
;;
esac

VHDL

-- Source: http://en.wikipedia.org/wiki/VHDL

library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;    -- for the unsigned type

entity COUNTER is
  generic (
    WIDTH : in natural := 32);
  port (
    RST   : in std_logic;
    CLK   : in std_logic;
    LOAD  : in std_logic;
    DATA  : in std_logic_vector(WIDTH-1 downto 0);
    Q     : out std_logic_vector(WIDTH-1 downto 0));
end entity COUNTER;

architecture RTL of COUNTER is
  signal CNT : unsigned(WIDTH-1 downto 0);
begin
  process(RST, CLK) is
  begin
    if RST = '1' then
      CNT <= (others => '0');
    elsif rising_edge(CLK) then
      if LOAD = '1' then
        CNT <= unsigned(DATA); -- type is converted to unsigned
      else
        CNT <= CNT + 1;
      end if;
    end if;
  end process;

  Q <= std_logic_vector(CNT); -- type is converted back to std_logic_vector
end architecture RTL;

process
begin
  wait until START = '1'; -- wait until START is high

  for i in 1 to 10 loop -- then wait for a few clock periods...
    wait until rising_edge(CLK);
  end loop;

  for i in 1 to 10 loop 	-- write numbers 1 to 10 to DATA, 1 every cycle
    DATA <= to_unsigned(i, 8);
    wait until rising_edge(CLK);
  end loop;

  -- wait until the output changes
  wait on RESULT;

  -- now raise ACK for clock period
  ACK <= '1';
  wait until rising_edge(CLK);
  ACK <= '0';

  -- and so on...
end process;

XML

<!--?xml version="1.0" encoding="UTF-8"?-->
<building name="GlobalDynamics Main Building"
    core:id="0xFA8A91C6617DFA1B" core:uid="0898213-123123123-1230898123" xmlns:core="http://www.xmlnamespace.tld">
	<core:group core:level="2">
		<room number="123">Conference Room A</room>
		<room number="124">Conference Room B</room>
		<room number="125">Conference Room C</room>
		<room number="126">Conference Room D</room>
	</core:group>
	<core:group core:level="2">
		<room number="17">John's Office</room>
		<room number="19">Eric's Office</room>
	</core:group>
	<core:group core:level="1">
		<room number="091">Mainframe Housing A</room>
		<room number="092">Mainframe Housing B</room>
		<room number="090">Mainframe Power Supply Station</room>
		<room number="089">Mainframe Backup Power Supply Station</room>
	</core:group>
	<core:group core:level="8">
		<room number="1717" role="cto">CTO Office</room>
		<room number="1819" role="ceo">CEO Office</room>
		<room number="1820" role="cfo">CFO Office</room>
	</core:group>
</building>