diff options
author | Jose Antonio Marquez | 2012-01-27 12:05:17 -0800 |
---|---|---|
committer | Jose Antonio Marquez | 2012-01-27 12:05:17 -0800 |
commit | 3a754133dbc138390503341fd2e9beba3e43aa4b (patch) | |
tree | cdeae7d7dd9a30d7b4fab5afb7efad68d4ec7508 /imports/codemirror/mode/coffeescript/index.html | |
parent | b89a7ee8b956c96a1dcee995ea840feddc5d4b27 (diff) | |
download | ninja-3a754133dbc138390503341fd2e9beba3e43aa4b.tar.gz |
Merged old FileIO
Diffstat (limited to 'imports/codemirror/mode/coffeescript/index.html')
-rwxr-xr-x | imports/codemirror/mode/coffeescript/index.html | 721 |
1 files changed, 721 insertions, 0 deletions
diff --git a/imports/codemirror/mode/coffeescript/index.html b/imports/codemirror/mode/coffeescript/index.html new file mode 100755 index 00000000..127c4bf9 --- /dev/null +++ b/imports/codemirror/mode/coffeescript/index.html | |||
@@ -0,0 +1,721 @@ | |||
1 | <!doctype html> | ||
2 | <html> | ||
3 | <head> | ||
4 | <title>CodeMirror: CoffeeScript mode</title> | ||
5 | <link rel="stylesheet" href="../../lib/codemirror.css"> | ||
6 | <script src="../../lib/codemirror.js"></script> | ||
7 | <script src="coffeescript.js"></script> | ||
8 | <style>.CodeMirror {border-top: 1px solid silver; border-bottom: 1px solid silver;}</style> | ||
9 | <link rel="stylesheet" href="../../doc/docs.css"> | ||
10 | </head> | ||
11 | <body> | ||
12 | <h1>CodeMirror: CoffeeScript mode</h1> | ||
13 | <form><textarea id="code" name="code"> | ||
14 | # CoffeeScript mode for CodeMirror | ||
15 | # Copyright (c) 2011 Jeff Pickhardt, released under | ||
16 | # the MIT License. | ||
17 | # | ||
18 | # Modified from the Python CodeMirror mode, which also is | ||
19 | # under the MIT License Copyright (c) 2010 Timothy Farrell. | ||
20 | # | ||
21 | # The following script, Underscore.coffee, is used to | ||
22 | # demonstrate CoffeeScript mode for CodeMirror. | ||
23 | # | ||
24 | # To download CoffeeScript mode for CodeMirror, go to: | ||
25 | # https://github.com/pickhardt/coffeescript-codemirror-mode | ||
26 | |||
27 | # **Underscore.coffee | ||
28 | # (c) 2011 Jeremy Ashkenas, DocumentCloud Inc.** | ||
29 | # Underscore is freely distributable under the terms of the | ||
30 | # [MIT license](http://en.wikipedia.org/wiki/MIT_License). | ||
31 | # Portions of Underscore are inspired by or borrowed from | ||
32 | # [Prototype.js](http://prototypejs.org/api), Oliver Steele's | ||
33 | # [Functional](http://osteele.com), and John Resig's | ||
34 | # [Micro-Templating](http://ejohn.org). | ||
35 | # For all details and documentation: | ||
36 | # http://documentcloud.github.com/underscore/ | ||
37 | |||
38 | |||
39 | # Baseline setup | ||
40 | # -------------- | ||
41 | |||
42 | # Establish the root object, `window` in the browser, or `global` on the server. | ||
43 | root = this | ||
44 | |||
45 | |||
46 | # Save the previous value of the `_` variable. | ||
47 | previousUnderscore = root._ | ||
48 | |||
49 | |||
50 | # Establish the object that gets thrown to break out of a loop iteration. | ||
51 | # `StopIteration` is SOP on Mozilla. | ||
52 | breaker = if typeof(StopIteration) is 'undefined' then '__break__' else StopIteration | ||
53 | |||
54 | |||
55 | # Helper function to escape **RegExp** contents, because JS doesn't have one. | ||
56 | escapeRegExp = (string) -> string.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1') | ||
57 | |||
58 | |||
59 | # Save bytes in the minified (but not gzipped) version: | ||
60 | ArrayProto = Array.prototype | ||
61 | ObjProto = Object.prototype | ||
62 | |||
63 | |||
64 | # Create quick reference variables for speed access to core prototypes. | ||
65 | slice = ArrayProto.slice | ||
66 | unshift = ArrayProto.unshift | ||
67 | toString = ObjProto.toString | ||
68 | hasOwnProperty = ObjProto.hasOwnProperty | ||
69 | propertyIsEnumerable = ObjProto.propertyIsEnumerable | ||
70 | |||
71 | |||
72 | # All **ECMA5** native implementations we hope to use are declared here. | ||
73 | nativeForEach = ArrayProto.forEach | ||
74 | nativeMap = ArrayProto.map | ||
75 | nativeReduce = ArrayProto.reduce | ||
76 | nativeReduceRight = ArrayProto.reduceRight | ||
77 | nativeFilter = ArrayProto.filter | ||
78 | nativeEvery = ArrayProto.every | ||
79 | nativeSome = ArrayProto.some | ||
80 | nativeIndexOf = ArrayProto.indexOf | ||
81 | nativeLastIndexOf = ArrayProto.lastIndexOf | ||
82 | nativeIsArray = Array.isArray | ||
83 | nativeKeys = Object.keys | ||
84 | |||
85 | |||
86 | # Create a safe reference to the Underscore object for use below. | ||
87 | _ = (obj) -> new wrapper(obj) | ||
88 | |||
89 | |||
90 | # Export the Underscore object for **CommonJS**. | ||
91 | if typeof(exports) != 'undefined' then exports._ = _ | ||
92 | |||
93 | |||
94 | # Export Underscore to global scope. | ||
95 | root._ = _ | ||
96 | |||
97 | |||
98 | # Current version. | ||
99 | _.VERSION = '1.1.0' | ||
100 | |||
101 | |||
102 | # Collection Functions | ||
103 | # -------------------- | ||
104 | |||
105 | # The cornerstone, an **each** implementation. | ||
106 | # Handles objects implementing **forEach**, arrays, and raw objects. | ||
107 | _.each = (obj, iterator, context) -> | ||
108 | try | ||
109 | if nativeForEach and obj.forEach is nativeForEach | ||
110 | obj.forEach iterator, context | ||
111 | else if _.isNumber obj.length | ||
112 | iterator.call context, obj[i], i, obj for i in [0...obj.length] | ||
113 | else | ||
114 | iterator.call context, val, key, obj for own key, val of obj | ||
115 | catch e | ||
116 | throw e if e isnt breaker | ||
117 | obj | ||
118 | |||
119 | |||
120 | # Return the results of applying the iterator to each element. Use JavaScript | ||
121 | # 1.6's version of **map**, if possible. | ||
122 | _.map = (obj, iterator, context) -> | ||
123 | return obj.map(iterator, context) if nativeMap and obj.map is nativeMap | ||
124 | results = [] | ||
125 | _.each obj, (value, index, list) -> | ||
126 | results.push iterator.call context, value, index, list | ||
127 | results | ||
128 | |||
129 | |||
130 | # **Reduce** builds up a single result from a list of values. Also known as | ||
131 | # **inject**, or **foldl**. Uses JavaScript 1.8's version of **reduce**, if possible. | ||
132 | _.reduce = (obj, iterator, memo, context) -> | ||
133 | if nativeReduce and obj.reduce is nativeReduce | ||
134 | iterator = _.bind iterator, context if context | ||
135 | return obj.reduce iterator, memo | ||
136 | _.each obj, (value, index, list) -> | ||
137 | memo = iterator.call context, memo, value, index, list | ||
138 | memo | ||
139 | |||
140 | |||
141 | # The right-associative version of **reduce**, also known as **foldr**. Uses | ||
142 | # JavaScript 1.8's version of **reduceRight**, if available. | ||
143 | _.reduceRight = (obj, iterator, memo, context) -> | ||
144 | if nativeReduceRight and obj.reduceRight is nativeReduceRight | ||
145 | iterator = _.bind iterator, context if context | ||
146 | return obj.reduceRight iterator, memo | ||
147 | reversed = _.clone(_.toArray(obj)).reverse() | ||
148 | _.reduce reversed, iterator, memo, context | ||
149 | |||
150 | |||
151 | # Return the first value which passes a truth test. | ||
152 | _.detect = (obj, iterator, context) -> | ||
153 | result = null | ||
154 | _.each obj, (value, index, list) -> | ||
155 | if iterator.call context, value, index, list | ||
156 | result = value | ||
157 | _.breakLoop() | ||
158 | result | ||
159 | |||
160 | |||
161 | # Return all the elements that pass a truth test. Use JavaScript 1.6's | ||
162 | # **filter**, if it exists. | ||
163 | _.filter = (obj, iterator, context) -> | ||
164 | return obj.filter iterator, context if nativeFilter and obj.filter is nativeFilter | ||
165 | results = [] | ||
166 | _.each obj, (value, index, list) -> | ||
167 | results.push value if iterator.call context, value, index, list | ||
168 | results | ||
169 | |||
170 | |||
171 | # Return all the elements for which a truth test fails. | ||
172 | _.reject = (obj, iterator, context) -> | ||
173 | results = [] | ||
174 | _.each obj, (value, index, list) -> | ||
175 | results.push value if not iterator.call context, value, index, list | ||
176 | results | ||
177 | |||
178 | |||
179 | # Determine whether all of the elements match a truth test. Delegate to | ||
180 | # JavaScript 1.6's **every**, if it is present. | ||
181 | _.every = (obj, iterator, context) -> | ||
182 | iterator ||= _.identity | ||
183 | return obj.every iterator, context if nativeEvery and obj.every is nativeEvery | ||
184 | result = true | ||
185 | _.each obj, (value, index, list) -> | ||
186 | _.breakLoop() unless (result = result and iterator.call(context, value, index, list)) | ||
187 | result | ||
188 | |||
189 | |||
190 | # Determine if at least one element in the object matches a truth test. Use | ||
191 | # JavaScript 1.6's **some**, if it exists. | ||
192 | _.some = (obj, iterator, context) -> | ||
193 | iterator ||= _.identity | ||
194 | return obj.some iterator, context if nativeSome and obj.some is nativeSome | ||
195 | result = false | ||
196 | _.each obj, (value, index, list) -> | ||
197 | _.breakLoop() if (result = iterator.call(context, value, index, list)) | ||
198 | result | ||
199 | |||
200 | |||
201 | # Determine if a given value is included in the array or object, | ||
202 | # based on `===`. | ||
203 | _.include = (obj, target) -> | ||
204 | return _.indexOf(obj, target) isnt -1 if nativeIndexOf and obj.indexOf is nativeIndexOf | ||
205 | return true for own key, val of obj when val is target | ||
206 | false | ||
207 | |||
208 | |||
209 | # Invoke a method with arguments on every item in a collection. | ||
210 | _.invoke = (obj, method) -> | ||
211 | args = _.rest arguments, 2 | ||
212 | (if method then val[method] else val).apply(val, args) for val in obj | ||
213 | |||
214 | |||
215 | # Convenience version of a common use case of **map**: fetching a property. | ||
216 | _.pluck = (obj, key) -> | ||
217 | _.map(obj, (val) -> val[key]) | ||
218 | |||
219 | |||
220 | # Return the maximum item or (item-based comput |