gitlab-rouge 1.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +23 -0
  3. data/LICENSE +186 -0
  4. data/bin/rougify +16 -0
  5. data/gitlab-rouge.gemspec +17 -0
  6. data/lib/rouge.rb +57 -0
  7. data/lib/rouge/cli.rb +363 -0
  8. data/lib/rouge/demos/apache +21 -0
  9. data/lib/rouge/demos/applescript +2 -0
  10. data/lib/rouge/demos/c +8 -0
  11. data/lib/rouge/demos/clojure +5 -0
  12. data/lib/rouge/demos/coffeescript +5 -0
  13. data/lib/rouge/demos/common_lisp +1 -0
  14. data/lib/rouge/demos/conf +4 -0
  15. data/lib/rouge/demos/cpp +8 -0
  16. data/lib/rouge/demos/csharp +5 -0
  17. data/lib/rouge/demos/css +4 -0
  18. data/lib/rouge/demos/dart +6 -0
  19. data/lib/rouge/demos/diff +7 -0
  20. data/lib/rouge/demos/elixir +1 -0
  21. data/lib/rouge/demos/erb +1 -0
  22. data/lib/rouge/demos/erlang +7 -0
  23. data/lib/rouge/demos/factor +5 -0
  24. data/lib/rouge/demos/gherkin +17 -0
  25. data/lib/rouge/demos/glsl +14 -0
  26. data/lib/rouge/demos/go +7 -0
  27. data/lib/rouge/demos/groovy +9 -0
  28. data/lib/rouge/demos/haml +5 -0
  29. data/lib/rouge/demos/handlebars +7 -0
  30. data/lib/rouge/demos/haskell +6 -0
  31. data/lib/rouge/demos/html +8 -0
  32. data/lib/rouge/demos/http +14 -0
  33. data/lib/rouge/demos/ini +4 -0
  34. data/lib/rouge/demos/io +11 -0
  35. data/lib/rouge/demos/java +5 -0
  36. data/lib/rouge/demos/javascript +1 -0
  37. data/lib/rouge/demos/json +1 -0
  38. data/lib/rouge/demos/json-doc +1 -0
  39. data/lib/rouge/demos/liquid +11 -0
  40. data/lib/rouge/demos/literate_coffeescript +3 -0
  41. data/lib/rouge/demos/literate_haskell +7 -0
  42. data/lib/rouge/demos/llvm +20 -0
  43. data/lib/rouge/demos/lua +12 -0
  44. data/lib/rouge/demos/make +6 -0
  45. data/lib/rouge/demos/markdown +4 -0
  46. data/lib/rouge/demos/matlab +6 -0
  47. data/lib/rouge/demos/moonscript +16 -0
  48. data/lib/rouge/demos/nginx +5 -0
  49. data/lib/rouge/demos/nim +27 -0
  50. data/lib/rouge/demos/objective_c +14 -0
  51. data/lib/rouge/demos/ocaml +12 -0
  52. data/lib/rouge/demos/perl +5 -0
  53. data/lib/rouge/demos/php +3 -0
  54. data/lib/rouge/demos/plaintext +1 -0
  55. data/lib/rouge/demos/powershell +49 -0
  56. data/lib/rouge/demos/prolog +9 -0
  57. data/lib/rouge/demos/properties +7 -0
  58. data/lib/rouge/demos/puppet +6 -0
  59. data/lib/rouge/demos/python +6 -0
  60. data/lib/rouge/demos/qml +9 -0
  61. data/lib/rouge/demos/r +8 -0
  62. data/lib/rouge/demos/racket +24 -0
  63. data/lib/rouge/demos/ruby +9 -0
  64. data/lib/rouge/demos/rust +12 -0
  65. data/lib/rouge/demos/sass +3 -0
  66. data/lib/rouge/demos/scala +3 -0
  67. data/lib/rouge/demos/scheme +4 -0
  68. data/lib/rouge/demos/scss +5 -0
  69. data/lib/rouge/demos/sed +4 -0
  70. data/lib/rouge/demos/shell +2 -0
  71. data/lib/rouge/demos/slim +17 -0
  72. data/lib/rouge/demos/smalltalk +6 -0
  73. data/lib/rouge/demos/sml +4 -0
  74. data/lib/rouge/demos/sql +1 -0
  75. data/lib/rouge/demos/swift +5 -0
  76. data/lib/rouge/demos/tcl +1 -0
  77. data/lib/rouge/demos/tex +1 -0
  78. data/lib/rouge/demos/toml +9 -0
  79. data/lib/rouge/demos/tulip +14 -0
  80. data/lib/rouge/demos/vb +4 -0
  81. data/lib/rouge/demos/viml +5 -0
  82. data/lib/rouge/demos/xml +2 -0
  83. data/lib/rouge/demos/yaml +4 -0
  84. data/lib/rouge/formatter.rb +50 -0
  85. data/lib/rouge/formatters/html.rb +117 -0
  86. data/lib/rouge/formatters/null.rb +19 -0
  87. data/lib/rouge/formatters/terminal256.rb +176 -0
  88. data/lib/rouge/lexer.rb +443 -0
  89. data/lib/rouge/lexers/apache.rb +68 -0
  90. data/lib/rouge/lexers/apache/keywords.yml +453 -0
  91. data/lib/rouge/lexers/apple_script.rb +367 -0
  92. data/lib/rouge/lexers/c.rb +212 -0
  93. data/lib/rouge/lexers/clojure.rb +112 -0
  94. data/lib/rouge/lexers/coffeescript.rb +174 -0
  95. data/lib/rouge/lexers/common_lisp.rb +345 -0
  96. data/lib/rouge/lexers/conf.rb +24 -0
  97. data/lib/rouge/lexers/cpp.rb +66 -0
  98. data/lib/rouge/lexers/csharp.rb +88 -0
  99. data/lib/rouge/lexers/css.rb +271 -0
  100. data/lib/rouge/lexers/dart.rb +104 -0
  101. data/lib/rouge/lexers/diff.rb +31 -0
  102. data/lib/rouge/lexers/elixir.rb +108 -0
  103. data/lib/rouge/lexers/erb.rb +56 -0
  104. data/lib/rouge/lexers/erlang.rb +118 -0
  105. data/lib/rouge/lexers/factor.rb +302 -0
  106. data/lib/rouge/lexers/gherkin.rb +137 -0
  107. data/lib/rouge/lexers/gherkin/keywords.rb +14 -0
  108. data/lib/rouge/lexers/glsl.rb +135 -0
  109. data/lib/rouge/lexers/go.rb +178 -0
  110. data/lib/rouge/lexers/groovy.rb +104 -0
  111. data/lib/rouge/lexers/haml.rb +228 -0
  112. data/lib/rouge/lexers/handlebars.rb +79 -0
  113. data/lib/rouge/lexers/haskell.rb +183 -0
  114. data/lib/rouge/lexers/html.rb +94 -0
  115. data/lib/rouge/lexers/http.rb +80 -0
  116. data/lib/rouge/lexers/ini.rb +57 -0
  117. data/lib/rouge/lexers/io.rb +68 -0
  118. data/lib/rouge/lexers/java.rb +76 -0
  119. data/lib/rouge/lexers/javascript.rb +297 -0
  120. data/lib/rouge/lexers/liquid.rb +287 -0
  121. data/lib/rouge/lexers/literate_coffeescript.rb +33 -0
  122. data/lib/rouge/lexers/literate_haskell.rb +36 -0
  123. data/lib/rouge/lexers/llvm.rb +84 -0
  124. data/lib/rouge/lexers/lua.rb +122 -0
  125. data/lib/rouge/lexers/lua/builtins.rb +22 -0
  126. data/lib/rouge/lexers/make.rb +116 -0
  127. data/lib/rouge/lexers/markdown.rb +154 -0
  128. data/lib/rouge/lexers/matlab.rb +74 -0
  129. data/lib/rouge/lexers/matlab/builtins.rb +11 -0
  130. data/lib/rouge/lexers/moonscript.rb +110 -0
  131. data/lib/rouge/lexers/nginx.rb +71 -0
  132. data/lib/rouge/lexers/nim.rb +152 -0
  133. data/lib/rouge/lexers/objective_c.rb +197 -0
  134. data/lib/rouge/lexers/ocaml.rb +111 -0
  135. data/lib/rouge/lexers/perl.rb +197 -0
  136. data/lib/rouge/lexers/php.rb +173 -0
  137. data/lib/rouge/lexers/php/builtins.rb +204 -0
  138. data/lib/rouge/lexers/plain_text.rb +25 -0
  139. data/lib/rouge/lexers/powershell.rb +96 -0
  140. data/lib/rouge/lexers/prolog.rb +64 -0
  141. data/lib/rouge/lexers/properties.rb +55 -0
  142. data/lib/rouge/lexers/puppet.rb +128 -0
  143. data/lib/rouge/lexers/python.rb +228 -0
  144. data/lib/rouge/lexers/qml.rb +72 -0
  145. data/lib/rouge/lexers/r.rb +56 -0
  146. data/lib/rouge/lexers/racket.rb +542 -0
  147. data/lib/rouge/lexers/ruby.rb +415 -0
  148. data/lib/rouge/lexers/rust.rb +191 -0
  149. data/lib/rouge/lexers/sass.rb +74 -0
  150. data/lib/rouge/lexers/sass/common.rb +180 -0
  151. data/lib/rouge/lexers/scala.rb +142 -0
  152. data/lib/rouge/lexers/scheme.rb +112 -0
  153. data/lib/rouge/lexers/scss.rb +34 -0
  154. data/lib/rouge/lexers/sed.rb +170 -0
  155. data/lib/rouge/lexers/shell.rb +152 -0
  156. data/lib/rouge/lexers/slim.rb +228 -0
  157. data/lib/rouge/lexers/smalltalk.rb +116 -0
  158. data/lib/rouge/lexers/sml.rb +347 -0
  159. data/lib/rouge/lexers/sql.rb +140 -0
  160. data/lib/rouge/lexers/swift.rb +144 -0
  161. data/lib/rouge/lexers/tcl.rb +192 -0
  162. data/lib/rouge/lexers/tex.rb +72 -0
  163. data/lib/rouge/lexers/toml.rb +71 -0
  164. data/lib/rouge/lexers/tulip.rb +75 -0
  165. data/lib/rouge/lexers/vb.rb +164 -0
  166. data/lib/rouge/lexers/viml.rb +101 -0
  167. data/lib/rouge/lexers/viml/keywords.rb +12 -0
  168. data/lib/rouge/lexers/xml.rb +59 -0
  169. data/lib/rouge/lexers/yaml.rb +364 -0
  170. data/lib/rouge/plugins/redcarpet.rb +30 -0
  171. data/lib/rouge/regex_lexer.rb +439 -0
  172. data/lib/rouge/template_lexer.rb +22 -0
  173. data/lib/rouge/text_analyzer.rb +48 -0
  174. data/lib/rouge/theme.rb +195 -0
  175. data/lib/rouge/themes/base16.rb +130 -0
  176. data/lib/rouge/themes/colorful.rb +67 -0
  177. data/lib/rouge/themes/github.rb +71 -0
  178. data/lib/rouge/themes/molokai.rb +82 -0
  179. data/lib/rouge/themes/monokai.rb +92 -0
  180. data/lib/rouge/themes/monokai_sublime.rb +90 -0
  181. data/lib/rouge/themes/thankful_eyes.rb +71 -0
  182. data/lib/rouge/token.rb +182 -0
  183. data/lib/rouge/util.rb +101 -0
  184. data/lib/rouge/version.rb +7 -0
  185. metadata +231 -0
@@ -0,0 +1,21 @@
1
+ AddDefaultCharset UTF-8
2
+
3
+ RewriteEngine On
4
+
5
+ # Serve gzipped version if available and accepted
6
+ AddEncoding x-gzip .gz
7
+ RewriteCond %{HTTP:Accept-Encoding} gzip
8
+ RewriteCond %{REQUEST_FILENAME}.gz -f
9
+ RewriteRule ^(.*)$ $1.gz [QSA,L]
10
+ <FilesMatch \.css\.gz$>
11
+ ForceType text/css
12
+ Header append Vary Accept-Encoding
13
+ </FilesMatch>
14
+ <FilesMatch \.js\.gz$>
15
+ ForceType application/javascript
16
+ Header append Vary Accept-Encoding
17
+ </FilesMatch>
18
+ <FilesMatch \.html\.gz$>
19
+ ForceType text/html
20
+ Header append Vary Accept-Encoding
21
+ </FilesMatch>
@@ -0,0 +1,2 @@
1
+ -- AppleScript playing with iTunes
2
+ tell application "iTunes" to get current selection
@@ -0,0 +1,8 @@
1
+ #include "ruby/ruby.h"
2
+
3
+ static int
4
+ clone_method_i(st_data_t key, st_data_t value, st_data_t data)
5
+ {
6
+ clone_method((VALUE)data, (ID)key, (const rb_method_entry_t *)value);
7
+ return ST_CONTINUE;
8
+ }
@@ -0,0 +1,5 @@
1
+ (defn make-adder [x]
2
+ (let [y x]
3
+ (fn [z] (+ y z))))
4
+ (def add2 (make-adder 2))
5
+ (add2 4)
@@ -0,0 +1,5 @@
1
+ # Objects:
2
+ math =
3
+ root: Math.sqrt
4
+ square: square
5
+ cube: (x) -> x * square x
@@ -0,0 +1 @@
1
+ (defun square (x) (* x x))
@@ -0,0 +1,4 @@
1
+ # A generic configuration file
2
+ option1 "val1"
3
+ option2 23
4
+ option3 'val3'
@@ -0,0 +1,8 @@
1
+ #include<iostream>
2
+
3
+ using namespace std;
4
+
5
+ int main()
6
+ {
7
+ cout << "Hello World" << endl;
8
+ }
@@ -0,0 +1,5 @@
1
+ // reverse byte order (16-bit)
2
+ public static UInt16 ReverseBytes(UInt16 value)
3
+ {
4
+ return (UInt16)((value & 0xFFU) << 8 | (value & 0xFF00U) >> 8);
5
+ }
@@ -0,0 +1,4 @@
1
+ body {
2
+ font-size: 12pt;
3
+ background: #fff url(temp.png) top left no-repeat;
4
+ }
@@ -0,0 +1,6 @@
1
+ void main() {
2
+ var collection=[1,2,3,4,5];
3
+ for(var a in collection){
4
+ print(a);
5
+ }
6
+ }
@@ -0,0 +1,7 @@
1
+ --- file1 2012-10-16 15:07:58.086886874 +0100
2
+ +++ file2 2012-10-16 15:08:07.642887236 +0100
3
+ @@ -1,3 +1,3 @@
4
+ a b c
5
+ -d e f
6
+ +D E F
7
+ g h i
@@ -0,0 +1 @@
1
+ Enum.map([1,2,3], fn(x) -> x * 2 end)
@@ -0,0 +1 @@
1
+ <title><%= @title %></title>
@@ -0,0 +1,7 @@
1
+ %%% Geometry module.
2
+ -module(geometry).
3
+ -export([area/1]).
4
+
5
+ %% Compute rectangle and circle area.
6
+ area({rectangle, Width, Ht}) -> Width * Ht;
7
+ area({circle, R}) -> 3.14159 * R * R.
@@ -0,0 +1,5 @@
1
+ USING: io kernel sequences ;
2
+
3
+ 4 iota [
4
+ "Happy Birthday " write 2 = "dear NAME" "to You" ? print
5
+ ] each
@@ -0,0 +1,17 @@
1
+ # language: en
2
+ Feature: Addition
3
+ In order to avoid silly mistakes
4
+ As a math idiot
5
+ I want to be told the sum of two numbers
6
+
7
+ Scenario Outline: Add two numbers
8
+ Given I have entered <input_1> into the calculator
9
+ And I have entered <input_2> into the calculator
10
+ When I press <button>
11
+ Then the result should be <output> on the screen
12
+
13
+ Examples:
14
+ | input_1 | input_2 | button | output |
15
+ | 20 | 30 | add | 50 |
16
+ | 2 | 5 | add | 7 |
17
+ | 0 | 40 | add | 40 |
@@ -0,0 +1,14 @@
1
+ #version 330 core
2
+
3
+ uniform mat4 worldMatrix;
4
+
5
+ layout(location = 0) in vec2 position;
6
+ layout(location = 1) in vec4 color;
7
+
8
+ out vec4 vertexColor;
9
+
10
+ void main()
11
+ {
12
+ vertexColor = color;
13
+ gl_Position = vec4(position, 0.0, 1.0);
14
+ }
@@ -0,0 +1,7 @@
1
+ package main
2
+
3
+ import "fmt"
4
+
5
+ func main() {
6
+ fmt.Println("Hello, 世界")
7
+ }
@@ -0,0 +1,9 @@
1
+ class Greet {
2
+ def name
3
+ Greet(who) { name = who[0].toUpperCase() +
4
+ who[1..-1] }
5
+ def salute() { println "Hello $name!" }
6
+ }
7
+
8
+ g = new Greet('world') // create object
9
+ g.salute() // output "Hello World!"
@@ -0,0 +1,5 @@
1
+ %section.container
2
+ %h1= post.title
3
+ %h2= post.subtitle
4
+ .content
5
+ = post.content
@@ -0,0 +1,7 @@
1
+ <div class="entry">
2
+ <h1>{{title}}</h1>
3
+ {{#with story}}
4
+ <div class="intro">{{{intro}}}</div>
5
+ <div class="body">{{{body}}}</div>
6
+ {{/with}}
7
+ </div>
@@ -0,0 +1,6 @@
1
+ quicksort :: Ord a => [a] -> [a]
2
+ quicksort [] = []
3
+ quicksort (p:xs) = (quicksort lesser) ++ [p] ++ (quicksort greater)
4
+ where
5
+ lesser = filter (< p) xs
6
+ greater = filter (>= p) xs
@@ -0,0 +1,8 @@
1
+ <html>
2
+ <head><title>Title!</title></head>
3
+ <body>
4
+ <p id="foo">Hello, World!</p>
5
+ <script type="text/javascript">var a = 1;</script>
6
+ <style type="text/css">#foo { font-weight: bold; }</style>
7
+ </body>
8
+ </html>
@@ -0,0 +1,14 @@
1
+ POST /demo/submit/ HTTP/1.1
2
+ Host: rouge.jneen.net
3
+ Cache-Control: max-age=0
4
+ Origin: http://rouge.jayferd.us
5
+ User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2)
6
+ AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.63 Safari/535.7
7
+ Content-Type: application/json
8
+ Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
9
+ Referer: http://pygments.org/
10
+ Accept-Encoding: gzip,deflate,sdch
11
+ Accept-Language: en-US,en;q=0.8
12
+ Accept-Charset: windows-949,utf-8;q=0.7,*;q=0.3
13
+
14
+ {"name":"test","lang":"text","boring":true}
@@ -0,0 +1,4 @@
1
+ ; last modified 1 April 2001 by John Doe
2
+ [owner]
3
+ name=John Doe
4
+ organization=Acme Widgets Inc.
@@ -0,0 +1,11 @@
1
+ bottle := method(i,
2
+ if(i==0, return "no more bottles of beer")
3
+ if(i==1, return "1 bottle of beer")
4
+ return i asString .. " bottles of beer"
5
+ )
6
+
7
+ for(i, 99, 1, -1,
8
+ write(bottle(i), " on the wall, ", bottle(i), ",\n")
9
+ write("take one down, pass it around,\n")
10
+ write(bottle(i - 1), " on the wall.\n\n")
11
+ )
@@ -0,0 +1,5 @@
1
+ public class java {
2
+ public static void main(String[] args) {
3
+ System.out.println("Hello World");
4
+ }
5
+ }
@@ -0,0 +1 @@
1
+ $(document).ready(function() { alert('ready!'); });
@@ -0,0 +1 @@
1
+ { "one": 1, "two": 2, "null": null, "simple": true }
@@ -0,0 +1 @@
1
+ { "one": 1, "two": 2, "null": null, "simple": true } // a simple json object
@@ -0,0 +1,11 @@
1
+ <ul id="products">
2
+ {% for product in products %}
3
+ <li>
4
+ <h2>{{ product.title }}</h2>
5
+ Only {{ product.price | format_as_money }}
6
+
7
+ <p>{{ product.description | prettyprint | truncate: 200 }}</p>
8
+
9
+ </li>
10
+ {% endfor %}
11
+ </ul>
@@ -0,0 +1,3 @@
1
+ Import the helpers we plan to use.
2
+
3
+ {extend, last} = require './helpers'
@@ -0,0 +1,7 @@
1
+ In Bird-style you have to leave a blank before the code.
2
+
3
+ > fact :: Integer -> Integer
4
+ > fact 0 = 1
5
+ > fact n = n * fact (n-1)
6
+
7
+ And you have to leave a blank line after the code as well.
@@ -0,0 +1,20 @@
1
+ ; copied from http://llvm.org/docs/LangRef.html#module-structure
2
+ ; Declare the string constant as a global constant.
3
+ @.str = private unnamed_addr constant [13 x i8] c"hello world\0A\00"
4
+
5
+ ; External declaration of the puts function
6
+ declare i32 @puts(i8* nocapture) nounwind
7
+
8
+ ; Definition of main function
9
+ define i32 @main() { ; i32()*
10
+ ; Convert [13 x i8]* to i8 *...
11
+ %cast210 = getelementptr [13 x i8]* @.str, i64 0, i64 0
12
+
13
+ ; Call puts function to write out the string to stdout.
14
+ call i32 @puts(i8* %cast210)
15
+ ret i32 0
16
+ }
17
+
18
+ ; Named metadata
19
+ !1 = metadata !{i32 42}
20
+ !foo = !{!1, null}
@@ -0,0 +1,12 @@
1
+ -- defines a factorial function
2
+ function fact (n)
3
+ if n == 0 then
4
+ return 1
5
+ else
6
+ return n * fact(n-1)
7
+ end
8
+ end
9
+
10
+ print("enter a number:")
11
+ a = io.read("*number") -- read a number
12
+ print(fact(a))
@@ -0,0 +1,6 @@
1
+ .PHONY: all
2
+ all: $(OBJ)
3
+
4
+ $(OBJ): $(SOURCE)
5
+ @echo "compiling..."
6
+ $(GCC) $(CFLAGS) $< > $@
@@ -0,0 +1,4 @@
1
+ Markdown has cool [reference links][ref 1]
2
+ and [regular links too](http://example.com)
3
+
4
+ [ref 1]: http://example.com
@@ -0,0 +1,6 @@
1
+ A = cat( 3, [1 2 3; 9 8 7; 4 6 5], [0 3 2; 8 8 4; 5 3 5], ...
2
+ [6 4 7; 6 8 5; 5 4 3]);
3
+ % The EIG function is applied to each of the horizontal 'slices' of A.
4
+ for i = 1:3
5
+ eig(squeeze(A(i,:,:)))
6
+ end
@@ -0,0 +1,16 @@
1
+ util = require "my.module"
2
+
3
+ a_table = {
4
+ foo: 'bar'
5
+ interpolated: "foo-#{other.stuff 2 + 3}"
6
+ "string": 2
7
+ do: 'keyword'
8
+ }
9
+
10
+ class MyClass extends SomeClass
11
+ new: (@init, arg2 = 'default') =>
12
+ @derived = @init + 2
13
+ super!
14
+
15
+ other: =>
16
+ @foo + 2
@@ -0,0 +1,5 @@
1
+ server {
2
+ listen 80;
3
+ server_name example.com *.example.com;
4
+ rewrite ^ http://www.domain.com$request_uri? permanent;
5
+ }
@@ -0,0 +1,27 @@
1
+ import math,strutils
2
+
3
+ proc fixedWidth(input: string, minFieldSize: int):string {.inline.} =
4
+ # Note that field size is a minimum- will expand field if input
5
+ # string is larger
6
+ if input.startsWith("-"):
7
+ return(input & repeatchar(count=(abs(minFieldSize-len(input))),c=' '))
8
+ else:
9
+ return(" " & input & repeatchar(count=(abs(minFieldSize-len(input))-1),c=' '))
10
+
11
+ template mathOnInterval(lowbound,highbound:float,counts: int,p:proc) =
12
+ block:
13
+ var step: float = (highbound - lowbound)/(max(counts,1))
14
+ var current: float = lowbound
15
+ while current < highbound:
16
+ echo($fixedWidth($current,25) & ": " & $fixedWidth($p(current),25))
17
+ current += step
18
+
19
+ echo "Sine of theta from 0 to 2*PI by PI/12"
20
+ mathOnInterval(0.0,2.0*PI,12,sin)
21
+ echo("\n")
22
+ echo "Cosine of theta from 0 to 2*PI by PI/12"
23
+ mathOnInterval(0.0,2.0*PI,12,cos)
24
+
25
+ # The first example above is much the same as:
26
+ # for i in 1..100:
27
+ # echo($sin( (float(i)/100.0) * 2.0*PI ))
@@ -0,0 +1,14 @@
1
+ @interface Person : NSObject {
2
+ @public
3
+ NSString *name;
4
+ @private
5
+ int age;
6
+ }
7
+
8
+ @property(copy) NSString *name;
9
+ @property(readonly) int age;
10
+
11
+ -(id)initWithAge:(int)age;
12
+ @end
13
+
14
+ NSArray *arrayLiteral = @[@"abc", @1];
@@ -0,0 +1,12 @@
1
+ (* Binary tree with leaves car­rying an integer. *)
2
+ type tree = Leaf of int | Node of tree * tree
3
+
4
+ let rec exists_leaf test tree =
5
+ match tree with
6
+ | Leaf v -> test v
7
+ | Node (left, right) ->
8
+ exists_leaf test left
9
+ || exists_leaf test right
10
+
11
+ let has_even_leaf tree =
12
+ exists_leaf (fun n -> n mod 2 = 0) tree
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env perl
2
+ use warnings;
3
+ print "a: ";
4
+ my $a = "foo";
5
+ print $a;
@@ -0,0 +1,3 @@
1
+ <?php
2
+ print("Hello {$world}");
3
+ ?>
@@ -0,0 +1 @@
1
+ plain text :)
@@ -0,0 +1,49 @@
1
+ Function Get-IPv4Scopes
2
+ <#
3
+ .SYNOPSIS
4
+ Read IPv4Scopes from an array of servers
5
+ .PARAMETER Servers
6
+ Specifies an array of servers
7
+ .EXAMPLE
8
+ Get-IPv4Scopes
9
+
10
+ Will prompt for all inputs
11
+ #>
12
+ {
13
+ [CmdletBinding()]
14
+ Param(
15
+ # 1
16
+ [parameter(
17
+ Mandatory=$true,
18
+ Position=0,
19
+ ValueFromPipelineByPropertyName=$true,
20
+ HelpMessage="Server List"
21
+ )]
22
+ [string[]]$Servers,
23
+ #2
24
+ [parameter(Mandatory=$false,ValueFromPipeline=$false)]
25
+ [bool]$Unique=$false
26
+ ) #EndParam
27
+
28
+ Begin {}
29
+
30
+ Process {
31
+ $arrayJobs=@()
32
+ foreach ($server in $Servers) {
33
+ $arrayJobs+=Invoke-Command -ComputerName $server -scriptblock {Get-DhcpServerv4Scope} -AsJob
34
+ }
35
+ $complete=$false
36
+ while (-not $complete) {
37
+ $arrayJobsInProgress= $arrayJobs | Where-Object { $_.State -match 'running' }
38
+ if (-not $arrayJobsInProgress) { $complete=$true }
39
+ }
40
+ $Scopes=$arrayJobs|Receive-Job
41
+ $UniqueScopes=$Scopes|Sort-Object -Property ScopeId -Unique
42
+ }
43
+
44
+ End {
45
+ if ($Unique) { return $UniqueScopes }
46
+ else { return $Scopes }
47
+ }
48
+
49
+ } #end function