Smart Tabs & First Line

421   2   3   4   5   6   7   8   9 
43string      path            = ""
44string      safeReferrer    = null
45FileInfo    fileInfo        = new FileInfo(string.Format("{0}/{1}", path, image)); 
46int         index           = 0; 
view plain | print | ?

C Sharp

1// single line comments 
2// second single line 
3override protected void OnLoad(EventArgs e) 
4
5    if(Attributes["class"] != null
6    { 
7        //_year.CssClass = _month.CssClass = _day.CssClass = Attributes["class"]; 
8    } 
9//  base.OnLoad(e); 
10
11 
12/***********************************
13 ** Multiline block comments
14 **********************************/ 
15 
16/// <summary> 
17///     Gets or sets currently selected date of birth or <see cref="DateTime.MinValue"/> if selection is incomplete or invalid. 
18/// </summary> 
19public DateTime Date 
20
21    String stringWithUrl = "http://blog.dreamprojections.com"
22     
23    get 
24    { 
25        #region Hello world 
26        try 
27        { 
28            /*
29            DateTime result = new DateTime(
30                int.Parse(_year.SelectedItem.Value),
31                int.Parse(_month.SelectedItem.Value),
32                int.Parse(_day.SelectedItem.Value)
33                );
34            
35            i *= 2;
36            */ 
37            return result; 
38        } 
39        catch 
40        { 
41            /* return _minDate; */ 
42        } 
43        #endregion 
44    } 
45    set 
46    { 
47        Day     = value.Day; 
48        Month   = value.Month; 
49        Year    = value.Year; 
50    } 
51
+ expand code | view plain | print | ?

JavaScript

1/***********************************
2 ** Multiline block comments
3 **********************************/ 
4 
5var stringWithUrl1 = "http://blog.dreamprojections.com"
6var stringWithUrl2 = 'http://www.dreamprojections.com'
7 
8// callback for the match sorting 
9dpSyntaxHighlighter.prototype.SortCallback = function(m1, m2) 
10
11    // sort matches by index first 
12    if(m1.index < m2.index) 
13        return -1; 
14    else if(m1.index > m2.index) 
15        return 1; 
16    else 
17    { 
18        /*
19        // if index is the same, sort by length
20        if(m1.length < m2.length)
21            return -1;
22        else if(m1.length > m2.length)
23            return 1;
24        */ 
25    } 
26     
27    alert('hello // world'); 
28    return 0; 
29
view plain | print | ?

Visual Basic

1' 
2' This is a VB test 
3' 
4 
5Imports System.Collections 
6 
7Dim stringWithUrl = "http://blog.dreamprojections.com" 
8 
9Public Class MyVbClass 
10    Private m_MyString As String 
11 
12    Public Sub New() 
13        myString = "Hello there" 
14    End Sub 
15 
16    Public Property MyString() As String 
17        Get 
18            Return m_MyString 
19        End Get 
20        Set(ByVal Value As String
21            m_MyString = Value 
22        End Set 
23    End Property 
24
25#Region "This is my region" 
26    ' This is a comment 
27    Public Function MyFunction( ByVal i as Integer ) As Double 
28        MyFunction = 123.456 
29    End Function 
30#End Region 
31End Class 
view plain | print | ?

XML / HTML

1<?xml version="1.0" encoding="utf-8" ?>  
2 
3<!-- comments --> 
4<rootNode> 
5    <childNodes> 
6        <childNode attribute = "value" attribute='value' attribute=/> 
7        <childNode /> 
8        <childNode /> 
9        <childNode /> 
10        <childNode attribute="value"></childNode> 
11        <childNode> 
12            <![CDATA[
13                this is some CDATA content
14                <!-- comments inside cdata -->
15                <b alert='false'>tags inside cdata</b>
16            ]]> 
17        </childNode> 
18    </childNodes> 
19</rootNode> 
20 
21<!--
22  -- Multiline comments <b>tag</b>
23  --> 
view plain | print | ?

PHP

1/***********************************
2 ** Multiline block comments
3 **********************************/ 
4 
5$stringWithUrl = "http://blog.dreamprojections.com"
6$stringWithUrl = 'http://www.dreamprojections.com'
7 
8ob_start("parseOutputBuffer");      // Start Code Buffering 
9session_start(); 
10 
11function parseOutputBuffer($buf) { 
12    global $portal_small_code$portal_gzcompress
13    global $PHP_SELF$HTTP_ACCEPT_ENCODING
14 
15    // cleaning out the code. 
16    if($portal_small_code && !$portal_gzcompress) { 
17        $buf = str_replace("    """$buf); 
18        $buf = str_replace("\n"""$buf); 
19        $buf = str_replace(chr(13), ""$buf); 
20    } 
21
view plain | print | ?

SQL

1SELECT TOP 10 
2    FirstName, 
3    LastName, 
4    Email, 
5    --SUBSTRING(Phone, 2, 3) AS CityCode, 
6    SUBSTRING(Phone, 7, 8) AS PhoneNumber, 
7    upper(LanguagePref) AS Language, 
8    Address1, 
9    UpdatedOn AS CreatedOn 
10FROM 
11    profiles 
12WHERE 
13    -- Exclude all test emails 
14    Email NOT LIKE '%test%' 
15    AND Email NOT LIKE '%asdf%' 
16ORDER BY 
17    UpdatedOn DESC 
view plain | print | ?

Delphi

1{$IFDEF VER140} 
2(***********************************
3 ** Multiline block comments
4 **********************************) 
5procedure TForm1.Button1Click(Sender: TObject); var 
6  Number, I, X: Integer; 
7  Y: Integer; 
8begin 
9  str := 'http://blog.dreamprojections.com'
10 
11  Number := 12356
12  Caption := 'The Number is ' + IntToStr(Number); 
13  for I := 0 to Number do 
14  begin 
15    Inc(X); 
16    {
17    Dec(X);
18    X := X * 1.0;
19    } 
20    Y := $F5D3
21    ListBox1.Items.Add(IntToStr(X)); 
22     
23    (* 
24    ShowMessage('Hello'); *) 
25  end
26  asm 
27    MOV AX,1234H 
28//    MOV Number,AX 
29  end
30end
view plain | print | ?

Python

cache = {} 
 
string s = "## comments inside a string" 
 
def arrange(plans, lines, totalMinutes): 
    """arrangements of plans taken lines times with an heuristic that the sum
       of values in one arrangement is less then totalMinutes
    """ 
    #if in cache we are done otherwise start calculating and save them to cache 
    if (plans, lines, totalMinutes) in cache: 
        return cache[(plans, lines, totalMinutes)] 
    if lines==1: 
        r = [[plan] for plan in plans] 
        cache[(plans, lines, totalMinutes)] = r 
        return r 
    solutions = [] 
    for plan in plans: 
        for ar in sort(list(arrange(plans, lines-1, totalMinutes))): 
            try
                one_solution = tuple(sort([plan] + list(ar))) 
                if sum(one_solution) <= totalMinutes and one_solution not in solutions: 
                    solutions.append(one_solution) 
            except Exception, e: 
                print "Error:"str(e) 
    cache[(plans, lines, totalMinutes)] = solutions 
    return solutions 
 
if __name__ == "__main__"
    import sys 
    lines, totalMinutes = int(sys.argv[1]), int(sys.argv[2]) 
    plans = tuple([int(p) for p in sys.argv[3:]]) 
    print "for", lines, totalMinutes, plans 
    for sol in arrange(plans, lines, totalMinutes): 
        print sol 

Auto Overflow Test

400px
1// this is a long line that will stretch the whole box causing it to scroll horizontally. 
2if($portal_small_code && !$portal_gzcompress) { 
3    $buf = str_replace("    ", "", $buf); 
4    $buf = str_replace("\n", "", $buf); 
5    $buf = str_replace(chr(13), "", $buf); 
6
view plain | print | ?