mdbe 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/LICENSE.txt +21 -0
- data/README.md +53 -0
- data/app.rb +182 -0
- data/bin/mdbe +5 -0
- data/config.ru +2 -0
- data/environment.rb +8 -0
- data/lib/mdbe.rb +39 -0
- data/lib/mdbe/action_controller_debug_patch.rb +12 -0
- data/lib/mdbe/code_evaluation.rb +46 -0
- data/lib/mdbe/database_views.rb +24 -0
- data/lib/mdbe/database_views/abstract_dictionary.rb +69 -0
- data/lib/mdbe/database_views/abstract_exception.rb +25 -0
- data/lib/mdbe/database_views/array.rb +28 -0
- data/lib/mdbe/database_views/boolean.rb +12 -0
- data/lib/mdbe/database_views/class.rb +46 -0
- data/lib/mdbe/database_views/exception.rb +3 -0
- data/lib/mdbe/database_views/execblock.rb +5 -0
- data/lib/mdbe/database_views/fixnum.rb +5 -0
- data/lib/mdbe/database_views/float.rb +5 -0
- data/lib/mdbe/database_views/globals.rb +2 -0
- data/lib/mdbe/database_views/gsnmethod.rb +29 -0
- data/lib/mdbe/database_views/hash.rb +5 -0
- data/lib/mdbe/database_views/maglev_record.rb +42 -0
- data/lib/mdbe/database_views/module.rb +103 -0
- data/lib/mdbe/database_views/nilclass.rb +5 -0
- data/lib/mdbe/database_views/object.rb +80 -0
- data/lib/mdbe/database_views/proc.rb +3 -0
- data/lib/mdbe/database_views/repository.rb +3 -0
- data/lib/mdbe/database_views/ruby_workspace.rb +5 -0
- data/lib/mdbe/database_views/smalltalk_classes.rb +34 -0
- data/lib/mdbe/database_views/smalltalk_classes.st +60 -0
- data/lib/mdbe/database_views/string.rb +31 -0
- data/lib/mdbe/database_views/symbol.rb +32 -0
- data/lib/mdbe/database_views/system.rb +61 -0
- data/lib/mdbe/database_views/thread.rb +101 -0
- data/lib/mdbe/debug_server.rb +22 -0
- data/lib/mdbe/halt.rb +42 -0
- data/lib/mdbe/ruby_workspace.rb +29 -0
- data/lib/mdbe/version.rb +3 -0
- data/lib/tasks/maglev-database-explorer_tasks.rake +4 -0
- data/public/LICENSE +35 -0
- data/public/amber/CHANGELOG +65 -0
- data/public/amber/LICENSE +22 -0
- data/public/amber/Makefile +53 -0
- data/public/amber/README.md +30 -0
- data/public/amber/bin/amber +3 -0
- data/public/amber/bin/amberc +352 -0
- data/public/amber/bin/nodecompile.js +33 -0
- data/public/amber/bin/server +3 -0
- data/public/amber/bin/server.bat +3 -0
- data/public/amber/css/amber-normalize.css +468 -0
- data/public/amber/css/amber-normalize.less +501 -0
- data/public/amber/css/amber.css +539 -0
- data/public/amber/css/documentation.css +84 -0
- data/public/amber/css/profstef.css +75 -0
- data/public/amber/css/style.css +313 -0
- data/public/amber/documentation.html +37 -0
- data/public/amber/examples/Makefile +23 -0
- data/public/amber/examples/README +4 -0
- data/public/amber/examples/android/helloamber/AndroidManifest.xml +19 -0
- data/public/amber/examples/android/helloamber/HelloAmber.st +13 -0
- data/public/amber/examples/android/helloamber/Makefile +56 -0
- data/public/amber/examples/android/helloamber/README.md +80 -0
- data/public/amber/examples/android/helloamber/ant.properties +17 -0
- data/public/amber/examples/android/helloamber/assets/index.html +15 -0
- data/public/amber/examples/android/helloamber/assets/jquery-1.7.2.min.js +4 -0
- data/public/amber/examples/android/helloamber/build.xml +83 -0
- data/public/amber/examples/android/helloamber/local.properties +10 -0
- data/public/amber/examples/android/helloamber/proguard-project.txt +20 -0
- data/public/amber/examples/android/helloamber/project.properties +14 -0
- data/public/amber/examples/android/helloamber/res/layout/main.xml +6 -0
- data/public/amber/examples/android/helloamber/res/values/strings.xml +4 -0
- data/public/amber/examples/android/helloamber/src/org/amberlang/android/helloamber/HelloAmber.java +59 -0
- data/public/amber/examples/myproject/index.html +16 -0
- data/public/amber/examples/nodejs/README +9 -0
- data/public/amber/examples/nodejs/benchfib/Benchfib.st +124 -0
- data/public/amber/examples/nodejs/benchfib/Makefile +8 -0
- data/public/amber/examples/nodejs/benchfib/benchfib +1 -0
- data/public/amber/examples/nodejs/hello/Hello.st +9 -0
- data/public/amber/examples/nodejs/hello/Makefile +8 -0
- data/public/amber/examples/nodejs/hello/README +13 -0
- data/public/amber/examples/nodejs/hello/hello +1 -0
- data/public/amber/examples/nodejs/meta/Makefile +8 -0
- data/public/amber/examples/nodejs/meta/MyScript.st +27 -0
- data/public/amber/examples/nodejs/meta/meta +1 -0
- data/public/amber/examples/nodejs/pystone/Makefile +8 -0
- data/public/amber/examples/nodejs/pystone/Pystone.st +306 -0
- data/public/amber/examples/nodejs/pystone/pystone +1 -0
- data/public/amber/examples/nodejs/trivialserver/Makefile +8 -0
- data/public/amber/examples/nodejs/trivialserver/TrivialServer.st +51 -0
- data/public/amber/examples/nodejs/trivialserver/trivial +1 -0
- data/public/amber/examples/presentation/esug2011/images/asterix.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/background_box.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/background_header.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/balloon.jpg +0 -0
- data/public/amber/examples/presentation/esug2011/images/balloon_header.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/devices.jpg +0 -0
- data/public/amber/examples/presentation/esug2011/images/enyo.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/ide_star_wars.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/nodejs.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/terminal.png +0 -0
- data/public/amber/examples/presentation/esug2011/images/webos.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/images/amber.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/images/ambrhino.jpg +0 -0
- data/public/amber/examples/presentation/fosdem2012/images/nodejs.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/images/pharo.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/images/php.gif +0 -0
- data/public/amber/examples/presentation/fosdem2012/images/rails.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/arrow-next.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/arrow-prev.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/closedhand.cur +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/openhand.cur +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/shadow-top-back.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/shadow-top-forward.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/images/shadow.png +0 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/jquery.booklet.1.2.0.css +100 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/jquery.booklet.1.2.0.js +1232 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/jquery.booklet.1.2.0.min.js +13 -0
- data/public/amber/examples/presentation/fosdem2012/lib/booklet/jquery.easing.1.3.js +38 -0
- data/public/amber/examples/presentation/index.html +17 -0
- data/public/amber/examples/presentation/js/Presentation.deploy.js +1922 -0
- data/public/amber/examples/presentation/js/Presentation.js +2712 -0
- data/public/amber/examples/presentation/st/Presentation.st +1996 -0
- data/public/amber/examples/trysmalltalk/index.html +18 -0
- data/public/amber/examples/trysmalltalk/js/TrySmalltalk.deploy.js +837 -0
- data/public/amber/examples/trysmalltalk/js/TrySmalltalk.js +1206 -0
- data/public/amber/examples/trysmalltalk/st/TrySmalltalk.st +964 -0
- data/public/amber/examples/twitterwall/css/twitterwall.css +19 -0
- data/public/amber/examples/twitterwall/index.html +35 -0
- data/public/amber/examples/twitterwall/js/TwitterWall.deploy.js +116 -0
- data/public/amber/examples/twitterwall/js/TwitterWall.js +146 -0
- data/public/amber/examples/twitterwall/st/TwitterWall.st +91 -0
- data/public/amber/examples/webos/README +11 -0
- data/public/amber/examples/webos/eris/DuckQwaq.wav +0 -0
- data/public/amber/examples/webos/eris/EnyoAmber.st +36 -0
- data/public/amber/examples/webos/eris/Eris.css +0 -0
- data/public/amber/examples/webos/eris/Eris.st +86 -0
- data/public/amber/examples/webos/eris/Makefile +37 -0
- data/public/amber/examples/webos/eris/README +3 -0
- data/public/amber/examples/webos/eris/appinfo.json +10 -0
- data/public/amber/examples/webos/eris/index.html +12 -0
- data/public/amber/examples/webos/helloamber/EnyoAmber.st +36 -0
- data/public/amber/examples/webos/helloamber/HelloAmber.st +86 -0
- data/public/amber/examples/webos/helloamber/Makefile +38 -0
- data/public/amber/examples/webos/helloamber/README +5 -0
- data/public/amber/examples/webos/helloamber/appinfo.json +10 -0
- data/public/amber/examples/webos/helloamber/index.html +12 -0
- data/public/amber/favicon.ico +0 -0
- data/public/amber/images/amber.png +0 -0
- data/public/amber/images/amber.svg +706 -0
- data/public/amber/images/amber_small.png +0 -0
- data/public/amber/images/off.amber.png +0 -0
- data/public/amber/images/off.png +0 -0
- data/public/amber/images/offHover.amber.png +0 -0
- data/public/amber/images/offHover.png +0 -0
- data/public/amber/images/presentation.png +0 -0
- data/public/amber/images/profstef.png +0 -0
- data/public/amber/images/sprite.amber.png +0 -0
- data/public/amber/images/sprite.png +0 -0
- data/public/amber/images/tinylogo.amber.png +0 -0
- data/public/amber/images/tinylogo.png +0 -0
- data/public/amber/images/twitterwall.png +0 -0
- data/public/amber/index.html +55 -0
- data/public/amber/js/Additional-Examples.deploy.js +15 -0
- data/public/amber/js/Additional-Examples.js +21 -0
- data/public/amber/js/Benchfib.deploy.js +132 -0
- data/public/amber/js/Benchfib.js +167 -0
- data/public/amber/js/Canvas.deploy.js +2446 -0
- data/public/amber/js/Canvas.js +3547 -0
- data/public/amber/js/Compiler-Tests.deploy.js +97 -0
- data/public/amber/js/Compiler-Tests.js +137 -0
- data/public/amber/js/Compiler.deploy.js +1877 -0
- data/public/amber/js/Compiler.js +2622 -0
- data/public/amber/js/Documentation.deploy.js +961 -0
- data/public/amber/js/Documentation.js +1376 -0
- data/public/amber/js/Examples.deploy.js +53 -0
- data/public/amber/js/Examples.js +73 -0
- data/public/amber/js/IDE.deploy.js +3557 -0
- data/public/amber/js/IDE.js +5002 -0
- data/public/amber/js/Kernel-Announcements.deploy.js +107 -0
- data/public/amber/js/Kernel-Announcements.js +152 -0
- data/public/amber/js/Kernel-Classes.deploy.js +774 -0
- data/public/amber/js/Kernel-Classes.js +1095 -0
- data/public/amber/js/Kernel-Collections.deploy.js +3121 -0
- data/public/amber/js/Kernel-Collections.js +4427 -0
- data/public/amber/js/Kernel-Exceptions.deploy.js +244 -0
- data/public/amber/js/Kernel-Exceptions.js +349 -0
- data/public/amber/js/Kernel-Methods.deploy.js +573 -0
- data/public/amber/js/Kernel-Methods.js +807 -0
- data/public/amber/js/Kernel-Objects.deploy.js +2877 -0
- data/public/amber/js/Kernel-Objects.js +4107 -0
- data/public/amber/js/Kernel-Tests.deploy.js +1513 -0
- data/public/amber/js/Kernel-Tests.js +2053 -0
- data/public/amber/js/Kernel-Transcript.deploy.js +142 -0
- data/public/amber/js/Kernel-Transcript.js +202 -0
- data/public/amber/js/Maglev-Core.deploy.js +2996 -0
- data/public/amber/js/Maglev-Core.js +4246 -0
- data/public/amber/js/Maglev-Database-Explorer.deploy.js +4476 -0
- data/public/amber/js/Maglev-Database-Explorer.js +6232 -0
- data/public/amber/js/Maglev-Vendor.deploy.js +350 -0
- data/public/amber/js/Maglev-Vendor.js +465 -0
- data/public/amber/js/README.md +5 -0
- data/public/amber/js/SUnit.deploy.js +351 -0
- data/public/amber/js/SUnit.js +501 -0
- data/public/amber/js/amber.js +273 -0
- data/public/amber/js/boot.js +602 -0
- data/public/amber/js/compat.js +22 -0
- data/public/amber/js/init.js +9 -0
- data/public/amber/js/lib/CodeMirror/LICENSE +19 -0
- data/public/amber/js/lib/CodeMirror/active-line.js +39 -0
- data/public/amber/js/lib/CodeMirror/amber.css +21 -0
- data/public/amber/js/lib/CodeMirror/codemirror.css +67 -0
- data/public/amber/js/lib/CodeMirror/codemirror.js +2144 -0
- data/public/amber/js/lib/CodeMirror/smalltalk.js +134 -0
- data/public/amber/js/lib/jQuery/jquery-1.4.4.min.js +167 -0
- data/public/amber/js/lib/jQuery/jquery-1.6.4.min.js +4 -0
- data/public/amber/js/lib/jQuery/jquery-ui-1.8.16.custom.min.js +791 -0
- data/public/amber/js/lib/jQuery/jquery.textarea.js +267 -0
- data/public/amber/js/lib/peg-0.6.2.min.js +2 -0
- data/public/amber/js/lib/showdown.js +419 -0
- data/public/amber/js/parser.js +4222 -0
- data/public/amber/js/parser.pegjs +223 -0
- data/public/amber/learn.html +40 -0
- data/public/amber/repl/Makefile +8 -0
- data/public/amber/repl/REPL.js +124 -0
- data/public/amber/repl/REPL.st +56 -0
- data/public/amber/repl/amber.js +18085 -0
- data/public/amber/server/FileServer.st +576 -0
- data/public/amber/server/Makefile +8 -0
- data/public/amber/server/server.js +13049 -0
- data/public/amber/st/Benchfib.js +297 -0
- data/public/amber/st/Benchfib.st +124 -0
- data/public/amber/st/Canvas.st +968 -0
- data/public/amber/st/Compiler-Tests.st +471 -0
- data/public/amber/st/Compiler.st +1445 -0
- data/public/amber/st/Documentation.st +758 -0
- data/public/amber/st/Examples.js +100 -0
- data/public/amber/st/Examples.st +38 -0
- data/public/amber/st/IDE.st +2404 -0
- data/public/amber/st/Kernel-Announcements.st +61 -0
- data/public/amber/st/Kernel-Classes.st +462 -0
- data/public/amber/st/Kernel-Collections.st +1611 -0
- data/public/amber/st/Kernel-Exceptions.st +124 -0
- data/public/amber/st/Kernel-Methods.st +291 -0
- data/public/amber/st/Kernel-Objects.st +1587 -0
- data/public/amber/st/Kernel-Tests.st +953 -0
- data/public/amber/st/Kernel-Transcript.st +70 -0
- data/public/amber/st/Maglev-Core.st +1694 -0
- data/public/amber/st/Maglev-Database-Explorer.st +3148 -0
- data/public/amber/st/Maglev-Vendor.st +151 -0
- data/public/amber/st/Makefile +104 -0
- data/public/amber/st/README.md +4 -0
- data/public/amber/st/SUnit.st +172 -0
- data/public/css/bootstrap-combined.no-icons.min.css +731 -0
- data/public/css/bootstrap.css +6811 -0
- data/public/css/images/animated-overlay.gif +0 -0
- data/public/css/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/public/css/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/public/css/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/public/css/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/public/css/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/public/css/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/public/css/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/public/css/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/public/css/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/public/css/images/ui-icons_222222_256x240.png +0 -0
- data/public/css/images/ui-icons_228ef1_256x240.png +0 -0
- data/public/css/images/ui-icons_ef8c08_256x240.png +0 -0
- data/public/css/images/ui-icons_ffd27a_256x240.png +0 -0
- data/public/css/images/ui-icons_ffffff_256x240.png +0 -0
- data/public/css/jquery-ui.min.css +5 -0
- data/public/css/smalltalk_code.css +42 -0
- data/public/css/style.css +210 -0
- data/public/images/bg_tile.png +0 -0
- data/public/images/maglev-logo.gif +0 -0
- data/public/images/mchammer.gif +0 -0
- data/public/images/rails_tiny.png +0 -0
- data/public/images/ruby.png +0 -0
- data/public/images/ruby_smalltalk_bridge.png +0 -0
- data/public/images/smalltalk.png +0 -0
- data/public/img/glyphicons-halflings.png +0 -0
- data/public/index.html +118 -0
- data/public/libs/bootstrap.min.js +7 -0
- data/public/libs/codemirror/CONTRIBUTING.md +72 -0
- data/public/libs/codemirror/LICENSE +23 -0
- data/public/libs/codemirror/README.md +11 -0
- data/public/libs/codemirror/addon/dialog/dialog.css +32 -0
- data/public/libs/codemirror/addon/dialog/dialog.js +80 -0
- data/public/libs/codemirror/addon/display/placeholder.js +54 -0
- data/public/libs/codemirror/addon/edit/closebrackets.js +54 -0
- data/public/libs/codemirror/addon/edit/closetag.js +86 -0
- data/public/libs/codemirror/addon/edit/continuecomment.js +44 -0
- data/public/libs/codemirror/addon/edit/continuelist.js +25 -0
- data/public/libs/codemirror/addon/edit/matchbrackets.js +82 -0
- data/public/libs/codemirror/addon/fold/brace-fold.js +31 -0
- data/public/libs/codemirror/addon/fold/foldcode.js +32 -0
- data/public/libs/codemirror/addon/fold/indent-fold.js +11 -0
- data/public/libs/codemirror/addon/fold/xml-fold.js +64 -0
- data/public/libs/codemirror/addon/hint/html-hint.js +582 -0
- data/public/libs/codemirror/addon/hint/javascript-hint.js +142 -0
- data/public/libs/codemirror/addon/hint/pig-hint.js +117 -0
- data/public/libs/codemirror/addon/hint/python-hint.js +93 -0
- data/public/libs/codemirror/addon/hint/show-hint.css +38 -0
- data/public/libs/codemirror/addon/hint/show-hint.js +180 -0
- data/public/libs/codemirror/addon/hint/xml-hint.js +118 -0
- data/public/libs/codemirror/addon/lint/javascript-lint.js +127 -0
- data/public/libs/codemirror/addon/lint/json-lint.js +14 -0
- data/public/libs/codemirror/addon/lint/lint.css +96 -0
- data/public/libs/codemirror/addon/lint/lint.js +197 -0
- data/public/libs/codemirror/addon/mode/loadmode.js +51 -0
- data/public/libs/codemirror/addon/mode/multiplex.js +95 -0
- data/public/libs/codemirror/addon/mode/overlay.js +59 -0
- data/public/libs/codemirror/addon/runmode/colorize.js +29 -0
- data/public/libs/codemirror/addon/runmode/runmode-standalone.js +130 -0
- data/public/libs/codemirror/addon/runmode/runmode.js +52 -0
- data/public/libs/codemirror/addon/runmode/runmode.node.js +89 -0
- data/public/libs/codemirror/addon/search/match-highlighter.js +60 -0
- data/public/libs/codemirror/addon/search/search.js +131 -0
- data/public/libs/codemirror/addon/search/searchcursor.js +133 -0
- data/public/libs/codemirror/addon/selection/active-line.js +39 -0
- data/public/libs/codemirror/addon/selection/mark-selection.js +34 -0
- data/public/libs/codemirror/bin/compress +91 -0
- data/public/libs/codemirror/bin/lint +11 -0
- data/public/libs/codemirror/demo/activeline.html +70 -0
- data/public/libs/codemirror/demo/bidi.html +61 -0
- data/public/libs/codemirror/demo/btree.html +87 -0
- data/public/libs/codemirror/demo/buffers.html +98 -0
- data/public/libs/codemirror/demo/changemode.html +50 -0
- data/public/libs/codemirror/demo/closebrackets.html +63 -0
- data/public/libs/codemirror/demo/closetag.html +37 -0
- data/public/libs/codemirror/demo/complete.html +70 -0
- data/public/libs/codemirror/demo/emacs.html +60 -0
- data/public/libs/codemirror/demo/folding.html +69 -0
- data/public/libs/codemirror/demo/fullscreen.html +147 -0
- data/public/libs/codemirror/demo/html5complete.html +92 -0
- data/public/libs/codemirror/demo/indentwrap.html +49 -0
- data/public/libs/codemirror/demo/lint.html +90 -0
- data/public/libs/codemirror/demo/loadmode.html +40 -0
- data/public/libs/codemirror/demo/marker.html +59 -0
- data/public/libs/codemirror/demo/markselection.html +36 -0
- data/public/libs/codemirror/demo/matchhighlighter.html +38 -0
- data/public/libs/codemirror/demo/multiplex.html +60 -0
- data/public/libs/codemirror/demo/mustache.html +59 -0
- data/public/libs/codemirror/demo/placeholder.html +36 -0
- data/public/libs/codemirror/demo/preview.html +76 -0
- data/public/libs/codemirror/demo/resize.html +49 -0
- data/public/libs/codemirror/demo/runmode.html +50 -0
- data/public/libs/codemirror/demo/search.html +85 -0
- data/public/libs/codemirror/demo/spanaffectswrapping_shim.html +73 -0
- data/public/libs/codemirror/demo/theme.html +89 -0
- data/public/libs/codemirror/demo/variableheight.html +52 -0
- data/public/libs/codemirror/demo/vim.html +65 -0
- data/public/libs/codemirror/demo/visibletabs.html +53 -0
- data/public/libs/codemirror/demo/widget.html +74 -0
- data/public/libs/codemirror/demo/xmlcomplete.html +81 -0
- data/public/libs/codemirror/index.html +487 -0
- data/public/libs/codemirror/keymap/emacs.js +30 -0
- data/public/libs/codemirror/keymap/vim.js +3044 -0
- data/public/libs/codemirror/lib/codemirror.css +253 -0
- data/public/libs/codemirror/lib/codemirror.js +5585 -0
- data/public/libs/codemirror/mode/apl/apl.js +160 -0
- data/public/libs/codemirror/mode/apl/index.html +61 -0
- data/public/libs/codemirror/mode/asterisk/asterisk.js +183 -0
- data/public/libs/codemirror/mode/asterisk/index.html +142 -0
- data/public/libs/codemirror/mode/clike/clike.js +302 -0
- data/public/libs/codemirror/mode/clike/index.html +103 -0
- data/public/libs/codemirror/mode/clike/scala.html +767 -0
- data/public/libs/codemirror/mode/clojure/clojure.js +222 -0
- data/public/libs/codemirror/mode/clojure/index.html +76 -0
- data/public/libs/codemirror/mode/coffeescript/LICENSE +22 -0
- data/public/libs/codemirror/mode/coffeescript/coffeescript.js +346 -0
- data/public/libs/codemirror/mode/coffeescript/index.html +728 -0
- data/public/libs/codemirror/mode/commonlisp/commonlisp.js +101 -0
- data/public/libs/codemirror/mode/commonlisp/index.html +165 -0
- data/public/libs/codemirror/mode/css/css.js +567 -0
- data/public/libs/codemirror/mode/css/index.html +58 -0
- data/public/libs/codemirror/mode/css/scss.html +145 -0
- data/public/libs/codemirror/mode/css/scss_test.js +80 -0
- data/public/libs/codemirror/mode/css/test.js +113 -0
- data/public/libs/codemirror/mode/d/d.js +205 -0
- data/public/libs/codemirror/mode/d/index.html +262 -0
- data/public/libs/codemirror/mode/diff/diff.js +32 -0
- data/public/libs/codemirror/mode/diff/index.html +105 -0
- data/public/libs/codemirror/mode/ecl/ecl.js +192 -0
- data/public/libs/codemirror/mode/ecl/index.html +39 -0
- data/public/libs/codemirror/mode/erlang/erlang.js +463 -0
- data/public/libs/codemirror/mode/erlang/index.html +64 -0
- data/public/libs/codemirror/mode/gas/gas.js +326 -0
- data/public/libs/codemirror/mode/gas/index.html +57 -0
- data/public/libs/codemirror/mode/gfm/gfm.js +96 -0
- data/public/libs/codemirror/mode/gfm/index.html +74 -0
- data/public/libs/codemirror/mode/gfm/test.js +112 -0
- data/public/libs/codemirror/mode/go/go.js +165 -0
- data/public/libs/codemirror/mode/go/index.html +74 -0
- data/public/libs/codemirror/mode/groovy/groovy.js +210 -0
- data/public/libs/codemirror/mode/groovy/index.html +73 -0
- data/public/libs/codemirror/mode/haskell/haskell.js +242 -0
- data/public/libs/codemirror/mode/haskell/index.html +62 -0
- data/public/libs/codemirror/mode/haxe/haxe.js +429 -0
- data/public/libs/codemirror/mode/haxe/index.html +90 -0
- data/public/libs/codemirror/mode/htmlembedded/htmlembedded.js +73 -0
- data/public/libs/codemirror/mode/htmlembedded/index.html +49 -0
- data/public/libs/codemirror/mode/htmlmixed/htmlmixed.js +104 -0
- data/public/libs/codemirror/mode/htmlmixed/index.html +73 -0
- data/public/libs/codemirror/mode/http/http.js +98 -0
- data/public/libs/codemirror/mode/http/index.html +32 -0
- data/public/libs/codemirror/mode/javascript/index.html +92 -0
- data/public/libs/codemirror/mode/javascript/javascript.js +467 -0
- data/public/libs/codemirror/mode/javascript/typescript.html +48 -0
- data/public/libs/codemirror/mode/jinja2/index.html +38 -0
- data/public/libs/codemirror/mode/jinja2/jinja2.js +42 -0
- data/public/libs/codemirror/mode/less/index.html +741 -0
- data/public/libs/codemirror/mode/less/less.js +266 -0
- data/public/libs/codemirror/mode/livescript/LICENSE +23 -0
- data/public/libs/codemirror/mode/livescript/index.html +446 -0
- data/public/libs/codemirror/mode/livescript/livescript.js +267 -0
- data/public/libs/codemirror/mode/livescript/livescript.ls +266 -0
- data/public/libs/codemirror/mode/lua/index.html +74 -0
- data/public/libs/codemirror/mode/lua/lua.js +140 -0
- data/public/libs/codemirror/mode/markdown/index.html +344 -0
- data/public/libs/codemirror/mode/markdown/markdown.js +526 -0
- data/public/libs/codemirror/mode/markdown/test.js +636 -0
- data/public/libs/codemirror/mode/meta.js +75 -0
- data/public/libs/codemirror/mode/mirc/index.html +149 -0
- data/public/libs/codemirror/mode/mirc/mirc.js +177 -0
- data/public/libs/codemirror/mode/ntriples/index.html +33 -0
- data/public/libs/codemirror/mode/ntriples/ntriples.js +170 -0
- data/public/libs/codemirror/mode/ocaml/index.html +131 -0
- data/public/libs/codemirror/mode/ocaml/ocaml.js +113 -0
- data/public/libs/codemirror/mode/pascal/LICENSE +7 -0
- data/public/libs/codemirror/mode/pascal/index.html +48 -0
- data/public/libs/codemirror/mode/pascal/pascal.js +94 -0
- data/public/libs/codemirror/mode/perl/LICENSE +19 -0
- data/public/libs/codemirror/mode/perl/index.html +62 -0
- data/public/libs/codemirror/mode/perl/perl.js +816 -0
- data/public/libs/codemirror/mode/php/index.html +51 -0
- data/public/libs/codemirror/mode/php/php.js +129 -0
- data/public/libs/codemirror/mode/pig/index.html +42 -0
- data/public/libs/codemirror/mode/pig/pig.js +171 -0
- data/public/libs/codemirror/mode/properties/index.html +41 -0
- data/public/libs/codemirror/mode/properties/properties.js +63 -0
- data/public/libs/codemirror/mode/python/LICENSE.txt +21 -0
- data/public/libs/codemirror/mode/python/index.html +135 -0
- data/public/libs/codemirror/mode/python/python.js +340 -0
- data/public/libs/codemirror/mode/q/index.html +131 -0
- data/public/libs/codemirror/mode/q/q.js +124 -0
- data/public/libs/codemirror/mode/r/LICENSE +24 -0
- data/public/libs/codemirror/mode/r/index.html +74 -0
- data/public/libs/codemirror/mode/r/r.js +141 -0
- data/public/libs/codemirror/mode/rpm/changes/changes.js +19 -0
- data/public/libs/codemirror/mode/rpm/changes/index.html +53 -0
- data/public/libs/codemirror/mode/rpm/spec/index.html +99 -0
- data/public/libs/codemirror/mode/rpm/spec/spec.css +5 -0
- data/public/libs/codemirror/mode/rpm/spec/spec.js +66 -0
- data/public/libs/codemirror/mode/rst/LICENSE.txt +21 -0
- data/public/libs/codemirror/mode/rst/index.html +524 -0
- data/public/libs/codemirror/mode/rst/rst.js +550 -0
- data/public/libs/codemirror/mode/ruby/LICENSE +24 -0
- data/public/libs/codemirror/mode/ruby/index.html +173 -0
- data/public/libs/codemirror/mode/ruby/ruby.js +197 -0
- data/public/libs/codemirror/mode/rust/index.html +48 -0
- data/public/libs/codemirror/mode/rust/rust.js +432 -0
- data/public/libs/codemirror/mode/sass/index.html +54 -0
- data/public/libs/codemirror/mode/sass/sass.js +349 -0
- data/public/libs/codemirror/mode/scheme/index.html +65 -0
- data/public/libs/codemirror/mode/scheme/scheme.js +230 -0
- data/public/libs/codemirror/mode/shell/index.html +51 -0
- data/public/libs/codemirror/mode/shell/shell.js +118 -0
- data/public/libs/codemirror/mode/sieve/LICENSE +19 -0
- data/public/libs/codemirror/mode/sieve/index.html +81 -0
- data/public/libs/codemirror/mode/sieve/sieve.js +183 -0
- data/public/libs/codemirror/mode/smalltalk/index.html +57 -0
- data/public/libs/codemirror/mode/smalltalk/smalltalk.js +141 -0
- data/public/libs/codemirror/mode/smarty/index.html +83 -0
- data/public/libs/codemirror/mode/smarty/smarty.js +148 -0
- data/public/libs/codemirror/mode/sparql/index.html +42 -0
- data/public/libs/codemirror/mode/sparql/sparql.js +143 -0
- data/public/libs/codemirror/mode/sql/index.html +68 -0
- data/public/libs/codemirror/mode/sql/sql.js +268 -0
- data/public/libs/codemirror/mode/stex/index.html +98 -0
- data/public/libs/codemirror/mode/stex/stex.js +246 -0
- data/public/libs/codemirror/mode/stex/test.js +117 -0
- data/public/libs/codemirror/mode/tcl/index.html +129 -0
- data/public/libs/codemirror/mode/tcl/tcl.js +131 -0
- data/public/libs/codemirror/mode/tiddlywiki/index.html +142 -0
- data/public/libs/codemirror/mode/tiddlywiki/tiddlywiki.css +14 -0
- data/public/libs/codemirror/mode/tiddlywiki/tiddlywiki.js +353 -0
- data/public/libs/codemirror/mode/tiki/index.html +81 -0
- data/public/libs/codemirror/mode/tiki/tiki.css +26 -0
- data/public/libs/codemirror/mode/tiki/tiki.js +308 -0
- data/public/libs/codemirror/mode/turtle/index.html +39 -0
- data/public/libs/codemirror/mode/turtle/turtle.js +145 -0
- data/public/libs/codemirror/mode/vb/LICENSE.txt +21 -0
- data/public/libs/codemirror/mode/vb/index.html +88 -0
- data/public/libs/codemirror/mode/vb/vb.js +259 -0
- data/public/libs/codemirror/mode/vbscript/index.html +42 -0
- data/public/libs/codemirror/mode/vbscript/vbscript.js +26 -0
- data/public/libs/codemirror/mode/velocity/index.html +103 -0
- data/public/libs/codemirror/mode/velocity/velocity.js +144 -0
- data/public/libs/codemirror/mode/verilog/index.html +121 -0
- data/public/libs/codemirror/mode/verilog/verilog.js +182 -0
- data/public/libs/codemirror/mode/xml/index.html +45 -0
- data/public/libs/codemirror/mode/xml/xml.js +328 -0
- data/public/libs/codemirror/mode/xquery/LICENSE +20 -0
- data/public/libs/codemirror/mode/xquery/index.html +221 -0
- data/public/libs/codemirror/mode/xquery/test.js +64 -0
- data/public/libs/codemirror/mode/xquery/xquery.js +450 -0
- data/public/libs/codemirror/mode/yaml/index.html +68 -0
- data/public/libs/codemirror/mode/yaml/yaml.js +95 -0
- data/public/libs/codemirror/mode/z80/index.html +39 -0
- data/public/libs/codemirror/mode/z80/z80.js +85 -0
- data/public/libs/codemirror/package.json +21 -0
- data/public/libs/codemirror/test/doc_test.js +329 -0
- data/public/libs/codemirror/test/driver.js +138 -0
- data/public/libs/codemirror/test/index.html +182 -0
- data/public/libs/codemirror/test/lint/acorn.js +1593 -0
- data/public/libs/codemirror/test/lint/lint.js +112 -0
- data/public/libs/codemirror/test/lint/parse-js.js +1372 -0
- data/public/libs/codemirror/test/lint/walk.js +216 -0
- data/public/libs/codemirror/test/mode_test.css +10 -0
- data/public/libs/codemirror/test/mode_test.js +192 -0
- data/public/libs/codemirror/test/phantom_driver.js +31 -0
- data/public/libs/codemirror/test/run.js +33 -0
- data/public/libs/codemirror/test/test.js +1400 -0
- data/public/libs/codemirror/test/vim_test.js +1688 -0
- data/public/libs/codemirror/theme/ambiance-mobile.css +5 -0
- data/public/libs/codemirror/theme/ambiance.css +75 -0
- data/public/libs/codemirror/theme/blackboard.css +25 -0
- data/public/libs/codemirror/theme/cobalt.css +18 -0
- data/public/libs/codemirror/theme/eclipse.css +25 -0
- data/public/libs/codemirror/theme/elegant.css +10 -0
- data/public/libs/codemirror/theme/erlang-dark.css +21 -0
- data/public/libs/codemirror/theme/lesser-dark.css +44 -0
- data/public/libs/codemirror/theme/midnight.css +52 -0
- data/public/libs/codemirror/theme/monokai.css +28 -0
- data/public/libs/codemirror/theme/neat.css +9 -0
- data/public/libs/codemirror/theme/night.css +21 -0
- data/public/libs/codemirror/theme/rubyblue.css +21 -0
- data/public/libs/codemirror/theme/solarized.css +207 -0
- data/public/libs/codemirror/theme/twilight.css +26 -0
- data/public/libs/codemirror/theme/vibrant-ink.css +27 -0
- data/public/libs/codemirror/theme/xq-dark.css +46 -0
- data/public/libs/codemirror/theme/xq-light.css +43 -0
- data/public/libs/font-awesome/css/font-awesome-ie7.css +983 -0
- data/public/libs/font-awesome/css/font-awesome-ie7.min.css +24 -0
- data/public/libs/font-awesome/css/font-awesome.css +1268 -0
- data/public/libs/font-awesome/css/font-awesome.min.css +24 -0
- data/public/libs/font-awesome/font/FontAwesome.otf +0 -0
- data/public/libs/font-awesome/font/fontawesome-webfont.eot +0 -0
- data/public/libs/font-awesome/font/fontawesome-webfont.svg +339 -0
- data/public/libs/font-awesome/font/fontawesome-webfont.ttf +0 -0
- data/public/libs/font-awesome/font/fontawesome-webfont.woff +0 -0
- data/public/libs/font-awesome/less/bootstrap.less +78 -0
- data/public/libs/font-awesome/less/core.less +132 -0
- data/public/libs/font-awesome/less/extras.less +79 -0
- data/public/libs/font-awesome/less/font-awesome-ie7.less +413 -0
- data/public/libs/font-awesome/less/font-awesome.less +32 -0
- data/public/libs/font-awesome/less/icons.less +330 -0
- data/public/libs/font-awesome/less/mixins.less +34 -0
- data/public/libs/font-awesome/less/path.less +15 -0
- data/public/libs/font-awesome/less/variables.less +9 -0
- data/public/libs/jquery-1.10.0.min.js +6 -0
- data/public/libs/jquery-ui.min.js +12 -0
- data/public/libs/jquery.jsPlumb-1.4.0-all.js +9571 -0
- data/public/libs/jquery.livequery.js +226 -0
- data/public/libs/jsPlumbInitializer.js +72 -0
- data/public/libs/jstree/README.txt +10 -0
- data/public/libs/jstree/_demo/_dump.sql +20 -0
- data/public/libs/jstree/_demo/_inc/__mysql_errors.log +0 -0
- data/public/libs/jstree/_demo/_inc/class._database.php +146 -0
- data/public/libs/jstree/_demo/_inc/class._database_i.php +152 -0
- data/public/libs/jstree/_demo/_inc/class.tree.php +602 -0
- data/public/libs/jstree/_demo/_install.txt +6 -0
- data/public/libs/jstree/_demo/config.php +14 -0
- data/public/libs/jstree/_demo/file.png +0 -0
- data/public/libs/jstree/_demo/folder.png +0 -0
- data/public/libs/jstree/_demo/index.html +461 -0
- data/public/libs/jstree/_demo/root.png +0 -0
- data/public/libs/jstree/_demo/server.php +69 -0
- data/public/libs/jstree/_docs/!style.css +48 -0
- data/public/libs/jstree/_docs/_drive.png +0 -0
- data/public/libs/jstree/_docs/_html_data.html +2 -0
- data/public/libs/jstree/_docs/_json_data.json +4 -0
- data/public/libs/jstree/_docs/_search_data.json +6 -0
- data/public/libs/jstree/_docs/_search_result.json +1 -0
- data/public/libs/jstree/_docs/_xml_flat.xml +12 -0
- data/public/libs/jstree/_docs/_xml_nest.xml +18 -0
- data/public/libs/jstree/_docs/checkbox.html +171 -0
- data/public/libs/jstree/_docs/contextmenu.html +121 -0
- data/public/libs/jstree/_docs/cookies.html +97 -0
- data/public/libs/jstree/_docs/core.html +689 -0
- data/public/libs/jstree/_docs/crrm.html +316 -0
- data/public/libs/jstree/_docs/dnd.html +199 -0
- data/public/libs/jstree/_docs/hotkeys.html +82 -0
- data/public/libs/jstree/_docs/html_data.html +175 -0
- data/public/libs/jstree/_docs/index.html +86 -0
- data/public/libs/jstree/_docs/json_data.html +249 -0
- data/public/libs/jstree/_docs/languages.html +152 -0
- data/public/libs/jstree/_docs/logo.png +0 -0
- data/public/libs/jstree/_docs/search.html +153 -0
- data/public/libs/jstree/_docs/sort.html +85 -0
- data/public/libs/jstree/_docs/syntax/!script.js +2232 -0
- data/public/libs/jstree/_docs/syntax/!style.css +511 -0
- data/public/libs/jstree/_docs/syntax/clipboard.swf +0 -0
- data/public/libs/jstree/_docs/syntax/help.png +0 -0
- data/public/libs/jstree/_docs/syntax/magnifier.png +0 -0
- data/public/libs/jstree/_docs/syntax/page_white_code.png +0 -0
- data/public/libs/jstree/_docs/syntax/page_white_copy.png +0 -0
- data/public/libs/jstree/_docs/syntax/printer.png +0 -0
- data/public/libs/jstree/_docs/syntax/wrapping.png +0 -0
- data/public/libs/jstree/_docs/themeroller.html +107 -0
- data/public/libs/jstree/_docs/themes.html +127 -0
- data/public/libs/jstree/_docs/types.html +178 -0
- data/public/libs/jstree/_docs/ui.html +197 -0
- data/public/libs/jstree/_docs/unique.html +85 -0
- data/public/libs/jstree/_docs/xml_data.html +218 -0
- data/public/libs/jstree/_lib/jquery.cookie.js +96 -0
- data/public/libs/jstree/_lib/jquery.hotkeys.js +99 -0
- data/public/libs/jstree/_lib/jquery.js +5 -0
- data/public/libs/jstree/jquery.jstree.js +4564 -0
- data/public/libs/jstree/themes/apple/bg.jpg +0 -0
- data/public/libs/jstree/themes/apple/d.png +0 -0
- data/public/libs/jstree/themes/apple/dot_for_ie.gif +0 -0
- data/public/libs/jstree/themes/apple/style.css +61 -0
- data/public/libs/jstree/themes/apple/throbber.gif +0 -0
- data/public/libs/jstree/themes/classic/d.gif +0 -0
- data/public/libs/jstree/themes/classic/d.png +0 -0
- data/public/libs/jstree/themes/classic/dot_for_ie.gif +0 -0
- data/public/libs/jstree/themes/classic/style.css +77 -0
- data/public/libs/jstree/themes/classic/throbber.gif +0 -0
- data/public/libs/jstree/themes/default-rtl/d.gif +0 -0
- data/public/libs/jstree/themes/default-rtl/d.png +0 -0
- data/public/libs/jstree/themes/default-rtl/dots.gif +0 -0
- data/public/libs/jstree/themes/default-rtl/style.css +84 -0
- data/public/libs/jstree/themes/default-rtl/throbber.gif +0 -0
- data/public/libs/jstree/themes/default/d.gif +0 -0
- data/public/libs/jstree/themes/default/d.png +0 -0
- data/public/libs/jstree/themes/default/style.css +74 -0
- data/public/libs/jstree/themes/default/throbber.gif +0 -0
- data/public/themes/geo-bootstrap/README.md +25 -0
- data/public/themes/geo-bootstrap/img/flames.gif +0 -0
- data/public/themes/geo-bootstrap/img/glyphicons-halflings-white.png +0 -0
- data/public/themes/geo-bootstrap/img/glyphicons-halflings.png +0 -0
- data/public/themes/geo-bootstrap/img/microfab.gif +0 -0
- data/public/themes/geo-bootstrap/img/progress.gif +0 -0
- data/public/themes/geo-bootstrap/img/rainbow.gif +0 -0
- data/public/themes/geo-bootstrap/img/stars.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/7upspot.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/americanflag.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/community.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/computer-01.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/computer.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/construction.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/counter.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/counter2.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/divider.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/divider1.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/divider2.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/divider3.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/divider4.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/drudgesiren.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/emailme.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/funky.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/geocities.jpg +0 -0
- data/public/themes/geo-bootstrap/img/test/hacker.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/heart.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/hot.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/ie_logo.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/mailkitten.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/mchammer.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/new.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/new2.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/noframes.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/notepad.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/ns_logo.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/sign-in.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/spinningearth.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/underconstruction.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/wabwalk.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/webtrips.gif +0 -0
- data/public/themes/geo-bootstrap/img/test/yahooweek.gif +0 -0
- data/public/themes/geo-bootstrap/package.json +21 -0
- data/public/themes/geo-bootstrap/swatch/bootstrap-responsive.css +1109 -0
- data/public/themes/geo-bootstrap/swatch/bootstrap-responsive.min.css +9 -0
- data/public/themes/geo-bootstrap/swatch/bootstrap.css +6462 -0
- data/public/themes/geo-bootstrap/swatch/bootstrap.min.css +9 -0
- metadata +791 -0
@@ -0,0 +1,728 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>CodeMirror: CoffeeScript mode</title>
|
6
|
+
<link rel="stylesheet" href="../../lib/codemirror.css">
|
7
|
+
<script src="../../lib/codemirror.js"></script>
|
8
|
+
<script src="coffeescript.js"></script>
|
9
|
+
<style>.CodeMirror {border-top: 1px solid silver; border-bottom: 1px solid silver;}</style>
|
10
|
+
<link rel="stylesheet" href="../../doc/docs.css">
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
<h1>CodeMirror: CoffeeScript mode</h1>
|
14
|
+
<form><textarea id="code" name="code">
|
15
|
+
# CoffeeScript mode for CodeMirror
|
16
|
+
# Copyright (c) 2011 Jeff Pickhardt, released under
|
17
|
+
# the MIT License.
|
18
|
+
#
|
19
|
+
# Modified from the Python CodeMirror mode, which also is
|
20
|
+
# under the MIT License Copyright (c) 2010 Timothy Farrell.
|
21
|
+
#
|
22
|
+
# The following script, Underscore.coffee, is used to
|
23
|
+
# demonstrate CoffeeScript mode for CodeMirror.
|
24
|
+
#
|
25
|
+
# To download CoffeeScript mode for CodeMirror, go to:
|
26
|
+
# https://github.com/pickhardt/coffeescript-codemirror-mode
|
27
|
+
|
28
|
+
# **Underscore.coffee
|
29
|
+
# (c) 2011 Jeremy Ashkenas, DocumentCloud Inc.**
|
30
|
+
# Underscore is freely distributable under the terms of the
|
31
|
+
# [MIT license](http://en.wikipedia.org/wiki/MIT_License).
|
32
|
+
# Portions of Underscore are inspired by or borrowed from
|
33
|
+
# [Prototype.js](http://prototypejs.org/api), Oliver Steele's
|
34
|
+
# [Functional](http://osteele.com), and John Resig's
|
35
|
+
# [Micro-Templating](http://ejohn.org).
|
36
|
+
# For all details and documentation:
|
37
|
+
# http://documentcloud.github.com/underscore/
|
38
|
+
|
39
|
+
|
40
|
+
# Baseline setup
|
41
|
+
# --------------
|
42
|
+
|
43
|
+
# Establish the root object, `window` in the browser, or `global` on the server.
|
44
|
+
root = this
|
45
|
+
|
46
|
+
|
47
|
+
# Save the previous value of the `_` variable.
|
48
|
+
previousUnderscore = root._
|
49
|
+
|
50
|
+
### Multiline
|
51
|
+
comment
|
52
|
+
###
|
53
|
+
|
54
|
+
# Establish the object that gets thrown to break out of a loop iteration.
|
55
|
+
# `StopIteration` is SOP on Mozilla.
|
56
|
+
breaker = if typeof(StopIteration) is 'undefined' then '__break__' else StopIteration
|
57
|
+
|
58
|
+
|
59
|
+
#### Docco style single line comment (title)
|
60
|
+
|
61
|
+
|
62
|
+
# Helper function to escape **RegExp** contents, because JS doesn't have one.
|
63
|
+
escapeRegExp = (string) -> string.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1')
|
64
|
+
|
65
|
+
|
66
|
+
# Save bytes in the minified (but not gzipped) version:
|
67
|
+
ArrayProto = Array.prototype
|
68
|
+
ObjProto = Object.prototype
|
69
|
+
|
70
|
+
|
71
|
+
# Create quick reference variables for speed access to core prototypes.
|
72
|
+
slice = ArrayProto.slice
|
73
|
+
unshift = ArrayProto.unshift
|
74
|
+
toString = ObjProto.toString
|
75
|
+
hasOwnProperty = ObjProto.hasOwnProperty
|
76
|
+
propertyIsEnumerable = ObjProto.propertyIsEnumerable
|
77
|
+
|
78
|
+
|
79
|
+
# All **ECMA5** native implementations we hope to use are declared here.
|
80
|
+
nativeForEach = ArrayProto.forEach
|
81
|
+
nativeMap = ArrayProto.map
|
82
|
+
nativeReduce = ArrayProto.reduce
|
83
|
+
nativeReduceRight = ArrayProto.reduceRight
|
84
|
+
nativeFilter = ArrayProto.filter
|
85
|
+
nativeEvery = ArrayProto.every
|
86
|
+
nativeSome = ArrayProto.some
|
87
|
+
nativeIndexOf = ArrayProto.indexOf
|
88
|
+
nativeLastIndexOf = ArrayProto.lastIndexOf
|
89
|
+
nativeIsArray = Array.isArray
|
90
|
+
nativeKeys = Object.keys
|
91
|
+
|
92
|
+
|
93
|
+
# Create a safe reference to the Underscore object for use below.
|
94
|
+
_ = (obj) -> new wrapper(obj)
|
95
|
+
|
96
|
+
|
97
|
+
# Export the Underscore object for **CommonJS**.
|
98
|
+
if typeof(exports) != 'undefined' then exports._ = _
|
99
|
+
|
100
|
+
|
101
|
+
# Export Underscore to global scope.
|
102
|
+
root._ = _
|
103
|
+
|
104
|
+
|
105
|
+
# Current version.
|
106
|
+
_.VERSION = '1.1.0'
|
107
|
+
|
108
|
+
|
109
|
+
# Collection Functions
|
110
|
+
# --------------------
|
111
|
+
|
112
|
+
# The cornerstone, an **each** implementation.
|
113
|
+
# Handles objects implementing **forEach**, arrays, and raw objects.
|
114
|
+
_.each = (obj, iterator, context) ->
|
115
|
+
try
|
116
|
+
if nativeForEach and obj.forEach is nativeForEach
|
117
|
+
obj.forEach iterator, context
|
118
|
+
else if _.isNumber obj.length
|
119
|
+
iterator.call context, obj[i], i, obj for i in [0...obj.length]
|
120
|
+
else
|
121
|
+
iterator.call context, val, key, obj for own key, val of obj
|
122
|
+
catch e
|
123
|
+
throw e if e isnt breaker
|
124
|
+
obj
|
125
|
+
|
126
|
+
|
127
|
+
# Return the results of applying the iterator to each element. Use JavaScript
|
128
|
+
# 1.6's version of **map**, if possible.
|
129
|
+
_.map = (obj, iterator, context) ->
|
130
|
+
return obj.map(iterator, context) if nativeMap and obj.map is nativeMap
|
131
|
+
results = []
|
132
|
+
_.each obj, (value, index, list) ->
|
133
|
+
results.push iterator.call context, value, index, list
|
134
|
+
results
|
135
|
+
|
136
|
+
|
137
|
+
# **Reduce** builds up a single result from a list of values. Also known as
|
138
|
+
# **inject**, or **foldl**. Uses JavaScript 1.8's version of **reduce**, if possible.
|
139
|
+
_.reduce = (obj, iterator, memo, context) ->
|
140
|
+
if nativeReduce and obj.reduce is nativeReduce
|
141
|
+
iterator = _.bind iterator, context if context
|
142
|
+
return obj.reduce iterator, memo
|
143
|
+
_.each obj, (value, index, list) ->
|
144
|
+
memo = iterator.call context, memo, value, index, list
|
145
|
+
memo
|
146
|
+
|
147
|
+
|
148
|
+
# The right-associative version of **reduce**, also known as **foldr**. Uses
|
149
|
+
# JavaScript 1.8's version of **reduceRight**, if available.
|
150
|
+
_.reduceRight = (obj, iterator, memo, context) ->
|
151
|
+
if nativeReduceRight and obj.reduceRight is nativeReduceRight
|
152
|
+
iterator = _.bind iterator, context if context
|
153
|
+
return obj.reduceRight iterator, memo
|
154
|
+
reversed = _.clone(_.toArray(obj)).reverse()
|
155
|
+
_.reduce reversed, iterator, memo, context
|
156
|
+
|
157
|
+
|
158
|
+
# Return the first value which passes a truth test.
|
159
|
+
_.detect = (obj, iterator, context) ->
|
160
|
+
result = null
|
161
|
+
_.each obj, (value, index, list) ->
|
162
|
+
if iterator.call context, value, index, list
|
163
|
+
result = value
|
164
|
+
_.breakLoop()
|
165
|
+
result
|
166
|
+
|
167
|
+
|
168
|
+
# Return all the elements that pass a truth test. Use JavaScript 1.6's
|
169
|
+
# **filter**, if it exists.
|
170
|
+
_.filter = (obj, iterator, context) ->
|
171
|
+
return obj.filter iterator, context if nativeFilter and obj.filter is nativeFilter
|
172
|
+
results = []
|
173
|
+
_.each obj, (value, index, list) ->
|
174
|
+
results.push value if iterator.call context, value, index, list
|
175
|
+
results
|
176
|
+
|
177
|
+
|
178
|
+
# Return all the elements for which a truth test fails.
|
179
|
+
_.reject = (obj, iterator, context) ->
|
180
|
+
results = []
|
181
|
+
_.each obj, (value, index, list) ->
|
182
|
+
results.push value if not iterator.call context, value, index, list
|
183
|
+
results
|
184
|
+
|
185
|
+
|
186
|
+
# Determine whether all of the elements match a truth test. Delegate to
|
187
|
+
# JavaScript 1.6's **every**, if it is present.
|
188
|
+
_.every = (obj, iterator, context) ->
|
189
|
+
iterator ||= _.identity
|
190
|
+
return obj.every iterator, context if nativeEvery and obj.every is nativeEvery
|
191
|
+
result = true
|
192
|
+
_.each obj, (value, index, list) ->
|
193
|
+
_.breakLoop() unless (result = result and iterator.call(context, value, index, list))
|
194
|
+
result
|
195
|
+
|
196
|
+
|
197
|
+
# Determine if at least one element in the object matches a truth test. Use
|
198
|
+
# JavaScript 1.6's **some**, if it exists.
|
199
|
+
_.some = (obj, iterator, context) ->
|
200
|
+
iterator ||= _.identity
|
201
|
+
return obj.some iterator, context if nativeSome and obj.some is nativeSome
|
202
|
+
result = false
|
203
|
+
_.each obj, (value, index, list) ->
|
204
|
+
_.breakLoop() if (result = iterator.call(context, value, index, list))
|
205
|
+
result
|
206
|
+
|
207
|
+
|
208
|
+
# Determine if a given value is included in the array or object,
|
209
|
+
# based on `===`.
|
210
|
+
_.include = (obj, target) ->
|
211
|
+
return _.indexOf(obj, target) isnt -1 if nativeIndexOf and obj.indexOf is nativeIndexOf
|
212
|
+
return true for own key, val of obj when val is target
|
213
|
+
false
|
214
|
+
|
215
|
+
|
216
|
+
# Invoke a method with arguments on every item in a collection.
|
217
|
+
_.invoke = (obj, method) ->
|
218
|
+
args = _.rest arguments, 2
|
219
|
+
(if method then val[method] else val).apply(val, args) for val in obj
|
220
|
+
|
221
|
+
|
222
|
+
# Convenience version of a common use case of **map**: fetching a property.
|
223
|
+
_.pluck = (obj, key) ->
|
224
|
+
_.map(obj, (val) -> val[key])
|
225
|
+
|
226
|
+
|
227
|
+
# Return the maximum item or (item-based computation).
|
228
|
+
_.max = (obj, iterator, context) ->
|
229
|
+
return Math.max.apply(Math, obj) if not iterator and _.isArray(obj)
|
230
|
+
result = computed: -Infinity
|
231
|
+
_.each obj, (value, index, list) ->
|
232
|
+
computed = if iterator then iterator.call(context, value, index, list) else value
|
233
|
+
computed >= result.computed and (result = {value: value, computed: computed})
|
234
|
+
result.value
|
235
|
+
|
236
|
+
|
237
|
+
# Return the minimum element (or element-based computation).
|
238
|
+
_.min = (obj, iterator, context) ->
|
239
|
+
return Math.min.apply(Math, obj) if not iterator and _.isArray(obj)
|
240
|
+
result = computed: Infinity
|
241
|
+
_.each obj, (value, index, list) ->
|
242
|
+
computed = if iterator then iterator.call(context, value, index, list) else value
|
243
|
+
computed < result.computed and (result = {value: value, computed: computed})
|
244
|
+
result.value
|
245
|
+
|
246
|
+
|
247
|
+
# Sort the object's values by a criterion produced by an iterator.
|
248
|
+
_.sortBy = (obj, iterator, context) ->
|
249
|
+
_.pluck(((_.map obj, (value, index, list) ->
|
250
|
+
{value: value, criteria: iterator.call(context, value, index, list)}
|
251
|
+
).sort((left, right) ->
|
252
|
+
a = left.criteria; b = right.criteria
|
253
|
+
if a < b then -1 else if a > b then 1 else 0
|
254
|
+
)), 'value')
|
255
|
+
|
256
|
+
|
257
|
+
# Use a comparator function to figure out at what index an object should
|
258
|
+
# be inserted so as to maintain order. Uses binary search.
|
259
|
+
_.sortedIndex = (array, obj, iterator) ->
|
260
|
+
iterator ||= _.identity
|
261
|
+
low = 0
|
262
|
+
high = array.length
|
263
|
+
while low < high
|
264
|
+
mid = (low + high) >> 1
|
265
|
+
if iterator(array[mid]) < iterator(obj) then low = mid + 1 else high = mid
|
266
|
+
low
|
267
|
+
|
268
|
+
|
269
|
+
# Convert anything iterable into a real, live array.
|
270
|
+
_.toArray = (iterable) ->
|
271
|
+
return [] if (!iterable)
|
272
|
+
return iterable.toArray() if (iterable.toArray)
|
273
|
+
return iterable if (_.isArray(iterable))
|
274
|
+
return slice.call(iterable) if (_.isArguments(iterable))
|
275
|
+
_.values(iterable)
|
276
|
+
|
277
|
+
|
278
|
+
# Return the number of elements in an object.
|
279
|
+
_.size = (obj) -> _.toArray(obj).length
|
280
|
+
|
281
|
+
|
282
|
+
# Array Functions
|
283
|
+
# ---------------
|
284
|
+
|
285
|
+
# Get the first element of an array. Passing `n` will return the first N
|
286
|
+
# values in the array. Aliased as **head**. The `guard` check allows it to work
|
287
|
+
# with **map**.
|
288
|
+
_.first = (array, n, guard) ->
|
289
|
+
if n and not guard then slice.call(array, 0, n) else array[0]
|
290
|
+
|
291
|
+
|
292
|
+
# Returns everything but the first entry of the array. Aliased as **tail**.
|
293
|
+
# Especially useful on the arguments object. Passing an `index` will return
|
294
|
+
# the rest of the values in the array from that index onward. The `guard`
|
295
|
+
# check allows it to work with **map**.
|
296
|
+
_.rest = (array, index, guard) ->
|
297
|
+
slice.call(array, if _.isUndefined(index) or guard then 1 else index)
|
298
|
+
|
299
|
+
|
300
|
+
# Get the last element of an array.
|
301
|
+
_.last = (array) -> array[array.length - 1]
|
302
|
+
|
303
|
+
|
304
|
+
# Trim out all falsy values from an array.
|
305
|
+
_.compact = (array) -> item for item in array when item
|
306
|
+
|
307
|
+
|
308
|
+
# Return a completely flattened version of an array.
|
309
|
+
_.flatten = (array) ->
|
310
|
+
_.reduce array, (memo, value) ->
|
311
|
+
return memo.concat(_.flatten(value)) if _.isArray value
|
312
|
+
memo.push value
|
313
|
+
memo
|
314
|
+
, []
|
315
|
+
|
316
|
+
|
317
|
+
# Return a version of the array that does not contain the specified value(s).
|
318
|
+
_.without = (array) ->
|
319
|
+
values = _.rest arguments
|
320
|
+
val for val in _.toArray(array) when not _.include values, val
|
321
|
+
|
322
|
+
|
323
|
+
# Produce a duplicate-free version of the array. If the array has already
|
324
|
+
# been sorted, you have the option of using a faster algorithm.
|
325
|
+
_.uniq = (array, isSorted) ->
|
326
|
+
memo = []
|
327
|
+
for el, i in _.toArray array
|
328
|
+
memo.push el if i is 0 || (if isSorted is true then _.last(memo) isnt el else not _.include(memo, el))
|
329
|
+
memo
|
330
|
+
|
331
|
+
|
332
|
+
# Produce an array that contains every item shared between all the
|
333
|
+
# passed-in arrays.
|
334
|
+
_.intersect = (array) ->
|
335
|
+
rest = _.rest arguments
|
336
|
+
_.select _.uniq(array), (item) ->
|
337
|
+
_.all rest, (other) ->
|
338
|
+
_.indexOf(other, item) >= 0
|
339
|
+
|
340
|
+
|
341
|
+
# Zip together multiple lists into a single array -- elements that share
|
342
|
+
# an index go together.
|
343
|
+
_.zip = ->
|
344
|
+
length = _.max _.pluck arguments, 'length'
|
345
|
+
results = new Array length
|
346
|
+
for i in [0...length]
|
347
|
+
results[i] = _.pluck arguments, String i
|
348
|
+
results
|
349
|
+
|
350
|
+
|
351
|
+
# If the browser doesn't supply us with **indexOf** (I'm looking at you, MSIE),
|
352
|
+
# we need this function. Return the position of the first occurrence of an
|
353
|
+
# item in an array, or -1 if the item is not included in the array.
|
354
|
+
_.indexOf = (array, item) ->
|
355
|
+
return array.indexOf item if nativeIndexOf and array.indexOf is nativeIndexOf
|
356
|
+
i = 0; l = array.length
|
357
|
+
while l - i
|
358
|
+
if array[i] is item then return i else i++
|
359
|
+
-1
|
360
|
+
|
361
|
+
|
362
|
+
# Provide JavaScript 1.6's **lastIndexOf**, delegating to the native function,
|
363
|
+
# if possible.
|
364
|
+
_.lastIndexOf = (array, item) ->
|
365
|
+
return array.lastIndexOf(item) if nativeLastIndexOf and array.lastIndexOf is nativeLastIndexOf
|
366
|
+
i = array.length
|
367
|
+
while i
|
368
|
+
if array[i] is item then return i else i--
|
369
|
+
-1
|
370
|
+
|
371
|
+
|
372
|
+
# Generate an integer Array containing an arithmetic progression. A port of
|
373
|
+
# [the native Python **range** function](http://docs.python.org/library/functions.html#range).
|
374
|
+
_.range = (start, stop, step) ->
|
375
|
+
a = arguments
|
376
|
+
solo = a.length <= 1
|
377
|
+
i = start = if solo then 0 else a[0]
|
378
|
+
stop = if solo then a[0] else a[1]
|
379
|
+
step = a[2] or 1
|
380
|
+
len = Math.ceil((stop - start) / step)
|
381
|
+
return [] if len <= 0
|
382
|
+
range = new Array len
|
383
|
+
idx = 0
|
384
|
+
loop
|
385
|
+
return range if (if step > 0 then i - stop else stop - i) >= 0
|
386
|
+
range[idx] = i
|
387
|
+
idx++
|
388
|
+
i+= step
|
389
|
+
|
390
|
+
|
391
|
+
# Function Functions
|
392
|
+
# ------------------
|
393
|
+
|
394
|
+
# Create a function bound to a given object (assigning `this`, and arguments,
|
395
|
+
# optionally). Binding with arguments is also known as **curry**.
|
396
|
+
_.bind = (func, obj) ->
|
397
|
+
args = _.rest arguments, 2
|
398
|
+
-> func.apply obj or root, args.concat arguments
|
399
|
+
|
400
|
+
|
401
|
+
# Bind all of an object's methods to that object. Useful for ensuring that
|
402
|
+
# all callbacks defined on an object belong to it.
|
403
|
+
_.bindAll = (obj) ->
|
404
|
+
funcs = if arguments.length > 1 then _.rest(arguments) else _.functions(obj)
|
405
|
+
_.each funcs, (f) -> obj[f] = _.bind obj[f], obj
|
406
|
+
obj
|
407
|
+
|
408
|
+
|
409
|
+
# Delays a function for the given number of milliseconds, and then calls
|
410
|
+
# it with the arguments supplied.
|
411
|
+
_.delay = (func, wait) ->
|
412
|
+
args = _.rest arguments, 2
|
413
|
+
setTimeout((-> func.apply(func, args)), wait)
|
414
|
+
|
415
|
+
|
416
|
+
# Memoize an expensive function by storing its results.
|
417
|
+
_.memoize = (func, hasher) ->
|
418
|
+
memo = {}
|
419
|
+
hasher or= _.identity
|
420
|
+
->
|
421
|
+
key = hasher.apply this, arguments
|
422
|
+
return memo[key] if key of memo
|
423
|
+
memo[key] = func.apply this, arguments
|
424
|
+
|
425
|
+
|
426
|
+
# Defers a function, scheduling it to run after the current call stack has
|
427
|
+
# cleared.
|
428
|
+
_.defer = (func) ->
|
429
|
+
_.delay.apply _, [func, 1].concat _.rest arguments
|
430
|
+
|
431
|
+
|
432
|
+
# Returns the first function passed as an argument to the second,
|
433
|
+
# allowing you to adjust arguments, run code before and after, and
|
434
|
+
# conditionally execute the original function.
|
435
|
+
_.wrap = (func, wrapper) ->
|
436
|
+
-> wrapper.apply wrapper, [func].concat arguments
|
437
|
+
|
438
|
+
|
439
|
+
# Returns a function that is the composition of a list of functions, each
|
440
|
+
# consuming the return value of the function that follows.
|
441
|
+
_.compose = ->
|
442
|
+
funcs = arguments
|
443
|
+
->
|
444
|
+
args = arguments
|
445
|
+
for i in [funcs.length - 1..0] by -1
|
446
|
+
args = [funcs[i].apply(this, args)]
|
447
|
+
args[0]
|
448
|
+
|
449
|
+
|
450
|
+
# Object Functions
|
451
|
+
# ----------------
|
452
|
+
|
453
|
+
# Retrieve the names of an object's properties.
|
454
|
+
_.keys = nativeKeys or (obj) ->
|
455
|
+
return _.range 0, obj.length if _.isArray(obj)
|
456
|
+
key for key, val of obj
|
457
|
+
|
458
|
+
|
459
|
+
# Retrieve the values of an object's properties.
|
460
|
+
_.values = (obj) ->
|
461
|
+
_.map obj, _.identity
|
462
|
+
|
463
|
+
|
464
|
+
# Return a sorted list of the function names available in Underscore.
|
465
|
+
_.functions = (obj) ->
|
466
|
+
_.filter(_.keys(obj), (key) -> _.isFunction(obj[key])).sort()
|
467
|
+
|
468
|
+
|
469
|
+
# Extend a given object with all of the properties in a source object.
|
470
|
+
_.extend = (obj) ->
|
471
|
+
for source in _.rest(arguments)
|
472
|
+
obj[key] = val for key, val of source
|
473
|
+
obj
|
474
|
+
|
475
|
+
|
476
|
+
# Create a (shallow-cloned) duplicate of an object.
|
477
|
+
_.clone = (obj) ->
|
478
|
+
return obj.slice 0 if _.isArray obj
|
479
|
+
_.extend {}, obj
|
480
|
+
|
481
|
+
|
482
|
+
# Invokes interceptor with the obj, and then returns obj.
|
483
|
+
# The primary purpose of this method is to "tap into" a method chain,
|
484
|
+
# in order to perform operations on intermediate results within
|
485
|
+
the chain.
|
486
|
+
_.tap = (obj, interceptor) ->
|
487
|
+
interceptor obj
|
488
|
+
obj
|
489
|
+
|
490
|
+
|
491
|
+
# Perform a deep comparison to check if two objects are equal.
|
492
|
+
_.isEqual = (a, b) ->
|
493
|
+
# Check object identity.
|
494
|
+
return true if a is b
|
495
|
+
# Different types?
|
496
|
+
atype = typeof(a); btype = typeof(b)
|
497
|
+
return false if atype isnt btype
|
498
|
+
# Basic equality test (watch out for coercions).
|
499
|
+
return true if `a == b`
|
500
|
+
# One is falsy and the other truthy.
|
501
|
+
return false if (!a and b) or (a and !b)
|
502
|
+
# One of them implements an `isEqual()`?
|
503
|
+
return a.isEqual(b) if a.isEqual
|
504
|
+
# Check dates' integer values.
|
505
|
+
return a.getTime() is b.getTime() if _.isDate(a) and _.isDate(b)
|
506
|
+
# Both are NaN?
|
507
|
+
return false if _.isNaN(a) and _.isNaN(b)
|
508
|
+
# Compare regular expressions.
|
509
|
+
if _.isRegExp(a) and _.isRegExp(b)
|
510
|
+
return a.source is b.source and
|
511
|
+
a.global is b.global and
|
512
|
+
a.ignoreCase is b.ignoreCase and
|
513
|
+
a.multiline is b.multiline
|
514
|
+
# If a is not an object by this point, we can't handle it.
|
515
|
+
return false if atype isnt 'object'
|
516
|
+
# Check for different array lengths before comparing contents.
|
517
|
+
return false if a.length and (a.length isnt b.length)
|
518
|
+
# Nothing else worked, deep compare the contents.
|
519
|
+
aKeys = _.keys(a); bKeys = _.keys(b)
|
520
|
+
# Different object sizes?
|
521
|
+
return false if aKeys.length isnt bKeys.length
|
522
|
+
# Recursive comparison of contents.
|
523
|
+
return false for key, val of a when !(key of b) or !_.isEqual(val, b[key])
|
524
|
+
true
|
525
|
+
|
526
|
+
|
527
|
+
# Is a given array or object empty?
|
528
|
+
_.isEmpty = (obj) ->
|
529
|
+
return obj.length is 0 if _.isArray(obj) or _.isString(obj)
|
530
|
+
return false for own key of obj
|
531
|
+
true
|
532
|
+
|
533
|
+
|
534
|
+
# Is a given value a DOM element?
|
535
|
+
_.isElement = (obj) -> obj and obj.nodeType is 1
|
536
|
+
|
537
|
+
|
538
|
+
# Is a given value an array?
|
539
|
+
_.isArray = nativeIsArray or (obj) -> !!(obj and obj.concat and obj.unshift and not obj.callee)
|
540
|
+
|
541
|
+
|
542
|
+
# Is a given variable an arguments object?
|
543
|
+
_.isArguments = (obj) -> obj and obj.callee
|
544
|
+
|
545
|
+
|
546
|
+
# Is the given value a function?
|
547
|
+
_.isFunction = (obj) -> !!(obj and obj.constructor and obj.call and obj.apply)
|
548
|
+
|
549
|
+
|
550
|
+
# Is the given value a string?
|
551
|
+
_.isString = (obj) -> !!(obj is '' or (obj and obj.charCodeAt and obj.substr))
|
552
|
+
|
553
|
+
|
554
|
+
# Is a given value a number?
|
555
|
+
_.isNumber = (obj) -> (obj is +obj) or toString.call(obj) is '[object Number]'
|
556
|
+
|
557
|
+
|
558
|
+
# Is a given value a boolean?
|
559
|
+
_.isBoolean = (obj) -> obj is true or obj is false
|
560
|
+
|
561
|
+
|
562
|
+
# Is a given value a Date?
|
563
|
+
_.isDate = (obj) -> !!(obj and obj.getTimezoneOffset and obj.setUTCFullYear)
|
564
|
+
|
565
|
+
|
566
|
+
# Is the given value a regular expression?
|
567
|
+
_.isRegExp = (obj) -> !!(obj and obj.exec and (obj.ignoreCase or obj.ignoreCase is false))
|
568
|
+
|
569
|
+
|
570
|
+
# Is the given value NaN -- this one is interesting. `NaN != NaN`, and
|
571
|
+
# `isNaN(undefined) == true`, so we make sure it's a number first.
|
572
|
+
_.isNaN = (obj) -> _.isNumber(obj) and window.isNaN(obj)
|
573
|
+
|
574
|
+
|
575
|
+
# Is a given value equal to null?
|
576
|
+
_.isNull = (obj) -> obj is null
|
577
|
+
|
578
|
+
|
579
|
+
# Is a given variable undefined?
|
580
|
+
_.isUndefined = (obj) -> typeof obj is 'undefined'
|
581
|
+
|
582
|
+
|
583
|
+
# Utility Functions
|
584
|
+
# -----------------
|
585
|
+
|
586
|
+
# Run Underscore.js in noConflict mode, returning the `_` variable to its
|
587
|
+
# previous owner. Returns a reference to the Underscore object.
|
588
|
+
_.noConflict = ->
|
589
|
+
root._ = previousUnderscore
|
590
|
+
this
|
591
|
+
|
592
|
+
|
593
|
+
# Keep the identity function around for default iterators.
|
594
|
+
_.identity = (value) -> value
|
595
|
+
|
596
|
+
|
597
|
+
# Run a function `n` times.
|
598
|
+
_.times = (n, iterator, context) ->
|
599
|
+
iterator.call context, i for i in [0...n]
|
600
|
+
|
601
|
+
|
602
|
+
# Break out of the middle of an iteration.
|
603
|
+
_.breakLoop = -> throw breaker
|
604
|
+
|
605
|
+
|
606
|
+
# Add your own custom functions to the Underscore object, ensuring that
|
607
|
+
# they're correctly added to the OOP wrapper as well.
|
608
|
+
_.mixin = (obj) ->
|
609
|
+
for name in _.functions(obj)
|
610
|
+
addToWrapper name, _[name] = obj[name]
|
611
|
+
|
612
|
+
|
613
|
+
# Generate a unique integer id (unique within the entire client session).
|
614
|
+
# Useful for temporary DOM ids.
|
615
|
+
idCounter = 0
|
616
|
+
_.uniqueId = (prefix) ->
|
617
|
+
(prefix or '') + idCounter++
|
618
|
+
|
619
|
+
|
620
|
+
# By default, Underscore uses **ERB**-style template delimiters, change the
|
621
|
+
# following template settings to use alternative delimiters.
|
622
|
+
_.templateSettings = {
|
623
|
+
start: '<%'
|
624
|
+
end: '%>'
|
625
|
+
interpolate: /<%=(.+?)%>/g
|
626
|
+
}
|
627
|
+
|
628
|
+
|
629
|
+
# JavaScript templating a-la **ERB**, pilfered from John Resig's
|
630
|
+
# *Secrets of the JavaScript Ninja*, page 83.
|
631
|
+
# Single-quote fix from Rick Strahl.
|
632
|
+
# With alterations for arbitrary delimiters, and to preserve whitespace.
|
633
|
+
_.template = (str, data) ->
|
634
|
+
c = _.templateSettings
|
635
|
+
endMatch = new RegExp("'(?=[^"+c.end.substr(0, 1)+"]*"+escapeRegExp(c.end)+")","g")
|
636
|
+
fn = new Function 'obj',
|
637
|
+
'var p=[],print=function(){p.push.apply(p,arguments);};' +
|
638
|
+
'with(obj||{}){p.push(\'' +
|
639
|
+
str.replace(/\r/g, '\\r')
|
640
|
+
.replace(/\n/g, '\\n')
|
641
|
+
.replace(/\t/g, '\\t')
|
642
|
+
.replace(endMatch,"���")
|
643
|
+
.split("'").join("\\'")
|
644
|
+
.split("���").join("'")
|
645
|
+
.replace(c.interpolate, "',$1,'")
|
646
|
+
.split(c.start).join("');")
|
647
|
+
.split(c.end).join("p.push('") +
|
648
|
+
"');}return p.join('');"
|
649
|
+
if data then fn(data) else fn
|
650
|
+
|
651
|
+
|
652
|
+
# Aliases
|
653
|
+
# -------
|
654
|
+
|
655
|
+
_.forEach = _.each
|
656
|
+
_.foldl = _.inject = _.reduce
|
657
|
+
_.foldr = _.reduceRight
|
658
|
+
_.select = _.filter
|
659
|
+
_.all = _.every
|
660
|
+
_.any = _.some
|
661
|
+
_.contains = _.include
|
662
|
+
_.head = _.first
|
663
|
+
_.tail = _.rest
|
664
|
+
_.methods = _.functions
|
665
|
+
|
666
|
+
|
667
|
+
# Setup the OOP Wrapper
|
668
|
+
# ---------------------
|
669
|
+
|
670
|
+
# If Underscore is called as a function, it returns a wrapped object that
|
671
|
+
# can be used OO-style. This wrapper holds altered versions of all the
|
672
|
+
# underscore functions. Wrapped objects may be chained.
|
673
|
+
wrapper = (obj) ->
|
674
|
+
this._wrapped = obj
|
675
|
+
this
|
676
|
+
|
677
|
+
|
678
|
+
# Helper function to continue chaining intermediate results.
|
679
|
+
result = (obj, chain) ->
|
680
|
+
if chain then _(obj).chain() else obj
|
681
|
+
|
682
|
+
|
683
|
+
# A method to easily add functions to the OOP wrapper.
|
684
|
+
addToWrapper = (name, func) ->
|
685
|
+
wrapper.prototype[name] = ->
|
686
|
+
args = _.toArray arguments
|
687
|
+
unshift.call args, this._wrapped
|
688
|
+
result func.apply(_, args), this._chain
|
689
|
+
|
690
|
+
|
691
|
+
# Add all ofthe Underscore functions to the wrapper object.
|
692
|
+
_.mixin _
|
693
|
+
|
694
|
+
|
695
|
+
# Add all mutator Array functions to the wrapper.
|
696
|
+
_.each ['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], (name) ->
|
697
|
+
method = Array.prototype[name]
|
698
|
+
wrapper.prototype[name] = ->
|
699
|
+
method.apply(this._wrapped, arguments)
|
700
|
+
result(this._wrapped, this._chain)
|
701
|
+
|
702
|
+
|
703
|
+
# Add all accessor Array functions to the wrapper.
|
704
|
+
_.each ['concat', 'join', 'slice'], (name) ->
|
705
|
+
method = Array.prototype[name]
|
706
|
+
wrapper.prototype[name] = ->
|
707
|
+
result(method.apply(this._wrapped, arguments), this._chain)
|
708
|
+
|
709
|
+
|
710
|
+
# Start chaining a wrapped Underscore object.
|
711
|
+
wrapper::chain = ->
|
712
|
+
this._chain = true
|
713
|
+
this
|
714
|
+
|
715
|
+
|
716
|
+
# Extracts the result from a wrapped and chained object.
|
717
|
+
wrapper::value = -> this._wrapped
|
718
|
+
</textarea></form>
|
719
|
+
<script>
|
720
|
+
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
|
721
|
+
</script>
|
722
|
+
|
723
|
+
<p><strong>MIME types defined:</strong> <code>text/x-coffeescript</code>.</p>
|
724
|
+
|
725
|
+
<p>The CoffeeScript mode was written by Jeff Pickhardt (<a href="LICENSE">license</a>).</p>
|
726
|
+
|
727
|
+
</body>
|
728
|
+
</html>
|