├── project ├── build.properties └── plugins.sbt ├── server └── src │ ├── main │ ├── assets │ │ ├── thirdparty │ │ │ └── static │ │ │ │ ├── jquery │ │ │ │ ├── js │ │ │ │ │ ├── jquery.jsm │ │ │ │ │ ├── jquery-ui.jsm │ │ │ │ │ └── jquery.autogrow.js │ │ │ │ └── css │ │ │ │ │ └── base │ │ │ │ │ └── images │ │ │ │ │ ├── animated-overlay.gif │ │ │ │ │ ├── ui-icons_222222_256x240.png │ │ │ │ │ ├── ui-icons_2e83ff_256x240.png │ │ │ │ │ ├── ui-icons_454545_256x240.png │ │ │ │ │ ├── ui-icons_888888_256x240.png │ │ │ │ │ ├── ui-icons_cd0a0a_256x240.png │ │ │ │ │ ├── ui-bg_flat_0_aaaaaa_40x100.png │ │ │ │ │ ├── ui-bg_flat_75_ffffff_40x100.png │ │ │ │ │ ├── ui-bg_glass_55_fbf9ee_1x400.png │ │ │ │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ │ │ │ ├── ui-bg_glass_75_dadada_1x400.png │ │ │ │ │ ├── ui-bg_glass_75_e6e6e6_1x400.png │ │ │ │ │ ├── ui-bg_glass_95_fef1ec_1x400.png │ │ │ │ │ └── ui-bg_highlight-soft_75_cccccc_1x100.png │ │ │ │ ├── knockout.jsm │ │ │ │ ├── less.jsm │ │ │ │ ├── curl │ │ │ │ ├── plugin │ │ │ │ │ ├── js.jsm │ │ │ │ │ ├── link.jsm │ │ │ │ │ └── bundle.js │ │ │ │ └── curl.jsm │ │ │ │ ├── bootstrap │ │ │ │ ├── img │ │ │ │ │ ├── glyphicons-halflings.png │ │ │ │ │ └── glyphicons-halflings-white.png │ │ │ │ └── version.txt │ │ │ │ └── bootstrap-icon │ │ │ │ ├── img │ │ │ │ ├── glyphicons-halflings.png │ │ │ │ └── glyphicons-halflings-white.png │ │ │ │ └── README.txt │ │ ├── from_ipython │ │ │ ├── static │ │ │ │ ├── css │ │ │ │ │ ├── login.css │ │ │ │ │ ├── logout.css │ │ │ │ │ ├── printnotebook.css │ │ │ │ │ ├── projectdashboard.css │ │ │ │ │ ├── fbm.css │ │ │ │ │ └── page.css │ │ │ │ ├── favicon.ico │ │ │ │ ├── codemirror │ │ │ │ │ ├── doc │ │ │ │ │ │ └── baboon.png │ │ │ │ │ ├── mode │ │ │ │ │ │ ├── rpm │ │ │ │ │ │ │ ├── spec │ │ │ │ │ │ │ │ └── spec.css │ │ │ │ │ │ │ └── changes │ │ │ │ │ │ │ │ ├── changes.js │ │ │ │ │ │ │ │ └── index.html │ │ │ │ │ │ ├── tiddlywiki │ │ │ │ │ │ │ └── tiddlywiki.css │ │ │ │ │ │ ├── tiki │ │ │ │ │ │ │ ├── tiki.css │ │ │ │ │ │ │ └── index.html │ │ │ │ │ │ ├── xquery │ │ │ │ │ │ │ ├── test │ │ │ │ │ │ │ │ ├── testEmptySequenceKeyword.js │ │ │ │ │ │ │ │ ├── testProcessingInstructions.js │ │ │ │ │ │ │ │ ├── testMultiAttr.js │ │ │ │ │ │ │ │ ├── testQuotes.js │ │ │ │ │ │ │ │ └── index.html │ │ │ │ │ │ │ └── LICENSE │ │ │ │ │ │ ├── diff │ │ │ │ │ │ │ └── diff.js │ │ │ │ │ │ ├── vbscript │ │ │ │ │ │ │ ├── vbscript.js │ │ │ │ │ │ │ └── index.html │ │ │ │ │ │ ├── pascal │ │ │ │ │ │ │ ├── LICENSE │ │ │ │ │ │ │ └── index.html │ │ │ │ │ │ ├── ntriples │ │ │ │ │ │ │ └── index.html │ │ │ │ │ │ ├── python │ │ │ │ │ │ │ └── LICENSE.txt │ │ │ │ │ │ ├── perl │ │ │ │ │ │ │ ├── LICENSE │ │ │ │ │ │ │ └── index.html │ │ │ │ │ │ ├── vb │ │ │ │ │ │ │ └── LICENSE.txt │ │ │ │ │ │ ├── jinja2 │ │ │ │ │ │ │ ├── index.html │ │ │ │ │ │ │ └── jinja2.js │ │ │ │ │ │ ├── coffeescript │ │ │ │ │ │ │ └── LICENSE │ │ │ │ │ │ ├── rust │ │ │ │ │ │ │ └── index.html │ │ │ │ │ │ ├── css │ │ │ │ │ │ │ └── index.html │ │ │ │ │ │ ├── ecl │ │ │ │ │ │ │ └── index.html │ │ │ │ │ │ ├── mysql │ │ │ │ │ │ │ └── index.html │ │ │ │ │ │ ├── pig │ │ │ │ │ │ │ └── index.html │ │ │ │ │ │ ├── properties │ │ │ │ │ │ │ ├── index.html │ │ │ │ │ │ │ └── properties.js │ │ │ │ │ │ ├── sparql │ │ │ │ │ │ │ └── index.html │ │ │ │ │ │ ├── shell │ │ │ │ │ │ │ └── index.html │ │ │ │ │ │ ├── gfm │ │ │ │ │ │ │ └── index.html │ │ │ │ │ │ ├── r │ │ │ │ │ │ │ └── LICENSE │ │ │ │ │ │ ├── ruby │ │ │ │ │ │ │ └── LICENSE │ │ │ │ │ │ ├── php │ │ │ │ │ │ │ └── index.html │ │ │ │ │ │ ├── smalltalk │ │ │ │ │ │ │ └── index.html │ │ │ │ │ │ ├── htmlmixed │ │ │ │ │ │ │ └── index.html │ │ │ │ │ │ ├── xml │ │ │ │ │ │ │ └── index.html │ │ │ │ │ │ ├── plsql │ │ │ │ │ │ │ └── index.html │ │ │ │ │ │ ├── htmlembedded │ │ │ │ │ │ │ └── index.html │ │ │ │ │ │ ├── lua │ │ │ │ │ │ │ └── index.html │ │ │ │ │ │ ├── erlang │ │ │ │ │ │ │ └── index.html │ │ │ │ │ │ ├── haskell │ │ │ │ │ │ │ └── index.html │ │ │ │ │ │ ├── yaml │ │ │ │ │ │ │ └── index.html │ │ │ │ │ │ ├── groovy │ │ │ │ │ │ │ └── index.html │ │ │ │ │ │ └── go │ │ │ │ │ │ │ └── index.html │ │ │ │ │ ├── README.md │ │ │ │ │ ├── test │ │ │ │ │ │ ├── mode_test.css │ │ │ │ │ │ └── driver.js │ │ │ │ │ ├── lib │ │ │ │ │ │ └── util │ │ │ │ │ │ │ ├── simple-hint.css │ │ │ │ │ │ │ ├── dialog.css │ │ │ │ │ │ │ ├── runmode.js │ │ │ │ │ │ │ ├── match-highlighter.js │ │ │ │ │ │ │ ├── loadmode.js │ │ │ │ │ │ │ └── overlay.js │ │ │ │ │ ├── theme │ │ │ │ │ │ ├── neat.css │ │ │ │ │ │ ├── elegant.css │ │ │ │ │ │ ├── cobalt.css │ │ │ │ │ │ ├── eclipse.css │ │ │ │ │ │ ├── night.css │ │ │ │ │ │ ├── monokai.css │ │ │ │ │ │ ├── erlang-dark.css │ │ │ │ │ │ ├── blackboard.css │ │ │ │ │ │ ├── rubyblue.css │ │ │ │ │ │ ├── vibrant-ink.css │ │ │ │ │ │ ├── ipython.css │ │ │ │ │ │ └── lesser-dark.css │ │ │ │ │ ├── package.json │ │ │ │ │ ├── demo │ │ │ │ │ │ ├── resize.html │ │ │ │ │ │ ├── matchhighlighter.html │ │ │ │ │ │ ├── loadmode.html │ │ │ │ │ │ ├── marker.html │ │ │ │ │ │ ├── changemode.html │ │ │ │ │ │ ├── vim.html │ │ │ │ │ │ ├── multiplex.html │ │ │ │ │ │ ├── visibletabs.html │ │ │ │ │ │ ├── mustache.html │ │ │ │ │ │ ├── emacs.html │ │ │ │ │ │ └── runmode.html │ │ │ │ │ ├── LICENSE │ │ │ │ │ └── keymap │ │ │ │ │ │ └── emacs.js │ │ │ │ ├── codemirror_README.txt │ │ │ │ ├── js │ │ │ │ │ ├── pagemain.js │ │ │ │ │ ├── logoutmain.js │ │ │ │ │ ├── loginmain.js │ │ │ │ │ ├── namespace.js │ │ │ │ │ ├── events.js │ │ │ │ │ ├── printnotebookmain.js │ │ │ │ │ ├── loginwidget.js │ │ │ │ │ ├── projectdashboardmain.js │ │ │ │ │ ├── quickhelp.js │ │ │ │ │ ├── page.js │ │ │ │ │ └── layoutmanager.js │ │ │ │ ├── prettify │ │ │ │ │ └── prettify.css │ │ │ │ └── pagedown │ │ │ │ │ └── LICENSE.txt │ │ │ └── README │ │ └── templates │ │ │ └── default.ssp │ ├── resources │ │ ├── com │ │ │ └── bwater │ │ │ │ └── notebook │ │ │ │ └── server │ │ │ │ └── init.sc │ │ ├── log4j.server.properties │ │ ├── reference.conf │ │ └── notebook-server.conf │ └── scala │ │ ├── ReqLogger.scala │ │ ├── KernelMessage.scala │ │ ├── LayoutTools.scala │ │ ├── WebSockWrapper.scala │ │ └── Scalate.scala │ └── test │ └── scala │ └── NBSerializerTests.scala ├── .travis.yml ├── .gitignore ├── subprocess └── src │ ├── test │ ├── resources │ │ ├── log4j.properties │ │ └── subprocess-test.conf │ └── scala │ │ └── com │ │ └── bwater │ │ └── notebook │ │ └── EchoActor.scala │ └── main │ ├── resources │ ├── test-server.conf │ ├── log4j.subprocess.properties │ └── kernel.conf │ └── scala │ └── com │ └── bwater │ └── notebook │ ├── kernel │ ├── pfork │ │ └── ChildProcessMain.java │ └── remote │ │ └── AkkaConfigUtils.scala │ └── Kernel.scala ├── kernel └── src │ └── main │ └── scala │ ├── HackIMain.scala │ └── com │ └── bwater │ └── notebook │ └── kernel │ ├── render.scala │ ├── TestStringCompletor.scala │ ├── StringCompletorResolver.scala │ ├── EvaluationResult.scala │ ├── completor │ └── FileCompletor.scala │ └── ConfigUtils.scala ├── observable └── src │ └── main │ └── scala │ └── com │ └── bwater │ └── notebook │ ├── ObservableMessage.scala │ ├── Codec.scala │ ├── ObservableHandler.scala │ ├── Observer.scala │ ├── ObsWebSocketService.scala │ ├── ObservableIntent.scala │ ├── Connection.scala │ └── Observable.scala ├── common └── src │ └── main │ └── scala │ └── com │ └── bwater │ └── notebook │ ├── As.scala │ ├── StringCompletor.scala │ ├── widgets │ ├── InputBox.scala │ └── DropDown.scala │ ├── util │ ├── ClassUtils.scala │ └── Logging.scala │ ├── Renderer.scala │ └── Widget.scala ├── 4.+Completions.snb └── README.md /project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=0.13.5 2 | -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/jquery/js/jquery.jsm: -------------------------------------------------------------------------------- 1 | 2 | http://code.jquery.com/jquery-1.7.1.js -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/knockout.jsm: -------------------------------------------------------------------------------- 1 | http://knockoutjs.com/downloads/knockout-2.2.1.debug.js -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/jquery/js/jquery-ui.jsm: -------------------------------------------------------------------------------- 1 | http://code.jquery.com/ui/1.10.1/jquery-ui.js -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/less.jsm: -------------------------------------------------------------------------------- 1 | http://cdnjs.cloudflare.com/ajax/libs/less.js/1.3.3/less.min.js 2 | -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/curl/plugin/js.jsm: -------------------------------------------------------------------------------- 1 | https://raw.github.com/cujojs/curl/0.7.3/src/curl/plugin/js.js -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/curl/plugin/link.jsm: -------------------------------------------------------------------------------- 1 | https://raw.github.com/cujojs/curl/0.7.3/src/curl/plugin/link.js -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/css/login.css: -------------------------------------------------------------------------------- 1 | 2 | #main_app { 3 | height: 100px; 4 | width: 350px; 5 | margin: 50px auto; 6 | } 7 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/css/logout.css: -------------------------------------------------------------------------------- 1 | 2 | #main_app { 3 | height: 100px; 4 | width: 200px; 5 | margin: 50px auto; 6 | } 7 | 8 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bridgewater/scala-notebook/HEAD/server/src/main/assets/from_ipython/static/favicon.ico -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: scala 2 | scala: 3 | - 2.10.3 4 | env: 5 | - SBT_OPTS="-XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:PermSize=256M -XX:MaxPermSize=512M" 6 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/README: -------------------------------------------------------------------------------- 1 | Based on IPython/master (Apr 22) at https://github.com/ipython/ipython 2 | 3 | commit hash: 4 | b9a817a6a4a332ca39a5010ed1c1471af6ca0ac6 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .idea_modules/ 3 | .project 4 | .settings 5 | .classpath 6 | .ensime 7 | .ensime_lucene 8 | .akka-cookie 9 | project/target/ 10 | target/ 11 | logs/ 12 | -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/curl/curl.jsm: -------------------------------------------------------------------------------- 1 | # No non-minified versions published, can compile our own if necessary... 2 | https://raw.github.com/cujojs/curl/0.7.3/src/curl.js 3 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/doc/baboon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bridgewater/scala-notebook/HEAD/server/src/main/assets/from_ipython/static/codemirror/doc/baboon.png -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/bootstrap/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bridgewater/scala-notebook/HEAD/server/src/main/assets/thirdparty/static/bootstrap/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/bootstrap-icon/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bridgewater/scala-notebook/HEAD/server/src/main/assets/thirdparty/static/bootstrap-icon/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/bootstrap/img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bridgewater/scala-notebook/HEAD/server/src/main/assets/thirdparty/static/bootstrap/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/jquery/css/base/images/animated-overlay.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bridgewater/scala-notebook/HEAD/server/src/main/assets/thirdparty/static/jquery/css/base/images/animated-overlay.gif -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/bootstrap-icon/img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bridgewater/scala-notebook/HEAD/server/src/main/assets/thirdparty/static/bootstrap-icon/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /project/plugins.sbt: -------------------------------------------------------------------------------- 1 | resolvers += Resolver.url( 2 | "sbt-plugin-releases", 3 | url("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/") 4 | )(Resolver.ivyStylePatterns) 5 | 6 | addSbtPlugin("com.untyped" %% "sbt-js" % "0.6") -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/jquery/css/base/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bridgewater/scala-notebook/HEAD/server/src/main/assets/thirdparty/static/jquery/css/base/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/jquery/css/base/images/ui-icons_2e83ff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bridgewater/scala-notebook/HEAD/server/src/main/assets/thirdparty/static/jquery/css/base/images/ui-icons_2e83ff_256x240.png -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/jquery/css/base/images/ui-icons_454545_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bridgewater/scala-notebook/HEAD/server/src/main/assets/thirdparty/static/jquery/css/base/images/ui-icons_454545_256x240.png -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/jquery/css/base/images/ui-icons_888888_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bridgewater/scala-notebook/HEAD/server/src/main/assets/thirdparty/static/jquery/css/base/images/ui-icons_888888_256x240.png -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/jquery/css/base/images/ui-icons_cd0a0a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bridgewater/scala-notebook/HEAD/server/src/main/assets/thirdparty/static/jquery/css/base/images/ui-icons_cd0a0a_256x240.png -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/jquery/css/base/images/ui-bg_flat_0_aaaaaa_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bridgewater/scala-notebook/HEAD/server/src/main/assets/thirdparty/static/jquery/css/base/images/ui-bg_flat_0_aaaaaa_40x100.png -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/jquery/css/base/images/ui-bg_flat_75_ffffff_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bridgewater/scala-notebook/HEAD/server/src/main/assets/thirdparty/static/jquery/css/base/images/ui-bg_flat_75_ffffff_40x100.png -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/jquery/css/base/images/ui-bg_glass_55_fbf9ee_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bridgewater/scala-notebook/HEAD/server/src/main/assets/thirdparty/static/jquery/css/base/images/ui-bg_glass_55_fbf9ee_1x400.png -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/jquery/css/base/images/ui-bg_glass_65_ffffff_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bridgewater/scala-notebook/HEAD/server/src/main/assets/thirdparty/static/jquery/css/base/images/ui-bg_glass_65_ffffff_1x400.png -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/jquery/css/base/images/ui-bg_glass_75_dadada_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bridgewater/scala-notebook/HEAD/server/src/main/assets/thirdparty/static/jquery/css/base/images/ui-bg_glass_75_dadada_1x400.png -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/jquery/css/base/images/ui-bg_glass_75_e6e6e6_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bridgewater/scala-notebook/HEAD/server/src/main/assets/thirdparty/static/jquery/css/base/images/ui-bg_glass_75_e6e6e6_1x400.png -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/jquery/css/base/images/ui-bg_glass_95_fef1ec_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bridgewater/scala-notebook/HEAD/server/src/main/assets/thirdparty/static/jquery/css/base/images/ui-bg_glass_95_fef1ec_1x400.png -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/bootstrap-icon/README.txt: -------------------------------------------------------------------------------- 1 | Bootstrap 2.1, just icon stuff. 2 | 3 | Downloaded by Chris Yang, 8/22/12 at http://twitter.github.com/bootstrap/customize.html (only Base CSS > Icons selected, all other options set to default). -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/jquery/css/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bridgewater/scala-notebook/HEAD/server/src/main/assets/thirdparty/static/jquery/css/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png -------------------------------------------------------------------------------- /subprocess/src/test/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=trace, rolling 2 | 3 | log4j.appender.rolling=org.apache.log4j.ConsoleAppender 4 | log4j.appender.rolling.ImmediateFlush=true 5 | log4j.appender.rolling.layout=org.apache.log4j.PatternLayout 6 | log4j.appender.rolling.layout.ConversionPattern=%d %5p [%t] (%c) - %m%n 7 | -------------------------------------------------------------------------------- /kernel/src/main/scala/HackIMain.scala: -------------------------------------------------------------------------------- 1 | package scala.tools.nsc 2 | package interpreter 3 | 4 | /** 5 | * Subclass to access some hidden things I need and also some custom behavior. 6 | */ 7 | class HackIMain(settings: Settings, out: JPrintWriter) extends IMain(settings, out) { 8 | def previousRequests = prevRequestList 9 | } 10 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/rpm/spec/spec.css: -------------------------------------------------------------------------------- 1 | .cm-s-default span.cm-preamble {color: #b26818; font-weight: bold;} 2 | .cm-s-default span.cm-macro {color: #b218b2;} 3 | .cm-s-default span.cm-section {color: green; font-weight: bold;} 4 | .cm-s-default span.cm-script {color: red;} 5 | .cm-s-default span.cm-issue {color: yellow;} 6 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror_README.txt: -------------------------------------------------------------------------------- 1 | 2 | CodeMirror 3 | 4 | 2.32, downloaded by Chris Yang 8/8/2012. 5 | 6 | We didn't apply the python patch (referenced in README-IPython.rst) but we added a CSS theme (iPython) to the theme directory, so that won't match. Otherwise, it should exactly the same as downloading from the internet and unzipping. -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/tiddlywiki/tiddlywiki.css: -------------------------------------------------------------------------------- 1 | span.cm-underlined { 2 | text-decoration: underline; 3 | } 4 | span.cm-strikethrough { 5 | text-decoration: line-through; 6 | } 7 | span.cm-brace { 8 | color: #170; 9 | font-weight: bold; 10 | } 11 | span.cm-table { 12 | color: blue; 13 | font-weight: bold; 14 | } 15 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/README.md: -------------------------------------------------------------------------------- 1 | # CodeMirror 2 2 | 3 | CodeMirror is a JavaScript component that provides a code editor in 4 | the browser. When a mode is available for the language you are coding 5 | in, it will color your code, and optionally help with indentation. 6 | 7 | The project page is http://codemirror.net 8 | The manual is at http://codemirror.net/doc/manual.html 9 | -------------------------------------------------------------------------------- /server/src/main/resources/com/bwater/notebook/server/init.sc: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Bridgewater Associates, LP 3 | * 4 | * Distributed under the terms of the Modified BSD License. The full license is in 5 | * the file COPYING, distributed as part of this software. 6 | */ 7 | 8 | import com.bwater.notebook._, widgets._ 9 | import net.liftweb.json.JsonAST.JArray 10 | import net.liftweb.json.JsonDSL._ 11 | 12 | -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/bootstrap/version.txt: -------------------------------------------------------------------------------- 1 | Downloaded by RH 2012-10-15. Version 2.1.1. 2 | 3 | Excludes: 4 | Normalize and reset 5 | Body type and links 6 | Headings, body, etc 7 | Code and pre 8 | Labels and badges 9 | Forms 10 | Custom settings: 11 | @sansFontFamily: 'Whitney Book', 'Helvetica Neue', Helvetica, sans-serif 12 | @monoFontFamily: Menlo, Monaco, Consolas, 'Courier New', monospace 13 | -------------------------------------------------------------------------------- /subprocess/src/test/scala/com/bwater/notebook/EchoActor.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Bridgewater Associates, LP 3 | * 4 | * Distributed under the terms of the Modified BSD License. The full license is in 5 | * the file COPYING, distributed as part of this software. 6 | */ 7 | 8 | package com.bwater.notebook 9 | 10 | import akka.actor.Actor 11 | 12 | class EchoActor extends Actor { 13 | def receive = { 14 | case x ⇒ sender ! x 15 | } 16 | } -------------------------------------------------------------------------------- /kernel/src/main/scala/com/bwater/notebook/kernel/render.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Bridgewater Associates, LP 3 | * 4 | * Distributed under the terms of the Modified BSD License. The full license is in 5 | * the file COPYING, distributed as part of this software. 6 | */ 7 | 8 | package com.bwater.notebook.kernel 9 | 10 | import com.bwater.notebook.Renderer 11 | 12 | object render { 13 | def apply[A](a: A)(implicit renderer: Renderer[A]) = renderer.render(a) 14 | } -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/test/mode_test.css: -------------------------------------------------------------------------------- 1 | .mt-output .mt-token { 2 | border: 1px solid #ddd; 3 | white-space: pre; 4 | font-family: "Consolas", monospace; 5 | text-align: center; 6 | } 7 | 8 | .mt-output .mt-style { 9 | font-size: x-small; 10 | } 11 | 12 | .mt-test { 13 | border-left: 10px solid #fff; 14 | } 15 | 16 | .mt-pass { 17 | border-left: 10px solid #cfc; 18 | } 19 | 20 | .mt-fail { 21 | border-left: 10px solid #fcc; 22 | } 23 | -------------------------------------------------------------------------------- /subprocess/src/main/resources/test-server.conf: -------------------------------------------------------------------------------- 1 | akka { 2 | event-handlers = ["akka.event.slf4j.Slf4jEventHandler"] 3 | loglevel = "DEBUG" 4 | actor { 5 | provider = "akka.remote.RemoteActorRefProvider" 6 | } 7 | remote { 8 | transport = "akka.remote.netty.NettyRemoteTransport" 9 | netty { 10 | hostname = "127.0.0.1" 11 | port = 0 12 | } 13 | log-sent-messages = on 14 | log-received-messages = on 15 | } 16 | } 17 | 18 | 19 | -------------------------------------------------------------------------------- /subprocess/src/main/scala/com/bwater/notebook/kernel/pfork/ChildProcessMain.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Bridgewater Associates, LP 3 | * 4 | * Distributed under the terms of the Modified BSD License. The full license is in 5 | * the file COPYING, distributed as part of this software. 6 | */ 7 | 8 | package com.bwater.notebook.kernel.pfork; 9 | 10 | public final class ChildProcessMain { 11 | public static void main(String[] args) { 12 | BetterFork$.MODULE$.main(args); 13 | } 14 | } -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/lib/util/simple-hint.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-completions { 2 | position: absolute; 3 | z-index: 10; 4 | overflow: hidden; 5 | -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2); 6 | -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2); 7 | box-shadow: 2px 3px 5px rgba(0,0,0,.2); 8 | } 9 | .CodeMirror-completions select { 10 | background: #fafafa; 11 | outline: none; 12 | border: none; 13 | padding: 0; 14 | margin: 0; 15 | font-family: monospace; 16 | } 17 | -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/curl/plugin/bundle.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This is a curl.js plugin for defining collections of resources that can be depended upon all at once. 3 | * 4 | * @author ryan.hendrickson 5 | */ 6 | define({ 7 | load: function (resourceName, req, callback, config) { 8 | if (resourceName in config.bundles) { 9 | curl(config.bundles[resourceName]).then(callback, function (ex) { throw ex; }); 10 | } else throw new Error('bundle ' + resourceName + ' is not defined'); 11 | } 12 | }); -------------------------------------------------------------------------------- /server/src/main/scala/ReqLogger.scala: -------------------------------------------------------------------------------- 1 | package com.bwater.notebook 2 | import unfiltered.request._ 3 | import unfiltered.response.Pass 4 | import util.Logging 5 | 6 | /** 7 | * Author: Ken 8 | */ 9 | 10 | class ReqLogger extends Logging { 11 | val intent:unfiltered.netty.cycle.Plan.Intent = { 12 | case req@GET(Path(p)) => 13 | logInfo("GET " + req.uri) 14 | Pass 15 | case req@POST(Path(p) & Params(params)) => 16 | logInfo("POST %s: %s".format(p, params)) 17 | Pass 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /server/src/main/scala/KernelMessage.scala: -------------------------------------------------------------------------------- 1 | package com.bwater.notebook 2 | package server 3 | 4 | import com.bwater.notebook.client.CalcRequest 5 | import net.liftweb.json._ 6 | 7 | /** 8 | * Author: Ken 9 | */ 10 | trait KernelMessage 11 | case object RestartKernel extends KernelMessage 12 | case object Shutdown extends KernelMessage 13 | 14 | trait CalcServiceMessage 15 | case class SessionRequest(header: JValue, session: JValue, kernelRequest: CalcRequest) extends CalcServiceMessage 16 | case object InterruptCalculator extends CalcServiceMessage 17 | 18 | -------------------------------------------------------------------------------- /observable/src/main/scala/com/bwater/notebook/ObservableMessage.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Bridgewater Associates, LP 3 | * 4 | * Distributed under the terms of the Modified BSD License. The full license is in 5 | * the file COPYING, distributed as part of this software. 6 | */ 7 | 8 | package com.bwater.notebook 9 | 10 | import net.liftweb.json._ 11 | 12 | trait ObservableMessage 13 | case class ObservableBrowserToVM(id: String, newValue: JValue) extends ObservableMessage 14 | case class ObservableVMToBrowser(id: String, update: JValue) extends ObservableMessage 15 | 16 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/theme/neat.css: -------------------------------------------------------------------------------- 1 | .cm-s-neat span.cm-comment { color: #a86; } 2 | .cm-s-neat span.cm-keyword { line-height: 1em; font-weight: bold; color: blue; } 3 | .cm-s-neat span.cm-string { color: #a22; } 4 | .cm-s-neat span.cm-builtin { line-height: 1em; font-weight: bold; color: #077; } 5 | .cm-s-neat span.cm-special { line-height: 1em; font-weight: bold; color: #0aa; } 6 | .cm-s-neat span.cm-variable { color: black; } 7 | .cm-s-neat span.cm-number, .cm-s-neat span.cm-atom { color: #3a3; } 8 | .cm-s-neat span.cm-meta {color: #555;} 9 | .cm-s-neat span.cm-link { color: #3a3; } 10 | -------------------------------------------------------------------------------- /common/src/main/scala/com/bwater/notebook/As.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Bridgewater Associates, LP 3 | * 4 | * Distributed under the terms of the Modified BSD License. The full license is in 5 | * the file COPYING, distributed as part of this software. 6 | */ 7 | 8 | package com.bwater.notebook 9 | 10 | import scalaz._, Scalaz._ 11 | 12 | case class As[P[_], A](self: P[A]) extends syntax.Ops[P[A]] 13 | 14 | object As { 15 | implicit def pureToAs[P[_], A](a: A)(implicit P: Applicative[P]): As[P, A] = As[P, A](P.pure(a)) 16 | implicit def identityToAs[P[_], A](a: P[A]): As[P, A] = As[P, A](a) 17 | } 18 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/tiki/tiki.css: -------------------------------------------------------------------------------- 1 | .cm-tw-syntaxerror { 2 | color: #FFFFFF; 3 | background-color: #990000; 4 | } 5 | 6 | .cm-tw-deleted { 7 | text-decoration: line-through; 8 | } 9 | 10 | .cm-tw-header5 { 11 | font-weight: bold; 12 | } 13 | .cm-tw-listitem:first-child { /*Added first child to fix duplicate padding when highlighting*/ 14 | padding-left: 10px; 15 | } 16 | 17 | .cm-tw-box { 18 | border-top-width: 0px ! important; 19 | border-style: solid; 20 | border-width: 1px; 21 | border-color: inherit; 22 | } 23 | 24 | .cm-tw-underline { 25 | text-decoration: underline; 26 | } -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/lib/util/dialog.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-dialog { 2 | position: relative; 3 | } 4 | 5 | .CodeMirror-dialog > div { 6 | position: absolute; 7 | top: 0; left: 0; right: 0; 8 | background: white; 9 | border-bottom: 1px solid #eee; 10 | z-index: 15; 11 | padding: .1em .8em; 12 | overflow: hidden; 13 | color: #333; 14 | } 15 | 16 | .CodeMirror-dialog input { 17 | border: none; 18 | outline: none; 19 | background: transparent; 20 | width: 20em; 21 | color: inherit; 22 | font-family: monospace; 23 | } 24 | 25 | .CodeMirror-dialog button { 26 | font-size: 70%; 27 | } -------------------------------------------------------------------------------- /subprocess/src/test/resources/subprocess-test.conf: -------------------------------------------------------------------------------- 1 | akka { 2 | event-handlers = ["akka.event.slf4j.Slf4jEventHandler"] 3 | loglevel = "DEBUG" 4 | daemonic = true 5 | 6 | actor { 7 | provider = "akka.remote.RemoteActorRefProvider" 8 | 9 | default-stash-dispatcher { 10 | mailbox-type = "akka.dispatch.UnboundedDequeBasedMailbox" 11 | } 12 | } 13 | remote { 14 | transport = "akka.remote.netty.NettyRemoteTransport" 15 | netty { 16 | hostname = "127.0.0.1" 17 | port = 0 18 | message-frame-size = 1 GiB 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /server/src/main/scala/LayoutTools.scala: -------------------------------------------------------------------------------- 1 | package com.bwater.notebook 2 | package server 3 | 4 | import java.net.URLEncoder 5 | 6 | /** 7 | * Global variables available to all templates 8 | */ 9 | 10 | object LayoutTools { 11 | def static_url(path: String) = "/static/" + path 12 | 13 | // Items that will eventually move into the app 14 | val base_project_url = "/" 15 | val base_kernel_url = "/" 16 | val base_observable_url = "observable" // TODO: Ugh... 17 | val read_only = false 18 | val mathjax_url = "" // http://cdn.mathjax.org/mathjax/latest/MathJax.js" 19 | 20 | def encode(text: String) = URLEncoder.encode(text, "UTF-8") 21 | 22 | } 23 | -------------------------------------------------------------------------------- /kernel/src/main/scala/com/bwater/notebook/kernel/TestStringCompletor.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Bridgewater Associates, LP 3 | * 4 | * Distributed under the terms of the Modified BSD License. The full license is in 5 | * the file COPYING, distributed as part of this software. 6 | */ 7 | 8 | package com.bwater.notebook.kernel 9 | 10 | import com.bwater.notebook.{Match, StringCompletor} 11 | 12 | class TestStringCompletor extends StringCompletor { 13 | def complete(stringToComplete: String) = (stringToComplete, if (stringToComplete.toLowerCase.startsWith("usa")) Seq("usacpi", "usangdp").map(Match(_, Map("Location" -> "InflationEstimate/master"))) else Seq()) 14 | } 15 | -------------------------------------------------------------------------------- /server/src/main/resources/log4j.server.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=debug, rolling, console 2 | 3 | log4j.appender.rolling=org.apache.log4j.RollingFileAppender 4 | log4j.appender.rolling.File=logs/sn-server.log 5 | log4j.appender.rolling.ImmediateFlush=true 6 | log4j.appender.rolling.MaxFileSize=10MB 7 | log4j.appender.rolling.MaxBackupIndex=10 8 | log4j.appender.rolling.layout=org.apache.log4j.PatternLayout 9 | log4j.appender.rolling.layout.ConversionPattern=%d %5p [%t] (%c) - %m%n 10 | 11 | log4j.appender.console=org.apache.log4j.ConsoleAppender 12 | log4j.appender.console.layout=org.apache.log4j.PatternLayout 13 | log4j.appender.console.layout.ConversionPattern=%d %5p [%t] (%c) - %m%n -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/theme/elegant.css: -------------------------------------------------------------------------------- 1 | .cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom {color: #762;} 2 | .cm-s-elegant span.cm-comment {color: #262; font-style: italic; line-height: 1em;} 3 | .cm-s-elegant span.cm-meta {color: #555; font-style: italic; line-height: 1em;} 4 | .cm-s-elegant span.cm-variable {color: black;} 5 | .cm-s-elegant span.cm-variable-2 {color: #b11;} 6 | .cm-s-elegant span.cm-qualifier {color: #555;} 7 | .cm-s-elegant span.cm-keyword {color: #730;} 8 | .cm-s-elegant span.cm-builtin {color: #30a;} 9 | .cm-s-elegant span.cm-error {background-color: #fdd;} 10 | .cm-s-elegant span.cm-link {color: #762;} 11 | -------------------------------------------------------------------------------- /subprocess/src/main/resources/log4j.subprocess.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=debug, console, rolling 2 | 3 | log4j.appender.console=org.apache.log4j.ConsoleAppender 4 | log4j.appender.console.layout=org.apache.log4j.PatternLayout 5 | log4j.appender.console.layout.ConversionPattern=%d %5p [%t] (%c) - %m%n 6 | 7 | log4j.appender.rolling=org.apache.log4j.RollingFileAppender 8 | log4j.appender.rolling.File=logs/sn-session.log 9 | log4j.appender.rolling.ImmediateFlush=true 10 | log4j.appender.rolling.MaxFileSize=10MB 11 | log4j.appender.rolling.MaxBackupIndex=10 12 | log4j.appender.rolling.layout=org.apache.log4j.PatternLayout 13 | log4j.appender.rolling.layout.ConversionPattern=%d %5p [%t] (%c) - %m%n 14 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/js/pagemain.js: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Copyright (C) 2008-2011 The IPython Development Team 3 | // 4 | // Distributed under the terms of the BSD License. The full license is in 5 | // the file COPYING, distributed as part of this software. 6 | //---------------------------------------------------------------------------- 7 | 8 | //============================================================================ 9 | // On document ready 10 | //============================================================================ 11 | 12 | 13 | $(document).ready(function () { 14 | 15 | IPython.page = new IPython.Page(); 16 | IPython.page.show(); 17 | 18 | }); 19 | 20 | -------------------------------------------------------------------------------- /kernel/src/main/scala/com/bwater/notebook/kernel/StringCompletorResolver.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Bridgewater Associates, LP 3 | * 4 | * Distributed under the terms of the Modified BSD License. The full license is in 5 | * the file COPYING, distributed as part of this software. 6 | */ 7 | 8 | package com.bwater.notebook.kernel 9 | 10 | //import org.clapper.util.classutil.ClassUtil 11 | import com.bwater.notebook.StringCompletor 12 | 13 | object StringCompletorResolver { 14 | lazy val completor = { 15 | val className = "com.bwater.notebook.kernel.completor.FileCompletor" 16 | //ClassUtil.instantiateClass(className).asInstanceOf[StringCompletor] 17 | Class.forName(className).getConstructor().newInstance().asInstanceOf[StringCompletor] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/xquery/test/testEmptySequenceKeyword.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function(){ 2 | module("testEmptySequenceKeyword"); 3 | test("testEmptySequenceKeyword", function() { 4 | expect(1); 5 | 6 | var input = '"foo" instance of empty-sequence()'; 7 | var expected = '"foo" instance of empty-sequence()'; 8 | 9 | $("#sandbox").html(''); 10 | var editor = CodeMirror.fromTextArea($("#editor")[0]); 11 | var result = $(".CodeMirror-lines div div pre")[0].innerHTML; 12 | 13 | equal(result, expected); 14 | $("#editor").html(""); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/rpm/changes/changes.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("changes", function(config, modeConfig) { 2 | var headerSeperator = /^-+$/; 3 | var headerLine = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ?\d{1,2} \d{2}:\d{2}(:\d{2})? [A-Z]{3,4} \d{4} - /; 4 | var simpleEmail = /^[\w+.-]+@[\w.-]+/; 5 | 6 | return { 7 | token: function(stream) { 8 | if (stream.sol()) { 9 | if (stream.match(headerSeperator)) { return 'tag'; } 10 | if (stream.match(headerLine)) { return 'tag'; } 11 | } 12 | if (stream.match(simpleEmail)) { return 'string'; } 13 | stream.next(); 14 | return null; 15 | } 16 | }; 17 | }); 18 | 19 | CodeMirror.defineMIME("text/x-rpm-changes", "changes"); 20 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/js/logoutmain.js: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Copyright (C) 2008-2011 The IPython Development Team 3 | // 4 | // Distributed under the terms of the BSD License. The full license is in 5 | // the file COPYING, distributed as part of this software. 6 | //---------------------------------------------------------------------------- 7 | 8 | //============================================================================ 9 | // On document ready 10 | //============================================================================ 11 | 12 | 13 | $(document).ready(function () { 14 | 15 | IPython.page = new IPython.Page(); 16 | $('div#main_app').addClass('border-box-sizing ui-widget'); 17 | IPython.page.show(); 18 | 19 | }); 20 | 21 | -------------------------------------------------------------------------------- /kernel/src/main/scala/com/bwater/notebook/kernel/EvaluationResult.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Bridgewater Associates, LP 3 | * 4 | * Distributed under the terms of the Modified BSD License. The full license is in 5 | * the file COPYING, distributed as part of this software. 6 | */ 7 | 8 | package com.bwater.notebook.kernel 9 | 10 | import xml.NodeSeq 11 | 12 | /** 13 | * Result of evaluating something in the REPL. 14 | * 15 | * The difference between Incomplete and Failure is Incomplete means 16 | * the expression failed to compile whereas Failure means an exception 17 | * was thrown during executing the code. 18 | */ 19 | sealed abstract class EvaluationResult 20 | 21 | case object Incomplete extends EvaluationResult 22 | case class Failure(stackTrace: String) extends EvaluationResult 23 | case class Success(result: NodeSeq) extends EvaluationResult 24 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/diff/diff.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("diff", function() { 2 | 3 | var TOKEN_NAMES = { 4 | '+': 'tag', 5 | '-': 'string', 6 | '@': 'meta' 7 | }; 8 | 9 | return { 10 | token: function(stream) { 11 | var tw_pos = stream.string.search(/[\t ]+?$/); 12 | 13 | if (!stream.sol() || tw_pos === 0) { 14 | stream.skipToEnd(); 15 | return ("error " + ( 16 | TOKEN_NAMES[stream.string.charAt(0)] || '')).replace(/ $/, ''); 17 | } 18 | 19 | var token_name = TOKEN_NAMES[stream.peek()] || stream.skipToEnd(); 20 | 21 | if (tw_pos === -1) { 22 | stream.skipToEnd(); 23 | } else { 24 | stream.pos = tw_pos; 25 | } 26 | 27 | return token_name; 28 | } 29 | }; 30 | }); 31 | 32 | CodeMirror.defineMIME("text/x-diff", "diff"); 33 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/xquery/test/testProcessingInstructions.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function(){ 2 | module("testProcessingInstructions"); 3 | test("testProcessingInstructions", function() { 4 | expect(1); 5 | 6 | var input = 'data() instance of xs:string'; 7 | var expected = 'data(<?target content?>) instance of xs:string'; 8 | 9 | $("#sandbox").html(''); 10 | var editor = CodeMirror.fromTextArea($("#editor")[0]); 11 | var result = $(".CodeMirror-lines div div pre")[0].innerHTML; 12 | 13 | equal(result, expected); 14 | $("#editor").html(""); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /common/src/main/scala/com/bwater/notebook/StringCompletor.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Bridgewater Associates, LP 3 | * 4 | * Distributed under the terms of the Modified BSD License. The full license is in 5 | * the file COPYING, distributed as part of this software. 6 | */ 7 | 8 | package com.bwater.notebook 9 | 10 | import net.liftweb.json.JsonAST.{JString, JField, JObject} 11 | 12 | /** 13 | * Pluggable interface for completing Strings. 14 | */ 15 | 16 | case class Match(matchedValue: String, metadata: Map[String, String]) { 17 | def toJson = JObject(JField("completion", JString(matchedValue)) :: (metadata.map { case (name, value) => JField(name, JString(value)) } toList)) 18 | } 19 | 20 | object Match { 21 | def apply(matchedValue: String): Match = Match(matchedValue, Map()) 22 | } 23 | 24 | trait StringCompletor { 25 | def complete(stringToComplete: String): (String, Seq[Match]) 26 | } 27 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/xquery/test/testMultiAttr.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function(){ 2 | module("testMultiAttr"); 3 | test("test1", function() { 4 | expect(1); 5 | 6 | var expected = '<p a1="foo" a2="bar">hello world</p>'; 7 | 8 | $("#sandbox").html(''); 9 | $("#editor").html('

hello world

'); 10 | var editor = CodeMirror.fromTextArea($("#editor")[0]); 11 | var result = $(".CodeMirror-lines div div pre")[0].innerHTML; 12 | 13 | equal(result, expected); 14 | $("#editor").html(""); 15 | }); 16 | }); -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/js/loginmain.js: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Copyright (C) 2008-2011 The IPython Development Team 3 | // 4 | // Distributed under the terms of the BSD License. The full license is in 5 | // the file COPYING, distributed as part of this software. 6 | //---------------------------------------------------------------------------- 7 | 8 | //============================================================================ 9 | // On document ready 10 | //============================================================================ 11 | 12 | 13 | $(document).ready(function () { 14 | 15 | IPython.page = new IPython.Page(); 16 | $('input#login_submit').button(); 17 | $('div#main_app').addClass('border-box-sizing ui-widget'); 18 | IPython.page.show(); 19 | $('input#password_input').focus(); 20 | 21 | }); 22 | 23 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "CodeMirror", 3 | "version":"2.32.0", 4 | "main": "codemirror.js", 5 | "description": "In-browser code editing made bearable", 6 | "licenses": [ 7 | { 8 | "type": "MIT", 9 | "url": "http://codemirror.net/LICENSE" 10 | } 11 | ], 12 | "directories": { 13 | "lib": "./lib" 14 | }, 15 | "bugs": "http://github.com/marijnh/CodeMirror2/issues", 16 | "keywords": ["JavaScript", "CodeMirror", "Editor"], 17 | "homepage": "http://codemirror.net", 18 | "maintainers":[ { 19 | "name": "Marijn Haverbeke", 20 | "email": "marijnh@gmail.com", 21 | "web": "http://codemirror.net" 22 | }], 23 | "repositories": [ 24 | { 25 | "type": "git", 26 | "url": "https://github.com/marijnh/CodeMirror2.git" 27 | } 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/prettify/prettify.css: -------------------------------------------------------------------------------- 1 | .pln{ 2 | color:#000 3 | } 4 | 5 | @media screen{ 6 | .str{ 7 | color:#BA2121; 8 | }.kwd{ 9 | color:#008000; 10 | font-weight: bold; 11 | }.com{ 12 | color:#408080; 13 | font-style: italic; 14 | }.typ{ 15 | color:#606 16 | }.lit{ 17 | color:#666666; 18 | }.pun,.opn,.clo{ 19 | }.tag{ 20 | color:#008 21 | }.atn{ 22 | color:#606 23 | }.atv{ 24 | color:#080 25 | }.dec,.var{ 26 | color:#606 27 | }.fun{ 28 | color:red 29 | } 30 | } 31 | 32 | pre.prettyprint{ 33 | padding:2px; 34 | border:1px solid #888 35 | } 36 | 37 | ol.linenums{ 38 | margin-top:0; 39 | margin-bottom:0 40 | } 41 | 42 | li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{ 43 | list-style-type:none 44 | } 45 | 46 | li.L1,li.L3,li.L5,li.L7,li.L9{ 47 | background:#eee 48 | } -------------------------------------------------------------------------------- /subprocess/src/main/resources/kernel.conf: -------------------------------------------------------------------------------- 1 | akka { 2 | event-handlers = ["akka.event.slf4j.Slf4jEventHandler"] 3 | 4 | # Debugging: 5 | loglevel = DEBUG 6 | # log-config-on-start = on 7 | debug { 8 | ## enable function of LoggingReceive, which is to log any received message at DEBUG level 9 | # receive = on 10 | ## enable DEBUG logging of all AutoReceiveMessages (Kill, PoisonPill and the like) 11 | # autoreceive = on 12 | ## enable DEBUG logging of actor lifecycle changes 13 | # lifecycle = on 14 | } 15 | 16 | daemonic = true 17 | actor { 18 | provider = "akka.remote.RemoteActorRefProvider" 19 | } 20 | remote { 21 | ## Debugging: 22 | # log-sent-messages = on 23 | # log-received-messages = on 24 | 25 | transport = "akka.remote.netty.NettyRemoteTransport" 26 | netty { 27 | hostname = "127.0.0.1" 28 | port = 0 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /common/src/main/scala/com/bwater/notebook/widgets/InputBox.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Bridgewater Associates, LP 3 | * 4 | * Distributed under the terms of the Modified BSD License. The full license is in 5 | * the file COPYING, distributed as part of this software. 6 | */ 7 | 8 | package com.bwater.notebook.widgets 9 | 10 | import net.liftweb.json.JsonDSL._ 11 | import net.liftweb.json.JsonAST.{JString, JValue} 12 | import com.bwater.notebook._ 13 | 14 | 15 | class InputBox(initial: String) extends Widget { 16 | private[this] val connection = JSBus.createConnection 17 | val currentValue = connection biMap JsonCodec.strings 18 | 19 | currentValue <-- Connection.just(initial) 20 | 21 | lazy val toHtml = { 22 | scopedScript( 23 | "require(['observable', 'knockout'], function (Observable, ko) { ko.applyBindings({ value: Observable.makeObservable(valueId) }, this); })", 24 | ("valueId" -> connection.id) 25 | ) 26 | } 27 | } -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/js/namespace.js: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Copyright (C) 2008-2011 The IPython Development Team 3 | // 4 | // Distributed under the terms of the BSD License. The full license is in 5 | // the file COPYING, distributed as part of this software. 6 | //---------------------------------------------------------------------------- 7 | 8 | var IPython = IPython || {}; 9 | 10 | IPython.namespace = function (ns_string) { 11 | var parts = ns_string.split('.'), 12 | parent = IPython, 13 | i; 14 | 15 | // String redundant leading global 16 | if (parts[0] === "IPython") { 17 | parts = parts.slice(1); 18 | } 19 | 20 | for (i=0; i header) ~ 26 | ("msg_type" -> msgType) ~ 27 | ("msg_id" -> UUID.randomUUID().toString) ~ 28 | ("content" -> content) ~ 29 | ("header" -> ("username" -> "kernel") ~ 30 | ("session" -> session) ~ 31 | ("msg_id" -> UUID.randomUUID().toString) ~ 32 | ("msg_type" -> msgType)) 33 | 34 | send(pretty(render(respJson))) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/pascal/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 souceLair 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/theme/cobalt.css: -------------------------------------------------------------------------------- 1 | .cm-s-cobalt { background: #002240; color: white; } 2 | .cm-s-cobalt div.CodeMirror-selected { background: #b36539 !important; } 3 | .cm-s-cobalt .CodeMirror-gutter { background: #002240; border-right: 1px solid #aaa; } 4 | .cm-s-cobalt .CodeMirror-gutter-text { color: #d0d0d0; } 5 | .cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white !important; } 6 | 7 | .cm-s-cobalt span.cm-comment { color: #08f; } 8 | .cm-s-cobalt span.cm-atom { color: #845dc4; } 9 | .cm-s-cobalt span.cm-number, .cm-s-cobalt span.cm-attribute { color: #ff80e1; } 10 | .cm-s-cobalt span.cm-keyword { color: #ffee80; } 11 | .cm-s-cobalt span.cm-string { color: #3ad900; } 12 | .cm-s-cobalt span.cm-meta { color: #ff9d00; } 13 | .cm-s-cobalt span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #9effff; } 14 | .cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def { color: white; } 15 | .cm-s-cobalt span.cm-error { color: #9d1e15; } 16 | .cm-s-cobalt span.cm-bracket { color: #d8d8d8; } 17 | .cm-s-cobalt span.cm-builtin, .cm-s-cobalt span.cm-special { color: #ff9e59; } 18 | .cm-s-cobalt span.cm-link { color: #845dc4; } 19 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/ntriples/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: NTriples mode 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |

CodeMirror: NTriples mode

17 |
18 | 25 |
26 | 27 | 30 |

MIME types defined: text/n-triples.

31 | 32 | 33 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/demo/resize.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Autoresize Demo 5 | 6 | 7 | 8 | 9 | 10 | 20 | 21 | 22 |

CodeMirror: Autoresize demo

23 | 24 |
30 | 31 |

By setting a few CSS properties, CodeMirror can be made to 32 | automatically resize to fit its content.

33 | 34 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/theme/eclipse.css: -------------------------------------------------------------------------------- 1 | .cm-s-eclipse span.cm-meta {color: #FF1717;} 2 | .cm-s-eclipse span.cm-keyword { line-height: 1em; font-weight: bold; color: #7F0055; } 3 | .cm-s-eclipse span.cm-atom {color: #219;} 4 | .cm-s-eclipse span.cm-number {color: #164;} 5 | .cm-s-eclipse span.cm-def {color: #00f;} 6 | .cm-s-eclipse span.cm-variable {color: black;} 7 | .cm-s-eclipse span.cm-variable-2 {color: #0000C0;} 8 | .cm-s-eclipse span.cm-variable-3 {color: #0000C0;} 9 | .cm-s-eclipse span.cm-property {color: black;} 10 | .cm-s-eclipse span.cm-operator {color: black;} 11 | .cm-s-eclipse span.cm-comment {color: #3F7F5F;} 12 | .cm-s-eclipse span.cm-string {color: #2A00FF;} 13 | .cm-s-eclipse span.cm-string-2 {color: #f50;} 14 | .cm-s-eclipse span.cm-error {color: #f00;} 15 | .cm-s-eclipse span.cm-qualifier {color: #555;} 16 | .cm-s-eclipse span.cm-builtin {color: #30a;} 17 | .cm-s-eclipse span.cm-bracket {color: #cc7;} 18 | .cm-s-eclipse span.cm-tag {color: #170;} 19 | .cm-s-eclipse span.cm-attribute {color: #00c;} 20 | .cm-s-eclipse span.cm-link {color: #219;} 21 | 22 | .cm-s-eclipse .CodeMirror-matchingbracket { 23 | border:1px solid grey; 24 | color:black !important;; 25 | } 26 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/python/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2010 Timothy Farrell 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/xquery/test/testQuotes.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function(){ 2 | module("testQuoteEscape"); 3 | test("testQuoteEscapeDouble", function() { 4 | expect(1); 5 | 6 | var input = 'let $rootfolder := "c:\\builds\\winnt\\HEAD\\qa\\scripts\\"\ 7 | let $keysfolder := concat($rootfolder, "keys\\")\ 8 | return\ 9 | $keysfolder'; 10 | var expected = 'let $rootfolder := "c:\\builds\\winnt\\HEAD\\qa\\scripts\\"let $keysfolder := concat($rootfolder, "keys\\")return$keysfolder'; 11 | 12 | $("#sandbox").html(''); 13 | var editor = CodeMirror.fromTextArea($("#editor")[0]); 14 | var result = $(".CodeMirror-lines div div pre")[0].innerHTML; 15 | 16 | equal(result, expected); 17 | $("#editor").html(""); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/js/events.js: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Copyright (C) 2008-2011 The IPython Development Team 3 | // 4 | // Distributed under the terms of the BSD License. The full license is in 5 | // the file COPYING, distributed as part of this software. 6 | //---------------------------------------------------------------------------- 7 | 8 | //============================================================================ 9 | // Events 10 | //============================================================================ 11 | 12 | // Give us an object to bind all events to. This object should be created 13 | // before all other objects so it exists when others register event handlers. 14 | // To trigger an event handler: 15 | // $([IPython.events]).trigger('event.Namespace); 16 | // To handle it: 17 | // $([IPython.events]).on('event.Namespace',function () {}); 18 | 19 | var IPython = (function (IPython) { 20 | 21 | var utils = IPython.utils; 22 | 23 | var Events = function () {}; 24 | 25 | IPython.Events = Events; 26 | IPython.events = new Events(); 27 | 28 | return IPython; 29 | 30 | }(IPython)); 31 | 32 | -------------------------------------------------------------------------------- /server/src/main/resources/reference.conf: -------------------------------------------------------------------------------- 1 | notebook { 2 | 3 | ### 4 | # Uncomment to enable attachment of a remote debugger (you will likely either need to change the port on the line below, or configure your debugger to connect to the specified port) 5 | #vmArgs=["-agentlib:jdwp=transport=dt_socket,address=localhost:9000,server=y,suspend=y"] 6 | 7 | ### 8 | # Working directory for kernel VMs 9 | #kernel.dir=. 10 | 11 | ### 12 | # Server dir (containing notebook files) 13 | #notebooks.dir=. 14 | 15 | ### 16 | # List of URLs of kernel init scripts (to be run when a kernel first starts). 17 | #kernel.init=[] 18 | 19 | ### 20 | # Kernel VM memory settings 21 | #heap=4g 22 | #permGen=128m 23 | 24 | ### 25 | # Static resources to be made available on the web server 26 | # You may add your own resource directories 27 | # Paths may be relative to the server root, or absolute. 28 | #resources=["./my-resources"] 29 | 30 | ### 31 | # Classpath for kernel VMs (defaults to server VM classpath) 32 | #kernel.classpath=[] 33 | 34 | ### 35 | # REPL compiler options 36 | #compilerArgs=[] 37 | 38 | } -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/perl/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2011 by Sabaca under the MIT license. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/xquery/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2011 by MarkLogic Corporation 2 | Author: Mike Brevoort 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/vb/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2012 Codility Limited, 107 Cheapside, London EC2V 6DN, UK 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/theme/night.css: -------------------------------------------------------------------------------- 1 | /* Loosely based on the Midnight Textmate theme */ 2 | 3 | .cm-s-night { background: #0a001f; color: #f8f8f8; } 4 | .cm-s-night div.CodeMirror-selected { background: #447 !important; } 5 | .cm-s-night .CodeMirror-gutter { background: #0a001f; border-right: 1px solid #aaa; } 6 | .cm-s-night .CodeMirror-gutter-text { color: #f8f8f8; } 7 | .cm-s-night .CodeMirror-cursor { border-left: 1px solid white !important; } 8 | 9 | .cm-s-night span.cm-comment { color: #6900a1; } 10 | .cm-s-night span.cm-atom { color: #845dc4; } 11 | .cm-s-night span.cm-number, .cm-s-night span.cm-attribute { color: #ffd500; } 12 | .cm-s-night span.cm-keyword { color: #599eff; } 13 | .cm-s-night span.cm-string { color: #37f14a; } 14 | .cm-s-night span.cm-meta { color: #7678e2; } 15 | .cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { color: #99b2ff; } 16 | .cm-s-night span.cm-variable-3, .cm-s-night span.cm-def { color: white; } 17 | .cm-s-night span.cm-error { color: #9d1e15; } 18 | .cm-s-night span.cm-bracket { color: #8da6ce; } 19 | .cm-s-night span.cm-comment { color: #6900a1; } 20 | .cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; } 21 | .cm-s-night span.cm-link { color: #845dc4; } 22 | -------------------------------------------------------------------------------- /observable/src/main/scala/com/bwater/notebook/ObservableHandler.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Bridgewater Associates, LP 3 | * 4 | * Distributed under the terms of the Modified BSD License. The full license is in 5 | * the file COPYING, distributed as part of this software. 6 | */ 7 | 8 | package com.bwater.notebook 9 | 10 | import akka.actor.{ActorRef, Actor} 11 | import org.slf4j.LoggerFactory 12 | 13 | /** 14 | * Actor that handles updates from a client and triggers the proper Scala EventStreams and 15 | * vice versa. 16 | * 17 | * Only one of these Handlers is intended to exist in a VM at a time. On construction, it will 18 | * set the JSBus publisher to itself. 19 | */ 20 | class ObservableHandler(proxy: ActorRef) extends Actor { 21 | 22 | JSBusState.setPublisher((id, value) => proxy ! ObservableVMToBrowser(id, value)) 23 | 24 | val log = LoggerFactory.getLogger(getClass()) 25 | 26 | log.info("Obs handler is ready") 27 | 28 | def receive = { 29 | case ObservableBrowserToVM(obsId, newValue) => 30 | try { 31 | log.info("Forwarding message to " + obsId) 32 | JSBus.forwardClientUpdateMessage(obsId, newValue) 33 | } catch { 34 | case e: Exception => e.printStackTrace() 35 | } 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/jinja2/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Jinja2 mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

CodeMirror: Jinja2 mode

13 |
31 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /kernel/src/main/scala/com/bwater/notebook/kernel/completor/FileCompletor.scala: -------------------------------------------------------------------------------- 1 | package com.bwater.notebook.kernel.completor 2 | 3 | import java.io.File 4 | 5 | import com.bwater.notebook.{Match, StringCompletor} 6 | import org.apache.commons.io.FileUtils 7 | 8 | /** 9 | * Auto-completes file paths based on the current directory 10 | */ 11 | class FileCompletor extends StringCompletor { 12 | def complete(stringToComplete: String): (String, Seq[Match]) = { 13 | val filesInCurrentDirectory = listFiles 14 | 15 | val matches = for { 16 | candidateFile <- filesInCurrentDirectory if normalize(candidateFile).startsWith(normalize(stringToComplete)) 17 | } yield { 18 | val f = new File(candidateFile) 19 | 20 | val metadata = Map("Path" -> f.getAbsolutePath) 21 | val extraMetadata = if (f.isDirectory) { Map ("Type" -> "Directory") } else { Map("Size" -> FileUtils.byteCountToDisplaySize(f.length())) } 22 | 23 | Match(candidateFile.toString, metadata ++ extraMetadata) 24 | } 25 | 26 | (stringToComplete, matches) 27 | } 28 | 29 | private def normalize(x: String) = x.trim.toLowerCase 30 | 31 | protected def listFiles: Seq[String] = { 32 | val currentDirectory = new File(".") 33 | currentDirectory.list.toSeq 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/coffeescript/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2011 Jeff Pickhardt 4 | Modified from the Python CodeMirror mode, Copyright (c) 2010 Timothy Farrell 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/theme/monokai.css: -------------------------------------------------------------------------------- 1 | /* Based on Sublime Text's Monokai theme */ 2 | 3 | .cm-s-monokai {background: #272822; color: #f8f8f2;} 4 | .cm-s-monokai div.CodeMirror-selected {background: #49483E !important;} 5 | .cm-s-monokai .CodeMirror-gutter {background: #272822; border-right: 0px;} 6 | .cm-s-monokai .CodeMirror-gutter-text {color: #d0d0d0;} 7 | .cm-s-monokai .CodeMirror-cursor {border-left: 1px solid #f8f8f0 !important;} 8 | 9 | .cm-s-monokai span.cm-comment {color: #75715e;} 10 | .cm-s-monokai span.cm-atom {color: #ae81ff;} 11 | .cm-s-monokai span.cm-number {color: #ae81ff;} 12 | 13 | .cm-s-monokai span.cm-property, .cm-s-monokai span.cm-attribute {color: #a6e22e;} 14 | .cm-s-monokai span.cm-keyword {color: #f92672;} 15 | .cm-s-monokai span.cm-string {color: #e6db74;} 16 | 17 | .cm-s-monokai span.cm-variable {color: #a6e22e;} 18 | .cm-s-monokai span.cm-variable-2 {color: #9effff;} 19 | .cm-s-monokai span.cm-def {color: #fd971f;} 20 | .cm-s-monokai span.cm-error {background: #f92672; color: #f8f8f0;} 21 | .cm-s-monokai span.cm-bracket {color: #f8f8f2;} 22 | .cm-s-monokai span.cm-tag {color: #f92672;} 23 | .cm-s-monokai span.cm-link {color: #ae81ff;} 24 | 25 | .cm-s-monokai .CodeMirror-matchingbracket { 26 | text-decoration: underline; 27 | color: white !important; 28 | } 29 | -------------------------------------------------------------------------------- /observable/src/main/scala/com/bwater/notebook/Observer.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Bridgewater Associates, LP 3 | * 4 | * Distributed under the terms of the Modified BSD License. The full license is in 5 | * the file COPYING, distributed as part of this software. 6 | */ 7 | 8 | package com.bwater.notebook 9 | 10 | /** 11 | * Author: Ken 12 | */ 13 | trait Observer[T] extends rx.Observer[T] { 14 | def map[A](fxn: A=>T): Observer[A] = new MappingObserver[T,A]{ def innerObserver = Observer.this; def observerMapper = fxn } 15 | def <--(other: Observable[T]): Unit = { 16 | other.subscribe(this) 17 | } 18 | } 19 | 20 | /** 21 | * A no-op observer, useful for extending just the methods you want 22 | * @tparam T 23 | */ 24 | trait ConcreteObserver[T] extends Observer[T] { 25 | def onCompleted() {} 26 | 27 | def onError(e: Exception) {} 28 | 29 | def onNext(args: T) {} 30 | } 31 | 32 | class NoopObserver[T] extends ConcreteObserver[T] 33 | 34 | trait MappingObserver[A,B] extends Observer[B] { 35 | protected def innerObserver: Observer[A] 36 | 37 | protected def observerMapper: B=>A 38 | 39 | def onCompleted() {innerObserver.onCompleted()} 40 | 41 | def onError(e: Exception) {innerObserver.onError(e)} 42 | 43 | def onNext(args: B) {innerObserver.onNext(observerMapper(args))} 44 | } 45 | 46 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/rust/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Rust mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

CodeMirror: Rust mode

13 | 14 |
37 | 38 | 45 | 46 |

MIME types defined: text/x-rustsrc.

47 | 48 | 49 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/xquery/test/index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |

XQuery CodeMirror Mode

21 |

22 |

23 |
    24 |
25 |
26 | 27 | 28 | -------------------------------------------------------------------------------- /server/src/main/assets/thirdparty/static/jquery/js/jquery.autogrow.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Auto Grow Textarea Plugin 3 | * by Jevin 5/11/2010 4 | * http://www.technoreply.com/autogrow-textarea-plugin/ 5 | * 6 | * Modified by Rob G (aka Fudgey/Mottie) 7 | * - Converted into a plugin 8 | * - Added ability to calculate approximate # cols when textarea is set to 100% 9 | * 10 | * Simplified by Brian Granger on 5/2/2011 11 | */ 12 | 13 | (function($) { 14 | $.fn.autogrow = function() { 15 | 16 | var grow = function(d) { 17 | var linesCount = 0; 18 | // modified split rule from 19 | // http://stackoverflow.com/questions/2035910/how-to-get-the-number-of-lines-in-a-textarea/2036424#2036424 20 | var lines = d.txt.value.split(/\r|\r\n|\n/); 21 | linesCount = lines.length; 22 | if (linesCount >= d.rowsDefault) { 23 | d.txt.rows = linesCount; 24 | } else { 25 | d.txt.rows = d.rowsDefault; 26 | } 27 | }; 28 | 29 | return this.each(function() { 30 | var d = { 31 | colsDefault : 0, 32 | rowsDefault : 1, 33 | txt : this, 34 | $txt : $(this) 35 | }; 36 | d.txt.onkeyup = function() { 37 | grow(d); 38 | }; 39 | grow(d); 40 | }); 41 | }; 42 | })(jQuery); 43 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/js/printnotebookmain.js: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Copyright (C) 2008-2011 The IPython Development Team 3 | // 4 | // Distributed under the terms of the BSD License. The full license is in 5 | // the file COPYING, distributed as part of this software. 6 | //---------------------------------------------------------------------------- 7 | 8 | //============================================================================ 9 | // On document ready 10 | //============================================================================ 11 | 12 | 13 | $(document).ready(function () { 14 | 15 | IPython.init_mathjax(); 16 | 17 | IPython.read_only = $('body').data('readOnly') === 'True'; 18 | $('div#main_app').addClass('border-box-sizing ui-widget'); 19 | $('div#notebook_panel').addClass('border-box-sizing ui-widget'); 20 | 21 | IPython.page = new IPython.Page(); 22 | IPython.markdown_converter = new Markdown.Converter(); 23 | IPython.login_widget = new IPython.LoginWidget('span#login_widget'); 24 | IPython.notebook = new IPython.Notebook('div#notebook'); 25 | IPython.page.show_site(); 26 | 27 | var body = $('body'); 28 | IPython.notebook.load_notebook(body.data('notebookName'), body.data('notebookId')); 29 | }); 30 | 31 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/css/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: CSS mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

CodeMirror: CSS mode

13 |
48 | 51 | 52 |

MIME types defined: text/css.

53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/ecl/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: ECL mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

CodeMirror: ECL mode

13 |
31 | 37 | 38 |

Based on CodeMirror's clike mode. For more information see HPCC Systems web site.

39 |

MIME types defined: text/x-ecl.

40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2012 by Marijn Haverbeke 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | 21 | Please note that some subdirectories of the CodeMirror distribution 22 | include their own LICENSE files, and are released under different 23 | licences. 24 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/theme/erlang-dark.css: -------------------------------------------------------------------------------- 1 | .cm-s-erlang-dark { background: #002240; color: white; } 2 | .cm-s-erlang-dark div.CodeMirror-selected { background: #b36539 !important; } 3 | .cm-s-erlang-dark .CodeMirror-gutter { background: #002240; border-right: 1px solid #aaa; } 4 | .cm-s-erlang-dark .CodeMirror-gutter-text { color: #d0d0d0; } 5 | .cm-s-erlang-dark .CodeMirror-cursor { border-left: 1px solid white !important; } 6 | 7 | .cm-s-erlang-dark span.cm-atom { color: #845dc4; } 8 | .cm-s-erlang-dark span.cm-attribute { color: #ff80e1; } 9 | .cm-s-erlang-dark span.cm-bracket { color: #ff9d00; } 10 | .cm-s-erlang-dark span.cm-builtin { color: #eeaaaa; } 11 | .cm-s-erlang-dark span.cm-comment { color: #7777ff; } 12 | .cm-s-erlang-dark span.cm-def { color: #ee77aa; } 13 | .cm-s-erlang-dark span.cm-error { color: #9d1e15; } 14 | .cm-s-erlang-dark span.cm-keyword { color: #ffee80; } 15 | .cm-s-erlang-dark span.cm-meta { color: #50fefe; } 16 | .cm-s-erlang-dark span.cm-number { color: #ffd0d0; } 17 | .cm-s-erlang-dark span.cm-operator { color: #dd1111; } 18 | .cm-s-erlang-dark span.cm-string { color: #3ad900; } 19 | .cm-s-erlang-dark span.cm-tag { color: #9effff; } 20 | .cm-s-erlang-dark span.cm-variable { color: #50fe50; } 21 | .cm-s-erlang-dark span.cm-variable-2 { color: #ee00ee; } 22 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/css/projectdashboard.css: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Primary styles 4 | * 5 | * Author: IPython Development Team 6 | */ 7 | 8 | #main_app { 9 | width: 920px; 10 | margin: 30px auto 0px auto; 11 | } 12 | 13 | #tabs { 14 | border-style: none; 15 | } 16 | 17 | #tab1, #tab2 { 18 | padding: 1em 0em; 19 | } 20 | 21 | .list_toolbar { 22 | padding: 5px; 23 | height: 25px; 24 | line-height: 25px; 25 | } 26 | 27 | .toolbar_info { 28 | float: left; 29 | } 30 | 31 | .toolbar_buttons { 32 | float: right; 33 | } 34 | 35 | .list_header { 36 | height: 25px; 37 | line-height: 25px; 38 | padding: 3px 5px; 39 | } 40 | 41 | 42 | 43 | .list_item { 44 | height: 25px; 45 | line-height: 25px; 46 | padding: 3px 5px; 47 | } 48 | 49 | .notebook_item a { 50 | text-decoration: none; 51 | } 52 | 53 | .profile_col { 54 | } 55 | 56 | .status_col { 57 | float: right; 58 | width: 325px; 59 | } 60 | 61 | .engines_col { 62 | float: right; 63 | width: 325px; 64 | } 65 | 66 | .action_col { 67 | float: right; 68 | } 69 | 70 | .item_buttons { 71 | float: right; 72 | } 73 | 74 | .item_buttons .upload_button { 75 | color: darkred; 76 | } 77 | 78 | .highlight_text { 79 | color: blue; 80 | } 81 | 82 | .ui-tabs .ui-tabs-nav li a { 83 | padding: .3em .5em; 84 | } 85 | -------------------------------------------------------------------------------- /server/src/main/resources/notebook-server.conf: -------------------------------------------------------------------------------- 1 | akka { 2 | event-handlers = ["akka.event.slf4j.Slf4jEventHandler"] 3 | loglevel = "DEBUG" 4 | daemonic = true 5 | 6 | debug { 7 | ## enable function of LoggingReceive, which is to log any received message at DEBUG level 8 | # receive = on 9 | ## enable DEBUG logging of all AutoReceiveMessages (Kill, PoisonPill and the like) 10 | # autoreceive = on 11 | ## enable DEBUG logging of actor lifecycle changes 12 | # lifecycle = on 13 | } 14 | 15 | actor { 16 | provider = "akka.remote.RemoteActorRefProvider" 17 | 18 | default-stash-dispatcher { 19 | mailbox-type = "akka.dispatch.UnboundedDequeBasedMailbox" 20 | } 21 | } 22 | remote { 23 | ## Debugging: 24 | # log-sent-messages = on 25 | # log-received-messages = on 26 | 27 | transport = "akka.remote.netty.NettyRemoteTransport" 28 | netty { 29 | hostname = "127.0.0.1" 30 | port = 0 // Set to 0 to allow multiple server instances on a single machine... 31 | message-frame-size = 1 GiB 32 | 33 | // secure-cookie = "" // If unset, and require-cookie is 'on', a cookie is generated at runtime. 34 | require-cookie = on 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/mysql/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: MySQL mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

CodeMirror: MySQL mode

13 |
30 | 37 | 38 |

MIME types defined: text/x-mysql.

39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/pig/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Pig Latin mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

CodeMirror: Pig Latin mode

13 | 14 |
26 | 27 | 35 | 36 |

37 | Simple mode that handles Pig Latin language. 38 |

39 | 40 |

MIME type defined: text/x-pig 41 | (PIG code) 42 | 43 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/pascal/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Pascal mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

CodeMirror: Pascal mode

13 | 14 |
37 | 38 | 45 | 46 |

MIME types defined: text/x-pascal.

47 | 48 | 49 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/theme/blackboard.css: -------------------------------------------------------------------------------- 1 | /* Port of TextMate's Blackboard theme */ 2 | 3 | .cm-s-blackboard { background: #0C1021; color: #F8F8F8; } 4 | .cm-s-blackboard .CodeMirror-selected { background: #253B76 !important; } 5 | .cm-s-blackboard .CodeMirror-gutter { background: #0C1021; border-right: 0; } 6 | .cm-s-blackboard .CodeMirror-gutter-text { color: #888; } 7 | .cm-s-blackboard .CodeMirror-cursor { border-left: 1px solid #A7A7A7 !important; } 8 | 9 | .cm-s-blackboard .cm-keyword { color: #FBDE2D; } 10 | .cm-s-blackboard .cm-atom { color: #D8FA3C; } 11 | .cm-s-blackboard .cm-number { color: #D8FA3C; } 12 | .cm-s-blackboard .cm-def { color: #8DA6CE; } 13 | .cm-s-blackboard .cm-variable { color: #FF6400; } 14 | .cm-s-blackboard .cm-operator { color: #FBDE2D;} 15 | .cm-s-blackboard .cm-comment { color: #AEAEAE; } 16 | .cm-s-blackboard .cm-string { color: #61CE3C; } 17 | .cm-s-blackboard .cm-string-2 { color: #61CE3C; } 18 | .cm-s-blackboard .cm-meta { color: #D8FA3C; } 19 | .cm-s-blackboard .cm-error { background: #9D1E15; color: #F8F8F8; } 20 | .cm-s-blackboard .cm-builtin { color: #8DA6CE; } 21 | .cm-s-blackboard .cm-tag { color: #8DA6CE; } 22 | .cm-s-blackboard .cm-attribute { color: #8DA6CE; } 23 | .cm-s-blackboard .cm-header { color: #FF6400; } 24 | .cm-s-blackboard .cm-hr { color: #AEAEAE; } 25 | .cm-s-blackboard .cm-link { color: #8DA6CE; } 26 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/vbscript/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: VBScript mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

CodeMirror: VBScript mode

13 | 14 |
31 | 32 | 38 | 39 |

MIME types defined: text/vbscript.

40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/properties/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Properties files mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

CodeMirror: Properties files mode

13 |
32 | 35 | 36 |

MIME types defined: text/x-properties, 37 | text/x-ini.

38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/sparql/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: SPARQL mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

CodeMirror: SPARQL mode

13 |
29 | 36 | 37 |

MIME types defined: application/x-sparql-query.

38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/theme/rubyblue.css: -------------------------------------------------------------------------------- 1 | .cm-s-rubyblue { font:13px/1.4em Trebuchet, Verdana, sans-serif; } /* - customized editor font - */ 2 | 3 | .cm-s-rubyblue { background: #112435; color: white; } 4 | .cm-s-rubyblue div.CodeMirror-selected { background: #38566F !important; } 5 | .cm-s-rubyblue .CodeMirror-gutter { background: #1F4661; border-right: 7px solid #3E7087; min-width:2.5em; } 6 | .cm-s-rubyblue .CodeMirror-gutter-text { color: white; } 7 | .cm-s-rubyblue .CodeMirror-cursor { border-left: 1px solid white !important; } 8 | 9 | .cm-s-rubyblue span.cm-comment { color: #999; font-style:italic; line-height: 1em; } 10 | .cm-s-rubyblue span.cm-atom { color: #F4C20B; } 11 | .cm-s-rubyblue span.cm-number, .cm-s-rubyblue span.cm-attribute { color: #82C6E0; } 12 | .cm-s-rubyblue span.cm-keyword { color: #F0F; } 13 | .cm-s-rubyblue span.cm-string { color: #F08047; } 14 | .cm-s-rubyblue span.cm-meta { color: #F0F; } 15 | .cm-s-rubyblue span.cm-variable-2, .cm-s-rubyblue span.cm-tag { color: #7BD827; } 16 | .cm-s-rubyblue span.cm-variable-3, .cm-s-rubyblue span.cm-def { color: white; } 17 | .cm-s-rubyblue span.cm-error { color: #AF2018; } 18 | .cm-s-rubyblue span.cm-bracket { color: #F0F; } 19 | .cm-s-rubyblue span.cm-link { color: #F4C20B; } 20 | .cm-s-rubyblue span.CodeMirror-matchingbracket { color:#F0F !important; } 21 | .cm-s-rubyblue span.cm-builtin, .cm-s-rubyblue span.cm-special { color: #FF9D00; } 22 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/demo/matchhighlighter.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Match Highlighter Demo 5 | 6 | 7 | 8 | 9 | 10 | 11 | 17 | 18 | 19 |

CodeMirror: Match Highlighter Demo

20 | 21 |
24 | 25 | 33 | 34 |

Highlight matches of selected text on select

35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/demo/loadmode.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Lazy Mode Loading Demo 5 | 6 | 7 | 8 | 9 | 10 | 13 | 14 | 15 |

CodeMirror: Lazy Mode Loading

16 | 17 |
22 |

23 | 24 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/test/driver.js: -------------------------------------------------------------------------------- 1 | var tests = [], runOnly = null; 2 | 3 | function Failure(why) {this.message = why;} 4 | 5 | function test(name, run) {tests.push({name: name, func: run}); return name;} 6 | function testCM(name, run, opts) { 7 | return test(name, function() { 8 | var place = document.getElementById("testground"), cm = CodeMirror(place, opts); 9 | try {run(cm);} 10 | finally {place.removeChild(cm.getWrapperElement());} 11 | }); 12 | } 13 | 14 | function runTests(callback) { 15 | function step(i) { 16 | if (i == tests.length) return callback("done"); 17 | var test = tests[i]; 18 | if (runOnly != null && runOnly != test.name) return step(i + 1); 19 | try {test.func(); callback("ok", test.name);} 20 | catch(e) { 21 | if (e instanceof Failure) 22 | callback("fail", test.name, e.message); 23 | else 24 | callback("error", test.name, e.toString()); 25 | } 26 | setTimeout(function(){step(i + 1);}, 20); 27 | } 28 | step(0); 29 | } 30 | 31 | function eq(a, b, msg) { 32 | if (a != b) throw new Failure(a + " != " + b + (msg ? " (" + msg + ")" : "")); 33 | } 34 | function eqPos(a, b, msg) { 35 | if (a == b) return; 36 | if (a == null || b == null) throw new Failure("comparing point to null"); 37 | eq(a.line, b.line, msg); 38 | eq(a.ch, b.ch, msg); 39 | } 40 | function is(a, msg) { 41 | if (!a) throw new Failure("assertion failed" + (msg ? " (" + msg + ")" : "")); 42 | } 43 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/keymap/emacs.js: -------------------------------------------------------------------------------- 1 | // TODO number prefixes 2 | (function() { 3 | // Really primitive kill-ring implementation. 4 | var killRing = []; 5 | function addToRing(str) { 6 | killRing.push(str); 7 | if (killRing.length > 50) killRing.shift(); 8 | } 9 | function getFromRing() { return killRing[killRing.length - 1] || ""; } 10 | function popFromRing() { if (killRing.length > 1) killRing.pop(); return getFromRing(); } 11 | 12 | CodeMirror.keyMap.emacs = { 13 | "Ctrl-X": function(cm) {cm.setOption("keyMap", "emacs-Ctrl-X");}, 14 | "Ctrl-W": function(cm) {addToRing(cm.getSelection()); cm.replaceSelection("");}, 15 | "Ctrl-Alt-W": function(cm) {addToRing(cm.getSelection()); cm.replaceSelection("");}, 16 | "Alt-W": function(cm) {addToRing(cm.getSelection());}, 17 | "Ctrl-Y": function(cm) {cm.replaceSelection(getFromRing());}, 18 | "Alt-Y": function(cm) {cm.replaceSelection(popFromRing());}, 19 | "Ctrl-/": "undo", "Shift-Ctrl--": "undo", "Shift-Alt-,": "goDocStart", "Shift-Alt-.": "goDocEnd", 20 | "Ctrl-S": "findNext", "Ctrl-R": "findPrev", "Ctrl-G": "clearSearch", "Shift-Alt-5": "replace", 21 | "Ctrl-Z": "undo", "Cmd-Z": "undo", "Alt-/": "autocomplete", 22 | fallthrough: ["basic", "emacsy"] 23 | }; 24 | 25 | CodeMirror.keyMap["emacs-Ctrl-X"] = { 26 | "Ctrl-S": "save", "Ctrl-W": "save", "S": "saveAll", "F": "open", "U": "undo", "K": "close", 27 | auto: "emacs", nofallthrough: true 28 | }; 29 | })(); 30 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/perl/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Perl mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

CodeMirror: Perl mode

13 | 14 |
52 | 53 | 59 | 60 |

MIME types defined: text/x-perl.

61 | 62 | 63 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/shell/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Shell mode 4 | 5 | 6 | 7 | 8 | 11 | 12 | 13 | 14 | 15 |

CodeMirror: Shell mode

16 | 17 | 41 | 42 | 49 | 50 |

MIME types defined: text/x-sh.

51 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/theme/vibrant-ink.css: -------------------------------------------------------------------------------- 1 | /* Taken from the popular Visual Studio Vibrant Ink Schema */ 2 | 3 | .cm-s-vibrant-ink { background: black; color: white; } 4 | .cm-s-vibrant-ink .CodeMirror-selected { background: #35493c !important; } 5 | 6 | .cm-s-vibrant-ink .CodeMirror-gutter { background: #002240; border-right: 1px solid #aaa; } 7 | .cm-s-vibrant-ink .CodeMirror-gutter-text { color: #d0d0d0; } 8 | .cm-s-vibrant-ink .CodeMirror-cursor { border-left: 1px solid white !important; } 9 | 10 | .cm-s-vibrant-ink .cm-keyword { color: #CC7832; } 11 | .cm-s-vibrant-ink .cm-atom { color: #FC0; } 12 | .cm-s-vibrant-ink .cm-number { color: #FFEE98; } 13 | .cm-s-vibrant-ink .cm-def { color: #8DA6CE; } 14 | .cm-s-vibrant-ink span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #FFC66D } 15 | .cm-s-vibrant-ink span.cm-variable-3, .cm-s-cobalt span.cm-def { color: #FFC66D } 16 | .cm-s-vibrant-ink .cm-operator { color: #888; } 17 | .cm-s-vibrant-ink .cm-comment { color: gray; font-weight: bold; } 18 | .cm-s-vibrant-ink .cm-string { color: #A5C25C } 19 | .cm-s-vibrant-ink .cm-string-2 { color: red } 20 | .cm-s-vibrant-ink .cm-meta { color: #D8FA3C; } 21 | .cm-s-vibrant-ink .cm-error { border-bottom: 1px solid red; } 22 | .cm-s-vibrant-ink .cm-builtin { color: #8DA6CE; } 23 | .cm-s-vibrant-ink .cm-tag { color: #8DA6CE; } 24 | .cm-s-vibrant-ink .cm-attribute { color: #8DA6CE; } 25 | .cm-s-vibrant-ink .cm-header { color: #FF6400; } 26 | .cm-s-vibrant-ink .cm-hr { color: #AEAEAE; } 27 | .cm-s-vibrant-ink .cm-link { color: blue; } 28 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/gfm/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: GFM mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |

CodeMirror: GFM mode

17 | 18 | 19 |
36 | 37 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /4.+Completions.snb: -------------------------------------------------------------------------------- 1 | { 2 | "metadata":{ 3 | "name":"4. Completions", 4 | "user_save_timestamp":"2015-02-07T17:16:05.795Z", 5 | "auto_save_timestamp":"2015-02-07T17:15:53.510Z" 6 | }, 7 | "worksheets":[{ 8 | "cells":[{ 9 | "cell_type":"markdown", 10 | "source":"## Completions\n\nScala Notebook supports help auto-complete options to make writing code less painful." 11 | },{ 12 | "cell_type":"code", 13 | "input":"// Put caret at the end of the line and hit Tab. Should auto-complete to \"notebook\". Add a period and\n// hit tab again. A dropdown of possible completions will appeaar.\ncom.bwater.note", 14 | "language":"scala", 15 | "collapsed":true, 16 | "outputs":[] 17 | },{ 18 | "cell_type":"code", 19 | "input":"// Type a left paren and wait. Method signature information will appear.\nsys.error", 20 | "language":"scala", 21 | "collapsed":true, 22 | "outputs":[] 23 | },{ 24 | "cell_type":"code", 25 | "input":"// Type a left paren and wait. Method overloads will appear as well.\nConsole.println", 26 | "language":"scala", 27 | "collapsed":true, 28 | "outputs":[] 29 | },{ 30 | "cell_type":"code", 31 | "input":"// SN can also complete String literals.\n// Hit tab -- a list of files and directory starting with the letter s in the current \n// working directory will appear.\nnew File(\"s", 32 | "language":"scala", 33 | "collapsed":true, 34 | "outputs":[] 35 | }] 36 | }], 37 | "autosaved":[], 38 | "nbformat":3 39 | } -------------------------------------------------------------------------------- /observable/src/main/scala/com/bwater/notebook/ObsWebSocketService.scala: -------------------------------------------------------------------------------- 1 | package com.bwater.notebook 2 | 3 | import scala.concurrent._ 4 | import akka.actor._ 5 | import scala.concurrent.duration._ 6 | import unfiltered.netty.websockets.WebSocket 7 | import akka.actor.Deploy 8 | import net.liftweb.json._, JsonDSL._ 9 | 10 | /** 11 | * Author: Ken 12 | */ 13 | class ObsWebSocketService(system: ActorSystem, val webSock: WebSocket, remoteDeployFuture: Future[Deploy]) { 14 | 15 | val obsActor = system.actorOf(Props(new LocalActor)) 16 | 17 | class LocalActor extends Actor with ActorLogging { 18 | var remote: ActorRef = null 19 | 20 | override def preStart() { 21 | val remoteDeploy = Await.result(remoteDeployFuture, 2 minutes) 22 | remote = context.actorOf(Props[ObsServiceRemoteActor].withDeploy(remoteDeploy)) 23 | } 24 | 25 | def receive = { 26 | case msg@ObservableBrowserToVM(id, newValue) => 27 | remote ! msg 28 | case ObservableVMToBrowser(id, value) => 29 | val respJson = ("id" -> id) ~ ("new_value" -> value) 30 | webSock.send(pretty(render(respJson))) 31 | } 32 | } 33 | 34 | } 35 | 36 | 37 | 38 | class ObsServiceRemoteActor extends Actor with ActorLogging { 39 | override def preStart() { 40 | JSBusState.setPublisher((id, value) => self ! ObservableVMToBrowser(id, value)) 41 | } 42 | 43 | def receive = { 44 | case ObservableBrowserToVM(id, newValue) => JSBus.forwardClientUpdateMessage(id, newValue) 45 | case msg: ObservableVMToBrowser => context.parent ! msg 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/jinja2/jinja2.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("jinja2", function(config, parserConf) { 2 | var keywords = ["block", "endblock", "for", "endfor", "in", "true", "false", 3 | "loop", "none", "self", "super", "if", "as", "not", "and", 4 | "else", "import", "with", "without", "context"]; 5 | keywords = new RegExp("^((" + keywords.join(")|(") + "))\\b"); 6 | 7 | function tokenBase (stream, state) { 8 | var ch = stream.next(); 9 | if (ch == "{") { 10 | if (ch = stream.eat(/\{|%|#/)) { 11 | stream.eat("-"); 12 | state.tokenize = inTag(ch); 13 | return "tag"; 14 | } 15 | } 16 | } 17 | function inTag (close) { 18 | if (close == "{") { 19 | close = "}"; 20 | } 21 | return function (stream, state) { 22 | var ch = stream.next(); 23 | if ((ch == close || (ch == "-" && stream.eat(close))) 24 | && stream.eat("}")) { 25 | state.tokenize = tokenBase; 26 | return "tag"; 27 | } 28 | if (stream.match(keywords)) { 29 | return "keyword"; 30 | } 31 | return close == "#" ? "comment" : "string"; 32 | }; 33 | } 34 | return { 35 | startState: function () { 36 | return {tokenize: tokenBase}; 37 | }, 38 | token: function (stream, state) { 39 | return state.tokenize(stream, state); 40 | } 41 | }; 42 | }); 43 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/js/loginwidget.js: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Copyright (C) 2008-2011 The IPython Development Team 3 | // 4 | // Distributed under the terms of the BSD License. The full license is in 5 | // the file COPYING, distributed as part of this software. 6 | //---------------------------------------------------------------------------- 7 | 8 | //============================================================================ 9 | // Login button 10 | //============================================================================ 11 | 12 | var IPython = (function (IPython) { 13 | 14 | var LoginWidget = function (selector) { 15 | this.selector = selector; 16 | if (this.selector !== undefined) { 17 | this.element = $(selector); 18 | this.style(); 19 | this.bind_events(); 20 | } 21 | }; 22 | 23 | LoginWidget.prototype.style = function () { 24 | this.element.find('button#logout').button(); 25 | this.element.find('button#login').button(); 26 | }; 27 | 28 | 29 | LoginWidget.prototype.bind_events = function () { 30 | var that = this; 31 | this.element.find("button#logout").click(function () { 32 | window.location = "/logout"; 33 | }); 34 | this.element.find("button#login").click(function () { 35 | window.location = "/login"; 36 | }); 37 | }; 38 | 39 | // Set module variables 40 | IPython.LoginWidget = LoginWidget; 41 | 42 | return IPython; 43 | 44 | }(IPython)); 45 | -------------------------------------------------------------------------------- /observable/src/main/scala/com/bwater/notebook/ObservableIntent.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Bridgewater Associates, LP 3 | * 4 | * Distributed under the terms of the Modified BSD License. The full license is in 5 | * the file COPYING, distributed as part of this software. 6 | */ 7 | 8 | package com.bwater.notebook 9 | 10 | import unfiltered.netty.websockets 11 | import unfiltered.request.{Seg, Path} 12 | import akka.actor.{ActorSystem, ActorRef, ActorRefFactory} 13 | import websockets._ 14 | import net.liftweb.json.JsonAST.{JString, JField} 15 | import net.liftweb.json._ 16 | 17 | class ObservableIntent(system: ActorSystem) { 18 | 19 | val kernelIdToObsService = collection.mutable.Map[String, ObsWebSocketService]() 20 | 21 | val webSocketIntent: websockets.Intent = { 22 | case req @ Path(Seg("observable" :: contextId :: Nil)) => { 23 | case Open(socket) => 24 | for (kernel <- KernelManager.get(contextId)) { 25 | 26 | val service = new ObsWebSocketService(system, socket, kernel.remoteDeployFuture) 27 | kernelIdToObsService += contextId -> service 28 | } 29 | 30 | case Message(socket, Text(msg)) => 31 | for { 32 | json <- parseOpt(msg) 33 | service <- kernelIdToObsService.get(contextId) 34 | JField("id", JString(id)) <- json 35 | JField("new_value", value) <- json 36 | } { 37 | service.obsActor ! ObservableBrowserToVM(id, value) 38 | } 39 | 40 | case Close(_) => 41 | kernelIdToObsService.remove(contextId) 42 | 43 | case Error(s, e) => 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/demo/marker.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Breakpoint Demo 5 | 6 | 7 | 8 | 9 | 10 | 19 | 20 | 21 |

CodeMirror: Breakpoint demo

22 | 23 |
35 | 36 |

Click the line-number gutter to add or remove 'breakpoints'.

37 | 38 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/r/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011, Ubalo, Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of the Ubalo, Inc nor the names of its 12 | contributors may be used to endorse or promote products derived 13 | from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL UBALO, INC BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/pagedown/LICENSE.txt: -------------------------------------------------------------------------------- 1 | A javascript port of Markdown, as used on Stack Overflow 2 | and the rest of Stack Exchange network. 3 | 4 | Largely based on showdown.js by John Fraser (Attacklab). 5 | 6 | Original Markdown Copyright (c) 2004-2005 John Gruber 7 | 8 | 9 | 10 | Original Showdown code copyright (c) 2007 John Fraser 11 | 12 | Modifications and bugfixes (c) 2009 Dana Robinson 13 | Modifications and bugfixes (c) 2009-2011 Stack Exchange Inc. 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining a copy 16 | of this software and associated documentation files (the "Software"), to deal 17 | in the Software without restriction, including without limitation the rights 18 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | copies of the Software, and to permit persons to whom the Software is 20 | furnished to do so, subject to the following conditions: 21 | 22 | The above copyright notice and this permission notice shall be included in 23 | all copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 31 | THE SOFTWARE. 32 | 33 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/ruby/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011, Ubalo, Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of the Ubalo, Inc. nor the names of its 12 | contributors may be used to endorse or promote products derived 13 | from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL UBALO, INC BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/demo/changemode.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Mode-Changing Demo 5 | 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 |

CodeMirror: Mode-Changing demo

17 | 18 |
25 | 26 |

On changes to the content of the above editor, a (crude) script 27 | tries to auto-detect the language used, and switches the editor to 28 | either JavaScript or Scheme mode based on that.

29 | 30 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/js/projectdashboardmain.js: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Copyright (C) 2008-2011 The IPython Development Team 3 | // 4 | // Distributed under the terms of the BSD License. The full license is in 5 | // the file COPYING, distributed as part of this software. 6 | //---------------------------------------------------------------------------- 7 | 8 | //============================================================================ 9 | // On document ready 10 | //============================================================================ 11 | 12 | 13 | $(document).ready(function () { 14 | 15 | IPython.page = new IPython.Page(); 16 | 17 | $('div#tabs').tabs(); 18 | $('div#tabs').on('tabsselect', function (event, ui) { 19 | var new_url = $('body').data('baseProjectUrl') + '#' + ui.panel.id; 20 | window.history.replaceState({}, '', new_url); 21 | }); 22 | $('div#main_app').addClass('border-box-sizing ui-widget'); 23 | $('div#notebooks_toolbar').addClass('ui-widget ui-helper-clearfix'); 24 | $('#new_notebook').button().click(function (e) { 25 | var url = $('body').data('baseProjectUrl')+'new' 26 | IPython.CSRF.postAction(url) 27 | }); 28 | 29 | IPython.read_only = $('body').data('readOnly') === 'True'; 30 | IPython.notebook_list = new IPython.NotebookList('div#notebook_list'); 31 | IPython.cluster_list = new IPython.ClusterList('div#cluster_list'); 32 | IPython.login_widget = new IPython.LoginWidget('span#login_widget'); 33 | 34 | IPython.notebook_list.load_list(); 35 | IPython.cluster_list.load_list(); 36 | 37 | IPython.page.show(); 38 | 39 | }); 40 | 41 | -------------------------------------------------------------------------------- /subprocess/src/main/scala/com/bwater/notebook/kernel/remote/AkkaConfigUtils.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Bridgewater Associates, LP 3 | * 4 | * Distributed under the terms of the Modified BSD License. The full license is in 5 | * the file COPYING, distributed as part of this software. 6 | */ 7 | 8 | package com.bwater.notebook.kernel.remote 9 | 10 | import com.typesafe.config.{ConfigFactory, Config} 11 | import scala.collection.JavaConversions._ 12 | 13 | 14 | /** 15 | * 16 | */ 17 | 18 | object AkkaConfigUtils { 19 | 20 | private val SecureCookiePath = "akka.remote.netty.secure-cookie" 21 | private val RequireCookiePath = "akka.remote.netty.require-cookie" 22 | 23 | /** Creates a configuration that requires the specified secure requiredCookie if defined. */ 24 | def requireCookie(baseConfig: Config, cookie: String) = 25 | ConfigFactory.parseMap(Map( 26 | SecureCookiePath -> cookie, 27 | RequireCookiePath -> "on" 28 | )).withFallback(baseConfig) 29 | 30 | /** If the specified configuration requires a secure requiredCookie, but does not define the requiredCookie value, this generates a new config with an appropriate value. */ 31 | def optSecureCookie(baseConfig: Config, cookie: => String) = 32 | requiredCookie(baseConfig).map { 33 | req => if (req.isEmpty) { 34 | ConfigFactory.parseMap(Map(SecureCookiePath -> cookie)).withFallback(baseConfig) 35 | } else baseConfig 36 | } getOrElse baseConfig 37 | 38 | /** Returns the secure requiredCookie value if the specified Config requires their use. */ 39 | def requiredCookie(config: Config) = 40 | if (config.getBoolean(RequireCookiePath)) { 41 | Some(config.getString(SecureCookiePath)) 42 | } else None 43 | } 44 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/php/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: PHP mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |

CodeMirror: PHP mode

17 | 18 |
29 | 30 | 41 | 42 |

Simple HTML/PHP mode based on 43 | the C-like mode. Depends on XML, 44 | JavaScript, CSS, and C-like modes.

45 | 46 |

MIME types defined: application/x-httpd-php (HTML with PHP code), text/x-php (plain, non-wrapped PHP code).

47 | 48 | 49 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/smalltalk/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Smalltalk mode 5 | 6 | 7 | 8 | 9 | 14 | 15 | 16 |

CodeMirror: Smalltalk mode

17 | 18 |
41 | 42 | 50 | 51 |

Simple Smalltalk mode.

52 | 53 |

MIME types defined: text/x-stsrc.

54 | 55 | 56 | -------------------------------------------------------------------------------- /kernel/src/main/scala/com/bwater/notebook/kernel/ConfigUtils.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Bridgewater Associates, LP 3 | * 4 | * Distributed under the terms of the Modified BSD License. The full license is in 5 | * the file COPYING, distributed as part of this software. 6 | */ 7 | 8 | package com.bwater.notebook.kernel 9 | 10 | import java.io.File 11 | import com.typesafe.config.Config 12 | import collection.JavaConversions._ 13 | import com.typesafe.config.ConfigException 14 | 15 | 16 | object ConfigUtils { 17 | 18 | implicit def configToRichConfig(config: Config) = new EasyConfig(config) 19 | 20 | class EasyConfig(config: Config) { 21 | def get(key: String) = if (config.hasPath(key)) Some(config.getString(key)) else None 22 | 23 | def getArray(key: String): Option[List[String]] = { 24 | if (config.hasPath(key)) { 25 | Some(configPathAsList(config, key)) 26 | } else None 27 | } 28 | 29 | def getMem(key: String) = get(key) map parseMem 30 | } 31 | 32 | private def configPathAsList(c: Config, path: String) = { 33 | scala.util.control.Exception.allCatch.either(c.getStringList(path).toList) match { 34 | /* Read scalar value as list for backwards compat with config that has been converted from scalar to list. */ 35 | case Left(_: ConfigException.WrongType) => List(c.getString(path)) 36 | case Left(e) => throw e 37 | case Right(v) => v 38 | } 39 | } 40 | 41 | private val MemSpec = """\s*(\d+)\s*([kKmMgG]?)""".r 42 | 43 | private def parseMem(memString: String) = { 44 | val MemSpec(mem, unit) = memString 45 | mem.toLong << (unit match { 46 | case "" => 0 47 | case "k" => 10 48 | case "m" => 20 49 | case "g" => 30 50 | }) 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /observable/src/main/scala/com/bwater/notebook/Connection.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Bridgewater Associates, LP 3 | * 4 | * Distributed under the terms of the Modified BSD License. The full license is in 5 | * the file COPYING, distributed as part of this software. 6 | */ 7 | 8 | package com.bwater.notebook 9 | 10 | /** 11 | * Author: Ken 12 | * An observer and observable - mutable data that can be changed or subscribed to 13 | */ 14 | trait Connection[T] { 15 | 16 | def observable: Observable[T] 17 | def observer: Observer[T] 18 | 19 | def biMap[A](codec: Codec[T,A]): Connection[A] = new MappingConnection[T,A](Connection.this, codec) 20 | 21 | def biMap[A](aToB: A=>T, bToA: T=>A): Connection[A] = biMap[A](new Codec[T,A] { 22 | def encode(x: T) = bToA(x) 23 | def decode(x: A) = aToB(x) 24 | }) 25 | 26 | def <--(other: Connection[T]) { 27 | other.observable.subscribe(observer) 28 | } 29 | 30 | def -->(other: Connection[T]) { 31 | observable.subscribe(other.observer) 32 | } 33 | 34 | def <-->(other: Connection[T]) { 35 | this <-- other 36 | this --> other 37 | } 38 | } 39 | 40 | class ConcreteConnection[T](val observable: Observable[T], val observer: Observer[T]) extends Connection[T] 41 | 42 | object Connection { 43 | def just[T](v: T) = new ConcreteConnection[T](Observable.just(v), new NoopObserver[T]()) 44 | } 45 | 46 | class MappingConnection[A,B](inner:Connection[A], codec: Codec[A,B]) extends Connection[B] { 47 | val observable = new MappingObservable[A,B] { 48 | protected def innerObservable = inner.observable 49 | protected def observableMapper = codec.encode 50 | } 51 | 52 | val observer = new MappingObserver[A,B] { 53 | protected def innerObserver = inner.observer 54 | protected def observerMapper = codec.decode 55 | } 56 | } -------------------------------------------------------------------------------- /common/src/main/scala/com/bwater/notebook/util/Logging.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Bridgewater Associates, LP 3 | * 4 | * Distributed under the terms of the Modified BSD License. The full license is in 5 | * the file COPYING, distributed as part of this software. 6 | */ 7 | 8 | package com.bwater.notebook.util 9 | 10 | import org.slf4j.LoggerFactory 11 | 12 | trait Logging { 13 | 14 | private[this] val log = LoggerFactory.getLogger(this.getClass) 15 | 16 | protected[this] def logInfo(messageGenerator: =>String) { if (log.isInfoEnabled) log.info(messageGenerator) } 17 | protected[this] def logInfo(messageGenerator: =>String, e: Throwable) { if (log.isInfoEnabled)log.info(messageGenerator, e) } 18 | 19 | protected[this] def logDebug(messageGenerator: =>String) {if (log.isDebugEnabled) log.debug(messageGenerator) } 20 | protected[this] def logDebug(messageGenerator: =>String, e: Throwable) {if (log.isDebugEnabled) log.debug(messageGenerator, e) } 21 | 22 | protected[this] def logTrace(messageGenerator: =>String) { if (log.isTraceEnabled) log.trace(messageGenerator) } 23 | protected[this] def logTrace(messageGenerator: =>String, e: Throwable) { if (log.isTraceEnabled)log.info(messageGenerator, e) } 24 | 25 | protected[this] def logError(messageGenerator: =>String) { log.error(messageGenerator) } 26 | protected[this] def logError(messageGenerator: =>String, e: Throwable) { log.error(messageGenerator, e) } 27 | 28 | protected[this] def logWarn(messageGenerator: =>String) { log.warn(messageGenerator) } 29 | protected[this] def logWarn(messageGenerator: =>String, e: Throwable) { log.warn(messageGenerator, e) } 30 | 31 | 32 | protected[this] def ifDebugEnabled(f: => Unit) = if (log.isDebugEnabled()) f 33 | protected[this] def ifTraceEnabled(f: => Unit) = if (log.isTraceEnabled()) f 34 | } -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/demo/vim.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Vim bindings demo 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 |

CodeMirror: Vim bindings demo

19 | 20 |
35 | 36 |

The vim keybindings are enabled by 37 | including keymap/vim.js and setting 38 | the keyMap option to "vim". Because 39 | CodeMirror's internal API is quite different from Vim, they are only 40 | a loose approximation of actual vim bindings, though.

41 | 42 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/htmlmixed/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: HTML mixed mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

CodeMirror: HTML mixed mode

16 |
40 | 43 | 44 |

The HTML mixed mode depends on the XML, JavaScript, and CSS modes.

45 | 46 |

MIME types defined: text/html 47 | (redefined, only takes effect if you load this parser after the 48 | XML parser).

49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /common/src/main/scala/com/bwater/notebook/Renderer.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Bridgewater Associates, LP 3 | * 4 | * Distributed under the terms of the Modified BSD License. The full license is in 5 | * the file COPYING, distributed as part of this software. 6 | */ 7 | 8 | package com.bwater.notebook 9 | 10 | import xml.{NodeBuffer, Text, NodeSeq} 11 | import runtime.BoxedUnit 12 | 13 | /** 14 | * Typeclass for rendering objects of a specific type. Implement one of these and import it 15 | * in your notebook to change how objects of the specified type get presented after evaluation. 16 | */ 17 | trait Renderer[-A] { 18 | def render(value: A): NodeSeq 19 | } 20 | 21 | class WidgetRenderer[-A](toWidget: A => Widget) extends Renderer[A] { 22 | def render(value: A) = toWidget(value).toHtml 23 | } 24 | 25 | object Renderer extends LowPriorityRenderers { 26 | implicit object htmlAsItself extends Renderer[NodeSeq] { 27 | def render(value: NodeSeq) = value 28 | } 29 | implicit object nodeBufferAsItself extends Renderer[NodeBuffer] { 30 | def render(value: NodeBuffer) = value 31 | } 32 | implicit object widgetAsItself extends Renderer[Widget] { 33 | def render(value: Widget) = value.toHtml 34 | } 35 | implicit object stringAsItself extends Renderer[String] { 36 | def render(value: String) = Text(value) 37 | } 38 | implicit object anyValAsItself extends Renderer[AnyVal] { 39 | def render(value: AnyVal) = if (value == BoxedUnit.UNIT) NodeSeq.Empty else Text(value.toString) 40 | } 41 | } 42 | 43 | trait LowPriorityRenderers { 44 | implicit object seqAsColumn extends Renderer[Seq[_]] { 45 | def render(x: Seq[_]) = { 46 | val values = if (x.lengthCompare(25) < 0) x.map(_.toString) else x.take(24).map(_.toString) :+ "..." 47 | widgets.column(values.map(widgets.text(_)):_*) 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/xml/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: XML mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

CodeMirror: XML mode

13 |
25 | 31 |

The XML mode supports two configuration parameters:

32 |
33 |
htmlMode (boolean)
34 |
This switches the mode to parse HTML instead of XML. This 35 | means attributes do not have to be quoted, and some elements 36 | (such as br) do not require a closing tag.
37 |
alignCDATA (boolean)
38 |
Setting this to true will force the opening tag of CDATA 39 | blocks to not be indented.
40 |
41 | 42 |

MIME types defined: application/xml, text/html.

43 | 44 | 45 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/lib/util/runmode.js: -------------------------------------------------------------------------------- 1 | CodeMirror.runMode = function(string, modespec, callback, options) { 2 | var mode = CodeMirror.getMode(CodeMirror.defaults, modespec); 3 | var isNode = callback.nodeType == 1; 4 | var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize; 5 | if (isNode) { 6 | var node = callback, accum = [], col = 0; 7 | callback = function(text, style) { 8 | if (text == "\n") { 9 | accum.push("
"); 10 | col = 0; 11 | return; 12 | } 13 | var escaped = ""; 14 | // HTML-escape and replace tabs 15 | for (var pos = 0;;) { 16 | var idx = text.indexOf("\t", pos); 17 | if (idx == -1) { 18 | escaped += CodeMirror.htmlEscape(text.slice(pos)); 19 | col += text.length - pos; 20 | break; 21 | } else { 22 | col += idx - pos; 23 | escaped += CodeMirror.htmlEscape(text.slice(pos, idx)); 24 | var size = tabSize - col % tabSize; 25 | col += size; 26 | for (var i = 0; i < size; ++i) escaped += " "; 27 | pos = idx + 1; 28 | } 29 | } 30 | 31 | if (style) 32 | accum.push("" + escaped + ""); 33 | else 34 | accum.push(escaped); 35 | } 36 | } 37 | var lines = CodeMirror.splitLines(string), state = CodeMirror.startState(mode); 38 | for (var i = 0, e = lines.length; i < e; ++i) { 39 | if (i) callback("\n"); 40 | var stream = new CodeMirror.StringStream(lines[i]); 41 | while (!stream.eol()) { 42 | var style = mode.token(stream, state); 43 | callback(stream.current(), style, i, stream.start); 44 | stream.start = stream.pos; 45 | } 46 | } 47 | if (isNode) 48 | node.innerHTML = accum.join(""); 49 | }; 50 | -------------------------------------------------------------------------------- /common/src/main/scala/com/bwater/notebook/Widget.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Bridgewater Associates, LP 3 | * 4 | * Distributed under the terms of the Modified BSD License. The full license is in 5 | * the file COPYING, distributed as part of this software. 6 | */ 7 | 8 | package com.bwater.notebook 9 | 10 | import util.ClassUtils 11 | import xml.{Node, NodeSeq} 12 | import java.util.UUID 13 | import scalaz._ 14 | 15 | trait Widget extends Iterable[Node] { 16 | def toHtml: NodeSeq 17 | 18 | def iterator = toHtml.iterator 19 | 20 | def ++(other: Widget): Widget = toHtml ++ other 21 | 22 | override def toString = "<" + ClassUtils.getSimpleName(getClass) + " widget>" 23 | } 24 | 25 | class SimpleWidget(html: NodeSeq) extends Widget { 26 | def toHtml = html 27 | override def toString = "" 28 | } 29 | 30 | object Widget { 31 | implicit def toHtml(widget: Widget): NodeSeq = widget.toHtml 32 | def fromHtml(html: NodeSeq): Widget = new SimpleWidget(html) 33 | 34 | implicit def fromRenderer[A](value: A)(implicit renderer: Renderer[A]): Widget = fromHtml(renderer.render(value)) 35 | 36 | object Empty extends Widget { 37 | def toHtml = NodeSeq.Empty 38 | override def toString = "" 39 | } 40 | 41 | implicit val widgetInstances = new Monoid[Widget] { 42 | def zero = Empty 43 | def append(s1: Widget, s2: ⇒ Widget) = s1 ++ s2 44 | } 45 | 46 | // We're stripping out dashes because we want these to be valid JS identifiers. 47 | // Prepending with the "obs_" accomplishes that as well in that it forces it to 48 | // start with a letter, but it also helps make the namespace a little more 49 | // manageable. 50 | @deprecated("Avoid using IDs in widgets, to support the same widget appearing in multiple places on a page.", "1.0") 51 | def generateId = "widget_" + UUID.randomUUID().toString.replaceAll("-", "") 52 | } 53 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/plsql/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Oracle PL/SQL mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

CodeMirror: Oracle PL/SQL mode

13 | 14 |
46 | 47 | 55 | 56 |

57 | Simple mode that handles Oracle PL/SQL language (and Oracle SQL, of course). 58 |

59 | 60 |

MIME type defined: text/x-plsql 61 | (PLSQL code) 62 | 63 | -------------------------------------------------------------------------------- /common/src/main/scala/com/bwater/notebook/widgets/DropDown.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Bridgewater Associates, LP 3 | * 4 | * Distributed under the terms of the Modified BSD License. The full license is in 5 | * the file COPYING, distributed as part of this software. 6 | */ 7 | 8 | package com.bwater.notebook 9 | package widgets 10 | 11 | import com.bwater.notebook.Widget 12 | import net.liftweb.json.JsonAST.{JValue, JArray, JInt} 13 | import net.liftweb.json.JsonDSL._ 14 | import net.liftweb.json.DefaultFormats 15 | import rx.Observable 16 | 17 | class DropDown[A](options: Seq[A], toString: A=>String = (a:A)=>a.toString) extends Widget { 18 | 19 | implicit val formats = DefaultFormats // JSON formats 20 | 21 | // Just implement the second function here to support option changing in JavaScript 22 | private lazy val _optionsConnection = JSBus.createConnection 23 | lazy val optionsConnection = _optionsConnection.biMap[Seq[A]]( 24 | (s: Seq[A]) => JArray(s.zipWithIndex map { case (opt, i) => ("text" -> toString(opt)) ~ ("index" -> i) } toList), (_:JValue) => Seq[A]() ) 25 | 26 | private lazy val _selected = JSBus.createConnection 27 | lazy val selected = _selected.biMap[A]((a:A) => JInt(options.indexOf(a)), (v:JValue) => options(v.extract[Int])) 28 | 29 | optionsConnection <-- Connection.just(options) 30 | 31 | lazy val toHtml = 32 | 38 | } 39 | 40 | object DropDown { 41 | private val defaultToString: Any => String = _.toString 42 | } -------------------------------------------------------------------------------- /observable/src/main/scala/com/bwater/notebook/Observable.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Bridgewater Associates, LP 3 | * 4 | * Distributed under the terms of the Modified BSD License. The full license is in 5 | * the file COPYING, distributed as part of this software. 6 | */ 7 | 8 | package com.bwater.notebook 9 | 10 | /** 11 | * Author: Ken 12 | * An observer trait, which is unfortunately lacking in rx.Subscription 13 | */ 14 | trait Observable[T] { 15 | def subscribe(observer: Observer[T]): rx.Subscription 16 | 17 | // def subscribe(next: T=>Unit): rx.Subscription = subscribe(new ConcreteObserver[T]{ override def onNext(args:T) = next(args) }) 18 | 19 | def map[A](fxn: T=>A):Observable[A] = new Observable[A] { 20 | def subscribe(observer: Observer[A]) = Observable.this.subscribe(observer map fxn) 21 | } 22 | } 23 | 24 | class WrappedObservable[T](inner: rx.Observable[T]) extends Observable[T] { 25 | def subscribe(observer: Observer[T]) = inner.subscribe(observer) 26 | } 27 | 28 | class ConcreteObservable[T] extends Observable[T] { 29 | protected val observableHandler = rx.subjects.Subject.create[T] 30 | 31 | def subscribe(observer: Observer[T]) = observableHandler.subscribe(observer) 32 | } 33 | 34 | trait MappingObservable[A,B] extends Observable[B] { 35 | protected def innerObservable: Observable[A] 36 | 37 | protected def observableMapper: A=>B 38 | 39 | def subscribe(observer: Observer[B]) = innerObservable.subscribe(observer map observableMapper) 40 | } 41 | 42 | 43 | object Observable { 44 | def just[T](x: T): Observable[T] = new WrappedObservable[T](rx.Observable.just(x)) 45 | 46 | def timer[T](x: Stream[T], delay: Int) = new WrappedObservable[T](rx.Observable.toObservable(new java.lang.Iterable[T] { 47 | def iterator = { 48 | import collection.JavaConversions._ 49 | x.map(x => { Thread.sleep(delay * 100); x }).toIterator 50 | } 51 | })) 52 | } -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/tiki/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Tiki wiki mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

CodeMirror: Tiki wiki mode

13 | 14 |
71 | 72 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/lib/util/match-highlighter.js: -------------------------------------------------------------------------------- 1 | // Define match-highlighter commands. Depends on searchcursor.js 2 | // Use by attaching the following function call to the onCursorActivity event: 3 | //myCodeMirror.matchHighlight(minChars); 4 | // And including a special span.CodeMirror-matchhighlight css class (also optionally a separate one for .CodeMirror-focused -- see demo matchhighlighter.html) 5 | 6 | (function() { 7 | var DEFAULT_MIN_CHARS = 2; 8 | 9 | function MatchHighlightState() { 10 | this.marked = []; 11 | } 12 | function getMatchHighlightState(cm) { 13 | return cm._matchHighlightState || (cm._matchHighlightState = new MatchHighlightState()); 14 | } 15 | 16 | function clearMarks(cm) { 17 | var state = getMatchHighlightState(cm); 18 | for (var i = 0; i < state.marked.length; ++i) 19 | state.marked[i].clear(); 20 | state.marked = []; 21 | } 22 | 23 | function markDocument(cm, className, minChars) { 24 | clearMarks(cm); 25 | minChars = (typeof minChars !== 'undefined' ? minChars : DEFAULT_MIN_CHARS); 26 | if (cm.somethingSelected() && cm.getSelection().replace(/^\s+|\s+$/g, "").length >= minChars) { 27 | var state = getMatchHighlightState(cm); 28 | var query = cm.getSelection(); 29 | cm.operation(function() { 30 | if (cm.lineCount() < 2000) { // This is too expensive on big documents. 31 | for (var cursor = cm.getSearchCursor(query); cursor.findNext();) { 32 | //Only apply matchhighlight to the matches other than the one actually selected 33 | if (!(cursor.from().line === cm.getCursor(true).line && cursor.from().ch === cm.getCursor(true).ch)) 34 | state.marked.push(cm.markText(cursor.from(), cursor.to(), className)); 35 | } 36 | } 37 | }); 38 | } 39 | } 40 | 41 | CodeMirror.defineExtension("matchHighlight", function(className, minChars) { 42 | markDocument(this, className, minChars); 43 | }); 44 | })(); 45 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/css/fbm.css: -------------------------------------------------------------------------------- 1 | 2 | /* Flexible box model classes */ 3 | /* Taken from Alex Russell http://infrequently.org/2009/08/css-3-progress/ */ 4 | 5 | .hbox { 6 | display: -webkit-box; 7 | -webkit-box-orient: horizontal; 8 | -webkit-box-align: stretch; 9 | 10 | display: -moz-box; 11 | -moz-box-orient: horizontal; 12 | -moz-box-align: stretch; 13 | 14 | display: box; 15 | box-orient: horizontal; 16 | box-align: stretch; 17 | } 18 | 19 | .hbox > * { 20 | -webkit-box-flex: 0; 21 | -moz-box-flex: 0; 22 | box-flex: 0; 23 | } 24 | 25 | .vbox { 26 | display: -webkit-box; 27 | -webkit-box-orient: vertical; 28 | -webkit-box-align: stretch; 29 | 30 | display: -moz-box; 31 | -moz-box-orient: vertical; 32 | -moz-box-align: stretch; 33 | 34 | display: box; 35 | box-orient: vertical; 36 | box-align: stretch; 37 | } 38 | 39 | .vbox > * { 40 | -webkit-box-flex: 0; 41 | -moz-box-flex: 0; 42 | box-flex: 0; 43 | } 44 | 45 | .reverse { 46 | -webkit-box-direction: reverse; 47 | -moz-box-direction: reverse; 48 | box-direction: reverse; 49 | } 50 | 51 | .box-flex0 { 52 | -webkit-box-flex: 0; 53 | -moz-box-flex: 0; 54 | box-flex: 0; 55 | } 56 | 57 | .box-flex1, .box-flex { 58 | -webkit-box-flex: 1; 59 | -moz-box-flex: 1; 60 | box-flex: 1; 61 | } 62 | 63 | .box-flex2 { 64 | -webkit-box-flex: 2; 65 | -moz-box-flex: 2; 66 | box-flex: 2; 67 | } 68 | 69 | .box-group1 { 70 | -webkit-box-flex-group: 1; 71 | -moz-box-flex-group: 1; 72 | box-flex-group: 1; 73 | } 74 | 75 | .box-group2 { 76 | -webkit-box-flex-group: 2; 77 | -moz-box-flex-group: 2; 78 | box-flex-group: 2; 79 | } 80 | 81 | .start { 82 | -webkit-box-pack: start; 83 | -moz-box-pack: start; 84 | box-pack: start; 85 | } 86 | 87 | .end { 88 | -webkit-box-pack: end; 89 | -moz-box-pack: end; 90 | box-pack: end; 91 | } 92 | 93 | .center { 94 | -webkit-box-pack: center; 95 | -moz-box-pack: center; 96 | box-pack: center; 97 | } 98 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/demo/multiplex.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Multiplexing Parser Demo 5 | 6 | 7 | 8 | 9 | 10 | 11 | 15 | 16 | 17 |

CodeMirror: Multiplexing Parser Demo

18 | 19 |
32 | 33 | 49 | 50 |

Demonstration of a multiplexing mode, which, at certain 51 | boundary strings, switches to one or more inner modes. The out 52 | (HTML) mode does not get fed the content of the << 53 | >> blocks. See 54 | the manual and 55 | the source for more 56 | information.

57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/demo/visibletabs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Visible tabs demo 5 | 6 | 7 | 8 | 9 | 10 | 24 | 25 | 26 |

CodeMirror: Visible tabs demo

27 | 28 |
43 | 44 |

Tabs inside the editor are spans with the 45 | class cm-tab, and can be styled. This demo uses 46 | an :after pseudo-class CSS hack that will not work on old 47 | browsers. You can use a more conservative technique like a background 48 | image as an alternative.

49 | 50 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/htmlembedded/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Html Embedded Scripts mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |

CodeMirror: Html Embedded Scripts mode

17 | 18 |
30 | 31 | 42 | 43 |

Mode for html embedded scripts like JSP and ASP.NET. Depends on HtmlMixed which in turn depends on 44 | JavaScript, CSS and XML.
Other dependancies include those of the scriping language chosen.

45 | 46 |

MIME types defined: application/x-aspx (ASP.NET), 47 | application/x-ejs (Embedded Javascript), application/x-jsp (JavaServer Pages)

48 | 49 | 50 | -------------------------------------------------------------------------------- /server/src/test/scala/NBSerializerTests.scala: -------------------------------------------------------------------------------- 1 | import com.bwater.notebook.NBSerializer 2 | import com.bwater.notebook.NBSerializer._ 3 | import org.scalatest.exceptions.TestFailedException 4 | import org.scalatest.FlatSpec 5 | import net.liftweb.json._ 6 | import net.liftweb.json.Serialization 7 | 8 | /** 9 | * Author: Ken 10 | */ 11 | 12 | class NBSerializerTests extends FlatSpec { 13 | val testnb = Notebook(new Metadata("ken1"), List(Worksheet(List(CodeCell("1+2", "python", false, Some(2), List(ScalaOutput(2, None, Some("3"))))))), Nil, None) 14 | 15 | "Notebook Serializer" should "write and read back a simple notebook" in { 16 | val s = NBSerializer.write(testnb) 17 | val res = NBSerializer.read(s) 18 | assert(testnb === res) 19 | } 20 | it should "read data scraped from iPython " in { 21 | val ipData = """{"worksheets":[{"cells":[{"input":"1+2","cell_type":"code","prompt_number":1,"outputs":[{"output_type":"pyout","prompt_number":1,"text":"res0: Int = 3\n"}],"language":"python","collapsed":false},{"input":"","cell_type":"code","outputs":[],"language":"python","collapsed":true}]}],"metadata":{"name":"Untitled2"},"nbformat":3}""" 22 | println(pretty(render(parse(NBSerializer.write(testnb))))) 23 | println(pretty(render(parse(ipData)))) 24 | val nb = NBSerializer.read(ipData) 25 | assert (nb.name === "Untitled2") 26 | nb.worksheets.head.cells.head match { 27 | case CodeCell("1+2", _, _, _, _) => 28 | case x => throw new TestFailedException("Expected serialized notebook, got " + x, 0) 29 | } 30 | } 31 | it should "read notebook with HTML outputs and stream" in { 32 | val data = """{"worksheets":[{"cells":[{"input":"3 * 3","cell_type":"code","prompt_number":1,"outputs":[{"output_type":"stream","text":"res0: Int = 9\n","stream":"stdout"},{"output_type":"pyout","prompt_number":1,"html":"9"}],"language":"python","collapsed":false}]}],"metadata":{"name":"Untitled4"},"nbformat":3}""" 33 | NBSerializer.read(data) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Scala Notebook 2 | ============== 3 | 4 | A more friendly, browser-based interactive Scala prompt (REPL). 5 | 6 | Based on the IPython notebook project, this project will let you interact with Scala in a browser window, which has the following advantages over the standard REPL: 7 | 8 | * Easy to view and edit past commands 9 | * Commands can return HTML or images, allowing richer interactivity (charts, for example) 10 | * Notebooks can be saved and loaded, providing a bridge between interactive REPL and classes in a project 11 | * Supports mixing Scala expressions and markdown, letting you create rich, interactive documents similar to Mathematica 12 | 13 | While I think this tool will be helpful for everyone using Scala, I expect it to be particularly valuable for the scientific and analytics community. 14 | 15 | 16 | Using Scala Notebook 17 | ---------------------- 18 | 19 | ## Building From Source 20 | * To build and run from SBT, type 21 | 22 | ```scala 23 | project server 24 | run 25 | ``` 26 | 27 | ![Alt text](http://i.imgur.com/8wnrP34.png) 28 | 29 | Development 30 | ----------- 31 | 32 | [![Build Status](https://secure.travis-ci.org/Bridgewater/scala-notebook.png?branch=master)](http://travis-ci.org/Bridgewater/scala-notebook) 33 | 34 | ### IDE Setup 35 | 36 | * If you're using an IntelliJ project, note that by default IntelliJ will not include SSP files resources. Change settings in IntelliJ to to include '*' as resource extension. 37 | 38 | ### Overview 39 | 40 | Having the web server process separate from the process doing the evaluation is also important in Scala; we want to separate 41 | the user's actions from the web server, allowing a restart of the client process (after building new client libraries, for example). 42 | 43 | To that end, the project is organized as follows: 44 | * *server* is the web server 45 | * *common* are the classes shared by both 46 | * *observable* 47 | * *kernel* 48 | * *subprocess* 49 | 50 | 51 | ### Architecture 52 | 53 | * Server 54 | * Kernel(s) 55 | * Widgets 56 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/demo/mustache.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Overlay Parser Demo 5 | 6 | 7 | 8 | 9 | 10 | 11 | 15 | 16 | 17 |

CodeMirror: Overlay Parser Demo

18 | 19 |
30 | 31 | 49 | 50 |

Demonstration of a mode that parses HTML, highlighting 51 | the Mustache templating 52 | directives inside of it by using the code 53 | in overlay.js. View 54 | source to see the 15 lines of code needed to accomplish this.

55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/lib/util/loadmode.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | if (!CodeMirror.modeURL) CodeMirror.modeURL = "../mode/%N/%N.js"; 3 | 4 | var loading = {}; 5 | function splitCallback(cont, n) { 6 | var countDown = n; 7 | return function() { if (--countDown == 0) cont(); } 8 | } 9 | function ensureDeps(mode, cont) { 10 | var deps = CodeMirror.modes[mode].dependencies; 11 | if (!deps) return cont(); 12 | var missing = []; 13 | for (var i = 0; i < deps.length; ++i) { 14 | if (!CodeMirror.modes.hasOwnProperty(deps[i])) 15 | missing.push(deps[i]); 16 | } 17 | if (!missing.length) return cont(); 18 | var split = splitCallback(cont, missing.length); 19 | for (var i = 0; i < missing.length; ++i) 20 | CodeMirror.requireMode(missing[i], split); 21 | } 22 | 23 | CodeMirror.requireMode = function(mode, cont) { 24 | if (typeof mode != "string") mode = mode.name; 25 | if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont); 26 | if (loading.hasOwnProperty(mode)) return loading[mode].push(cont); 27 | 28 | var script = document.createElement("script"); 29 | script.src = CodeMirror.modeURL.replace(/%N/g, mode); 30 | var others = document.getElementsByTagName("script")[0]; 31 | others.parentNode.insertBefore(script, others); 32 | var list = loading[mode] = [cont]; 33 | var count = 0, poll = setInterval(function() { 34 | if (++count > 100) return clearInterval(poll); 35 | if (CodeMirror.modes.hasOwnProperty(mode)) { 36 | clearInterval(poll); 37 | loading[mode] = null; 38 | ensureDeps(mode, function() { 39 | for (var i = 0; i < list.length; ++i) list[i](); 40 | }); 41 | } 42 | }, 200); 43 | }; 44 | 45 | CodeMirror.autoLoadMode = function(instance, mode) { 46 | if (!CodeMirror.modes.hasOwnProperty(mode)) 47 | CodeMirror.requireMode(mode, function() { 48 | instance.setOption("mode", instance.getOption("mode")); 49 | }); 50 | }; 51 | }()); 52 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/lua/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Lua mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Lua mode

14 |
55 | 62 | 63 |

Loosely based on Franciszek 64 | Wawrzak's CodeMirror 65 | 1 mode. One configuration parameter is 66 | supported, specials, to which you can provide an 67 | array of strings to have those identifiers highlighted with 68 | the lua-special style.

69 |

MIME types defined: text/x-lua.

70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/properties/properties.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("properties", function() { 2 | return { 3 | token: function(stream, state) { 4 | var sol = stream.sol() || state.afterSection; 5 | var eol = stream.eol(); 6 | 7 | state.afterSection = false; 8 | 9 | if (sol) { 10 | if (state.nextMultiline) { 11 | state.inMultiline = true; 12 | state.nextMultiline = false; 13 | } else { 14 | state.position = "def"; 15 | } 16 | } 17 | 18 | if (eol && ! state.nextMultiline) { 19 | state.inMultiline = false; 20 | state.position = "def"; 21 | } 22 | 23 | if (sol) { 24 | while(stream.eatSpace()); 25 | } 26 | 27 | var ch = stream.next(); 28 | 29 | if (sol && (ch === "#" || ch === "!" || ch === ";")) { 30 | state.position = "comment"; 31 | stream.skipToEnd(); 32 | return "comment"; 33 | } else if (sol && ch === "[") { 34 | state.afterSection = true; 35 | stream.skipTo("]"); stream.eat("]"); 36 | return "header"; 37 | } else if (ch === "=" || ch === ":") { 38 | state.position = "quote"; 39 | return null; 40 | } else if (ch === "\\" && state.position === "quote") { 41 | if (stream.next() !== "u") { // u = Unicode sequence \u1234 42 | // Multiline value 43 | state.nextMultiline = true; 44 | } 45 | } 46 | 47 | return state.position; 48 | }, 49 | 50 | startState: function() { 51 | return { 52 | position : "def", // Current position, "def", "quote" or "comment" 53 | nextMultiline : false, // Is the next line multiline value 54 | inMultiline : false, // Is the current line a multiline value 55 | afterSection : false // Did we just open a section 56 | }; 57 | } 58 | 59 | }; 60 | }); 61 | 62 | CodeMirror.defineMIME("text/x-properties", "properties"); 63 | CodeMirror.defineMIME("text/x-ini", "properties"); 64 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/erlang/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Erlang mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Erlang mode

14 | 15 |
50 | 51 | 59 | 60 |

MIME types defined: text/x-erlang.

61 | 62 | 63 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/rpm/changes/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: RPM changes mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

CodeMirror: RPM changes mode

13 | 14 |
41 | 50 | 51 |

MIME types defined: text/x-rpm-changes.

52 | 53 | 54 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/haskell/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Haskell mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Haskell mode

14 | 15 |
49 | 50 | 57 | 58 |

MIME types defined: text/x-haskell.

59 | 60 | 61 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/yaml/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: YAML mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

CodeMirror: YAML mode

13 |
60 | 63 | 64 |

MIME types defined: text/x-yaml.

65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/js/quickhelp.js: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Copyright (C) 2008-2011 The IPython Development Team 3 | // 4 | // Distributed under the terms of the BSD License. The full license is in 5 | // the file COPYING, distributed as part of this software. 6 | //---------------------------------------------------------------------------- 7 | 8 | //============================================================================ 9 | // QuickHelp button 10 | //============================================================================ 11 | 12 | var IPython = (function (IPython) { 13 | 14 | var QuickHelp = function (selector) { 15 | }; 16 | 17 | /* Bindings is an array of objects with properties 'key' and 'desc' */ 18 | QuickHelp.prototype.show_keyboard_shortcuts = function (bindings) { 19 | // toggles display of keyboard shortcut dialog 20 | var that = this; 21 | if ( this.shortcut_dialog ){ 22 | // if dialog is already shown, close it 23 | this.shortcut_dialog.dialog("close"); 24 | this.shortcut_dialog = null; 25 | return; 26 | } 27 | var dialog = $('
'); 28 | this.shortcut_dialog = dialog; 29 | var shortcuts = bindings; 30 | for (var i=0; i'). 32 | append($('').addClass('shortcut_key').html(shortcuts[i].key.replace(/,/g,''))). 33 | append($('').addClass('shortcut_descr').html(' : ' + shortcuts[i].desc)) 34 | ); 35 | }; 36 | dialog.dialog({ 37 | title: 'Keyboard shortcuts', 38 | closeOnEscape: true, 39 | closeText: '', 40 | close: function() { 41 | $(this).dialog('destroy').remove(); 42 | that.shortcut_dialog = null; 43 | } 44 | }); 45 | }; 46 | 47 | // Set module variables 48 | IPython.QuickHelp = QuickHelp; 49 | 50 | return IPython; 51 | 52 | }(IPython)); 53 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/groovy/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Groovy mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

CodeMirror: Groovy mode

13 | 14 |
60 | 61 | 68 | 69 |

MIME types defined: text/x-groovy

70 | 71 | 72 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/mode/go/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Go mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Go mode

14 | 15 |
58 | 59 | 69 | 70 |

MIME type: text/x-go

71 | 72 | 73 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/demo/emacs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Emacs bindings demo 5 | 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 |

CodeMirror: Emacs bindings demo

17 | 18 |
33 | 34 |

The emacs keybindings are enabled by 35 | including keymap/emacs.js and setting 36 | the keyMap option to "emacs". Because 37 | CodeMirror's internal API is quite different from Emacs, they are only 38 | a loose approximation of actual emacs bindings, though.

39 | 40 |

Also note that a lot of browsers disallow certain keys from being 41 | captured. For example, Chrome blocks both Ctrl-W and Ctrl-N, with the 42 | result that idiomatic use of Emacs keys will constantly close your tab 43 | or open a new window.

44 | 45 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/js/page.js: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Copyright (C) 2008-2011 The IPython Development Team 3 | // 4 | // Distributed under the terms of the BSD License. The full license is in 5 | // the file COPYING, distributed as part of this software. 6 | //---------------------------------------------------------------------------- 7 | 8 | //============================================================================ 9 | // Global header/site setup. 10 | //============================================================================ 11 | 12 | var IPython = (function (IPython) { 13 | 14 | var Page = function () { 15 | this.style(); 16 | this.bind_events(); 17 | }; 18 | 19 | Page.prototype.style = function () { 20 | $('div#header').addClass('border-box-sizing'). 21 | addClass('ui-widget ui-widget-content'). 22 | css('border-top-style','none'). 23 | css('border-left-style','none'). 24 | css('border-right-style','none'); 25 | $('div#site').addClass('border-box-sizing') 26 | }; 27 | 28 | 29 | Page.prototype.bind_events = function () { 30 | }; 31 | 32 | 33 | Page.prototype.show = function () { 34 | // The header and site divs start out hidden to prevent FLOUC. 35 | // Main scripts should call this method after styling everything. 36 | this.show_header(); 37 | this.show_site(); 38 | }; 39 | 40 | 41 | Page.prototype.show_header = function () { 42 | // The header and site divs start out hidden to prevent FLOUC. 43 | // Main scripts should call this method after styling everything. 44 | $('div#header').css('display','block'); 45 | }; 46 | 47 | 48 | Page.prototype.show_site = function () { 49 | // The header and site divs start out hidden to prevent FLOUC. 50 | // Main scripts should call this method after styling everything. 51 | $('div#site').css('display','block'); 52 | }; 53 | 54 | 55 | IPython.Page = Page; 56 | 57 | return IPython; 58 | 59 | }(IPython)); 60 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/js/layoutmanager.js: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | // Copyright (C) 2008-2011 The IPython Development Team 3 | // 4 | // Distributed under the terms of the BSD License. The full license is in 5 | // the file COPYING, distributed as part of this software. 6 | //---------------------------------------------------------------------------- 7 | 8 | //============================================================================ 9 | // Layout 10 | //============================================================================ 11 | 12 | var IPython = (function (IPython) { 13 | 14 | var LayoutManager = function () { 15 | this.bind_events(); 16 | }; 17 | 18 | 19 | LayoutManager.prototype.bind_events = function () { 20 | var that = this; 21 | $(window).resize($.proxy(this.do_resize,this)); 22 | $('div#expand_header > a').click($.proxy(this.toggle_header, this)); 23 | }; 24 | 25 | 26 | LayoutManager.prototype.do_resize = function () { 27 | var win = $(window); 28 | var w = win.width(); 29 | var h = win.height(); 30 | var header_height; 31 | if ($('div#header').css('display') === 'none') { 32 | header_height = 0; 33 | } else { 34 | header_height = $('div#header').outerHeight(true); 35 | } 36 | var menubar_height; 37 | if ($('div#header').css('display') === 'none') { 38 | menubar_height = 0; 39 | } else { 40 | menubar_height = $('div#menubar_container').outerHeight(true); 41 | } 42 | 43 | var app_height = h-header_height-menubar_height; // content height 44 | 45 | $('div#notebook_panel').height(app_height); // content+padding+border height 46 | }; 47 | 48 | LayoutManager.prototype.toggle_header = function() { 49 | $('div#expand_header').toggle(); 50 | $('div#header').toggle(); 51 | $('div#menubar_container').toggle(); 52 | this.do_resize(); 53 | } 54 | 55 | IPython.LayoutManager = LayoutManager; 56 | 57 | return IPython; 58 | 59 | }(IPython)); 60 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/css/page.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Primary styles 3 | * 4 | * Author: IPython Development Team 5 | */ 6 | 7 | 8 | body { 9 | background-color: white; 10 | /* This makes sure that the body covers the entire window and needs to 11 | be in a different element than the display: box in wrapper below */ 12 | position: absolute; 13 | left: 0px; 14 | right: 0px; 15 | top: 0px; 16 | bottom: 0px; 17 | overflow: visible; 18 | } 19 | 20 | 21 | div#header { 22 | /* Initially hidden to prevent FLOUC */ 23 | display: none; 24 | position: relative; 25 | height: 40px; 26 | padding: 5px; 27 | margin: 0px; 28 | width: 100%; 29 | } 30 | 31 | div#expand_header { 32 | display: none; 33 | padding: 0px; 34 | margin: 0px; 35 | text-align: right; 36 | width: 100%; 37 | } 38 | 39 | div#logo { 40 | float: right; 41 | height: 100%; 42 | display: table 43 | } 44 | 45 | span#ipython_notebook { 46 | position: absolute; 47 | padding: 2px 2px 2px 5px; 48 | } 49 | 50 | span#ipython_notebook h1 img { 51 | font-family: Verdana, "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif; 52 | height: 24px; 53 | text-decoration:none; 54 | display: inline; 55 | color: black; 56 | } 57 | 58 | #site { 59 | width: 100%; 60 | display: none; 61 | min-width: 1024px; 62 | } 63 | 64 | /* We set the fonts by hand here to override the values in the theme */ 65 | .ui-widget { 66 | font-family: "Lucinda Grande", "Lucinda Sans Unicode", Helvetica, Arial, Verdana, sans-serif; 67 | } 68 | 69 | .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { 70 | font-family: "Lucinda Grande", "Lucinda Sans Unicode", Helvetica, Arial, Verdana, sans-serif; 71 | } 72 | 73 | /* Smaller buttons */ 74 | .ui-button .ui-button-text { 75 | padding: 0.2em 0.8em; 76 | font-size: 77%; 77 | } 78 | 79 | input.ui-button { 80 | padding: 0.3em 0.9em; 81 | } 82 | 83 | span#login_widget { 84 | float: right; 85 | } 86 | 87 | .border-box-sizing { 88 | box-sizing: border-box; 89 | -moz-box-sizing: border-box; 90 | -webkit-box-sizing: border-box; 91 | } 92 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/demo/runmode.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: Mode Runner Demo 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |

CodeMirror: Mode Runner Demo

13 | 14 |
20 | 21 |

22 | 
23 |     
29 | 
30 |     

Running a CodeMirror mode outside of the editor. 31 | The CodeMirror.runMode function, defined 32 | in lib/runmode.js takes the following arguments:

33 | 34 |
35 |
text (string)
36 |
The document to run through the highlighter.
37 |
mode (mode spec)
38 |
The mode to use (must be loaded as normal).
39 |
output (function or DOM node)
40 |
If this is a function, it will be called for each token with 41 | two arguments, the token's text and the token's style class (may 42 | be null for unstyled tokens). If it is a DOM node, 43 | the tokens will be converted to span elements as in 44 | an editor, and inserted into the node 45 | (through innerHTML).
46 |
47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /subprocess/src/main/scala/com/bwater/notebook/Kernel.scala: -------------------------------------------------------------------------------- 1 | package com.bwater.notebook 2 | 3 | import akka.actor._ 4 | import akka.actor.Deploy 5 | import scala.concurrent._ 6 | import kernel.remote.{RemoteActorSystem, RemoteActorProcess} 7 | import scala.concurrent.duration._ 8 | import java.util.concurrent.ConcurrentHashMap 9 | import scala.collection.JavaConverters._ 10 | 11 | /** 12 | * A kernel is a remote VM with a set of sub-actors, each of which interacts with local resources (for example, WebSockets). 13 | * The local resource must be fully initialized before we will let messages flow through to the remote actor. This is 14 | * accomplished by blocking on actor startup 15 | * to the remote (this is accomplished by blocking on startup waiting for 16 | */ 17 | 18 | class Kernel(system: ActorSystem) { 19 | implicit val executor = system.dispatcher 20 | 21 | val router = system.actorOf(Props(new ExecutionManager)) 22 | 23 | private val remoteDeployPromise = Promise[Deploy] 24 | 25 | def remoteDeployFuture = remoteDeployPromise.future 26 | 27 | case object ShutdownNow 28 | 29 | def shutdown() { router ! ShutdownNow } 30 | 31 | class ExecutionManager extends Actor with ActorLogging { 32 | // These get filled in before we ever receive messages 33 | var remoteInfo: RemoteActorSystem = null 34 | 35 | override def preStart() { 36 | remoteInfo = Await.result( RemoteActorSystem.spawn(system, "kernel"), 1 minutes) 37 | remoteDeployPromise.success(remoteInfo.deploy) 38 | } 39 | 40 | override def postStop() { 41 | if (remoteInfo != null) 42 | remoteInfo.shutdownRemote() 43 | } 44 | 45 | def receive = { 46 | case ShutdownNow => 47 | if (remoteInfo != null) { 48 | remoteInfo.shutdownRemote() 49 | } 50 | } 51 | } 52 | } 53 | 54 | object KernelManager { 55 | def shutdown() { 56 | kernels.values foreach { _.shutdown() } 57 | } 58 | 59 | val kernels = new ConcurrentHashMap[String, Kernel]().asScala 60 | 61 | def get(id: String) = kernels.get(id) 62 | def apply(id: String) = kernels(id) 63 | 64 | def add(id:String, kernel: Kernel) { 65 | kernels += id -> kernel 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/lib/util/overlay.js: -------------------------------------------------------------------------------- 1 | // Utility function that allows modes to be combined. The mode given 2 | // as the base argument takes care of most of the normal mode 3 | // functionality, but a second (typically simple) mode is used, which 4 | // can override the style of text. Both modes get to parse all of the 5 | // text, but when both assign a non-null style to a piece of code, the 6 | // overlay wins, unless the combine argument was true, in which case 7 | // the styles are combined. 8 | 9 | // overlayParser is the old, deprecated name 10 | CodeMirror.overlayMode = CodeMirror.overlayParser = function(base, overlay, combine) { 11 | return { 12 | startState: function() { 13 | return { 14 | base: CodeMirror.startState(base), 15 | overlay: CodeMirror.startState(overlay), 16 | basePos: 0, baseCur: null, 17 | overlayPos: 0, overlayCur: null 18 | }; 19 | }, 20 | copyState: function(state) { 21 | return { 22 | base: CodeMirror.copyState(base, state.base), 23 | overlay: CodeMirror.copyState(overlay, state.overlay), 24 | basePos: state.basePos, baseCur: null, 25 | overlayPos: state.overlayPos, overlayCur: null 26 | }; 27 | }, 28 | 29 | token: function(stream, state) { 30 | if (stream.start == state.basePos) { 31 | state.baseCur = base.token(stream, state.base); 32 | state.basePos = stream.pos; 33 | } 34 | if (stream.start == state.overlayPos) { 35 | stream.pos = stream.start; 36 | state.overlayCur = overlay.token(stream, state.overlay); 37 | state.overlayPos = stream.pos; 38 | } 39 | stream.pos = Math.min(state.basePos, state.overlayPos); 40 | if (stream.eol()) state.basePos = state.overlayPos = 0; 41 | 42 | if (state.overlayCur == null) return state.baseCur; 43 | if (state.baseCur != null && combine) return state.baseCur + " " + state.overlayCur; 44 | else return state.overlayCur; 45 | }, 46 | 47 | indent: base.indent && function(state, textAfter) { 48 | return base.indent(state.base, textAfter); 49 | }, 50 | electricChars: base.electricChars 51 | }; 52 | }; 53 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/theme/ipython.css: -------------------------------------------------------------------------------- 1 | 2 | 3 | .cm-s-ipython span.cm-keyword {color: #008000; font-weight: bold;} 4 | .cm-s-ipython span.cm-number {color: #000080;} 5 | .cm-s-ipython span.cm-operator {color: #AA22FF; font-weight: bold;} 6 | .cm-s-ipython span.cm-meta {color: #AA22FF;} 7 | .cm-s-ipython span.cm-comment {color: #408080; font-style: italic;} 8 | .cm-s-ipython span.cm-string {color: #BA2121;} 9 | .cm-s-ipython span.cm-error {color: #f00;} 10 | .cm-s-ipython span.cm-builtin {color: #008000;} 11 | .cm-s-ipython span.cm-variable {color: #000000;} 12 | 13 | div.CodeMirror { font-family:"Consolas", monospace; } 14 | div.CodeMirror span.CodeMirror-matchingbracket {background-color: #99CCFF; color: inherit; } 15 | div.CodeMirror span.CodeMirror-nonmatchingbracket {background-color: #FFDCDC; color: inherit;} 16 | 17 | /* These classes are not currently used in the python.js mode */ 18 | 19 | /*.cm-s-ipython span.cm-atom {color: #219;}*/ 20 | /*.cm-s-ipython span.cm-def {color: #00f;}*/ 21 | /*.cm-s-ipython span.cm-variable-2 {color: #05a;}*/ 22 | /*.cm-s-ipython span.cm-variable-3 {color: #0a5;}*/ 23 | /*.cm-s-ipython span.cm-property {color: black;}*/ 24 | /*.cm-s-ipython span.cm-qualifier {color: #555;}*/ 25 | /*.cm-s-ipython span.cm-bracket {color: #cc7;}*/ 26 | /*.cm-s-ipython span.cm-tag {color: #170;}*/ 27 | /*.cm-s-ipython span.cm-attribute {color: #00c;}*/ 28 | 29 | /* These are the old styles for our pre-themed version */ 30 | 31 | /*span.py-delimiter {color: #666666;}*/ 32 | /*span.py-special {color: #666666;}*/ 33 | /*span.py-operator {color: #AA22FF; font-weight: bold;}*/ 34 | /*span.py-keyword {color: #008000; font-weight: bold;}*/ 35 | /*span.py-number {color: #666666;}*/ 36 | /*span.py-identifier {color: #000000;}*/ 37 | /*span.py-func {color: #000000;}*/ 38 | /*span.py-type {color: #008000;}*/ 39 | /*span.py-decorator {color: #AA22FF;}*/ 40 | /*span.py-comment {color: #408080; font-style: italic;}*/ 41 | /*span.py-string {color: #BA2121;}*/ 42 | /*span.py-bytes {color: #BA2121;}*/ 43 | /*span.py-raw {color: #BA2121;}*/ 44 | /*span.py-unicode {color: #BA2121;}*/ 45 | 46 | div.CodeMirror-selected { background: #E6E6E6; } 47 | .CodeMirror-focused div.CodeMirror-selected { background: #90cfe4; } -------------------------------------------------------------------------------- /server/src/main/scala/Scalate.scala: -------------------------------------------------------------------------------- 1 | package com.bwater.notebook 2 | package server 3 | 4 | import org.fusesource.scalate.{ 5 | TemplateEngine, Binding, DefaultRenderContext, RenderContext} 6 | import unfiltered.request.{Path,HttpRequest} 7 | import unfiltered.response.{ResponseWriter} 8 | import java.io.{File,OutputStreamWriter,PrintWriter} 9 | import scala.util.control.NonFatal 10 | 11 | object Scalate { 12 | /** Constructs a ResponseWriter for Scalate templates. 13 | * Note that any parameter in the second, implicit set 14 | * can be overriden by specifying an implicit value of the 15 | * expected type in a pariticular scope. */ 16 | def apply[A, B](request: HttpRequest[A], 17 | template: String, 18 | attributes:(String,Any)*) 19 | ( implicit 20 | engine: TemplateEngine = defaultEngine, 21 | contextBuilder: ToRenderContext = defaultRenderContext, 22 | bindings: List[Binding] = Nil, 23 | additionalAttributes: Seq[(String, Any)] = Nil 24 | ) = new ResponseWriter { 25 | def write(writer: OutputStreamWriter) { 26 | val printWriter = new PrintWriter(writer) 27 | try { 28 | val scalateTemplate = engine.load(template, bindings) 29 | val context = contextBuilder(Path(request), printWriter, engine) 30 | (additionalAttributes ++ attributes) foreach { 31 | case (k,v) => context.attributes(k) = v 32 | } 33 | engine.layout(scalateTemplate, context) 34 | } catch { 35 | case NonFatal(e) if engine.isDevelopmentMode => 36 | printWriter.println("Exception: " + e.getMessage) 37 | e.getStackTrace.foreach(printWriter.println) 38 | case NonFatal(e) => throw e 39 | } 40 | } 41 | } 42 | 43 | /* Function to construct a RenderContext. */ 44 | type ToRenderContext = 45 | (String, PrintWriter, TemplateEngine) => RenderContext 46 | 47 | private val defaultTemplateDirs = 48 | new File("src/main/resources/templates") :: Nil 49 | private val defaultEngine = new TemplateEngine(defaultTemplateDirs, "development") 50 | private val defaultRenderContext: ToRenderContext = 51 | (path, writer, engine) => 52 | new DefaultRenderContext(path, engine, writer) 53 | } 54 | -------------------------------------------------------------------------------- /server/src/main/assets/from_ipython/static/codemirror/theme/lesser-dark.css: -------------------------------------------------------------------------------- 1 | /* 2 | http://lesscss.org/ dark theme 3 | Ported to CodeMirror by Peter Kroon 4 | */ 5 | .cm-s-lesser-dark { 6 | line-height: 1.3em; 7 | } 8 | .cm-s-lesser-dark { 9 | font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', 'Monaco', Courier, monospace !important; 10 | } 11 | 12 | .cm-s-lesser-dark { background: #262626; color: #EBEFE7; text-shadow: 0 -1px 1px #262626; } 13 | .cm-s-lesser-dark div.CodeMirror-selected {background: #45443B !important;} /* 33322B*/ 14 | .cm-s-lesser-dark .CodeMirror-cursor { border-left: 1px solid white !important; } 15 | .cm-s-lesser-dark .CodeMirror-lines { margin-left:3px; margin-right:3px; }/*editable code holder*/ 16 | 17 | div.CodeMirror span.CodeMirror-matchingbracket { color: #7EFC7E; }/*65FC65*/ 18 | 19 | .cm-s-lesser-dark .CodeMirror-gutter { background: #262626; border-right:1px solid #aaa; padding-right:3px; min-width:2.5em; } 20 | .cm-s-lesser-dark .CodeMirror-gutter-text { color: #777; } 21 | 22 | .cm-s-lesser-dark span.cm-keyword { color: #599eff; } 23 | .cm-s-lesser-dark span.cm-atom { color: #C2B470; } 24 | .cm-s-lesser-dark span.cm-number { color: #B35E4D; } 25 | .cm-s-lesser-dark span.cm-def {color: white;} 26 | .cm-s-lesser-dark span.cm-variable { color:#D9BF8C; } 27 | .cm-s-lesser-dark span.cm-variable-2 { color: #669199; } 28 | .cm-s-lesser-dark span.cm-variable-3 { color: white; } 29 | .cm-s-lesser-dark span.cm-property {color: #92A75C;} 30 | .cm-s-lesser-dark span.cm-operator {color: #92A75C;} 31 | .cm-s-lesser-dark span.cm-comment { color: #666; } 32 | .cm-s-lesser-dark span.cm-string { color: #BCD279; } 33 | .cm-s-lesser-dark span.cm-string-2 {color: #f50;} 34 | .cm-s-lesser-dark span.cm-meta { color: #738C73; } 35 | .cm-s-lesser-dark span.cm-error { color: #9d1e15; } 36 | .cm-s-lesser-dark span.cm-qualifier {color: #555;} 37 | .cm-s-lesser-dark span.cm-builtin { color: #ff9e59; } 38 | .cm-s-lesser-dark span.cm-bracket { color: #EBEFE7; } 39 | .cm-s-lesser-dark span.cm-tag { color: #669199; } 40 | .cm-s-lesser-dark span.cm-attribute {color: #00c;} 41 | .cm-s-lesser-dark span.cm-header {color: #a0a;} 42 | .cm-s-lesser-dark span.cm-quote {color: #090;} 43 | .cm-s-lesser-dark span.cm-hr {color: #999;} 44 | .cm-s-lesser-dark span.cm-link {color: #00c;} 45 | -------------------------------------------------------------------------------- /server/src/main/assets/templates/default.ssp: -------------------------------------------------------------------------------- 1 | <%@ var body: String %> 2 | <%@ var title: String = "Scala Notebook" %> 3 | <%@ var stylesheet: String = "" %> 4 | <%@ var meta: String = "" %> 5 | <%@ var params: String = "" %> 6 | <%@ var header: String = "" %> 7 | <%@ var site: String = "" %> 8 | <%@ var script: String = "" %> 9 | <% import com.bwater.notebook.server.LayoutTools._ %> 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | ${title} 18 | 19 | 20 | 21 | 22 | 23 | ${unescape(stylesheet)} 24 | 25 | ${unescape(meta)} 26 | 27 | 28 | 29 | 30 | 31 | 43 |
44 | 45 |
46 | ${unescape(site)} 47 |
48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | ${unescape(script)} 58 | 59 | 60 | 61 | --------------------------------------------------------------------------------