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
|
<?php
$code = array();
$code['php'] = <<<EOF
<div id="foo">
<?php
function foo() {
echo "Hello World!\\n";
}
for (\$i = 0; \$i < 10 $i++) {
foo();
}
?>
</div>
EOF;
$code['lisp'] = <<<EOF
(defun foo
"bleh *bleh* bleh"
(interactive))
EOF;
$code['java'] = <<<EOF
public class Hello {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
EOF;
$code['xml'] = <<<EOF
<xml>
<foo>
<bar id="howdy">"Hello World!"</bar>
</foo>
</xml>
EOF;
$code['html'] = <<<EOF
<html><head><title>Hello World</title></head>
<body>
<h1>Hello World!</h1>
<p><strong>howdy</strong></p>
</body>
</html>
EOF;
$code['ruby'] = <<<EOF
class Example
def example(arg1)
return "Hello: " + arg1.to_s
end
end
EOF;
$code['rails'] = <<<EOF
ActionController::Routing::Routes.draw do |map|
map.connect ':controller/:action', :action => 'index', :requirements => { :action => /(?:[a-z](?:[-_]?[a-z]+)*)/ }
map.connect ':controller/:id', :action => 'show', :requirements => { :id => /\d+/ }
map.connect ':controller/:id/:action',
end
EOF;
$code['ocaml'] = <<<EOF
let square x = x * x;;
val square : int -> int =
let rec fact x =
if x < = 1 then 1 else x * fact (x - 1);;
val fact : int -> int =
fact 5;; - : int = 120
square 120;; - : int = 14400
EOF;
$code['python'] = <<<EOF
from itertools import islice
def fib():
x, y = 1, 1
while True:
yield x
x, y = y, x + y
for num in islice(fib(), 20):
print num
EOF;
$code['c'] = <<<EOF
_tcsncat_s(CurrentFileName, MAX_PATH, TEXT("\\\\"), MAX_PATH);
_tcsncat_s(CurrentFileName, MAX_PATH, FileInformation.cFileName, MAX_PATH);
if(FileInformation.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
RecurseFileSystem(CurrentFileName);
}
else
{
/* Do action on file here! */
}
EOF;
?>
|