File: Tests.html

package info (click to toggle)
mochikit 1.4.2-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 2,240 kB
  • ctags: 1,415
  • sloc: xml: 40; makefile: 6
file content (339 lines) | stat: -rw-r--r-- 7,833 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title>dp.SyntaxHighlighter testing</title>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

	<link type="text/css" rel="stylesheet" href="SyntaxHighlighter.css"></link>

	<style>
	/* @import url(SyntaxHighlighter.css); */

	body {
		font-family: Arial;
		font-size: 12px;
	}
	</style>
</head>

<body bgcolor="#cecece">
  
<h3>Smart Tabs &amp; First Line</h3>
  
<textarea name="code" class="c#:firstline[42]">
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;
</textarea>
  
<h3>C Sharp</h3>
  
<textarea name="code" class="c#:collapse">
// 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
 **********************************/

/// <summary>
///		Gets or sets currently selected date of birth or <see cref="DateTime.MinValue"/> if selection is incomplete or invalid.
/// </summary>
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;
	}
}
</textarea>
  
<h3>JavaScript</h3>
  
<textarea name="code" class="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;
}
</textarea>
  
<h3>Visual Basic</h3>
  
<textarea name="code" class="vb">
'
' 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
</textarea>
  
<h3>XML / HTML</h3>
  
<textarea name="code" class="xml">
<?xml version="1.0" encoding="utf-8" ?> 

<!-- comments -->
<rootNode>
	<childNodes>
		<childNode attribute = "value" attribute='value' attribute=/>
		<childNode />
		<childNode />
		<childNode />
		<childNode attribute="value"></childNode>
		<childNode>
			&lt;![CDATA[
				this is some CDATA content
				<!-- comments inside cdata -->
				<b alert='false'>tags inside cdata</b>
			]]>
		</childNode>
	</childNodes>
</rootNode>

<!--
  -- Multiline comments <b>tag</b>
  -->
</textarea>
  
<h3>PHP</h3>
  
<textarea name="code" class="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);
	}
}
</textarea>
  
<h3>SQL</h3>
  
<textarea name="code" class="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
</textarea>

<h3>Delphi</h3>

<textarea name="code" id="dd" class="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;
</textarea>

<h3>Python</h3>

<textarea name="code" class="python:nogutter:nocontrols">
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
</textarea>
  
<h3>Auto Overflow Test</h3>
  
400px
<div style="width: 400px; border-top: 2px solid black;">
  
<textarea id="Textarea1" name="code" class="xml">
	// 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);
	}
</textarea>
  
</div>
  
</div>
<script class="javascript" src="shCore.js"></script>
<script class="javascript" src="shBrushCSharp.js"></script>
<script class="javascript" src="shBrushPhp.js"></script>
<script class="javascript" src="shBrushJScript.js"></script>
<script class="javascript" src="shBrushVb.js"></script>
<script class="javascript" src="shBrushSql.js"></script>
<script class="javascript" src="shBrushXml.js"></script>
<script class="javascript" src="shBrushDelphi.js"></script>
<script class="javascript" src="shBrushPython.js"></script>
<script class="javascript">
dp.SyntaxHighlighter.HighlightAll('code');
</script>

</body>
</html>