Smart Tabs & First Line
1 2 3 4 5 6 7 8 9 string path = ""; string safeReferrer = null; FileInfo fileInfo = new FileInfo(string.Format("{0}/{1}", path, image)); int index = 0;
C Sharp
// single line comments // second single line override protected void OnLoad(EventArgs e) { if(Attributes["class"] != null) { //_year.CssClass = _month.CssClass = _day.CssClass = Attributes["class"]; } // base.OnLoad(e); } /*********************************** ** Multiline block comments **********************************/ ///
/// Gets or sets currently selected date of birth or
if selection is incomplete or invalid. ///
public DateTime Date { String stringWithUrl = "http://blog.dreamprojections.com"; get { #region Hello world try { /* DateTime result = new DateTime( int.Parse(_year.SelectedItem.Value), int.Parse(_month.SelectedItem.Value), int.Parse(_day.SelectedItem.Value) ); i *= 2; */ return result; } catch { /* return _minDate; */ } #endregion } set { Day = value.Day; Month = value.Month; Year = value.Year; } }
Perl
#!/usr/bin/perl $ENV[0]='ttttt'; $ENV[1]='ttttt\n'; /* dfdfdfdfdf */ init_words(); print "what is your name? "; =
; chomp(); if ( =~ /^randal\b/i) { # back to the other way :-) print "Hello, Randal! How good of you to be here!\n test"; } else { print "Hello, !\n"; # ordinary greeting print "What is the secret word? "; =
; chomp ; while (! good_word(,)) { print "Wrong, try again. What is the secret word? "; =
; chomp ; } } dbmopen (%last_good,"lastdb",0666); = time; dbmclose (%last_good); sub init_words { while ( = <*.secret>) { open (WORDSLIST, )|| die "can't open : $!"; if (-M WORDSLIST < 7.0) { while ( =
) { chomp (); =
; chomp (); = ; } } else { # rename the file so it gets noticed rename (,".old") || die "can't rename .old: $!"; } close WORDSLIST; } } sub good_word { my(,) = @_; # name the parameters =~ s/\W.*//; # delete everything after first word =~ tr/A-Z/a-z/; # lowercase everything if ( eq "randal") { # should not need to guess return 1; # return value is true } elsif (( || "groucho") eq ) { return 1; # return value is true } else { open (MAIL, "|mail YOUR_ADDRESS_HERE"); print MAIL "bad news: guessed \n"; close MAIL; return 0; # return value is false } }
JavaScript
/*********************************** ** Multiline block comments **********************************/ var stringWithUrl1 = "http://blog.dreamprojections.com"; var stringWithUrl2 = 'http://www.dreamprojections.com'; // callback for the match sorting dpSyntaxHighlighter.prototype.SortCallback = function(m1, m2) { // sort matches by index first if(m1.index < m2.index) return -1; else if(m1.index > m2.index) return 1; else { /* // if index is the same, sort by length if(m1.length < m2.length) return -1; else if(m1.length > m2.length) return 1; */ } alert('hello // world'); return 0; }
Visual Basic
' ' This is a VB test ' Imports System.Collections Dim stringWithUrl = "http://blog.dreamprojections.com" Public Class MyVbClass Private m_MyString As String Public Sub New() myString = "Hello there" End Sub Public Property MyString() As String Get Return m_MyString End Get Set(ByVal Value As String) m_MyString = Value End Set End Property #Region "This is my region" ' This is a comment Public Function MyFunction( ByVal i as Integer ) As Double MyFunction = 123.456 End Function #End Region End Class
XML / HTML
<![CDATA[ this is some CDATA content
tags inside cdata
]]>
PHP
/*********************************** ** Multiline block comments **********************************/ $stringWithUrl = "http://blog.dreamprojections.com"; $stringWithUrl = 'http://www.dreamprojections.com'; ob_start("parseOutputBuffer"); // Start Code Buffering session_start(); function parseOutputBuffer($buf) { global $portal_small_code, $portal_gzcompress; global $PHP_SELF, $HTTP_ACCEPT_ENCODING; // cleaning out the code. if($portal_small_code && !$portal_gzcompress) { $buf = str_replace(" ", "", $buf); $buf = str_replace("\n", "", $buf); $buf = str_replace(chr(13), "", $buf); } }
SQL
SELECT TOP 10 FirstName, LastName, Email, --SUBSTRING(Phone, 2, 3) AS CityCode, SUBSTRING(Phone, 7, 8) AS PhoneNumber, upper(LanguagePref) AS Language, Address1, UpdatedOn AS CreatedOn FROM profiles WHERE -- Exclude all test emails Email NOT LIKE '%test%' AND Email NOT LIKE '%asdf%' ORDER BY UpdatedOn DESC
Delphi
{$IFDEF VER140} (*********************************** ** Multiline block comments **********************************) procedure TForm1.Button1Click(Sender: TObject); var Number, I, X: Integer; Y: Integer; begin str := 'http://blog.dreamprojections.com'; Number := 12356; Caption := 'The Number is ' + IntToStr(Number); for I := 0 to Number do begin Inc(X); { Dec(X); X := X * 1.0; } Y := $F5D3; ListBox1.Items.Add(IntToStr(X)); (* ShowMessage('Hello'); *) end; asm MOV AX,1234H // MOV Number,AX end; end;
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
// this is a long line that will stretch the whole box causing it to scroll horizontally. if($portal_small_code && !$portal_gzcompress) { $buf = str_replace(" ", "", $buf); $buf = str_replace("\n", "", $buf); $buf = str_replace(chr(13), "", $buf); }