├── remote ├── .gitignore ├── public │ ├── _includes │ │ ├── img │ │ │ └── fav.ico │ │ ├── js │ │ │ └── site.js │ │ └── css │ │ │ └── screen.css │ ├── connection-type │ │ └── index.html │ └── index.html ├── package.json └── app.js ├── s5 ├── _ui │ ├── rainbow │ │ ├── .gitignore │ │ ├── themes │ │ │ ├── all-hallows-eve.css │ │ │ ├── zenburnesque.css │ │ │ ├── tricolore.css │ │ │ ├── tomorrow-night.css │ │ │ ├── blackboard.css │ │ │ ├── espresso-libre.css │ │ │ ├── obsidian.css │ │ │ ├── twilight.css │ │ │ ├── solarized-dark.css │ │ │ ├── solarized-light.css │ │ │ ├── sunburst.css │ │ │ ├── github.css │ │ │ └── pastie.css │ │ ├── demos │ │ │ ├── index.html │ │ │ ├── scheme.html │ │ │ ├── css.html │ │ │ ├── html.html │ │ │ ├── go.html │ │ │ ├── r.html │ │ │ ├── coffeescript.html │ │ │ ├── php.html │ │ │ ├── js.html │ │ │ ├── ruby-test.html │ │ │ ├── python.html │ │ │ ├── lua.html │ │ │ ├── c.html │ │ │ └── ruby.html │ │ ├── util │ │ │ ├── compile.py │ │ │ └── builder.py │ │ ├── js │ │ │ ├── language │ │ │ │ ├── smalltalk.js │ │ │ │ ├── sql.js │ │ │ │ ├── shell.js │ │ │ │ ├── lua.js │ │ │ │ ├── go.js │ │ │ │ ├── java.js │ │ │ │ ├── generic.js │ │ │ │ ├── c.js │ │ │ │ ├── html.js │ │ │ │ ├── css.js │ │ │ │ ├── python.js │ │ │ │ ├── r.js │ │ │ │ ├── javascript.js │ │ │ │ ├── coffeescript.js │ │ │ │ ├── csharp.js │ │ │ │ ├── scheme.js │ │ │ │ ├── php.js │ │ │ │ └── ruby.js │ │ │ └── rainbow.min.js │ │ ├── tests │ │ │ ├── index.html │ │ │ ├── tests.css │ │ │ ├── api.html │ │ │ ├── language │ │ │ │ ├── java-test.js │ │ │ │ ├── smalltalk-test.js │ │ │ │ ├── python-test.js │ │ │ │ ├── csharp-test.js │ │ │ │ ├── r-test.js │ │ │ │ ├── javascript-test.js │ │ │ │ └── css-test.js │ │ │ └── tests.js │ │ └── README.md │ ├── default │ │ ├── blank.gif │ │ ├── bodybg.gif │ │ ├── opera.css │ │ ├── slides.css │ │ ├── s5-core.css │ │ ├── outline.css │ │ ├── framing.css │ │ ├── iepngfix.htc │ │ ├── print.css │ │ └── pretty.css │ └── pg │ │ ├── icon_bracket-open.gif │ │ ├── array.js │ │ ├── slide-websockets.js │ │ └── printlinks.js └── index.html ├── .gitignore ├── README.md └── goog ├── assets └── slide-websockets.js └── index.html /remote/.gitignore: -------------------------------------------------------------------------------- 1 | deploy.sh 2 | node_modules -------------------------------------------------------------------------------- /s5/_ui/rainbow/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.sw? 3 | js/rainbow-custom.min.js 4 | .AppleDouble 5 | -------------------------------------------------------------------------------- /s5/_ui/default/blank.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orangespaceman/slide-controller/master/s5/_ui/default/blank.gif -------------------------------------------------------------------------------- /s5/_ui/default/bodybg.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orangespaceman/slide-controller/master/s5/_ui/default/bodybg.gif -------------------------------------------------------------------------------- /s5/_ui/pg/icon_bracket-open.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orangespaceman/slide-controller/master/s5/_ui/pg/icon_bracket-open.gif -------------------------------------------------------------------------------- /remote/public/_includes/img/fav.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orangespaceman/slide-controller/master/remote/public/_includes/img/fav.ico -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | lib-cov 2 | *.seed 3 | *.log 4 | *.csv 5 | *.dat 6 | *.out 7 | *.pid 8 | *.gz 9 | 10 | pids 11 | logs 12 | results 13 | 14 | npm-debug.log 15 | -------------------------------------------------------------------------------- /s5/_ui/default/opera.css: -------------------------------------------------------------------------------- 1 | /* DO NOT CHANGE THESE unless you really want to break Opera Show */ 2 | .slide { 3 | visibility: visible !important; 4 | position: static !important; 5 | page-break-before: always; 6 | } 7 | #slide0 {page-break-before: avoid;} 8 | -------------------------------------------------------------------------------- /s5/_ui/default/slides.css: -------------------------------------------------------------------------------- 1 | @import url(s5-core.css); /* required to make the slide show run at all */ 2 | @import url(framing.css); /* sets basic placement and size of slide components */ 3 | @import url(pretty.css); /* stuff that makes the slides look better than blah */ -------------------------------------------------------------------------------- /s5/_ui/default/s5-core.css: -------------------------------------------------------------------------------- 1 | /* Do not edit or override these styles! The system will likely break if you do. */ 2 | 3 | div#header, div#footer, div#controls, .slide {position: absolute;} 4 | html>body div#header, html>body div#footer, 5 | html>body div#controls, html>body .slide {position: fixed;} 6 | .handout {display: none;} 7 | .layout {display: block;} 8 | .slide, .hideme, .incremental {visibility: hidden;} 9 | #slide0 {visibility: visible;} 10 | -------------------------------------------------------------------------------- /remote/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "slide-controller", 3 | "node":"0.10.x", 4 | "description": "Node.js-based remote control for HTML/JS slideshows", 5 | "version": "0.0.2", 6 | "repository": { "type" : "git", "url" : "http://github.com/orangespaceman/slide-controller.git" }, 7 | "keywords": ["slideshow"], 8 | "dependencies": { 9 | "express" : "2.5.x", 10 | "socket.io" : "0.9.x" 11 | }, 12 | "devDependencies": {}, 13 | "optionalDependencies": {}, 14 | "engines": { 15 | "node": "*" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /s5/_ui/default/outline.css: -------------------------------------------------------------------------------- 1 | /* don't change this unless you want the layout stuff to show up in the outline view! */ 2 | 3 | .layout div, #footer *, #controlForm * {display: none;} 4 | #footer, #controls, #controlForm, #navLinks, #toggle { 5 | display: block; visibility: visible; margin: 0; padding: 0;} 6 | #toggle {float: right; padding: 0.5em;} 7 | html>body #toggle {position: fixed; top: 0; right: 0;} 8 | 9 | /* making the outline look pretty-ish */ 10 | 11 | #slide0 h1, #slide0 h2, #slide0 h3, #slide0 h4 {border: none; margin: 0;} 12 | #slide0 h1 {padding-top: 1.5em;} 13 | .slide h1 {margin: 1.5em 0 0; padding-top: 0.25em; 14 | border-top: 1px solid #888; border-bottom: 1px solid #AAA;} 15 | #toggle {border: 1px solid; border-width: 0 0 1px 1px; background: #FFF;} 16 | -------------------------------------------------------------------------------- /remote/public/connection-type/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Connection Type 6 | 7 | 8 | 9 | 21 | 22 | 23 |

Connection type

24 |

Loading...

25 | 26 | -------------------------------------------------------------------------------- /remote/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Slide Controller 6 | 7 | 8 | 9 | 10 |

Slide Controller

11 |
12 | 16 |
17 |
18 |

Slide x of x

19 |
20 |

notes will appear here...

21 |
22 |
23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/themes/all-hallows-eve.css: -------------------------------------------------------------------------------- 1 | /** 2 | * All Hallows Eve theme 3 | * 4 | * Adapted from Ultraviolet RubyGem 5 | * 6 | * @author Flinn Mueller 7 | * @version 1.0.1 8 | */ 9 | pre { 10 | background: #000; 11 | word-wrap: break-word; 12 | margin: 0px; 13 | padding: 0px; 14 | padding: 10px; 15 | color: #fff; 16 | font-size: 14px; 17 | margin-bottom: 20px; 18 | } 19 | 20 | pre, code { 21 | font-family: 'Monaco', courier, monospace; 22 | } 23 | 24 | pre .comment { 25 | color: #9933CC; 26 | } 27 | 28 | pre .constant { 29 | color: #3387CC; 30 | } 31 | 32 | pre .storage { 33 | color: #CC7833; 34 | } 35 | 36 | pre .string { 37 | color: #66CC33; 38 | } 39 | 40 | pre .keyword, pre .selector { 41 | color: #CC7833; 42 | } 43 | 44 | pre .inherited-class { 45 | font-style: italic; 46 | } 47 | 48 | pre .support { 49 | color: #C83730; 50 | } 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # slide-controller 2 | 3 | Node.js-based remote control for a HTML slideshows - S5 or Google slides 4 | 5 | ## Installation 6 | 7 | Check the project out from GitHub 8 | 9 | In the 'remote' directory, run npm install 10 | 11 | ## Running slide-controller 12 | 13 | $ node remote/app.js 14 | 15 | This runs the remote app on port 7003, e.g. **http://localhost:7003** 16 | 17 | ### Remote 18 | 19 | This can be run from a live server - the websocket control can be cross-domain 20 | 21 | ### Slideshow 22 | 23 | Once the slide controller is set up, you can run your slideshows from a standard apache server. 24 | 25 | Examples of an s5 slideshow and a google slideshow are provided. 26 | 27 | Within these slideshows, set the ```websocketUrl``` parameter to point to your slide-controller URL. 28 | 29 | To begin controlling the slideshow via the remote, type 'go' in the slideshow window. (If you open the browser console you'll see that it has been triggered.) 30 | 31 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/demos/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Syntax Highlighting 4 | 5 | 22 | 23 | -------------------------------------------------------------------------------- /s5/_ui/default/framing.css: -------------------------------------------------------------------------------- 1 | /* The following styles size, place, and layer the slide components. 2 | Edit these if you want to change the overall slide layout. 3 | The commented lines can be uncommented (and modified, if necessary) 4 | to help you with the rearrangement process. */ 5 | 6 | /* target = 1024x768 */ 7 | 8 | div#header, div#footer, .slide {width: 100%; top: 0; left: 0;} 9 | div#header {top: 0; height: 3em; z-index: 1;} 10 | div#footer {top: auto; bottom: 0; height: 2.5em; z-index: 5;} 11 | .slide {top: 0; width: 92%; padding: 3.5em 4% 4%; z-index: 2; list-style: none;} 12 | div#controls {left: 50%; bottom: 0; width: 50%; z-index: 100;} 13 | div#controls form {position: absolute; bottom: 0; right: 0; width: 100%; 14 | margin: 0;} 15 | #currentSlide {position: absolute; width: 10%; left: 45%; bottom: 1em; z-index: 10;} 16 | html>body #currentSlide {position: fixed;} 17 | 18 | /* 19 | div#header {background: #FCC;} 20 | div#footer {background: #CCF;} 21 | div#controls {background: #BBD;} 22 | div#currentSlide {background: #FFC;} 23 | */ 24 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/themes/zenburnesque.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Zenburnesque theme 3 | * 4 | * Adapted from Ultraviolet RubyGem 5 | * 6 | * @author Flinn Mueller 7 | * @version 1.0 8 | */ 9 | pre { 10 | background: #404040; 11 | word-wrap: break-word; 12 | margin: 0px; 13 | padding: 0px; 14 | padding: 10px; 15 | color: #dedede; 16 | font-size: 14px; 17 | margin-bottom: 20px; 18 | } 19 | 20 | pre, code { 21 | font-family: 'Monaco', courier, monospace; 22 | } 23 | 24 | pre .comment { 25 | color: #709070; 26 | font-style: italic; 27 | } 28 | 29 | pre .integer { 30 | color: #22C0FF; 31 | } 32 | 33 | pre .storage { 34 | color: #6080FF; 35 | } 36 | 37 | /* This includes regexes */ 38 | pre .string { 39 | color: #FF2020; 40 | } 41 | 42 | pre .keyword, pre .selector { 43 | color: #ffffa0; 44 | } 45 | 46 | pre .inherited-class { 47 | font-style: italic; 48 | } 49 | 50 | pre .entity { 51 | color: #F09040; 52 | } 53 | 54 | pre .support { 55 | color: #C83730; 56 | } 57 | 58 | pre .variable.class { 59 | color: #FF8000; 60 | } 61 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/themes/tricolore.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Tricolore theme 3 | * 4 | * @author Jean Nicolas 5 | * @version 1.0.1 6 | */ 7 | pre { 8 | background: #FFF; 9 | word-wrap: break-word; 10 | margin: 0px; 11 | padding: 0px; 12 | padding: 10px; 13 | color: #000; 14 | font-size: 12px; 15 | margin-bottom: 20px; 16 | line-height: 16px; 17 | } 18 | 19 | pre, code { 20 | font-family: 'Monaco', 'Consolas', monospace; 21 | } 22 | 23 | pre .comment { 24 | color: #7E7E7E; 25 | font-style: italic; 26 | } 27 | 28 | pre .constant { 29 | color: #18838A; 30 | font-weight: bold; 31 | } 32 | 33 | pre .storage { 34 | color: #0000A1; 35 | } 36 | 37 | pre .string { 38 | color: #8E0022; 39 | } 40 | 41 | pre .keyword, pre .selector { 42 | color: #0000A1; 43 | font-weight: bold; 44 | } 45 | 46 | pre .inherited-class { 47 | font-style: italic; 48 | } 49 | 50 | pre .entity { 51 | color: #3E853F; 52 | } 53 | 54 | pre .support { 55 | color: #192140; 56 | } 57 | 58 | pre .variable.global, pre .variable.class, pre .variable.instance { 59 | color: #3E853F; 60 | } 61 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/themes/tomorrow-night.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Tomorrow Night theme 3 | * 4 | * @author Chris Kempson 5 | * @author skim 6 | * @version 1.0.0 7 | */ 8 | pre { 9 | background-color: #1d1f21; 10 | word-wrap: break-word; 11 | margin: 0px; 12 | padding: 0 10px; 13 | color: #c5c8c6; 14 | font-size: 14px; 15 | margin-bottom: 20px; 16 | } 17 | 18 | pre, code { 19 | font-family: 'Monaco', courier, monospace; 20 | } 21 | 22 | pre .comment { 23 | color: #969896; 24 | } 25 | 26 | pre .variable.global, pre .variable.class, pre .variable.instance { 27 | color: #cc6666; /* red */ 28 | } 29 | 30 | pre .constant.numeric, pre .constant.language, pre .constant.hex-color, pre .keyword.unit { 31 | color: #de935f; /* orange */ 32 | } 33 | 34 | pre .constant, pre .entity, pre .entity.class, pre .support { 35 | color: #f0c674; /* yellow */ 36 | } 37 | 38 | pre .constant.symbol, pre .string { 39 | color: #b5bd68; /* green */ 40 | } 41 | 42 | pre .entity.function, pre .support.css-property, pre .selector { 43 | color: #81a2be; /* blue */ 44 | } 45 | 46 | pre .keyword, pre .storage { 47 | color: #b294bb; /* purple */ 48 | } 49 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/util/compile.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import sys 3 | import os 4 | from builder import RainbowBuilder 5 | 6 | sys.argv.pop(0) 7 | languages = sys.argv 8 | languages.sort() 9 | 10 | no_language_args = ['--alone', '--forever-alone', '--core', '--no-languages', '--without-languages', '--none'] 11 | rainbow_only = len(set(no_language_args) - set(sys.argv)) < len(no_language_args) 12 | 13 | if not rainbow_only: 14 | languages.insert(0, 'generic') 15 | 16 | js_path = os.path.dirname(__file__) + '/../js/' 17 | 18 | for language in languages[:]: 19 | if language.startswith('--'): 20 | languages.remove(language) 21 | 22 | builder = RainbowBuilder(js_path, os.environ.get('CLOSURE_COMPILER', '/usr/local/compiler-latest/compiler.jar')) 23 | 24 | print 'waiting for closure compiler...' 25 | contents = builder.getFileForLanguages(languages) 26 | 27 | print "\nincluded:" 28 | for file in builder.js_files_to_include: 29 | print " ", os.path.basename(file) 30 | print "" 31 | 32 | print 'writing to file:', builder.file_name 33 | 34 | new_file = os.path.join(js_path, builder.file_name) 35 | 36 | file = open(new_file, "w") 37 | file.write(contents) 38 | file.close() 39 | -------------------------------------------------------------------------------- /remote/app.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Node slide controller 3 | * 4 | * $ node app.js 5 | * 6 | */ 7 | 8 | var express = require('express'), 9 | server = express.createServer(), 10 | io = require("socket.io").listen(server,{"log level":0}), 11 | port = process.env.PORT || process.env['app_port'] || 7003; 12 | 13 | 14 | // serve static files, routes, etc 15 | server.use(express.query()); 16 | server.use(express.static(__dirname + '/public')); 17 | server.use(express.favicon(__dirname + '/public/_includes/img/fav.ico')); 18 | server.listen(port); 19 | 20 | // listen for socket.io controller connection 21 | io.sockets.on('connection', function (socket) { 22 | 23 | // log message on client and server 24 | log("slide controller connected"); 25 | 26 | // detect calls to move back/forward a slide 27 | socket.on('move', function (data) { 28 | var dir = data.message; 29 | socket.broadcast.emit('shift', { dir: dir }); 30 | }); 31 | 32 | // detect notes 33 | socket.on('slide-notes', function (data) { 34 | socket.broadcast.emit('notes', data); 35 | }); 36 | 37 | // log any server messages to the client and server console 38 | function log(message) { 39 | socket.send(message); 40 | console.log(message); 41 | } 42 | }); 43 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/themes/blackboard.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Blackboard theme 3 | * 4 | * Adapted from Domenico Carbotta's TextMate theme of the same name 5 | * 6 | * @author Domenico Carbotta 7 | * @author Craig Campbell 8 | * @version 1.0.2 9 | */ 10 | pre { 11 | background: #0B1022; 12 | word-wrap: break-word; 13 | margin: 0px; 14 | padding: 0px; 15 | padding: 10px; 16 | color: #fff; 17 | font-size: 14px; 18 | margin-bottom: 20px; 19 | } 20 | 21 | pre, code { 22 | font-family: 'Monaco', courier, monospace; 23 | } 24 | 25 | pre .comment { 26 | color: #727272; 27 | } 28 | 29 | pre .constant { 30 | color: #D8FA3C; 31 | } 32 | 33 | pre .storage { 34 | color: #FBDE2D; 35 | } 36 | 37 | pre .string, pre .comment.docstring { 38 | color: #61CE3C; 39 | } 40 | 41 | pre .string.regexp, pre .support.tag.script, pre .support.tag.style { 42 | color: #fff; 43 | } 44 | 45 | pre .keyword, pre .selector { 46 | color: #FBDE2D; 47 | } 48 | 49 | pre .inherited-class { 50 | font-style: italic; 51 | } 52 | 53 | pre .entity { 54 | color: #FF6400; 55 | } 56 | 57 | pre .support, *[data-language="c"] .function.call { 58 | color: #8DA6CE; 59 | } 60 | 61 | pre .variable.global, pre .variable.class, pre .variable.instance { 62 | color: #FF6400; 63 | } 64 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/themes/espresso-libre.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Espresso Libre theme 3 | * 4 | * Adapted from Ultraviolet RubyGem 5 | * 6 | * @author Flinn Mueller 7 | * @version 1.0 8 | */ 9 | pre { 10 | background-color: #2a211c; 11 | word-wrap: break-word; 12 | margin: 0px; 13 | padding: 0px; 14 | padding: 10px; 15 | color: #bdae9d; 16 | font-size: 14px; 17 | margin-bottom: 20px; 18 | } 19 | 20 | pre, code { 21 | font-family: 'Monaco', courier, monospace; 22 | } 23 | 24 | pre .support.class, pre .support.type { 25 | color: #6d79de; 26 | } 27 | 28 | pre .support.constant { 29 | color: #00af0e; 30 | } 31 | 32 | pre .constant.language { 33 | color: #585cf6; 34 | } 35 | 36 | pre .support.function { 37 | font-weight: bold; 38 | color: #7290d9; 39 | } 40 | 41 | pre .string { 42 | color: #049b0a; 43 | } 44 | 45 | pre .constant.numeric { 46 | color: #44aa43; 47 | } 48 | 49 | pre .keyword, pre .storage { 50 | color: #43a8ed; 51 | } 52 | 53 | pre .entity.function { 54 | color: #ff9358; 55 | } 56 | 57 | pre .comment { 58 | color: #0066ff; 59 | font-style: italic; 60 | } 61 | 62 | pre .constant.symbol { 63 | color:#c5656b; 64 | } 65 | 66 | pre .variable.instance, pre .variable.language, pre .constant { 67 | color: #318495; 68 | } 69 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/demos/scheme.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Syntax Highlighting 4 | 5 | 6 | 7 | 8 |

9 | 10 |
11 | 
12 | ;; Produces the union of two sets
13 | (define (set-union set1 set2)
14 |   (let loop ((set1 set1)
15 | 	     (set2 set2))
16 |     (if (null? set2)
17 | 	set1
18 | 	(let ((item (car set2)))
19 | 	  (if (member item set1)
20 | 	      (loop set1 (cdr set2))
21 | 	      (loop (cons item set1) (cdr set2)))))))
22 | 
23 | (define (all? pred coll)
24 |   (if (null? coll)
25 |       #t
26 |       (and (pred (car coll))
27 |            (all? pred (cdr coll)))))
28 | 
29 | (define (filter pred coll)
30 |   (let loop ((ret '())
31 |              (coll coll))
32 |     (if (null? coll)
33 |         (reverse ret)
34 |         (let ((a (car coll)))
35 |           (if (pred a)
36 |               (loop (cons a ret) (cdr coll))
37 |               (loop ret (cdr coll)))))))
38 | 
39 | 
40 | 41 | 42 |
43 |
44 | Last modified: Wed Jan 25 22:04:37 CET 2012 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /s5/_ui/pg/array.js: -------------------------------------------------------------------------------- 1 | /* 2 | * extra array functions 3 | */ 4 | 5 | var arrayFunctions = { 6 | 7 | /** 8 | * Check whether a value is in an array 9 | * 10 | * @param array to check for value in 11 | * @param value to check for 12 | * 13 | * @return the array key (integer) where the value occurs, or false if not 14 | */ 15 | arrayContainsValue: function(arrayName, value) { 16 | for(x=0; x 2 | 3 | Syntax Highlighting 4 | 5 | 6 | 7 |
 8 | /**
 9 |  * styles for blackboard theme
10 |  */
11 | pre {
12 |     background: #0B1022;
13 |     white-space: pre-wrap;
14 |     white-space: -moz-pre-wrap;
15 |     white-space: -pre-wrap;
16 |     white-space: -o-pre-wrap;
17 |     word-wrap: break-word;
18 |     margin: 0px;
19 |     padding: 0px;
20 |     padding: 10px;
21 |     color: #fff;
22 |     font-size: 14px;
23 |     margin-bottom: 20px;
24 | }
25 | 
26 | pre, code {
27 |     font-family: 'Monaco', courier, monospace;
28 | }
29 | 
30 | pre .comment {
31 |     color: #727272;
32 | }
33 | 
34 | pre .constant {
35 |     color: #D8FA3C;
36 | }
37 | 
38 | pre .storage {
39 |     color: #FBDE2D;
40 | }
41 | 
42 | pre .string {
43 |     color: #61CE3C;
44 | }
45 | 
46 | pre .keyword, pre .selector {
47 |     color: #FBDE2D;
48 | }
49 | 
50 | pre .parent {
51 |     font-style: italic;
52 | }
53 | 
54 | pre .entity {
55 |     color: #FF6400;
56 | }
57 | 
58 | pre .support {
59 |     color: #8DA6CE;
60 | }
61 | 
62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/js/language/smalltalk.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Smalltalk patterns 3 | * 4 | * @author Frank Shearar 5 | * @version 1.0 6 | */ 7 | Rainbow.extend('smalltalk', [ 8 | { 9 | 'name': 'keyword.pseudovariable', 10 | 'pattern': /self|thisContext/g 11 | }, 12 | { 13 | 'name': 'keyword.constant', 14 | 'pattern': /false|nil|true/g 15 | }, 16 | { 17 | 'name': 'string', 18 | 'pattern': /'([^']|'')*'/g 19 | }, 20 | { 21 | 'name': 'string.symbol', 22 | 'pattern': /#\w+|#'([^']|'')*'/g 23 | }, 24 | { 25 | 'name': 'string.character', 26 | 'pattern': /\$\w+/g 27 | }, 28 | { 29 | 'name': 'comment', 30 | 'pattern': /"([^"]|"")*"/g 31 | }, 32 | { 33 | 'name': 'constant.numeric', 34 | 'pattern': /-?\d+(\.\d+)?((r-?|s)[A-Za-z0-9]+|e-?[0-9]+)?/g 35 | }, 36 | { 37 | 'name': 'entity.name.class', 38 | 'pattern': /\b[A-Z]\w*/g 39 | }, 40 | { 41 | 'name': 'entity.name.function', 42 | 'pattern': /\b[a-z]\w*:?/g 43 | }, 44 | { 45 | 'name': 'entity.name.binary', 46 | 'pattern': /(<|>|&|[=~\|\\\/!@*\-_+])+/g 47 | }, 48 | { 49 | 'name': 'operator.delimiter', 50 | 'pattern': /;[\(\)\[\]\{\}]|#\[|#\(^\./g 51 | } 52 | ], true); 53 | -------------------------------------------------------------------------------- /s5/_ui/default/iepngfix.htc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 42 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/themes/obsidian.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Obsidian theme 3 | * 4 | * Adapted from a theme based on: 5 | * http://studiostyl.es/schemes/son-of-obsidian 6 | * 7 | * @author Dan Stewart 8 | * @version 1.0 9 | */ 10 | pre { 11 | background: #22282A; 12 | word-wrap: break-word; 13 | margin: 0px; 14 | padding: 0px; 15 | padding: 10px; 16 | color: #F1F2F3; 17 | font-size: 14px; 18 | margin-bottom: 20px; 19 | } 20 | 21 | pre, code { 22 | font-family: 'Monaco', courier, monospace; 23 | } 24 | 25 | pre .comment { 26 | color: #66747B; 27 | } 28 | 29 | pre .constant { 30 | color: #EC7600; 31 | } 32 | 33 | pre .storage { 34 | color: #EC7600; 35 | } 36 | 37 | pre .string, pre .comment.docstring { 38 | color: #EC7600; 39 | } 40 | 41 | pre .string.regexp, pre .support.tag.script, pre .support.tag.style { 42 | color: #fff; 43 | } 44 | 45 | 46 | pre .keyword, pre .selector { 47 | color: #93C763; 48 | } 49 | 50 | pre .inherited-class { 51 | font-style: italic; 52 | } 53 | 54 | pre .entity { 55 | color: #93C763; 56 | } 57 | 58 | pre .integer { 59 | color: #FFCD22; 60 | } 61 | 62 | pre .support, *[data-language="csharp"] .function.call { 63 | color: #FACD22; 64 | } 65 | 66 | pre .variable.global, pre .variable.class, pre .variable.instance { 67 | color: #CCC; 68 | } 69 | 70 | /* C# specific rule */ 71 | pre .preprocessor { 72 | color: #66747B; 73 | } 74 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/demos/html.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Syntax Highlighting 4 | 5 | 6 | 8 |
 9 | <!-- inline styles! -->
10 | <style type="text/css">
11 |     body span.blah {
12 |         background: #000;
13 |         color: #fff;
14 |     }
15 | </style>
16 | 
17 | <body>
18 |     <span class="blah" width="200" height="200">test code goes here</span>
19 | </body>
20 | 
21 | <!-- inline php! -->
22 | <?php
23 |     $test = true;
24 | 
25 |     /**
26 |      * test
27 |      */
28 |     function what($test) {
29 |         return $test;
30 |     }
31 | ?>
32 | 
33 | <!-- inline javascript! -->
34 | <script type="text/javascript">
35 |     function prettyCool() {
36 |         doSomeJQueryOrWhatever();
37 |     }
38 | </script>
39 | 
40 | <article title="<?= $user->name ?>">test</article>
41 | 
42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /s5/_ui/default/print.css: -------------------------------------------------------------------------------- 1 | /* The following rule is necessary to have all slides appear in print! DO NOT REMOVE IT! */ .slide, ul {page-break-inside: avoid; visibility: visible !important;} h1 {page-break-after: avoid;} body {font-size: 12pt; background: white;} * {color: black;} #slide0 h1 {font-size: 200%; border: none; margin: 0.5em 0 0.25em;} #slide0 h3 {margin: 0; padding: 0;} #slide0 h4 {margin: 0 0 0.5em; padding: 0;} #slide0 {margin-bottom: 3em;} h1 {border-top: 2pt solid gray; border-bottom: 1px dotted silver;} .extra {background: transparent !important;} div.extra, pre.extra, .example {font-size: 10pt; color: #333;} ul.extra a {font-weight: bold;} p.example {display: none;} #header {display: none;} #footer h1 {margin: 0; border-bottom: 1px solid; color: gray; font-style: italic;} #footer h2, #controls {display: none;} /* The following rule keeps the layout stuff out of print. Remove at your own risk! */ .layout, .layout * {display: none !important;} /* Pete additions */ h2.interstitial { display:none; padding:30px 50px; background:#eee; border:1px solid #ccc; font: bold 150%/1em Helvetica, sans-serif; text-transform: capitalize; color: #333; margin:100px 0; border-bottom: 1px solid; page-break-before: always; } .no-print, .no-print * {display: none !important;} a { /*text-decoration:none;*/ padding-right:10px; } a .printonly { padding-left:4px; font-size:60%; vertical-align:top; } td, th { border:1px solid #999; padding:5px 10px; } -------------------------------------------------------------------------------- /s5/_ui/rainbow/js/language/sql.js: -------------------------------------------------------------------------------- 1 | /** 2 | * PL/SQL patterns 3 | * 4 | * @author Ray Myers 5 | * @version 1.0.0 6 | */ 7 | Rainbow.extend( "sql", [ 8 | { 9 | name: "constant", 10 | pattern: /\b(false|null|true)\b/gi 11 | }, 12 | { 13 | // see http://docs.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html 14 | name: "keyword", 15 | // An attempt at listing the most common keywords. Add to this as needed. 16 | pattern: /\b(select|from|insert|update|create|order|by|asc|desc|limit|or|database|show|describe|alter|add|change|drop|truncate|drop|use|package|as|procedure|xmltype|function|return|varchar|varchar2|char|number|long|float|double|integer|int|tinyint|datetime|text|date|timestamp|out|body|rowtype|values|into|nextval|begin|end|table|type|loop|constant|exception|pragma|exception_init|is|while|then|else|raise|others|when|delete|merge|union|commit|rollback|clob|if|elsif|join|using|set|values|sysdate|inner|outer|exists|distinct|sequence|on|matched|where|and|rownum|boolean|default|count|cursor|for|in)\b/gi 17 | }, 18 | { 19 | name: "string", 20 | pattern: /'([^']|(''))*'/g 21 | }, 22 | { 23 | name: "number", 24 | pattern: /\b[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?\b/g 25 | }, 26 | { 27 | name: "comment", 28 | pattern: /\/\*[\s\S]*?\*\/|(--).*?$/gm 29 | }, 30 | { 31 | name: "operator", 32 | pattern: /(\+{1,2}|-{1,2}|~|!|\*|\/|%|(?:<){1,2}|(?:>){1,3}|(?:&){1,2}|\^|\|{1,2}|\?|:|(?:=|!|\+|-|\*|\/|%|\^|\||:=|(?:<){1,2}|(?:>){1,3})?=)/g 33 | } 34 | ], true ); -------------------------------------------------------------------------------- /s5/_ui/rainbow/themes/twilight.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Twilight theme 3 | * 4 | * Adapted from Michael Sheets' TextMate theme of the same name 5 | * 6 | * @author Michael Sheets 7 | * @author Jesse Farmer 8 | * @version 1.0.1 9 | */ 10 | pre { 11 | background: #141414; 12 | word-wrap: break-word; 13 | margin: 0px; 14 | padding: 0px; 15 | padding: 10px; 16 | color: #F8F8F8; 17 | font-size: 14px; 18 | margin-bottom: 20px; 19 | } 20 | 21 | pre, code { 22 | font-family: 'Monaco', courier, monospace; 23 | } 24 | 25 | pre .comment { 26 | color: #5F5A60; 27 | } 28 | 29 | pre .constant.numeric { 30 | color: #D87D50; 31 | } 32 | 33 | pre .constant { 34 | color: #889AB4; 35 | } 36 | 37 | pre .constant.symbol, pre .constant.language { 38 | color: #D87D50; 39 | } 40 | 41 | pre .storage { 42 | color: #F9EE98; 43 | } 44 | 45 | pre .string { 46 | color: #8F9D6A; 47 | } 48 | 49 | pre .string.regexp { 50 | color: #E9C062; 51 | } 52 | 53 | pre .keyword, pre .selector, pre .storage { 54 | color: #CDA869; 55 | } 56 | 57 | pre .inherited-class { 58 | color: #9B5C2E; 59 | } 60 | 61 | pre .entity { 62 | color: #FF6400; 63 | } 64 | 65 | pre .support { 66 | color: #9B859D; 67 | } 68 | 69 | pre .support.magic { 70 | color: #DAD69A; 71 | } 72 | 73 | pre .variable { 74 | color: #7587A6; 75 | } 76 | 77 | pre .function, pre .entity.class { 78 | color: #9B703F; 79 | } 80 | 81 | pre .support.class-name, pre .support.type { 82 | color: #AB99AC; 83 | } 84 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/js/language/shell.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Shell patterns 3 | * 4 | * @author Matthew King 5 | * @author Craig Campbell 6 | * @version 1.0.3 7 | */ 8 | Rainbow.extend('shell', [ 9 | /** 10 | * This handles the case where subshells contain quotes. 11 | * For example: `"$(resolve_link "$name" || true)"`. 12 | * 13 | * Caveat: This really should match balanced parentheses, but cannot. 14 | * @see http://stackoverflow.com/questions/133601/can-regular-expressions-be-used-to-match-nested-patterns 15 | */ 16 | { 17 | 'name': 'shell', 18 | 'matches': { 19 | 1: { 20 | 'language': 'shell' 21 | } 22 | }, 23 | 'pattern': /\$\(([\s\S]*?)\)/gm 24 | }, 25 | { 26 | 'matches': { 27 | 2: 'string' 28 | }, 29 | 'pattern': /(\(|\s|\[|\=)(('|")[\s\S]*?(\3))/gm 30 | }, 31 | { 32 | 'name': 'keyword.operator', 33 | 'pattern': /<|>|&/g 34 | }, 35 | { 36 | 'name': 'comment', 37 | 'pattern': /\#[\s\S]*?$/gm 38 | }, 39 | { 40 | 'name': 'storage.function', 41 | 'pattern': /(.+?)(?=\(\)\s{0,}\{)/g 42 | }, 43 | /** 44 | * Environment variables 45 | */ 46 | { 47 | 'name': 'support.command', 48 | 'pattern': /\b(echo|rm|ls|(mk|rm)dir|cd|find|cp|exit|pwd|exec|trap|source|shift|unset)/g 49 | }, 50 | { 51 | 'matches': { 52 | 1: 'keyword' 53 | }, 54 | 'pattern': /\b(break|case|continue|do|done|elif|else|esac|eval|export|fi|for|function|if|in|local|return|set|then|unset|until|while)(?=\(|\b)/g 55 | } 56 | ], true); 57 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/js/language/lua.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Lua patterns 3 | * 4 | * @author Javier Aguirre 5 | * @version 1.0 6 | */ 7 | Rainbow.extend('lua', [ 8 | { 9 | 'matches': { 10 | 1: { 11 | 'name': 'keyword.operator', 12 | 'pattern': /\=/g 13 | }, 14 | 2: { 15 | 'name': 'string', 16 | 'matches': { 17 | 'name': 'constant.character.escape', 18 | 'pattern': /\\('|"){1}/g 19 | } 20 | } 21 | }, 22 | 'pattern': /(\(|\s|\[|\=)(('|")([^\\\1]|\\.)*?(\3))/gm 23 | }, 24 | { 25 | 'name': 'comment', 26 | 'pattern': /\-{2}\[{2}\-{2}[\s\S]*?\-{2}\]{2}\-{2}|(\-{2})[\s\S]*?$/gm 27 | }, 28 | { 29 | 'name': 'constant.numeric', 30 | 'pattern': /\b(\d+(\.\d+)?(e(\+|\-)?\d+)?(f|d)?|0x[\da-f]+)\b/gi 31 | }, 32 | { 33 | 'matches': { 34 | 1: 'keyword' 35 | }, 36 | 'pattern': /\b((a|e)nd|in|repeat|break|local|return|do|for|then|else(if)?|function|not|if|or|until|while)(?=\(|\b)/gi 37 | }, 38 | { 39 | 'name': 'constant.language', 40 | 'pattern': /true|false|nil/g 41 | }, 42 | { 43 | 'name': 'keyword.operator', 44 | 'pattern': /\+|\!|\-|&(gt|lt|amp);|\||\*|\=|#|\.{2}/g 45 | }, 46 | { 47 | 'matches': { 48 | 1: 'storage.function', 49 | 2: 'entity.name.function' 50 | }, 51 | 'pattern': /(function)\s+(\w+[\:|\.]?\w+?)(?=\()/g 52 | }, 53 | { 54 | 'matches': { 55 | 1: 'support.function' 56 | }, 57 | 'pattern': /\b(print|require|module|\w+\.\w+)(?=\()/g 58 | } 59 | ]); 60 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/tests/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Rainbow tests 4 | 5 | 6 | 7 |

Rainbow Tests

8 |
9 |
10 | Select Language(s) 11 | 26 | 27 | 28 |
29 |
30 | expand all 31 |
32 |
33 | 34 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/js/language/go.js: -------------------------------------------------------------------------------- 1 | /** 2 | * GO Language 3 | * 4 | * @author Javier Aguirre 5 | * @version 1.0 6 | */ 7 | Rainbow.extend('go', [ 8 | { 9 | 'matches': { 10 | 1: { 11 | 'name': 'keyword.operator', 12 | 'pattern': /\=/g 13 | }, 14 | 2: { 15 | 'name': 'string', 16 | 'matches': { 17 | 'name': 'constant.character.escape', 18 | 'pattern': /\\(`|"){1}/g 19 | } 20 | } 21 | }, 22 | 'pattern': /(\(|\s|\[|\=|:)((`|")([^\\\1]|\\.)*?(\3))/gm 23 | }, 24 | { 25 | 'name': 'comment', 26 | 'pattern': /\/\*[\s\S]*?\*\/|(\/\/)[\s\S]*?$/gm 27 | }, 28 | { 29 | 'name': 'constant.numeric', 30 | 'pattern': /\b(\d+(\.\d+)?(e(\+|\-)?\d+)?(f|d)?|0x[\da-f]+)\b/gi 31 | }, 32 | { 33 | 'matches': { 34 | 1: 'keyword' 35 | }, 36 | 'pattern': /\b(break|c(ase|onst|ontinue)|d(efault|efer)|else|fallthrough|for|go(to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)(?=\(|\b)/gi 37 | }, 38 | { 39 | 'name': 'constant.language', 40 | 'pattern': /true|false|null|string|byte|rune|u?int(8|16|32|64)?|float(32|64)|complex(64|128)/g 41 | }, 42 | { 43 | 'name': 'keyword.operator', 44 | 'pattern': /\+|\!|\-|&(gt|lt|amp);|\||\*|\:?=/g 45 | }, 46 | { 47 | 'matches': { 48 | 1: 'function.call' 49 | }, 50 | 'pattern': /(\w+?)(?=\()/g 51 | }, 52 | { 53 | 'matches': { 54 | 1: 'storage.function', 55 | 2: 'entity.name.function' 56 | }, 57 | 'pattern': /(func)\s(.*?)(?=\()/g 58 | } 59 | ]); 60 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/js/language/java.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Java patterns 3 | * 4 | * @author Leo Accend 5 | * @version 1.0.0 6 | */ 7 | Rainbow.extend( "java", [ 8 | { 9 | name: "constant", 10 | pattern: /\b(false|null|true|[A-Z_]+)\b/g 11 | }, 12 | { 13 | matches: { 14 | 1: "keyword", 15 | 2: "support.namespace" 16 | }, 17 | pattern: /(import|package)\s(.+)/g 18 | }, 19 | { 20 | // see http://docs.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html 21 | name: "keyword", 22 | pattern: /\b(abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|native|new|package|private|protected|public|return|short|static|strictfp|super|switch|synchronized|this|throw|throws|transient|try|void|volatile|while)\b/g 23 | }, 24 | { 25 | name: "string", 26 | pattern: /(".*?")/g 27 | }, 28 | { 29 | name: "char", 30 | pattern: /(')(.|\\.|\\u[\dA-Fa-f]{4})\1/g 31 | }, 32 | { 33 | name: "integer", 34 | pattern: /\b(0x[\da-f]+|\d+)L?\b/g 35 | }, 36 | { 37 | name: "comment", 38 | pattern: /\/\*[\s\S]*?\*\/|(\/\/).*?$/gm 39 | }, 40 | { 41 | name: "support.annotation", 42 | pattern: /@\w+/g 43 | }, 44 | { 45 | matches: { 46 | 1: "entity.function" 47 | }, 48 | pattern: /([^@\.\s]+)\(/g 49 | }, 50 | { 51 | name: "entity.class", 52 | pattern: /\b([A-Z]\w*)\b/g 53 | }, 54 | { 55 | // see http://docs.oracle.com/javase/tutorial/java/nutsandbolts/operators.html 56 | name: "operator", 57 | pattern: /(\+{1,2}|-{1,2}|~|!|\*|\/|%|(?:<){1,2}|(?:>){1,3}|instanceof|(?:&){1,2}|\^|\|{1,2}|\?|:|(?:=|!|\+|-|\*|\/|%|\^|\||(?:<){1,2}|(?:>){1,3})?=)/g 58 | } 59 | ], true ); 60 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/js/language/generic.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Generic language patterns 3 | * 4 | * @author Craig Campbell 5 | * @version 1.0.9 6 | */ 7 | Rainbow.extend([ 8 | { 9 | 'matches': { 10 | 1: { 11 | 'name': 'keyword.operator', 12 | 'pattern': /\=/g 13 | }, 14 | 2: { 15 | 'name': 'string', 16 | 'matches': { 17 | 'name': 'constant.character.escape', 18 | 'pattern': /\\('|"){1}/g 19 | } 20 | } 21 | }, 22 | 'pattern': /(\(|\s|\[|\=|:)(('|")([^\\\1]|\\.)*?(\3))/gm 23 | }, 24 | { 25 | 'name': 'comment', 26 | 'pattern': /\/\*[\s\S]*?\*\/|(\/\/|\#)[\s\S]*?$/gm 27 | }, 28 | { 29 | 'name': 'constant.numeric', 30 | 'pattern': /\b(\d+(\.\d+)?(e(\+|\-)?\d+)?(f|d)?|0x[\da-f]+)\b/gi 31 | }, 32 | { 33 | 'matches': { 34 | 1: 'keyword' 35 | }, 36 | 'pattern': /\b(and|array|as|bool(ean)?|c(atch|har|lass|onst)|d(ef|elete|o(uble)?)|e(cho|lse(if)?|xit|xtends|xcept)|f(inally|loat|or(each)?|unction)|global|if|import|int(eger)?|long|new|object|or|pr(int|ivate|otected)|public|return|self|st(ring|ruct|atic)|switch|th(en|is|row)|try|(un)?signed|var|void|while)(?=\(|\b)/gi 37 | }, 38 | { 39 | 'name': 'constant.language', 40 | 'pattern': /true|false|null/g 41 | }, 42 | { 43 | 'name': 'keyword.operator', 44 | 'pattern': /\+|\!|\-|&(gt|lt|amp);|\||\*|\=/g 45 | }, 46 | { 47 | 'matches': { 48 | 1: 'function.call' 49 | }, 50 | 'pattern': /(\w+?)(?=\()/g 51 | }, 52 | { 53 | 'matches': { 54 | 1: 'storage.function', 55 | 2: 'entity.name.function' 56 | }, 57 | 'pattern': /(function)\s(.*?)(?=\()/g 58 | } 59 | ]); 60 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/themes/solarized-dark.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Solarized Dark theme 3 | * 4 | * Adaptation of Solarized Dark from ethanschoonover.com/solarized 5 | * 6 | * @author Ethan Schoonover 7 | * @author David Litmark 8 | * @version 1.0.0 9 | */ 10 | pre { 11 | background: #002b36; /* base03 */ 12 | word-wrap: break-word; 13 | margin: 0px; 14 | padding: 0px; 15 | padding: 10px; 16 | color: #839496; /* base0 */ 17 | font-size: 14px; 18 | margin-bottom: 20px; 19 | } 20 | 21 | pre, code { 22 | font-family: 'Monaco', courier, monospace; 23 | } 24 | 25 | pre .comment { 26 | color: #586e75; /* base01 */ 27 | } 28 | 29 | pre .constant { 30 | color: #839496; /* base0 */ 31 | } 32 | 33 | pre .constant.language { 34 | color: #268bd2; /* blue */ 35 | } 36 | 37 | pre .constant.regexp { 38 | color: #2aa198; /* cyan */ 39 | } 40 | 41 | pre .storage { 42 | color: #268bd2; /* blue */ 43 | } 44 | 45 | pre .string, pre .comment.docstring { 46 | color: #2aa198; /* cyan */ 47 | } 48 | 49 | pre .support.tag.script, pre .support.tag.style { 50 | color: #2aa198; /* cyan */ 51 | } 52 | 53 | pre .string.regexp { 54 | color: #2aa198; /* cyan */ 55 | } 56 | 57 | pre .string.regexp.open, pre .string.regexp.close { 58 | color: #2aa198; /* cyan */ 59 | } 60 | 61 | pre .keyword, pre .selector { 62 | color: #859900; /* green */ 63 | } 64 | 65 | pre .inherited-class { 66 | font-style: italic; 67 | } 68 | 69 | pre .entity { 70 | color: #b58900; /* yellow */ 71 | } 72 | 73 | pre .support, *[data-language="c"] .function.call { 74 | color: #859900; /* green */ 75 | } 76 | 77 | pre .support.method { 78 | color: #839496; /* base0 */ 79 | } 80 | 81 | pre .support.property { 82 | color: #839496; /* base0 */ 83 | } 84 | 85 | pre .variable.global, pre .variable.class, pre .variable.instance { 86 | color: #839496; /* base0 */ 87 | } 88 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/themes/solarized-light.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Solarized Light theme 3 | * 4 | * Adaptation of Solarized Light from ethanschoonover.com/solarized 5 | * 6 | * @author Ethan Schoonover 7 | * @author David Litmark 8 | * @version 1.0.0 9 | */ 10 | pre { 11 | background: #fdf6e3; /* base3 */ 12 | word-wrap: break-word; 13 | margin: 0px; 14 | padding: 0px; 15 | padding: 10px; 16 | color: #657b83; /* base00 */ 17 | font-size: 14px; 18 | margin-bottom: 20px; 19 | } 20 | 21 | pre, code { 22 | font-family: 'Monaco', courier, monospace; 23 | } 24 | 25 | pre .comment { 26 | color: #93a1a1; /* base1 */ 27 | } 28 | 29 | pre .constant { 30 | color: #657b83; /* base00 */ 31 | } 32 | 33 | pre .constant.language { 34 | color: #268bd2; /* blue */ 35 | } 36 | 37 | pre .constant.regexp { 38 | color: #2aa198; /* cyan */ 39 | } 40 | 41 | pre .storage { 42 | color: #268bd2; /* blue */ 43 | } 44 | 45 | pre .string, pre .comment.docstring { 46 | color: #2aa198; /* cyan */ 47 | } 48 | 49 | pre .support.tag.script, pre .support.tag.style { 50 | color: #2aa198; /* cyan */ 51 | } 52 | 53 | pre .string.regexp { 54 | color: #2aa198; /* cyan */ 55 | } 56 | 57 | pre .string.regexp.open, pre .string.regexp.close { 58 | color: #2aa198; /* cyan */ 59 | } 60 | 61 | pre .keyword, pre .selector { 62 | color: #859900; /* green */ 63 | } 64 | 65 | pre .inherited-class { 66 | font-style: italic; 67 | } 68 | 69 | pre .entity { 70 | color: #b58900; /* yellow */ 71 | } 72 | 73 | pre .support, *[data-language="c"] .function.call { 74 | color: #859900; /* green */ 75 | } 76 | 77 | pre .support.method { 78 | color: #657b83; /* base00 */ 79 | } 80 | 81 | pre .support.property { 82 | color: #657b83; /* base00 */ 83 | } 84 | 85 | pre .variable.global, pre .variable.class, pre .variable.instance { 86 | color: #657b83; /* base00 */ 87 | } 88 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/themes/sunburst.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Sunburst theme 3 | * 4 | * Adapted from the Textmate Sunburst theme by Stanley Rost 5 | * 6 | * @author Stanley Rost 7 | * @author Rachel Baker 8 | * @version 1.0.0 9 | */ 10 | pre { 11 | background-color: #000; 12 | word-wrap: break-word; 13 | margin: 0px; 14 | padding: 0px; 15 | padding: 10px; 16 | color: #fff; 17 | font-size: 14px; 18 | margin-bottom: 20px; 19 | } 20 | 21 | pre, code { 22 | font-family: 'Monaco', courier, monospace; 23 | } 24 | 25 | pre .comment { 26 | color: #AEAEAE; font-style: italic; 27 | } 28 | 29 | pre .constant { 30 | color: #3387CC; 31 | } 32 | 33 | pre .storage { 34 | color: #99CF50; 35 | } 36 | 37 | pre .string, pre .entity.name.class, pre .comment.docstring { 38 | color: #65B042; 39 | /* green */ 40 | } 41 | 42 | pre .string.regexp { 43 | color: #E9C062; 44 | } 45 | 46 | pre .string.constant { 47 | color: #DDF2A4; 48 | } 49 | 50 | pre .constant.hex-color { 51 | color: #DD7B3B; 52 | /* orange */ 53 | } 54 | pre .support, pre .tag.script, pre .function.call { 55 | color: #dad085; 56 | } 57 | pre .support.css-property { 58 | color: #C5AF75; 59 | } 60 | pre .support.tag.style { 61 | color: #fff; 62 | } 63 | pre .keyword, pre .selector { 64 | color: #E28964; 65 | /* dark pink */ 66 | } 67 | 68 | pre .keyword.namespace { 69 | color: #3387CC; 70 | font-weight: bold; 71 | } 72 | 73 | pre .inherited-class { 74 | font-style: italic; 75 | } 76 | 77 | pre .entity, pre .variable.instance, pre .support.namespace, pre .support.tag, pre .support.tag-name { 78 | color: #89BDFF; 79 | } 80 | 81 | pre .entity.name.id { 82 | color: #8693A5; 83 | } 84 | 85 | *[data-language="c"] .function.call { 86 | color: #8DA6CE; 87 | } 88 | 89 | pre .variable, pre .variable.global { 90 | color: #3E87E3; 91 | } 92 | pre .variable.class { 93 | 94 | } 95 | 96 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/themes/github.css: -------------------------------------------------------------------------------- 1 | /** 2 | * GitHub theme 3 | * 4 | * @author Craig Campbell 5 | * @version 1.0.4 6 | */ 7 | pre { 8 | border: 1px solid #ccc; 9 | word-wrap: break-word; 10 | padding: 6px 10px; 11 | line-height: 19px; 12 | margin-bottom: 20px; 13 | } 14 | 15 | code { 16 | border: 1px solid #eaeaea; 17 | margin: 0px 2px; 18 | padding: 0px 5px; 19 | font-size: 12px; 20 | } 21 | 22 | pre code { 23 | border: 0px; 24 | padding: 0px; 25 | margin: 0px; 26 | -moz-border-radius: 0px; 27 | -webkit-border-radius: 0px; 28 | border-radius: 0px; 29 | } 30 | 31 | pre, code { 32 | font-family: Consolas, 'Liberation Mono', Courier, monospace; 33 | color: #333; 34 | background: #f8f8f8; 35 | -moz-border-radius: 3px; 36 | -webkit-border-radius: 3px; 37 | border-radius: 3px; 38 | } 39 | 40 | pre, pre code { 41 | font-size: 13px; 42 | } 43 | 44 | pre .comment { 45 | color: #998; 46 | } 47 | 48 | pre .support { 49 | color: #0086B3; 50 | } 51 | 52 | pre .tag, pre .tag-name { 53 | color: navy; 54 | } 55 | 56 | pre .keyword, pre .css-property, pre .vendor-prefix, pre .sass, pre .class, pre .id, pre .css-value, pre .entity.function, pre .storage.function { 57 | font-weight: bold; 58 | } 59 | 60 | pre .css-property, pre .css-value, pre .vendor-prefix, pre .support.namespace { 61 | color: #333; 62 | } 63 | 64 | pre .constant.numeric, pre .keyword.unit, pre .hex-color { 65 | font-weight: normal; 66 | color: #099; 67 | } 68 | 69 | pre .entity.class { 70 | color: #458; 71 | } 72 | 73 | pre .entity.id, pre .entity.function { 74 | color: #900; 75 | } 76 | 77 | pre .attribute, pre .variable { 78 | color: teal; 79 | } 80 | 81 | pre .string, pre .support.value { 82 | font-weight: normal; 83 | color: #d14; 84 | } 85 | 86 | pre .regexp { 87 | color: #009926; 88 | } 89 | 90 | /* PG */ 91 | pre .keyword { 92 | color:#099; 93 | } 94 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/demos/go.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | Syntax Highlighting 7 | 8 | 9 |

GO language

10 |

First example:

11 |
// You can edit this code!
12 | // Click here and start typing.
13 | package main
14 | 
15 | import "fmt"
16 | 
17 | func main() {
18 |     fmt.Println("Hello, world!")
19 | }
20 | 21 |
package main
22 | 
23 | // fib returns a function that returns
24 | // successive Fibonacci numbers.
25 | func fib() func() int {
26 |     a, b := 0, 1
27 |     return func() int {
28 |         a, b = b, a+b
29 |         c = 256
30 |         return a
31 |     }
32 | }
33 | 
34 | func main() {
35 |     f := fib()
36 |     // Function calls are evaluated left-to-right.
37 |     println(f(), f(), f(), f(), f())
38 | }
39 | 40 |

Another Example:

41 | 42 |
/*
43 |     This is a long comment
44 |     Second line.
45 | */
46 | package main
47 | 
48 | import (
49 |     "fmt"
50 |     "github.com/hoisie/web.go"
51 | )
52 | 
53 | type mytype struct {
54 |     A   string
55 |     B   string
56 |     C   int
57 |     D   int64
58 |     E   uint8
59 |     F   complex128
60 |     G   float32
61 | }
62 | 
63 | var page = `
64 |     This is a long string
65 |     This is another string
66 | `
67 | 
68 | func index() string { return page }
69 | 
70 | func process(ctx *web.Context) string {
71 |     var data mytype
72 |     ctx.UnmarshalParams(&data)
73 |     return fmt.Sprintf("%v\n", data)
74 | }
75 | 
76 | func main() {
77 |     web.Get("/", index)
78 |     web.Post("/process", process)
79 |     web.Run("0.0.0.0:9999")
80 | }
81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/demos/r.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | R Demo 5 | 6 | 7 | 8 |
 9 | ## Probability density function for the Generalised Normal Laplace distribution
10 | dgnl <- function(x, mu = 0, sigma = 1, alpha = 1, beta = 1, rho = 1,
11 |                  param = c(mu, sigma, alpha, beta, rho)) {
12 | 
13 |   ## check parameters
14 |   parResult <- gnlCheckPars(param)
15 |   case <- parResult$case
16 |   errMessage <- parResult$errMessage
17 | 
18 |   if (case == "error")
19 |     stop(errMessage)
20 | 
21 |   mu <- param[1]
22 |   sigma <- param[2]
23 |   alpha <- param[3]
24 |   beta <- param[4]
25 |   rho <- param[5]
26 | 
27 |   ## Shifting by mu
28 |   x <- x - mu
29 | 
30 |   ## Initialising result vector
31 |   pdfValues <- rep(0, length(x))
32 |   
33 |   ## Because 'integrate' doesn't take vectors as input, we need to iterate over
34 |   ## x to evaluate densities
35 |   for (i in 1:length(x)) {
36 |     ## Modified characteristic function. Includes minor calculation regarding
37 |     ## complex numbers to ensure the function returns a real number
38 |     chfn <- function(s) {
39 |       result <- (alpha * beta * exp(-((sigma^2 * s^2) / 2))) /
40 |                 (complex(real = alpha, imaginary = -s) *
41 |                  complex(real = beta, imaginary = s))
42 |       result <- result^rho  ## Scaling result by rho
43 |       r <- Mod(result)
44 |       theta <- Arg(result)  
45 |       r * cos(theta - (s * x[i]))
46 |     }
47 |     
48 |     ## Integrating modified characteristic function
49 |     pdfValues[i] <- (1 / pi) * integrate(chfn, 0, Inf)$value
50 |   }
51 |   
52 |   ## Returning vector of densities
53 |   pdfValues
54 | }
55 | 
56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/tests/tests.css: -------------------------------------------------------------------------------- 1 | ul, li, h1, h2, h3, h4, h5, h6 { 2 | margin: 0px; 3 | padding: 0px; 4 | } 5 | 6 | h1 { 7 | margin-bottom: 15px; 8 | } 9 | 10 | body { 11 | font-family: helvetica; 12 | } 13 | 14 | a { 15 | text-decoration: none; 16 | color: #666; 17 | } 18 | 19 | select { 20 | width: 200px; 21 | height: 200px; 22 | font-size: 14px; 23 | } 24 | 25 | form label { 26 | display: block; 27 | margin-top: 10px; 28 | } 29 | 30 | form input { 31 | margin-top: 10px; 32 | } 33 | 34 | ul { 35 | padding-left: 20px; 36 | margin-left: 20px; 37 | } 38 | 39 | .global_toggle { 40 | position: relative; 41 | float: right; 42 | top: 15px; 43 | display: none; 44 | } 45 | 46 | h3 { 47 | margin-top: 30px; 48 | margin-bottom: 10px; 49 | } 50 | 51 | li { 52 | font-size: 30px; 53 | } 54 | 55 | .success a:hover, .failure a:hover, a:hover { 56 | color: #000; 57 | } 58 | 59 | a:active { 60 | color: #ff8009 !important; 61 | } 62 | 63 | pre { 64 | margin-bottom: 10px; 65 | } 66 | 67 | li h5 { 68 | font-size: 16px; 69 | color: #000; 70 | } 71 | 72 | .success, .success a { 73 | color: green; 74 | } 75 | 76 | .success .code, .failure .code { 77 | display: none; 78 | } 79 | 80 | .failure, .failure a { 81 | color: red; 82 | } 83 | 84 | .failure .code { 85 | margin-top: 5px; 86 | } 87 | 88 | h6 { 89 | font-size: 14px; 90 | color: #666; 91 | } 92 | 93 | table { 94 | margin-top: 25px; 95 | margin-bottom: 25px; 96 | /*border: 2px solid #000;*/ 97 | border-collapse: collapse; 98 | } 99 | 100 | table th { 101 | text-align: left; 102 | padding: 5px 20px 5px 5px; 103 | } 104 | 105 | table td { 106 | border: 1px solid #999; 107 | padding: 4px; 108 | } 109 | 110 | table tr td:first-child { 111 | /*border: 0px;*/ 112 | } 113 | 114 | table tr:last-child td:first-child { 115 | /*border-bottom: 0px;*/ 116 | } 117 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/js/language/c.js: -------------------------------------------------------------------------------- 1 | /** 2 | * C patterns 3 | * 4 | * @author Daniel Holden 5 | * @author Craig Campbell 6 | * @version 1.0.6 7 | */ 8 | Rainbow.extend('c', [ 9 | { 10 | 'name': 'meta.preprocessor', 11 | 'matches': { 12 | 1: [ 13 | { 14 | 'matches': { 15 | 1: 'keyword.define', 16 | 2: 'entity.name' 17 | }, 18 | 'pattern': /(\w+)\s(\w+)\b/g 19 | }, 20 | { 21 | 'name': 'keyword.define', 22 | 'pattern': /endif/g 23 | }, 24 | { 25 | 'name': 'constant.numeric', 26 | 'pattern': /\d+/g 27 | }, 28 | { 29 | 'matches': { 30 | 1: 'keyword.include', 31 | 2: 'string' 32 | }, 33 | 'pattern': /(include)\s(.*?)$/g 34 | } 35 | ] 36 | }, 37 | 'pattern': /\#([\S\s]*?)$/gm 38 | }, 39 | { 40 | 'name': 'keyword', 41 | 'pattern': /\b(do|goto|continue|break|switch|case|typedef)\b/g 42 | }, 43 | { 44 | 'name': 'entity.label', 45 | 'pattern': /\w+:/g 46 | }, 47 | { 48 | 'matches': { 49 | 1: 'storage.type', 50 | 3: 'storage.type', 51 | 4: 'entity.name.function' 52 | }, 53 | 'pattern': /\b((un)?signed|const)? ?(void|char|short|int|long|float|double)\*? +((\w+)(?= ?\())?/g 54 | }, 55 | { 56 | 'matches': { 57 | 2: 'entity.name.function' 58 | }, 59 | 'pattern': /(\w|\*) +((\w+)(?= ?\())/g 60 | }, 61 | { 62 | 'name': 'storage.modifier', 63 | 'pattern': /\b(static|extern|auto|register|volatile|inline)\b/g 64 | }, 65 | { 66 | 'name': 'support.type', 67 | 'pattern': /\b(struct|union|enum)\b/g 68 | } 69 | ]); 70 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/demos/coffeescript.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Syntax Highlighting 4 | 5 | 6 | 7 |
# Assignment:
 8 | number   = 42
 9 | opposite = true
10 | 
11 | # Conditions:
12 | number = -42 if opposite
13 | 
14 | # Functions:
15 | square = (x) -> x * x
16 | 
17 | # Arrays:
18 | list = [1, 2, 3, 4, 5]
19 | 
20 | # Objects:
21 | math =
22 |   root:   Math.sqrt
23 |   square: square
24 |   cube:   (x) -> x * square x
25 | 
26 | # Splats:
27 | race = (winner, runners...) ->
28 |   print winner, runners
29 | 
30 | # Existence:
31 | alert "I knew it!" if elvis?
32 | 
33 | # Array comprehensions:
34 | cubes = (math.cube num for num in list)
35 | 36 |
class Animal
37 |   constructor: (@name) ->
38 | 
39 |   move: (meters) ->
40 |     alert @name + " moved #{meters}m."
41 | 
42 | class Snake extends Animal
43 |   move: ->
44 |     alert "Slithering..."
45 |     super 5
46 | 
47 | class Horse extends Animal
48 |   move: ->
49 |     alert "Galloping..."
50 |     super 45
51 | 
52 | sam = new Snake "Sammy the Python"
53 | tom = new Horse "Tommy the Palomino"
54 | 
55 | sam.move()
56 | tom.move()
57 |
weatherReport = (location) ->
58 |   # Make an Ajax request to fetch the weather...
59 |   [location, 72, "Mostly Sunny"]
60 | 
61 | [city, temp, forecast] = weatherReport "Berkeley, CA"
62 | 63 |
fs = require 'fs'
64 | 
65 | option '-o', '--output [DIR]', 'directory for compiled code'
66 | 
67 | task 'build:parser', 'rebuild the Jison parser', (options) ->
68 |   require 'jison'
69 |   code = require('./lib/grammar').parser.generate()
70 |   dir  = options.output or 'lib'
71 |   fs.writeFile "#{dir}/parser.js", code
72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/demos/php.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Syntax Highlighting 4 | 5 | 6 | 7 |
 8 | // this is some sample php code
 9 | $i = 0;
10 | for ($i = 0; $i < 25; ++$i) {
11 |     echo $i;
12 | }
13 | 
14 | # comment like this
15 | function customFunction()
16 | {
17 |     return mt_rand(1, 100);
18 | }
19 | 
20 | while ($test) {
21 |     echo 'blah' . "\n";
22 | };
23 | 
24 | $fruits = array('banana', 'strawberry', 'blueberry', 'apple', 'blackberry');
25 | 
26 | asort($fruits);
27 | 
28 | foreach ($fruits as $key => $value) {
29 |     echo $value;
30 | }
31 | 
32 | 33 |
34 | <?php
35 | namespace Sonic;
36 | 
37 | /**
38 |  * Util
39 |  *
40 |  * @category Sonic
41 |  * @package Util
42 |  * @author Craig Campbell
43 |  */
44 | class Util
45 | {
46 |     /**
47 |      * deletes a directory recursively
48 |      *
49 |      * php's native rmdir() function only removes a directory if there is nothing in it
50 |      *
51 |      * @param string $path
52 |      * @return void
53 |      */
54 |     public static function removeDir($path)
55 |     {
56 |         if (is_link($path)) {
57 |             return unlink($path);
58 |         }
59 | 
60 |         $files = new \RecursiveDirectoryIterator($path);
61 |         foreach ($files as $file) {
62 |             if (in_array($file->getFilename(), array('.', '..'))) {
63 |                 continue;
64 |             }
65 | 
66 |             if ($file->isLink()) {
67 |                 unlink($file->getPathName());
68 |                 continue;
69 |             }
70 | 
71 |             if ($file->isFile()) {
72 |                 unlink($file->getRealPath());
73 |                 continue;
74 |             }
75 | 
76 |             if ($file->isDir()) {
77 |                 self::removeDir($file->getRealPath());
78 |             }
79 |         }
80 |         return rmdir($path);
81 |     }
82 | }
83 | 
84 | 
85 | 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/js/language/html.js: -------------------------------------------------------------------------------- 1 | /** 2 | * HTML patterns 3 | * 4 | * @author Craig Campbell 5 | * @version 1.0.7 6 | */ 7 | Rainbow.extend('html', [ 8 | { 9 | 'name': 'source.php.embedded', 10 | 'matches': { 11 | 2: { 12 | 'language': 'php' 13 | } 14 | }, 15 | 'pattern': /<\?=?(?!xml)(php)?([\s\S]*?)(\?>)/gm 16 | }, 17 | { 18 | 'name': 'source.css.embedded', 19 | 'matches': { 20 | 0: { 21 | 'language': 'css' 22 | } 23 | }, 24 | 'pattern': /<style(.*?)>([\s\S]*?)<\/style>/gm 25 | }, 26 | { 27 | 'name': 'source.js.embedded', 28 | 'matches': { 29 | 0: { 30 | 'language': 'javascript' 31 | } 32 | }, 33 | 'pattern': /<script(?! src)(.*?)>([\s\S]*?)<\/script>/gm 34 | }, 35 | { 36 | 'name': 'comment.html', 37 | 'pattern': /<\!--[\S\s]*?-->/g 38 | }, 39 | { 40 | 'matches': { 41 | 1: 'support.tag.open', 42 | 2: 'support.tag.close' 43 | }, 44 | 'pattern': /(<)|(\/?\??>)/g 45 | }, 46 | { 47 | 'name': 'support.tag', 48 | 'matches': { 49 | 1: 'support.tag', 50 | 2: 'support.tag.special', 51 | 3: 'support.tag-name' 52 | }, 53 | 'pattern': /(<\??)(\/|\!?)(\w+)/g 54 | }, 55 | { 56 | 'matches': { 57 | 1: 'support.attribute' 58 | }, 59 | 'pattern': /([a-z-]+)(?=\=)/gi 60 | }, 61 | { 62 | 'matches': { 63 | 1: 'support.operator', 64 | 2: 'string.quote', 65 | 3: 'string.value', 66 | 4: 'string.quote' 67 | }, 68 | 'pattern': /(=)('|")(.*?)(\2)/g 69 | }, 70 | { 71 | 'matches': { 72 | 1: 'support.operator', 73 | 2: 'support.value' 74 | }, 75 | 'pattern': /(=)([a-zA-Z\-0-9]*)\b/g 76 | }, 77 | { 78 | 'matches': { 79 | 1: 'support.attribute' 80 | }, 81 | 'pattern': /\s(\w+)(?=\s|>)(?![\s\S]*<)/g 82 | } 83 | ], true); 84 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/demos/js.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Syntax Highlighting 4 | 5 | 6 |
 7 | /**
 8 |  * test function
 9 |  *
10 |  * @param string
11 |  * @return string
12 |  */
13 | function blah(foo, blah) {
14 |     var test = 25;
15 | 
16 |     console.log(test.length);
17 | 
18 |     // if foo is true then return this string
19 |     if (foo === true) {
20 |         return 'foo is true';
21 |     }
22 |     return 'foo is false';
23 | }
24 | 
25 | $(document).ready(function() {
26 |     $("table").on("click", "td", function() {
27 |         console.log('td click');
28 |     });
29 | });
30 | 
31 | 
32 | 33 |
34 | window.Rainbow = {
35 |     whatever: function(param) {
36 | 
37 |     },
38 | 
39 |     another: function(param) {
40 | 
41 |     }
42 | };
43 | 
44 | 45 |
46 | window.Rainbow = window.Rainbow || {};
47 | 
48 | Rainbow.extend('javascript', [
49 |     {
50 |         'name': 'selector',
51 |         'pattern': /\$(?=\.|\()/g
52 |     }
53 | ]);
54 | 
55 | 56 |
57 | /**
58 |  * cross browser get attribute for an element
59 |  *
60 |  * @see http://stackoverflow.com/questions/3755227/cross-browser-javascript-getattribute-method
61 |  *
62 |  * @param {Element} el
63 |  * @param {string} attr     attribute you are trying to get
64 |  * @returns {string}
65 |  */
66 | function _attr(el, attr) {
67 |     var result = (el.getAttribute && el.getAttribute(attr)) || null;
68 | 
69 |     if (!result) {
70 |         var attrs = el.attributes,
71 |             length = attrs.length,
72 |             i;
73 | 
74 |         for (i = 0; i < length; ++i) {
75 |             if (attr[i].nodeName === attr) {
76 |                 result = attr[i].nodeValue;
77 |             }
78 |         }
79 |     }
80 | 
81 |     return result;
82 | }
83 | 
84 | 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/themes/pastie.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Pastie theme 3 | * 4 | * @author pygments.org 5 | * @author pastie.org 6 | * @author Simon Potter 7 | * @version 1.0 8 | */ 9 | 10 | pre { 11 | /* original is white background with no border */ 12 | background-color: #F8F8FF; 13 | border: 1px solid #DEDEDE; 14 | word-wrap: break-word; 15 | margin: 0; 16 | padding: 0; 17 | color: #000; 18 | font-size: 13px; 19 | line-height: 16px; 20 | margin-bottom: 20px 21 | } 22 | 23 | pre, code { 24 | font-family: monospace; 25 | } 26 | 27 | pre .comment { 28 | color: #888; 29 | } 30 | 31 | pre .keyword, pre .selector, pre .storage.module, pre .storage.class, pre .storage.function { 32 | color: #080; 33 | font-weight: bold; 34 | } 35 | 36 | pre .keyword.operator { 37 | color: #000; 38 | font-weight: normal; 39 | } 40 | 41 | pre .constant.language { 42 | color: #038; 43 | font-weight:bold; 44 | } 45 | 46 | pre .constant.symbol, pre .class, pre .constant { 47 | color: #036; 48 | font-weight: bold; 49 | } 50 | 51 | pre .keyword.namespace, pre .entity.name.class { 52 | color: #B06; 53 | font-weight: bold; 54 | } 55 | 56 | pre .constant.numeric { 57 | color: #00D; 58 | font-weight: bold; 59 | } 60 | 61 | pre .string, pre .comment.docstring { 62 | color: #D20; 63 | background-color: #FFF0F0; 64 | } 65 | 66 | pre .string.regexp { 67 | background-color: #FFF0FF; 68 | color: #808; 69 | } 70 | 71 | pre .variable.instance { 72 | color: #33B; 73 | } 74 | 75 | pre .entity.name.function { 76 | color: #06B; 77 | font-weight: bold; 78 | } 79 | 80 | pre .support.tag-name, pre .entity.tag.script, pre .entity.tag.style { 81 | color: #070; 82 | } 83 | 84 | pre .support.attribute { 85 | color: #007; 86 | font-style: italic; 87 | } 88 | 89 | pre .entity.name.tag, pre .storage.type { 90 | color: #070; 91 | font-weight: bold; 92 | } 93 | 94 | pre .variable.self, pre .support.function { 95 | color: #038; 96 | font-weight: bold; 97 | } 98 | 99 | pre .entity.function, pre .support.magic, pre.support.method { 100 | color: #C00; 101 | font-weight: bold; 102 | } 103 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/tests/api.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Syntax Highlighting 4 | 5 | 6 |

API Test Page

7 |
8 |

code on page to begin with

9 |
var foo = false;
10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 53 | 54 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/js/language/css.js: -------------------------------------------------------------------------------- 1 | /** 2 | * CSS patterns 3 | * 4 | * @author Craig Campbell 5 | * @version 1.0.7 6 | */ 7 | Rainbow.extend('css', [ 8 | { 9 | 'name': 'comment', 10 | 'pattern': /\/\*[\s\S]*?\*\//gm 11 | }, 12 | { 13 | 'name': 'constant.hex-color', 14 | 'pattern': /#([a-f0-9]{3}|[a-f0-9]{6})(?=;|\s)/gi 15 | }, 16 | { 17 | 'matches': { 18 | 1: 'constant.numeric', 19 | 2: 'keyword.unit' 20 | }, 21 | 'pattern': /(\d+)(px|em|cm|s|%)?/g 22 | }, 23 | { 24 | 'name': 'string', 25 | 'pattern': /('|")(.*?)\1/g 26 | }, 27 | { 28 | 'name': 'support.css-property', 29 | 'matches': { 30 | 1: 'support.vendor-prefix' 31 | }, 32 | 'pattern': /(-o-|-moz-|-webkit-|-ms-)?[\w-]+(?=\s?:)(?!.*\{)/g 33 | }, 34 | { 35 | 'matches': { 36 | 1: [ 37 | { 38 | 'name': 'entity.name.sass', 39 | 'pattern': /&/g 40 | }, 41 | { 42 | 'name': 'direct-descendant', 43 | 'pattern': />/g 44 | }, 45 | { 46 | 'name': 'entity.name.class', 47 | 'pattern': /\.[\w\-_]+/g 48 | }, 49 | { 50 | 'name': 'entity.name.id', 51 | 'pattern': /\#[\w\-_]+/g 52 | }, 53 | { 54 | 'name': 'entity.name.pseudo', 55 | 'pattern': /:[\w\-_]+/g 56 | }, 57 | { 58 | 'name': 'entity.name.tag', 59 | 'pattern': /\w+/g 60 | } 61 | ] 62 | }, 63 | 'pattern': /([\w\ ,:\.\#\&\;\-_]+)(?=.*\{)/g 64 | }, 65 | { 66 | 'matches': { 67 | 2: 'support.vendor-prefix', 68 | 3: 'support.css-value' 69 | }, 70 | 'pattern': /(:|,)\s?(-o-|-moz-|-webkit-|-ms-)?([a-zA-Z-]*)(?=\b)(?!.*\{)/g 71 | }, 72 | { 73 | 'matches': { 74 | 1: 'support.tag.style', 75 | 2: [ 76 | { 77 | 'name': 'string', 78 | 'pattern': /('|")(.*?)(\1)/g 79 | }, 80 | { 81 | 'name': 'entity.tag.style', 82 | 'pattern': /(\w+)/g 83 | } 84 | ], 85 | 3: 'support.tag.style' 86 | }, 87 | 'pattern': /(<\/?)(style.*?)(>)/g 88 | } 89 | ], true); 90 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/js/language/python.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Python patterns 3 | * 4 | * @author Craig Campbell 5 | * @version 1.0.7 6 | */ 7 | Rainbow.extend('python', [ 8 | /** 9 | * don't highlight self as a keyword 10 | */ 11 | { 12 | 'name': 'variable.self', 13 | 'pattern': /self/g 14 | }, 15 | { 16 | 'name': 'constant.language', 17 | 'pattern': /None|True|False/g 18 | }, 19 | { 20 | 'name': 'support.object', 21 | 'pattern': /object/g 22 | }, 23 | 24 | /** 25 | * built in python functions 26 | * 27 | * this entire list is 580 bytes minified / 379 bytes gzipped 28 | * 29 | * @see http://docs.python.org/library/functions.html 30 | * 31 | * @todo strip some out or consolidate the regexes with matching patterns? 32 | */ 33 | { 34 | 'name': 'support.function.python', 35 | 'pattern': /\b(bs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|bin|file|iter|property|tuple|bool|filter|len|range|type|bytearray|float|list|raw_input|unichr|callable|format|locals|reduce|unicode|chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|__import__|complex|hash|min|set|apply|delattr|help|next|setattr|buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern)(?=\()/g 36 | }, 37 | { 38 | 'matches': { 39 | 1: 'keyword' 40 | }, 41 | 'pattern': /\b(pass|lambda|with|is|not|in|from|elif)(?=\(|\b)/g 42 | }, 43 | { 44 | 'matches': { 45 | 1: 'storage.class', 46 | 2: 'entity.name.class', 47 | 3: 'entity.other.inherited-class' 48 | }, 49 | 'pattern': /(class)\s+(\w+)\((\w+?)\)/g 50 | }, 51 | { 52 | 'matches': { 53 | 1: 'storage.function', 54 | 2: 'support.magic' 55 | }, 56 | 'pattern': /(def)\s+(__\w+)(?=\()/g 57 | }, 58 | { 59 | 'name': 'support.magic', 60 | 'pattern': /__(name)__/g 61 | }, 62 | { 63 | 'matches': { 64 | 1: 'keyword.control', 65 | 2: 'support.exception.type' 66 | }, 67 | 'pattern': /(except) (\w+):/g 68 | }, 69 | { 70 | 'matches': { 71 | 1: 'storage.function', 72 | 2: 'entity.name.function' 73 | }, 74 | 'pattern': /(def)\s+(\w+)(?=\()/g 75 | }, 76 | { 77 | 'name': 'entity.name.function.decorator', 78 | 'pattern': /@(\w+)/g 79 | }, 80 | { 81 | 'name': 'comment.docstring', 82 | 'pattern': /('{3}|"{3})[\s\S]*?\1/gm 83 | } 84 | ]); 85 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/demos/ruby-test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Ruby Test 5 | 6 | 7 | 8 |
  9 | # Comments
 10 | not_comment # comment
 11 | 
 12 | =begin
 13 | comment
 14 | =end
 15 | 
 16 |   =begin
 17 |   not_comment
 18 |   =end
 19 | 
 20 | # Strings
 21 | 'string'
 22 | "string"
 23 | %q(string)
 24 | %q[string]
 25 | %q{string}
 26 | %q<string>
 27 | %q|string|
 28 | %Q(string)
 29 | %Q[string]
 30 | %Q{string}
 31 | %Q<string>
 32 | %Q|string|
 33 | 
 34 | foo('string', 'string')
 35 | 
 36 | "unsupported\"string"
 37 | 
 38 | # Heredocs
 39 | if true
 40 |   DOC = foo(<<-DOC)
 41 | heredoc
 42 |   xxx
 43 |     xxx
 44 |   DOC
 45 |   # ^heredoc ends here
 46 | DOC
 47 | end
 48 | 
 49 | if true
 50 |   DOC = foo(<<DOC)
 51 | heredoc
 52 |   xxx
 53 |     xxx
 54 |   DOC
 55 | DOC
 56 | # ^heredoc ends here
 57 | end
 58 | 
 59 | # Symbols
 60 | :symbol
 61 | :'long symbol'
 62 | :"long symbol"
 63 | 
 64 | # Regular Expressions
 65 | /regex/xxx
 66 | %r(regex)xxx
 67 | %r[regex]xxx
 68 | %r{regex}xxx
 69 | %r<regex>xxx
 70 | %r|regex|xxx
 71 | 
 72 | foo(/regex/xxx, /regex/xxx)
 73 | @path.sub(/^#{@root}/, '')
 74 | 
 75 | /unsupported\/regex/
 76 | 
 77 | # Classes
 78 | class Test < Object
 79 |   attr_accessor :z
 80 | end
 81 | 
 82 | x = Test.method(1, 2)
 83 | x = Test::method(1, 2)
 84 | x = Test::CONSTANT
 85 | 
 86 | # Methods
 87 | def method(x, y)
 88 |   z = 3
 89 | end
 90 | 
 91 | def self.method(x, y)
 92 |   z = 3
 93 | end
 94 | 
 95 | # Sigils
 96 | $stderr.puts 3
 97 | @@foo = 3
 98 | @foo = 3
 99 | 
100 | # Data Structures
101 | [:value]
102 | ['value']
103 | {:key=>'value'}
104 | {:key => 'value'}
105 | {'key' => 'value'}
106 | {key: 'value'}
107 | foo(:key => 'value')
108 | foo(key: 'value')
109 | 
110 | # Classes, modules, etc.
111 | module Foo
112 |   CONSTANT = 'An \'escaped\' string'
113 |   class Bar
114 |     def self.something
115 |     begin
116 |       1 + 1
117 |     rescue StandardError => e
118 |       puts "Whoa buddy!"
119 |     end
120 | 
121 |     class << self
122 |       def something
123 |         1 + 1
124 |       end
125 |     end
126 | 
127 |     def something
128 |     end
129 |   end
130 | end
131 | 
132 | class MyClass < ::Foo::Bar
133 | end
134 | 
135 | foo(::Foo::Bar.something)
136 | 
137 | 
138 | 
139 | 140 | 141 | 142 | 143 | 144 | -------------------------------------------------------------------------------- /remote/public/_includes/js/site.js: -------------------------------------------------------------------------------- 1 | /* 2 | * S5 Controller 3 | */ 4 | (function(doc, $) { 5 | 6 | var $notes, $slideCount, $totalSlides; 7 | 8 | // init on dom load 9 | $.domReady(function(){ 10 | detectClicks(); 11 | $notes = $(".notes"); 12 | $currentSlide = $(".current-slide"); 13 | $totalSlides = $(".total-slides"); 14 | }); 15 | 16 | // set up websockets 17 | var socket = io.connect(); 18 | 19 | // connection established 20 | socket.on('open', function (data) { 21 | log("remote", data); 22 | }); 23 | 24 | // message received 25 | socket.on('message', function (data) { 26 | log("remote", data); 27 | }); 28 | 29 | // update notes 30 | socket.on('notes', function (data){ 31 | $notes.html(data.notes); 32 | $currentSlide.html(data.currentSlide); 33 | $totalSlides.html(data.totalSlides); 34 | log("updated notes", data); 35 | }); 36 | 37 | // connection closed 38 | socket.on('close', function (data) { 39 | log("remote", data); 40 | }); 41 | 42 | 43 | // detect previous/next clicks 44 | function detectClicks() { 45 | var $prev = $("a.prev"), 46 | $next = $("a.next"); 47 | 48 | $prev.on('click', function(e){ 49 | this.blur(); 50 | e.preventDefault(); 51 | send("prev"); 52 | }); 53 | 54 | $next.on('click', function(e){ 55 | this.blur(); 56 | e.preventDefault(); 57 | send("next"); 58 | }); 59 | } 60 | 61 | 62 | // send (and log) a message 63 | function send(message) { 64 | socket.emit("move", {message:message}); 65 | log("local", message); 66 | } 67 | 68 | 69 | // log recieved messages 70 | function log(source, message) { 71 | console.log(source, " message received: ", message); 72 | } 73 | 74 | 75 | /* 76 | * iOS viewport fix 77 | * https://raw.github.com/gist/901295/bf9a44b636a522e608bba11a91b8298acd081f50/ios-viewport-scaling-bug-fix.js 78 | * By @mathias, @cheeaun and @jdalton 79 | */ 80 | (function(){ 81 | var addEvent = 'addEventListener', 82 | type = 'gesturestart', 83 | qsa = 'querySelectorAll', 84 | scales = [1, 1], 85 | meta = qsa in doc ? doc[qsa]('meta[name=viewport]') : []; 86 | 87 | function fix() { 88 | meta.content = 'width=device-width,minimum-scale=' + scales[0] + ',maximum-scale=' + scales[1]; 89 | doc.removeEventListener(type, fix, true); 90 | } 91 | 92 | if ((meta = meta[meta.length - 1]) && addEvent in doc) { 93 | fix(); 94 | scales = [0.25, 1.6]; 95 | doc[addEvent](type, fix, true); 96 | } 97 | })(); 98 | 99 | }(document, $)); 100 | 101 | 102 | // hide address bar 103 | window.addEventListener('load', function(e) { 104 | setTimeout(function() { window.scrollTo(0, 1); }, 1); 105 | }, false); -------------------------------------------------------------------------------- /s5/_ui/rainbow/demos/python.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Syntax Highlighting 4 | 5 | 6 | 7 |
 8 | #!/usr/bin/env python
 9 | # Copyright 2012 Craig Campbell
10 | #
11 | # Licensed under the Apache License, Version 2.0 (the "License");
12 | # you may not use this file except in compliance with the License.
13 | # You may obtain a copy of the License at
14 | #
15 | # http://www.apache.org/licenses/LICENSE-2.0
16 | #
17 | # Unless required by applicable law or agreed to in writing, software
18 | # distributed under the License is distributed on an "AS IS" BASIS,
19 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 | # See the License for the specific language governing permissions and
21 | # limitations under the License.
22 | import re, os, math
23 | from util import Util
24 | from instrument import Instrument
25 | 
26 | class WarpWhistle(object):
27 |     TEMPO = 'tempo'
28 |     VOLUME = 'volume'
29 |     TIMBRE = 'timbre'
30 |     ARPEGGIO = 'arpeggio'
31 |     INSTRUMENT = 'instrument'
32 |     PITCH = 'pitch'
33 |     OCTAVE = 'octave'
34 |     SLIDE = 'slide'
35 |     Q = 'q'
36 | 
37 |     ABSOLUTE_NOTES = 'X-ABSOLUTE-NOTES'
38 |     TRANSPOSE = 'X-TRANSPOSE'
39 |     COUNTER = 'X-COUNTER'
40 |     X_TEMPO = 'X-TEMPO'
41 |     SMOOTH = 'X-SMOOTH'
42 |     N106 = 'EX-NAMCO106'
43 |     FDS = 'EX-DISKFM'
44 |     VRC6 = 'EX-VRC6'
45 |     PITCH_CORRECTION = 'PITCH-CORRECTION'
46 | 
47 |     CHIP_N106 = 'N106'
48 |     CHIP_FDS = 'FDS'
49 |     CHIP_VRC6 = 'VRC6'
50 | 
51 |     def __init__(self, content, logger, options):
52 |         self.first_run = True
53 | 
54 |         # current voice we are processing if we are processing voices separately
55 |         self.process_voice = None
56 | 
57 |         # list of voices to process
58 |         self.voices_to_process = None
59 | 
60 |         # list of voices
61 |         self.voices = None
62 | 
63 |         self.content = content
64 |         self.logger = logger
65 |         self.options = options
66 |         self.reset()
67 | 
68 |     def reset(self):
69 |         """
70 |         This method resets the properties of the instance.
71 |         """
72 |         self.current_voices = []
73 |         self.global_vars = {}
74 |         self.vars = {}
75 |         self.instruments = {}
76 |         self.data = {}
77 |         self.global_lines = []
78 | 
79 |     def getDataForVoice(self, voice, key):
80 |         if not voice in self.data:
81 |             return None
82 | 
83 |         if not key in self.data[voice]:
84 |             return None
85 | 
86 |         return self.data[voice][key]
87 | 
88 | 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /s5/_ui/pg/slide-websockets.js: -------------------------------------------------------------------------------- 1 | // Slide websockets 2 | 3 | /* 4 | * Init on load 5 | */ 6 | (function(){ 7 | 8 | // only start the sockets once... 9 | var socketOn = false; 10 | 11 | 12 | // add load event 13 | if (window.addEventListener) { 14 | window.addEventListener("load", init, false); 15 | } 16 | 17 | 18 | /* 19 | * init web sockets 20 | */ 21 | function init() { 22 | 23 | // enter the password to activate bonus mode 24 | var 25 | kkeys = [], 26 | password = "71,79"; //this spells guns 27 | 28 | if (window.addEventListener) { 29 | window.addEventListener('keydown', function(e){ 30 | kkeys.push( e.keyCode ); 31 | if ( kkeys.toString().indexOf( password ) >= 0 ) { 32 | console.log("starting controller"); 33 | startController(); 34 | kkeys = []; 35 | } 36 | }); 37 | } 38 | } 39 | 40 | 41 | 42 | function startController() { 43 | 44 | var socket, note; 45 | 46 | // only start sockets once 47 | if (!!socketOn) { 48 | return; 49 | } 50 | socketOn = true; 51 | 52 | console.log("web sockets activated"); 53 | 54 | // set up websockets 55 | socket = io.connect(websocketUrl); 56 | 57 | // connection established 58 | socket.on('connect', function () { 59 | console.log("socket connected"); 60 | socket.emit("slide-notes",{ 61 | currentSlide: snum+1, 62 | totalSlides : smax, 63 | notes : getNote() 64 | }); 65 | }); 66 | 67 | // move received 68 | socket.on('shift', function (data) { 69 | 70 | console.log("shift", data); 71 | 72 | note = getNote(data.dir); 73 | 74 | // trigger 'left' keypress for s5 75 | if (data.dir === "prev") { 76 | keys({which:37}); 77 | socket.emit("slide-notes",{ 78 | currentSlide: snum+1, 79 | totalSlides : smax, 80 | notes : note 81 | }); 82 | } 83 | 84 | // trigger 'right' keypress for s5 85 | if (data.dir === "next") { 86 | keys({which:39}); 87 | socket.emit("slide-notes",{ 88 | currentSlide: snum+1, 89 | totalSlides : smax, 90 | notes : note 91 | }); 92 | } 93 | }); 94 | } 95 | 96 | 97 | function getNote(dir) { 98 | var notesEl, notes, slideNo; 99 | 100 | if (dir === "next") { 101 | slideNo = snum + 1; 102 | } else if (dir === "prev") { 103 | slideNo = snum - 1; 104 | } else { 105 | slideNo = snum; 106 | } 107 | 108 | notesEl = document.querySelectorAll('.slide')[slideNo].querySelector('.notes'); 109 | if (notesEl) { 110 | notes = notesEl.innerHTML; 111 | } else { 112 | notes = "[no notes]"; 113 | } 114 | 115 | return notes; 116 | } 117 | })(); -------------------------------------------------------------------------------- /goog/assets/slide-websockets.js: -------------------------------------------------------------------------------- 1 | // Slide websockets 2 | 3 | /* 4 | * Init on load 5 | */ 6 | (function(){ 7 | 8 | // only start the sockets once... 9 | var socketOn = false; 10 | 11 | 12 | // add load event 13 | if (window.addEventListener) { 14 | window.addEventListener("load", init, false); 15 | } 16 | 17 | 18 | /* 19 | * init web sockets 20 | */ 21 | function init() { 22 | 23 | // enter the password to activate web sockets 24 | var 25 | kkeys = [], 26 | password = "71,79"; //this spells go 27 | 28 | if (window.addEventListener) { 29 | window.addEventListener('keydown', function(e){ 30 | kkeys.push( e.keyCode ); 31 | if ( kkeys.toString().indexOf( password ) >= 0 ) { 32 | console.log("starting controller"); 33 | startController(); 34 | kkeys = []; 35 | } 36 | }); 37 | } 38 | } 39 | 40 | 41 | 42 | function startController() { 43 | 44 | var socket, note; 45 | 46 | // only start sockets once 47 | if (!!socketOn) { 48 | return; 49 | } 50 | socketOn = true; 51 | 52 | console.log("web sockets activated"); 53 | 54 | // set up websockets 55 | socket = io.connect(websocketUrl); 56 | 57 | // connection established 58 | socket.on('connect', function () { 59 | console.log("socket connected"); 60 | socket.emit("slide-notes",{ 61 | currentSlide: curSlide+1, 62 | totalSlides : slideEls.length, 63 | notes : getNote() 64 | }); 65 | }); 66 | 67 | // move received 68 | socket.on('shift', function (data) { 69 | 70 | console.log("shift", data); 71 | 72 | note = getNote(data.dir); 73 | 74 | // trigger 'left' keypress for s5 75 | if (data.dir === "prev") { 76 | prevSlide(); 77 | socket.emit("slide-notes",{ 78 | currentSlide: curSlide+1, 79 | totalSlides : slideEls.length, 80 | notes : note 81 | }); 82 | } 83 | 84 | // trigger 'right' keypress for s5 85 | if (data.dir === "next") { 86 | nextSlide(); 87 | socket.emit("slide-notes",{ 88 | currentSlide: curSlide+1, 89 | totalSlides : slideEls.length, 90 | notes : note 91 | }); 92 | } 93 | }); 94 | } 95 | 96 | 97 | function getNote(dir) { 98 | var notesEl, notes, slideNo; 99 | 100 | if (dir === "next") { 101 | slideNo = curSlide + 1; 102 | } else if (dir === "prev") { 103 | slideNo = curSlide - 1; 104 | } else { 105 | slideNo = curSlide; 106 | } 107 | 108 | notesEl = document.querySelectorAll('article')[slideNo].querySelector('.notes'); 109 | if (notesEl) { 110 | notes = notesEl.innerHTML; 111 | } else { 112 | notes = "[no notes]"; 113 | } 114 | 115 | return notes; 116 | } 117 | })(); -------------------------------------------------------------------------------- /s5/_ui/rainbow/js/language/r.js: -------------------------------------------------------------------------------- 1 | /** 2 | * R language patterns 3 | * 4 | * @author Simon Potter 5 | * @version 1.0 6 | */ 7 | Rainbow.extend('r', [ 8 | /** 9 | * Note that a valid variable name is of the form: 10 | * [.a-zA-Z][0-9a-zA-Z._]* 11 | */ 12 | { 13 | 'matches': { 14 | 1: { 15 | 'name': 'keyword.operator', 16 | 'pattern': /\=|<\-|<-/g 17 | }, 18 | 2: { 19 | 'name': 'string', 20 | 'matches': { 21 | 'name': 'constant.character.escape', 22 | 'pattern': /\\('|"){1}/g 23 | } 24 | } 25 | }, 26 | 'pattern': /(\(|\s|\[|\=|:)(('|")([^\\\1]|\\.)*?(\3))/gm 27 | }, 28 | 29 | /** 30 | * Most of these are known via the Language Reference. 31 | * The built-in constant symbols are known via ?Constants. 32 | */ 33 | { 34 | 'matches': { 35 | 1: 'constant.language' 36 | }, 37 | 'pattern': /\b(NULL|NA|TRUE|FALSE|T|F|NaN|Inf|NA_integer_|NA_real_|NA_complex_|NA_character_)\b/g 38 | }, 39 | { 40 | 'matches': { 41 | 1: 'constant.symbol' 42 | }, 43 | 'pattern': /[^0-9a-zA-Z\._](LETTERS|letters|month\.(abb|name)|pi)/g 44 | }, 45 | 46 | /** 47 | * @todo: The list subsetting operator isn't quite working properly. 48 | * It includes the previous variable when it should only match [[ 49 | */ 50 | { 51 | 'name': 'keyword.operator', 52 | 'pattern': /<-|<-|-|==|<=|<=|>>|>=|<|>|&&|&&|&|&|!=|\|\|?|\*|\+|\^|\/|%%|%\/%|\=|%in%|%\*%|%o%|%x%|\$|:|~|\[{1,2}|\]{1,2}/g 53 | }, 54 | { 55 | 'matches': { 56 | 1: 'storage', 57 | 3: 'entity.function' 58 | }, 59 | 'pattern': /(\s|^)(.*)(?=\s?=\s?function\s\()/g 60 | }, 61 | { 62 | 'matches': { 63 | 1: 'storage.function' 64 | }, 65 | 'pattern': /[^a-zA-Z0-9._](function)(?=\s*\()/g 66 | }, 67 | { 68 | 'matches': { 69 | 1: 'namespace', 70 | 2: 'keyword.operator', 71 | 3: 'function.call' 72 | }, 73 | 'pattern': /([a-zA-Z][a-zA-Z0-9._]+)([:]{2,3})([.a-zA-Z][a-zA-Z0-9._]*(?=\s*\())\b/g 74 | }, 75 | 76 | /* 77 | * Note that we would perhaps match more builtin functions and 78 | * variables, but there are so many that most are ommitted for now. 79 | * See ?builtins for more info. 80 | * 81 | * @todo: Fix the case where we have a function like tmp.logical(). 82 | * This should just be a function call, at the moment it's 83 | * only partly a function all. 84 | */ 85 | { 86 | 'name': 'support.function', 87 | 'pattern': /(^|[^0-9a-zA-Z\._])(array|character|complex|data\.frame|double|integer|list|logical|matrix|numeric|vector)(?=\s*\()/g 88 | } 89 | ]); 90 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/js/rainbow.min.js: -------------------------------------------------------------------------------- 1 | /* Rainbow v1.1.8 rainbowco.de */ 2 | window.Rainbow=function(){function q(a){var b,c=a.getAttribute&&a.getAttribute("data-language")||0;if(!c){a=a.attributes;for(b=0;b=e[d][c])delete e[d][c],delete j[d][c];if(a>=c&&ac&&b'+b+""}function s(a,b,c,h){var f=a.exec(c);if(f){++t;!b.name&&"string"==typeof b.matches[0]&&(b.name=b.matches[0],delete b.matches[0]);var k=f[0],i=f.index,u=f[0].length+i,g=function(){function f(){s(a,b,c,h)}t%100>0?f():setTimeout(f,0)};if(C(i,u))g();else{var m=v(b.matches),l=function(a,c,h){if(a>=c.length)h(k);else{var d=f[c[a]];if(d){var e=b.matches[c[a]],i=e.language,g=e.name&&e.matches? 4 | e.matches:e,j=function(b,d,e){var i;i=0;var g;for(g=1;g/g,">").replace(/&(?![\w\#]+;)/g, 6 | "&"),b,c)}function o(a,b,c){if(bdef openFile(path): 17 | file = open(path, "r") 18 | content = file.read() 19 | file.close() 20 | return content 21 | ``` 22 | 23 | 2. Include a CSS theme file in the ````: 24 | 25 | ```html 26 | 27 | ``` 28 | 29 | 3. Include rainbow.js and whatever languages you want before the closing ````: 30 | 31 | ```html 32 | 33 | 34 | 35 | ``` 36 | 37 | ## Extending Rainbow 38 | If you have a language specific pattern that you want highlighted, but it does not exist in the language syntax rules you can add a rule on your page. 39 | 40 | Let's say for example you want to reference PHP's apc functions. 41 | You can include the php language then in the markup on your page add: 42 | 43 | ```html 44 | 54 | ``` 55 | 56 | ## Supported Languages 57 | 58 | Currently supported languages are: 59 | - C 60 | - C# 61 | - Coffeescript 62 | - CSS 63 | - Go 64 | - HTML 65 | - Java 66 | - Javascript 67 | - Lua 68 | - PHP 69 | - Python 70 | - R 71 | - Ruby 72 | - Scheme 73 | - Shell 74 | - Smalltalk 75 | 76 | ## Building 77 | 78 | Rainbow gets minified with the closure compiler. You can install it on OS X via Homebrew: 79 | 80 | brew install closure-compiler 81 | 82 | To build a minified version of your changes, you can run the compile script: 83 | 84 | ./util/compile.py --core 85 | 86 | In case the compiler cannot be found (which is the case if you installed via Homebrew), 87 | you will have to specify the path to the compiler.jar (see `brew info closure-compiler`) - 88 | here's an example: 89 | 90 | CLOSURE_COMPILER=/usr/local/Cellar/closure-compiler/20120710/libexec/build/compiler.jar util/compile.py --core 91 | 92 | If you want to build a custom version, list the languages you would like to include as 93 | command line arguments: 94 | 95 | util/compile.py ruby javascript 96 | 97 | ## More Info 98 | 99 | If you are looking for line number support you can try one of the following: 100 | - https://github.com/Blender3D/rainbow.linenumbers.js 101 | - https://github.com/Sjeiti/rainbow.linenumbers 102 | 103 | You can check out additional documentation and build custom packages at [rainbowco.de](http://rainbowco.de). 104 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/js/language/coffeescript.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Coffeescript patterns 3 | * 4 | * @author Craig Campbell 5 | * @version 1.0 6 | */ 7 | Rainbow.extend('coffeescript', [ 8 | { 9 | 'name': 'comment.block', 10 | 'pattern': /(\#{3})[\s\S]*\1/gm 11 | }, 12 | { 13 | 'name': 'string.block', 14 | 'pattern': /('{3}|"{3})[\s\S]*\1/gm 15 | }, 16 | 17 | /** 18 | * multiline regex with comments 19 | */ 20 | { 21 | 'name': 'string.regex', 22 | 'matches': { 23 | 2: { 24 | 'name': 'comment', 25 | 'pattern': /\#(.*?)\n/g 26 | } 27 | }, 28 | 'pattern': /(\/{3})([\s\S]*)\1/gm 29 | }, 30 | { 31 | 'matches': { 32 | 1: 'keyword' 33 | }, 34 | 'pattern': /\b(in|when|is|isnt|of|not|unless|until|super)(?=\b)/gi 35 | }, 36 | { 37 | 'name': 'keyword.operator', 38 | 'pattern': /\?/g 39 | }, 40 | { 41 | 'name': 'constant.language', 42 | 'pattern': /\b(undefined|yes|on|no|off)\b/g 43 | }, 44 | { 45 | 'name': 'keyword.variable.coffee', 46 | 'pattern': /@(\w+)/gi 47 | }, 48 | 49 | /** 50 | * reset global keywards from generic 51 | */ 52 | { 53 | 'name': 'reset', 54 | 'pattern': /object|class|print/gi 55 | }, 56 | 57 | /** 58 | * named function 59 | */ 60 | { 61 | 'matches' : { 62 | 1: 'entity.name.function', 63 | 2: 'keyword.operator', 64 | 3: { 65 | 'name': 'function.argument.coffee', 66 | 'pattern': /([\@\w]+)/g 67 | }, 68 | 4: 'keyword.function' 69 | }, 70 | 'pattern': /(\w+)\s{0,}(=|:)\s{0,}\((.*?)((-|=)>)/gi 71 | }, 72 | 73 | /** 74 | * anonymous function 75 | */ 76 | { 77 | 'matches': { 78 | 1: { 79 | 'name': 'function.argument.coffee', 80 | 'pattern': /([\@\w]+)/g 81 | }, 82 | 2: 'keyword.function' 83 | }, 84 | 'pattern': /\s\((.*?)\)\s{0,}((-|=)>)/gi 85 | }, 86 | 87 | /** 88 | * direct function no arguments 89 | */ 90 | { 91 | 'matches' : { 92 | 1: 'entity.name.function', 93 | 2: 'keyword.operator', 94 | 3: 'keyword.function' 95 | }, 96 | 'pattern': /(\w+)\s{0,}(=|:)\s{0,}((-|=)>)/gi 97 | }, 98 | 99 | /** 100 | * class definitions 101 | */ 102 | { 103 | 'matches': { 104 | 1: 'storage.class', 105 | 2: 'entity.name.class', 106 | 3: 'storage.modifier.extends', 107 | 4: 'entity.other.inherited-class' 108 | }, 109 | 'pattern': /\b(class)\s(\w+)(\sextends\s)?([\w\\]*)?\b/g 110 | }, 111 | 112 | /** 113 | * object instantiation 114 | */ 115 | { 116 | 'matches': { 117 | 1: 'keyword.new', 118 | 2: { 119 | 'name': 'support.class', 120 | 'pattern': /\w+/g 121 | } 122 | }, 123 | 'pattern': /\b(new)\s(.*?)(?=\s)/g 124 | } 125 | ]); 126 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/js/language/csharp.js: -------------------------------------------------------------------------------- 1 | /** 2 | * C# patterns 3 | * 4 | * @author Dan Stewart 5 | * @version 1.0.1 6 | */ 7 | Rainbow.extend('csharp', [ 8 | { 9 | // @see http://msdn.microsoft.com/en-us/library/23954zh5.aspx 10 | 'name': 'constant', 11 | 'pattern': /\b(false|null|true)\b/g 12 | }, 13 | { 14 | // @see http://msdn.microsoft.com/en-us/library/x53a06bb%28v=vs.100%29.aspx 15 | // Does not support putting an @ in front of a keyword which makes it not a keyword anymore. 16 | 'name': 'keyword', 17 | 'pattern': /\b(abstract|add|alias|ascending|as|base|bool|break|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|descending|double|do|dynamic|else|enum|event|explicit|extern|false|finally|fixed|float|foreach|for|from|get|global|goto|group|if|implicit|int|interface|internal|into|in|is|join|let|lock|long|namespace|new|object|operator|orderby|out|override|params|partial|private|protected|public|readonly|ref|remove|return|sbyte|sealed|select|set|short|sizeof|stackalloc|static|string|struct|switch|this|throw|try|typeof|uint|unchecked|ulong|unsafe|ushort|using|value|var|virtual|void|volatile|where|while|yield)\b/g 18 | }, 19 | { 20 | 'matches': { 21 | 1: 'keyword', 22 | 2: { 23 | 'name': 'support.class', 24 | 'pattern': /\w+/g 25 | } 26 | }, 27 | 'pattern': /(typeof)\s([^\$].*?)(\)|;)/g 28 | }, 29 | { 30 | 'matches': { 31 | 1: 'keyword.namespace', 32 | 2: { 33 | 'name': 'support.namespace', 34 | 'pattern': /\w+/g 35 | } 36 | }, 37 | 'pattern': /\b(namespace)\s(.*?);/g 38 | }, 39 | { 40 | 'matches': { 41 | 1: 'storage.modifier', 42 | 2: 'storage.class', 43 | 3: 'entity.name.class', 44 | 4: 'storage.modifier.extends', 45 | 5: 'entity.other.inherited-class' 46 | }, 47 | 'pattern': /\b(abstract|sealed)?\s?(class)\s(\w+)(\sextends\s)?([\w\\]*)?\s?\{?(\n|\})/g 48 | }, 49 | { 50 | 'name': 'keyword.static', 51 | 'pattern': /\b(static)\b/g 52 | }, 53 | { 54 | 'matches': { 55 | 1: 'keyword.new', 56 | 2: { 57 | 'name': 'support.class', 58 | 'pattern': /\w+/g 59 | } 60 | 61 | }, 62 | 'pattern': /\b(new)\s([^\$].*?)(?=\)|\(|;|&)/g 63 | }, 64 | { 65 | 'name': 'string', 66 | 'pattern': /(")(.*?)\1/g 67 | }, 68 | { 69 | 'name': 'integer', 70 | 'pattern': /\b(0x[\da-f]+|\d+)\b/g 71 | }, 72 | { 73 | 'name': 'comment', 74 | 'pattern': /\/\*[\s\S]*?\*\/|(\/\/)[\s\S]*?$/gm 75 | }, 76 | { 77 | 'name': 'operator', 78 | // @see http://msdn.microsoft.com/en-us/library/6a71f45d%28v=vs.100%29.aspx 79 | // ++ += + -- -= - <<= << <= => >>= >> >= != ! ~ ^ || && &= & ?? :: : *= * |= %= |= == = 80 | 'pattern': /(\+\+|\+=|\+|--|-=|-|<<=|<<|<=|=>|>>=|>>|>=|!=|!|~|\^|\|\||&&|&=|&|\?\?|::|:|\*=|\*|\/=|%=|\|=|==|=)/g 81 | }, 82 | { 83 | // @see http://msdn.microsoft.com/en-us/library/ed8yd1ha%28v=vs.100%29.aspx 84 | 'name': 'preprocessor', 85 | 'pattern': /(\#if|\#else|\#elif|\#endif|\#define|\#undef|\#warning|\#error|\#line|\#region|\#endregion|\#pragma)[\s\S]*?$/gm 86 | } 87 | ], true); 88 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/js/language/scheme.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Scheme patterns 3 | * 4 | * @author Alex Queiroz 5 | * @version 1.0 6 | */ 7 | Rainbow.extend('scheme', [ 8 | { 9 | /* making peace with HTML */ 10 | 'name': 'plain', 11 | 'pattern': />|</g 12 | }, 13 | { 14 | 'name': 'comment', 15 | 'pattern': /;.*$/gm 16 | }, 17 | { 18 | 'name': 'constant.language', 19 | 'pattern': /#t|#f|'\(\)/g 20 | }, 21 | { 22 | 'name': 'constant.symbol', 23 | 'pattern': /'[^()\s#]+/g 24 | }, 25 | { 26 | 'name': 'constant.number', 27 | 'pattern': /\b\d+(?:\.\d*)?\b/g 28 | }, 29 | { 30 | 'name': 'string', 31 | 'pattern': /".+?"/g 32 | }, 33 | { 34 | 'matches': { 35 | 1: 'storage.function', 36 | 2: 'variable' 37 | }, 38 | 'pattern': /\(\s*(define)\s+\(?(\S+)/g 39 | }, 40 | { 41 | 'matches': { 42 | 1: 'keyword' 43 | }, 44 | 'pattern': /\(\s*(begin|define\-syntax|if|lambda|quasiquote|quote|set!|syntax\-rules|and|and\-let\*|case|cond|delay|do|else|or|let|let\*|let\-syntax|letrec|letrec\-syntax)(?=[\]()\s#])/g 45 | }, 46 | { 47 | 'matches': { 48 | 1: 'entity.function' 49 | }, 50 | 'pattern': /\(\s*(eqv\?|eq\?|equal\?|number\?|complex\?|real\?|rational\?|integer\?|exact\?|inexact\?|=|<|>|<=|>=|zero\?|positive\?|negative\?|odd\?|even\?|max|min|\+|\-|\*|\/|abs|quotient|remainder|modulo|gcd|lcm|numerator|denominator|floor|ceiling|truncate|round|rationalize|exp|log|sin|cos|tan|asin|acos|atan|sqrt|expt|make\-rectangular|make\-polar|real\-part|imag\-part|magnitude|angle|exact\->inexact|inexact\->exact|number\->string|string\->number|not|boolean\?|pair\?|cons|car|cdr|set\-car!|set\-cdr!|caar|cadr|cdar|cddr|caaar|caadr|cadar|caddr|cdaar|cdadr|cddar|cdddr|caaaar|caaadr|caadar|caaddr|cadaar|cadadr|caddar|cadddr|cdaaar|cdaadr|cdadar|cdaddr|cddaar|cddadr|cdddar|cddddr|null\?|list\?|list|length|append|reverse|list\-tail|list\-ref|memq|memv|member|assq|assv|assoc|symbol\?|symbol\->string|string\->symbol|char\?|char=\?|char<\?|char>\?|char<=\?|char>=\?|char\-ci=\?|char\-ci<\?|char\-ci>\?|char\-ci<=\?|char\-ci>=\?|char\-alphabetic\?|char\-numeric\?|char\-whitespace\?|char\-upper\-case\?|char\-lower\-case\?|char\->integer|integer\->char|char\-upcase|char\-downcase|string\?|make\-string|string|string\-length|string\-ref|string\-set!|string=\?|string\-ci=\?|string<\?|string>\?|string<=\?|string>=\?|string\-ci<\?|string\-ci>\?|string\-ci<=\?|string\-ci>=\?|substring|string\-append|string\->list|list\->string|string\-copy|string\-fill!|vector\?|make\-vector|vector|vector\-length|vector\-ref|vector\-set!|vector\->list|list\->vector|vector\-fill!|procedure\?|apply|map|for\-each|force|call\-with\-current\-continuation|call\/cc|values|call\-with\-values|dynamic\-wind|eval|scheme\-report\-environment|null\-environment|interaction\-environment|call\-with\-input\-file|call\-with\-output\-file|input\-port\?|output\-port\?|current\-input\-port|current\-output\-port|with\-input\-from\-file|with\-output\-to\-file|open\-input\-file|open\-output\-file|close\-input\-port|close\-output\-port|read|read\-char|peek\-char|eof\-object\?|char\-ready\?|write|display|newline|write\-char|load|transcript\-on|transcript\-off)(?=[\]()\s#])/g 51 | } 52 | ], true); 53 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/demos/lua.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | Syntax Highlighting 7 | 8 | 9 | 10 |
 11 | 
 12 | function get_all_factors(number)
 13 |     --[[--
 14 |     Gets all of the factors of a given number
 15 | 
 16 |     @Parameter: number
 17 |         The number to find the factors of
 18 | 
 19 |     @Returns: A table of factors of the number
 20 |     --]]--
 21 |     local factors = {}
 22 |     for possible_factor=1, math.sqrt(number), 1 do
 23 |         local remainder = number%possible_factor
 24 | 
 25 |         if remainder == 0 then
 26 |             local factor, factor_pair = possible_factor, number/possible_factor
 27 |             table.insert(factors, factor)
 28 | 
 29 |             if factor ~= factor_pair then
 30 |                 table.insert(factors, factor_pair)
 31 |             end
 32 |         end
 33 |     end
 34 | 
 35 |     hello = nil  -- This is it!
 36 |     hello = 3%2
 37 |     print("I haz "..#bag_of_stuff.." things")
 38 |     table.sort(factors)
 39 |     return factors
 40 | end
 41 | 
 42 | --The Meaning of the Universe is 42. Let's find all of the factors driving the Universe.
 43 | 
 44 | the_universe = 42
 45 | factors_of_the_universe = get_all_factors(the_universe)
 46 | 
 47 | --Print out each factor
 48 | 
 49 | print("Count",  "The Factors of Life, the Universe, and Everything")
 50 | table.foreach(factors_of_the_universe, print)
 51 | 
 52 | 
 53 | -- Other example
 54 | -------------------------------------------------
 55 | -- PUBLIC FUNCTIONS
 56 | -------------------------------------------------
 57 | 
 58 | function gameminion.init(accessKey, secretKey)  -- constructor
 59 |     -- initialize GM connection
 60 | 
 61 |     GM_ACCESS_KEY = accessKey
 62 |     GM_SECRET_KEY = secretKey
 63 | 
 64 |     local newGameminion = {
 65 |         authToken = authToken,
 66 |         accessKey = GM_ACCESS_KEY,
 67 |         secretKey = GM_SECRET_KEY,
 68 |         gameID = "4f6f1e456b789d0001000002",
 69 |         cloudStorageBox = cloudStorageBox,
 70 |         gameminion = gameminion
 71 |     }
 72 | 
 73 |     return setmetatable( newGameminion, gameminion_mt )
 74 | end
 75 | 
 76 | -------------------------------------------------
 77 | -- User
 78 | -------------------------------------------------
 79 | 
 80 | function gameminion:loginWeb()
 81 |     local authToken
 82 | 
 83 |     return authToken
 84 | end
 85 | 
 86 | -------------------------------------------------
 87 | 
 88 | function gameminion:loginAPI(username, password)
 89 |     local params = "login="..username.."&password="..password"
 90 | 
 91 |     local path = "user_sessions/user_login.json"
 92 | 
 93 |     -- set AuthToken when it gets it
 94 |     local function networkListener(event)
 95 |         if (event.isError) then
 96 |             print("Network Error")
 97 |             print("Error: "..event.response)
 98 |             return false
 99 |         else
100 |             self.authToken = json.decode(event.response).auth_token
101 |             print("User Logged In!")
102 |             print("Auth Token: "..self.authToken)
103 |             return true
104 |         end
105 |     end
106 | 
107 |     postGM(path, params, networkListener)
108 | 
109 |     return true
110 | end
111 | 
112 | 
113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /remote/public/_includes/css/screen.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Slide Controller 3 | */ 4 | 5 | /* normalise */ 6 | html { font-size: 100%; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; } 7 | html, button, input, select, textarea { font-family: sans-serif; color: #222; } 8 | body { margin: 0; font-size: 1em; line-height: 1.4; } 9 | 10 | ::-moz-selection { background: #fe57a1; color: #fff; text-shadow: none; } 11 | ::selection { background: #fe57a1; color: #fff; text-shadow: none; } 12 | 13 | a:focus { outline: thin dotted; } 14 | a:hover, a:active { outline: 0; } 15 | 16 | ul, ol, li { margin:0; padding:0; } 17 | 18 | html, body { height:100%; } 19 | 20 | /* site */ 21 | body { 22 | background:#aaa; 23 | font-size:16px; 24 | } 25 | 26 | h1, .controls, .controls li { 27 | -webkit-box-sizing: border-box; 28 | -moz-box-sizing: border-box; 29 | box-sizing: border-box; 30 | } 31 | 32 | h1 { 33 | position: fixed; 34 | top:0; 35 | width:100%; 36 | height:10%; 37 | text-align:center; 38 | background:#f60; 39 | color:#fff; 40 | font-size:2em; 41 | padding:0.4em 0; 42 | margin:0; 43 | border-bottom:1px solid #fff; 44 | } 45 | 46 | /* controls */ 47 | .controls { 48 | position:fixed; 49 | top:10%; 50 | left:0; 51 | right:0; 52 | height:50%; 53 | } 54 | 55 | .controls ul, 56 | .controls li { 57 | height:100%; 58 | } 59 | 60 | .controls li { 61 | display:table; 62 | width:50%; 63 | float:left; 64 | list-style:none; 65 | border-bottom:1px solid #fff; 66 | } 67 | 68 | .controls li:first-child { 69 | border-right:1px solid #fff; 70 | } 71 | 72 | .controls a { 73 | display:table-cell; 74 | width:100%; 75 | height:100%; 76 | background-color:#f90; 77 | color:#fff; 78 | text-align:center; 79 | text-decoration:none; 80 | font-size:3.75em; 81 | vertical-align:middle; 82 | } 83 | 84 | .controls a:hover { 85 | background-color:#f60; 86 | color:#fff; 87 | } 88 | 89 | .controls a, 90 | .controls h1 { 91 | -webkit-transition : all 0.25s ease-out; 92 | -moz-transition : all 0.25s ease-out; 93 | -ms-transition : all 0.25s ease-out; 94 | -o-transition : all 0.25s ease-out; 95 | transition : all 0.25s ease-out; 96 | } 97 | 98 | /* notes */ 99 | .note-container { 100 | position:fixed; 101 | top:60%; 102 | height:40%; 103 | left:0; 104 | right:0; 105 | padding:20px; 106 | background:#fff; 107 | overflow: auto; 108 | -webkit-overflow-scrolling: touch; 109 | } 110 | 111 | 112 | /* 113 | * mobile, landscape 114 | */ 115 | @media only screen and (max-height: 400px) { 116 | h1 { 117 | height:20%; 118 | font-size:1em; 119 | } 120 | .controls { 121 | top:20%; 122 | height:40%; 123 | } 124 | } 125 | 126 | @media only screen and (max-height: 600px) { 127 | h1 { 128 | height:15%; 129 | } 130 | .controls { 131 | top:15%; 132 | height:45%; 133 | } 134 | } 135 | 136 | 137 | /* boilerplate */ 138 | .hidden { display: none !important; visibility: hidden; } 139 | .visuallyhidden { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; } 140 | .visuallyhidden.focusable:active, .visuallyhidden.focusable:focus { clip: auto; height: auto; margin: 0; overflow: visible; position: static; width: auto; } 141 | .invisible { visibility: hidden; } 142 | .clearfix:before, .clearfix:after { content: ""; display: table; } 143 | .clearfix:after { clear: both; } 144 | .clearfix { *zoom: 1; } 145 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/js/language/php.js: -------------------------------------------------------------------------------- 1 | /** 2 | * PHP patterns 3 | * 4 | * @author Craig Campbell 5 | * @version 1.0.7 6 | */ 7 | Rainbow.extend('php', [ 8 | { 9 | 'name': 'support', 10 | 'pattern': /\becho\b/g 11 | }, 12 | { 13 | 'matches': { 14 | 1: 'variable.dollar-sign', 15 | 2: 'variable' 16 | }, 17 | 'pattern': /(\$)(\w+)\b/g 18 | }, 19 | { 20 | 'name': 'constant.language', 21 | 'pattern': /true|false|null/ig 22 | }, 23 | { 24 | 'name': 'constant', 25 | 'pattern': /\b[A-Z0-9_]{2,}\b/g 26 | }, 27 | { 28 | 'name': 'keyword.dot', 29 | 'pattern': /\./g 30 | }, 31 | { 32 | 'name': 'keyword', 33 | 'pattern': /\b(continue|break|die|end(for(each)?|switch|if)|case|require(_once)?|include(_once)?)(?=\(|\b)/g 34 | }, 35 | { 36 | 'matches': { 37 | 1: 'keyword', 38 | 2: { 39 | 'name': 'support.class', 40 | 'pattern': /\w+/g 41 | } 42 | }, 43 | 'pattern': /(instanceof)\s([^\$].*?)(\)|;)/g 44 | }, 45 | 46 | /** 47 | * these are the top 50 most used PHP functions 48 | * found from running a script and checking the frequency of each function 49 | * over a bunch of popular PHP frameworks then combining the results 50 | */ 51 | { 52 | 'matches': { 53 | 1: 'support.function' 54 | }, 55 | 'pattern': /\b(array(_key_exists|_merge|_keys|_shift)?|isset|count|empty|unset|printf|is_(array|string|numeric|object)|sprintf|each|date|time|substr|pos|str(len|pos|tolower|_replace|totime)?|ord|trim|in_array|implode|end|preg_match|explode|fmod|define|link|list|get_class|serialize|file|sort|mail|dir|idate|log|intval|header|chr|function_exists|dirname|preg_replace|file_exists)(?=\()/g 56 | }, 57 | { 58 | 'name': 'variable.language.php-tag', 59 | 'pattern': /(<\?(php)?|\?>)/g 60 | }, 61 | { 62 | 'matches': { 63 | 1: 'keyword.namespace', 64 | 2: { 65 | 'name': 'support.namespace', 66 | 'pattern': /\w+/g 67 | } 68 | }, 69 | 'pattern': /\b(namespace|use)\s(.*?);/g 70 | }, 71 | { 72 | 'matches': { 73 | 1: 'storage.modifier', 74 | 2: 'storage.class', 75 | 3: 'entity.name.class', 76 | 4: 'storage.modifier.extends', 77 | 5: 'entity.other.inherited-class', 78 | 6: 'storage.modifier.extends', 79 | 7: 'entity.other.inherited-class' 80 | }, 81 | 'pattern': /\b(abstract|final)?\s?(class|interface|trait)\s(\w+)(\sextends\s)?([\w\\]*)?(\simplements\s)?([\w\\]*)?\s?\{?(\n|\})/g 82 | }, 83 | { 84 | 'name': 'keyword.static', 85 | 'pattern': /self::|static::/g 86 | }, 87 | { 88 | 'matches': { 89 | 1: 'storage.function', 90 | 2: 'support.magic' 91 | }, 92 | 'pattern': /(function)\s(__.*?)(?=\()/g 93 | }, 94 | { 95 | 'matches': { 96 | 1: 'keyword.new', 97 | 2: { 98 | 'name': 'support.class', 99 | 'pattern': /\w+/g 100 | } 101 | }, 102 | 'pattern': /\b(new)\s([^\$].*?)(?=\)|\(|;)/g 103 | }, 104 | { 105 | 'matches': { 106 | 1: { 107 | 'name': 'support.class', 108 | 'pattern': /\w+/g 109 | }, 110 | 2: 'keyword.static' 111 | }, 112 | 'pattern': /([\w\\]*?)(::)(?=\b|\$)/g 113 | }, 114 | { 115 | 'matches': { 116 | 2: { 117 | 'name': 'support.class', 118 | 'pattern': /\w+/g 119 | } 120 | }, 121 | 'pattern': /(\(|,\s?)([\w\\]*?)(?=\s\$)/g 122 | } 123 | ]); 124 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/tests/language/java-test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Java tests 3 | * 4 | * @author Leo Accend 5 | */ 6 | RainbowTester.startTest("java"); 7 | 8 | RainbowTester.run( 9 | "package declaration", 10 | 'package com.example.rainbow;', 11 | 'package com.example.rainbow;' 12 | ); 13 | 14 | RainbowTester.run( 15 | "import statement", 16 | 'import com.example.rainbow.util.RainbowUtil;', 17 | 'import com.example.rainbow.util.RainbowUtil;' 18 | ); 19 | 20 | RainbowTester.run( 21 | "multi-line comment", 22 | '/**\n * This is a Javadoc style comment. It is pretty awesome.\n */', 23 | '/**\n * This is a Javadoc style comment. It is pretty awesome.\n */' 24 | ); 25 | 26 | RainbowTester.run( 27 | "single-line comment", 28 | '// This is a good comment.', 29 | '// This is a good comment.' 30 | ); 31 | 32 | RainbowTester.run( 33 | "complicated class declaration", 34 | 'public class Rainbow> extends Spectrum implements HasColors, IsPretty {', 35 | 'public class Rainbow<T, List<? extends T>> extends Spectrum implements HasColors, IsPretty {' 36 | ); 37 | 38 | RainbowTester.run( 39 | "simple class declaration", 40 | 'public class Rainbow {', 41 | 'public class Rainbow {' 42 | ); 43 | 44 | RainbowTester.run( 45 | "constant declaration", 46 | 'private static final int RESOLUTION = 7;', 47 | 'private static final int RESOLUTION = 7;' 48 | ); 49 | 50 | RainbowTester.run( 51 | "field declaration", 52 | 'private final String name;', 53 | 'private final String name;' 54 | ); 55 | 56 | RainbowTester.run( 57 | "method declaration", 58 | 'public void shine() {', 59 | 'public void shine() {' 60 | ); 61 | 62 | RainbowTester.run( 63 | "simple annotation", 64 | '@Override', 65 | '@Override' 66 | ); 67 | 68 | RainbowTester.run( 69 | "complex annotation", 70 | '@RequestMapping( value = "/rainbow", method = Method.POST )', 71 | '@RequestMapping( value = "/rainbow", method = Method.POST )' 72 | ); 73 | 74 | RainbowTester.run( 75 | "string concatenation", 76 | '"I found " + numberOfTurtles + " turtles."', 77 | '"I found " + numberOfTurtles + " turtles."' 78 | ); 79 | 80 | RainbowTester.run( 81 | "local method invocation", 82 | 'wait(1000L)', 83 | 'wait(1000L)' 84 | ); 85 | 86 | RainbowTester.run( 87 | "static method invocation", 88 | 'System.out.println("Hello, world!");', 89 | 'System.out.println("Hello, world!");' 90 | ); 91 | 92 | RainbowTester.run( 93 | "variable assignment", 94 | 'int numberOfColors = (int) Math.ceil( Math.random() * 256 );', 95 | 'int numberOfColors = (int) Math.ceil( Math.random() * 256 );' 96 | ); 97 | 98 | RainbowTester.endTest("java"); -------------------------------------------------------------------------------- /goog/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Google Presentation 5 | 6 | 7 | 8 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 32 | 33 |
34 |

My slideshow

35 |

Blah blah blah

36 | 37 |

Hello!

38 |
39 | 40 | 41 |
42 |

Lorem

43 |

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod 44 | tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, 45 | quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo 46 | consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse 47 | cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non 48 | proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

49 |
50 |

Slide 2: Some notes

51 |
52 |
53 | 54 | 55 |
56 |

Lorem Ipsum Dolor Sit Amet

57 |
<!DOCTYPE html>
 58 |   <html>
 59 |     <head>
 60 |       <title>Hello world</title>
 61 |     </head>
 62 |     <body>
 63 |       <h3>Hello world</h3>
 64 |       <p>This is a test</p>
 65 |     </body>
 66 |   </html>
67 |
68 |

Slide 3: quidquid Latine dictum sit altum videtur

69 |
70 |
71 | 72 | 73 |
74 |

Lorem

75 |
    76 |
  • Lorem
  • 77 |
  • Ipsum
  • 78 |
  • Dolor
  • 79 |
  • Sit
  • 80 |
  • Amet
  • 81 |
82 | 83 |
84 | 85 | 86 |
87 |

Lorem

88 |

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod 89 | tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, 90 | quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo 91 | consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse 92 | cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non 93 | proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

94 |
95 |

Slide 5: quidquid Latine dictum sit altum videtur

96 |
97 |
98 | 99 | 100 |
101 |

Lorem Ipsum Dolor Sit Amet

102 |
body {
103 |       background:yellow;
104 |       color:red;
105 |       font-family:Arial;
106 |   }
107 | 
108 |   h3 {
109 |       color:green;
110 |   }
111 |
112 | 113 | 114 |
115 |

Lorem

116 |
    117 |
  • Lorem
  • 118 |
  • Ipsum
  • 119 |
  • Dolor
  • 120 |
  • Sit
  • 121 |
  • Amet
  • 122 |
123 |
124 | 125 | 126 |
127 |

Lorem

128 |

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod 129 | tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, 130 | quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo 131 | consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse 132 | cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non 133 | proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

134 |
135 | 136 | 137 |
138 |

Lorem Ipsum Dolor Sit Amet

139 |

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod 140 | tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.

141 |
142 |

Slide 9: quidquid Latine dictum sit altum videtur

143 |
144 |
145 | 146 | 147 |
148 |

Lorem

149 |
    150 |
  • Lorem
  • 151 |
  • Ipsum
  • 152 |
  • Dolor
  • 153 |
  • Sit
  • 154 |
  • Amet
  • 155 |
156 |
157 | 158 |
159 | 160 | 161 | 162 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/demos/c.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Syntax Highlighting 4 | 5 | 6 | 7 |
  8 | 
  9 | /* variable names that match a keyword or type at the beginning */
 10 | char charcoal;
 11 | float interval;
 12 | char *floating;
 13 | double short_stuff, voider;
 14 | 
 15 | void floater(int x, int y)
 16 | {
 17 |     return;
 18 | }
 19 | 
 20 | 
21 | 22 |
 23 | 
 24 | #include <stdio.h>
 25 | #include <stdarg.h>
 26 | #include <sys/types.h>
 27 | #include <sys/stat.h>
 28 | #include <fcntl.h>
 29 | #include <unistd.h>
 30 | 
 31 | #ifndef BUF_SIZE
 32 | #define BUF_SIZE 1024
 33 | #endif
 34 | 
 35 | static void die (const char * format, ...)
 36 | {
 37 |     va_list vargs;
 38 |     va_start(vargs, format);
 39 |     vfprintf(stderr, format, vargs);
 40 |     fprintf(stderr, ".\n");
 41 |     va_end(vargs);
 42 |     _exit(1);
 43 | }
 44 | 
 45 | int main (int argc, char *argv[])
 46 | {
 47 |     static int x;
 48 |     const float y;
 49 |     unsigned int n;
 50 |     unsigned short int g;
 51 |     char* test;
 52 | 
 53 |     int outFD, opt, openFlags = O_WRONLY;
 54 |     char buf[BUF_SIZE];
 55 |     ssize_t charCount;
 56 | 
 57 |     while ((opt = getopt(argc, argv, ":a")) != -1) {
 58 | 	switch (opt) {
 59 | 	case 'a': 
 60 | 	    openFlags |= O_APPEND;
 61 | 	default:
 62 | 	    die("Unrecognized option");
 63 | 	}
 64 |     }
 65 | 
 66 |     outFD = open(argv[1], O_WRONLY);
 67 |     while ((charCount = read(STDIN_FILENO, buf, BUF_SIZE) > 0)) {
 68 | 	if (charCount != write(STDOUT_FILENO, buf, BUF_SIZE))
 69 | 	    die("Couldn't write same number of bytes to stdout");
 70 | 	if (charCount != write(outFD, buf, BUF_SIZE))
 71 | 	    die("Couldn't write same number of bytes to output file");
 72 |     }
 73 |     close(outFD);
 74 | 
 75 |     return 0;
 76 | }
 77 | 
 78 | 
79 | 80 |
 81 | 
 82 | #ifndef type_h
 83 | #define type_h
 84 | 
 85 | typedef int type_id;
 86 | 
 87 | #define typeid(TYPE) type_find(#TYPE)
 88 | #define type_name(TYPE) #TYPE
 89 | 
 90 | type_id type_find(const char* type);
 91 | const char* type_id_name(int id);
 92 | 
 93 | #endif
 94 | 
 95 | 
 96 | 
97 | 98 |
 99 | 
100 | #include <string.h>
101 | #include <stdio.h>
102 | #include <stdlib.h>
103 | 
104 | #include "error.h"
105 | 
106 | #include "type.h"
107 | 
108 | #define MAX_TYPE_LEN 512
109 | #define MAX_NUM_TYPES 1024
110 | 
111 | /* Store Table of type names */
112 | typedef char type_string[MAX_TYPE_LEN];
113 | type_string type_table[MAX_NUM_TYPES];
114 | int type_index = 0;
115 | 
116 | /* Dynamically enter types into table */
117 | int type_find(const char* type) {
118 |   
119 |   if (strlen(type) >= MAX_TYPE_LEN) {
120 |     error("Type name %s is too long to index into type table.", type);
121 |   }
122 |   if (type_index >= MAX_NUM_TYPES) {
123 |     error("Too many types in type table already. Cannot add %s.", type);
124 |   }
125 |   
126 |   for (int i = 0; i < type_index; i++) {
127 |     // Return type index if found
128 |     if (strcmp(type, type_table[i]) == 0) {
129 |       return i;
130 |     }
131 |   }
132 |   
133 |   // If not found add to table and return
134 |   strcpy(type_table[type_index], type);
135 |   type_index++;
136 |   
137 |   return type_index-1;
138 | }
139 | 
140 | const char* type_id_name(int id) {
141 |   return type_table[id];
142 | }
143 | 
144 | 
145 | 146 |
147 | 
148 | #ifndef sound_h
149 | #define sound_h
150 | 
151 | #include "SDL/SDL.h"
152 | 
153 | typedef struct {
154 |   char* data;
155 |   int length;
156 | } sound;
157 | 
158 | sound* wav_load_file(char* filename);
159 | void sound_delete(sound* s);
160 | 
161 | #endif
162 | 
163 | 
164 | 165 |
166 | 
167 | #include "error.h"
168 | 
169 | #include "assets/sound.h"
170 | 
171 | static void flip_endian(char* data, int length) {
172 |   for(int i = 0; i < length; i += 2) {
173 |     int x = data[i];
174 |     data[i] = data[i + 1];
175 |     data[i + 1] = x;
176 |   }
177 | }
178 | 
179 | sound* wav_load_file(char* filename) {
180 |   
181 |   sound* s = malloc(sizeof(sound));
182 |   
183 |   SDL_AudioSpec spec;
184 |   
185 |   if( SDL_LoadWAV(filename, &spec, (Uint8**)&s->data, (Uint32*)&s->length) == NULL) {
186 |     error("Unable to load sound file %s", filename);
187 |   }
188 |   
189 |   if ((spec.format != AUDIO_S16LSB) &&
190 |       (spec.format != AUDIO_S16MSB)) {
191 |     error("Unsupported sound format for file %s, id %i.", filename, spec.format);
192 |   }
193 |   
194 |   if (spec.format != AUDIO_S16SYS) {
195 |     flip_endian(s->data, s->length);
196 |   }
197 |   
198 |   return s;
199 | }
200 | 
201 | void sound_delete(sound* s) {
202 |   SDL_FreeWAV((Uint8*)s->data);
203 |   free(s);
204 | }
205 | 
206 | 
207 | 208 | 209 | 210 | 211 | 212 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/tests/language/smalltalk-test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Smalltalk tests 3 | * 4 | * @author Frank Shearar 5 | */ 6 | RainbowTester.startTest('smalltalk'); 7 | 8 | RainbowTester.run( 9 | 'constant true', 10 | 11 | 'true', 12 | 13 | 'true' 14 | ); 15 | 16 | RainbowTester.run( 17 | 'constant false', 18 | 19 | 'false', 20 | 21 | 'false' 22 | ); 23 | 24 | RainbowTester.run( 25 | 'constant nil', 26 | 27 | 'nil', 28 | 29 | 'nil' 30 | ); 31 | 32 | RainbowTester.run( 33 | 'self pseudovariable', 34 | 35 | 'self', 36 | 37 | 'self' 38 | ); 39 | 40 | RainbowTester.run( 41 | 'thisContext pseudovariable', 42 | 43 | 'thisContext', 44 | 45 | 'thisContext' 46 | ); 47 | 48 | RainbowTester.run( 49 | 'two-character operator !!', 50 | 51 | '!!', 52 | 53 | '!!' 54 | ); 55 | 56 | RainbowTester.run( 57 | 'two-character operator //', 58 | 59 | '//', 60 | 61 | '//' 62 | ); 63 | 64 | RainbowTester.run( 65 | '| delimiter', 66 | 67 | '|', 68 | 69 | '|' 70 | ); 71 | 72 | RainbowTester.run( 73 | '|| binary selector', 74 | 75 | '||', 76 | 77 | '||' 78 | ); 79 | 80 | RainbowTester.run( 81 | 'HTML-unfriendly operator', 82 | 83 | '&', 84 | 85 | '&' 86 | ); 87 | 88 | RainbowTester.run( 89 | 'three-character operator', 90 | 91 | '>>=', 92 | 93 | '>>=' 94 | ); 95 | 96 | RainbowTester.run( 97 | 'String-like Symbol', 98 | 99 | "#'this is a symbol'", 100 | 101 | "#'this is a symbol'" 102 | ); 103 | 104 | RainbowTester.run( 105 | 'Symbol', 106 | 107 | "#thisIsaSymbol0", 108 | 109 | "#thisIsaSymbol0" 110 | ); 111 | 112 | RainbowTester.run( 113 | 'String', 114 | 115 | "'This is a string'", 116 | 117 | '\'This is a string\'' 118 | ); 119 | 120 | RainbowTester.run( 121 | 'Comment', 122 | 123 | '"This is a comment"', 124 | 125 | '"This is a comment"' 126 | ); 127 | 128 | RainbowTester.run( 129 | 'Comment in between message sends', 130 | 131 | 'self "this is a comment" foo', 132 | 133 | 'self "this is a comment" foo' 134 | ); 135 | 136 | RainbowTester.run( 137 | 'Integer', 138 | 139 | '987654321', 140 | 141 | '987654321' 142 | ); 143 | 144 | RainbowTester.run( 145 | 'Negative integer', 146 | 147 | '-987654321', 148 | 149 | '-987654321' 150 | ); 151 | 152 | RainbowTester.run( 153 | 'Exponent integer', 154 | 155 | '987654321e10', 156 | 157 | '987654321e10' 158 | ); 159 | 160 | RainbowTester.run( 161 | 'Negative exponent integer', 162 | 163 | '-987654321e10', 164 | 165 | '-987654321e10' 166 | ); 167 | 168 | RainbowTester.run( 169 | 'Radix Integer', 170 | 171 | '16r987654321deadbeef', 172 | 173 | '16r987654321deadbeef' 174 | ); 175 | 176 | RainbowTester.run( 177 | 'Negative radix Integer', 178 | 179 | '16r-987654321deadbeef', 180 | 181 | '16r-987654321deadbeef' 182 | ); 183 | 184 | RainbowTester.run( 185 | 'Float', 186 | 187 | '987654321.0', 188 | 189 | '987654321.0' 190 | ); 191 | 192 | RainbowTester.run( 193 | 'Negative float', 194 | 195 | '-987654321.0', 196 | 197 | '-987654321.0' 198 | ); 199 | 200 | RainbowTester.run( 201 | 'Exponent float', 202 | 203 | '1.0e10', 204 | 205 | '1.0e10' 206 | ); 207 | 208 | RainbowTester.run( 209 | 'Negative exponent float', 210 | 211 | '1.0e-10', 212 | 213 | '1.0e-10' 214 | ); 215 | 216 | RainbowTester.run( 217 | 'Negative exponent negative float', 218 | 219 | '-1.0e-10', 220 | 221 | '-1.0e-10' 222 | ); 223 | 224 | RainbowTester.run( 225 | 'Scaled decimal', 226 | 227 | '1.0s10', 228 | 229 | '1.0s10' 230 | ); 231 | 232 | RainbowTester.run( 233 | 'Class name, normal', 234 | 235 | 'Class', 236 | 237 | 'Class' 238 | ); 239 | 240 | RainbowTester.run( 241 | 'Class name, with digits', 242 | 243 | 'Class0zero', 244 | 245 | 'Class0zero' 246 | ); 247 | 248 | RainbowTester.endTest('smalltalk'); 249 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/util/builder.py: -------------------------------------------------------------------------------- 1 | import os 2 | import subprocess 3 | import zipfile 4 | import hashlib 5 | import re 6 | import glob 7 | from zipfile import ZipFile 8 | from StringIO import StringIO 9 | 10 | 11 | class RainbowBuilder(object): 12 | 13 | def __init__(self, js_path, closure_path, theme_path=None): 14 | 15 | self.versions = { 16 | 'c': '1.0.6', 17 | 'csharp': '1.0.1', 18 | 'coffeescript': '1.0', 19 | 'css': '1.0.7', 20 | 'generic': '1.0.9', 21 | 'go': '1.0', 22 | 'html': '1.0.7', 23 | 'java': '1.0', 24 | 'javascript': '1.0.7', 25 | 'lua': '1.0', 26 | 'php': '1.0.7', 27 | 'python': '1.0.7', 28 | 'r': '1.0', 29 | 'ruby': '1.0.5', 30 | 'scheme': '1.0', 31 | 'shell': '1.0.3', 32 | 'smalltalk': '1.0' 33 | } 34 | 35 | self.js_path = js_path 36 | self.closure_path = closure_path 37 | self.js_files_to_include = [] 38 | self.file_name = "" 39 | self.theme_path = theme_path 40 | 41 | def getPathForLanguage(self, language): 42 | return os.path.join(self.js_path, 'language/' + language + '.js') 43 | 44 | def getRainbowPath(self): 45 | return os.path.join(self.js_path, 'rainbow.js') 46 | 47 | def verifyPaths(self): 48 | if not os.path.exists(self.js_path): 49 | raise Exception('directory does not exist at: %s' % self.js_path) 50 | 51 | if not os.path.isfile(self.closure_path): 52 | raise Exception('closure compiler does not exist at: %s' % self.closure_path) 53 | 54 | def getZipForLanguages(self, languages, path=None): 55 | self.verifyPaths() 56 | 57 | # strip out any duplicates 58 | languages = list(set(languages)) 59 | 60 | write_to = StringIO() if path is None else path 61 | zip_file = ZipFile(write_to, 'w') 62 | zip_file.write(self.getRainbowPath(), 'rainbow.js', zipfile.ZIP_DEFLATED) 63 | 64 | # include minimized version even when downloading the dev version 65 | zip_file.write(self.getRainbowPath().replace('.js', '.min.js'), 'rainbow.min.js', zipfile.ZIP_DEFLATED) 66 | 67 | # include themes as well 68 | if self.theme_path: 69 | files = glob.glob(self.theme_path + '/*.css') 70 | for file_name in files: 71 | zip_file.write(file_name, os.path.join('themes', os.path.basename(file_name)), zipfile.ZIP_DEFLATED) 72 | 73 | for language in languages: 74 | zip_file.write(self.getPathForLanguage(language), os.path.join('language', language + '.js'), zipfile.ZIP_DEFLATED) 75 | 76 | zip_file.close() 77 | 78 | return write_to 79 | 80 | def openFile(self, path): 81 | file = open(path, "r") 82 | content = file.read() 83 | file.close() 84 | return content 85 | 86 | def writeFile(self, path, content): 87 | file = open(path, "w") 88 | file.write(content) 89 | file.close() 90 | 91 | def getVersion(self): 92 | contents = self.openFile(self.getRainbowPath()) 93 | match = re.search(r'@version\s(.*)\s+?', contents) 94 | return match.group(1) 95 | 96 | def getLanguageVersions(self, languages): 97 | groups = [] 98 | for language in languages: 99 | if language in self.versions: 100 | groups.append(language + ' v' + self.versions[language]) 101 | 102 | return ', '.join(groups) 103 | 104 | def getFileForLanguages(self, languages, cache=None): 105 | self.verifyPaths() 106 | 107 | # strip out any duplicates 108 | languages = list(set(languages)) 109 | 110 | self.js_files_to_include = [self.getRainbowPath()] 111 | for language in languages: 112 | path = self.getPathForLanguage(language) 113 | if not os.path.exists(path): 114 | continue 115 | 116 | self.js_files_to_include.append(path) 117 | 118 | self.file_name = 'rainbow' + ('-custom' if len(languages) else '') + '.min.js' 119 | 120 | if cache is not None: 121 | version = self.getVersion() 122 | cache_key = 'rainbow_' + hashlib.md5(self.getLanguageVersions(languages)).hexdigest() + '_' + version 123 | cached_version = cache.get(cache_key) 124 | if cached_version: 125 | return cached_version 126 | 127 | command = ['java', '-jar', self.closure_path, '--compilation_level', 'ADVANCED_OPTIMIZATIONS'] + self.js_files_to_include 128 | proc = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 129 | output, err = proc.communicate() 130 | 131 | lines = output.splitlines() 132 | comments = lines[0:4] 133 | version = comments[1].replace(' @version ', '') 134 | url = comments[2].replace(' @url ', '') 135 | new_comment = '/* Rainbow v' + version + ' ' + url 136 | 137 | if len(languages): 138 | new_comment += ' | included languages: ' + ', '.join(languages) 139 | 140 | new_comment += ' */' 141 | 142 | output = new_comment + '\n' + '\n'.join(lines[4:]) 143 | 144 | if cache is not None: 145 | cache.set(cache_key, output, 14400) # 4 hours 146 | 147 | return output 148 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/tests/language/python-test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Python tests 3 | * 4 | * @author Craig Campbell 5 | */ 6 | RainbowTester.startTest('python'); 7 | 8 | RainbowTester.run( 9 | 'no self', 10 | 11 | 'print self.something', 12 | 13 | 'print self.something' 14 | ); 15 | 16 | RainbowTester.run( 17 | 'comment', 18 | 19 | '# this is a comment', 20 | 21 | '# this is a comment' 22 | ); 23 | 24 | RainbowTester.run( 25 | 'language constants', 26 | 27 | 'var1 = None\n' + 28 | 'var2 = True\n' + 29 | 'someFunction(var3=False)', 30 | 31 | 'var1 = None\n' + 32 | 'var2 = True\n' + 33 | 'someFunction(var3=False)' 34 | ); 35 | 36 | RainbowTester.run( 37 | 'object', 38 | 39 | 'object', 40 | 41 | 'object' 42 | ); 43 | 44 | RainbowTester.run( 45 | 'import', 46 | 47 | 'from SomePackage import SomeThing', 48 | 49 | 'from SomePackage import SomeThing' 50 | ); 51 | 52 | RainbowTester.run( 53 | 'class', 54 | 55 | 'class Something(object):\n' + 56 | ' pass', 57 | 58 | 'class Something(object):\n' + 59 | ' pass' 60 | ); 61 | 62 | RainbowTester.run( 63 | 'special method', 64 | 65 | 'def __init__(self, some_var):\n' + 66 | ' pass', 67 | 68 | 'def __init__(self, some_var):\n' + 69 | ' pass' 70 | ); 71 | 72 | RainbowTester.run( 73 | 'function', 74 | 75 | 'def openFile(path):\n' + 76 | ' file = open(path, "r")\n' + 77 | ' content = file.read()\n' + 78 | ' file.close()\n' + 79 | ' return content', 80 | 81 | 'def openFile(path):\n' + 82 | ' file = open(path, "r")\n' + 83 | ' content = file.read()\n' + 84 | ' file.close()\n' + 85 | ' return content' 86 | ); 87 | 88 | RainbowTester.run( 89 | 'decorator', 90 | 91 | '@makebold\n' + 92 | '@makeitalic\n' + 93 | 'def hello():\n' + 94 | ' return "hello world"', 95 | 96 | '@makebold\n' + 97 | '@makeitalic\n' + 98 | 'def hello():\n' + 99 | ' return "hello world"' 100 | ); 101 | 102 | RainbowTester.run( 103 | '__main__', 104 | 105 | 'if __name__ == \'__main__\':\n' + 106 | ' pass', 107 | 108 | 'if __name__ == \'__main__\':\n' + 109 | ' pass' 110 | ); 111 | 112 | RainbowTester.run( 113 | 'try catch', 114 | 115 | 'try:\n' + 116 | ' import cPickle as pickle\n' + 117 | 'except ImportError:\n' + 118 | ' import pickle', 119 | 120 | 'try:\n' + 121 | ' import cPickle as pickle\n' + 122 | 'except ImportError:\n' + 123 | ' import pickle' 124 | ); 125 | 126 | RainbowTester.run( 127 | 'docstring single line double quotes', 128 | 129 | '"""docstring test"""', 130 | 131 | '"""docstring test"""' 132 | ); 133 | 134 | RainbowTester.run( 135 | 'docstring single line single quotes', 136 | 137 | "'''docstring test'''", 138 | 139 | '\'\'\'docstring test\'\'\'' 140 | ); 141 | 142 | RainbowTester.run( 143 | 'docstring multiline', 144 | 145 | '"""test\n' + 146 | 'multiline\n' + 147 | 'yes"""', 148 | 149 | '"""test\n' + 150 | 'multiline\n' + 151 | 'yes"""' 152 | ); 153 | 154 | RainbowTester.run( 155 | 'multiple docstrings', 156 | 157 | '"""\n' + 158 | 'x\n' + 159 | '"""\n' + 160 | '2 + 2\n' + 161 | '"""\n' + 162 | 'y\n' + 163 | '"""', 164 | 165 | '"""\n' + 166 | 'x\n' + 167 | '"""\n' + 168 | '2 + 2\n' + 169 | '"""\n' + 170 | 'y\n' + 171 | '"""' 172 | ); 173 | 174 | RainbowTester.endTest('python'); 175 | -------------------------------------------------------------------------------- /s5/_ui/rainbow/tests/language/csharp-test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * C# tests 3 | * 4 | * @author Dan Stewart 5 | * The csharp.js file is configured to not load generic.js 6 | */ 7 | RainbowTester.startTest('csharp'); 8 | 9 | RainbowTester.run( 10 | 'echo', 11 | 12 | 'Console.WriteLine("hello world");', 13 | 14 | 'Console.WriteLine("hello world");' 15 | ); 16 | 17 | RainbowTester.run( 18 | 'variable', 19 | 20 | 'var foo = true;', 21 | 22 | 'var foo = true;' 23 | ); 24 | 25 | RainbowTester.run( 26 | 'string concatenation', 27 | 28 | 'string foo = "test " + "string " + "concatenation";', 29 | 30 | 'string foo = "test " + "string " + "concatenation";' 31 | ); 32 | 33 | RainbowTester.run( 34 | 'typeof', 35 | 36 | "var is_array_object = typeof(System.Array);", 37 | 38 | 'var is_array_object = typeof(System.Array);' 39 | ); 40 | 41 | RainbowTester.run( 42 | 'array stuff', 43 | 44 | 'string[] turtles = new string[] {\n' + 45 | ' "leonardo",\n' + 46 | ' "michaelangelo",\n' + 47 | ' "donatello",\n' + 48 | ' "raphael"\n' + 49 | '};\n' + 50 | '\n' + 51 | 'bool exists = turtles[0] == "leonardo";', 52 | 53 | 'string[] turtles = new string[] {\n' + 54 | ' "leonardo",\n' + 55 | ' "michaelangelo",\n' + 56 | ' "donatello",\n' + 57 | ' "raphael"\n' + 58 | '};\n' + 59 | '\n' + 60 | 'bool exists = turtles[0] == "leonardo";' 61 | ); 62 | 63 | RainbowTester.run( 64 | 'namespace declaration', 65 | 66 | 'namespace Sonic.Database {', 67 | 68 | 'namespace Sonic.Database {' 69 | ); 70 | 71 | RainbowTester.run( 72 | 'class declaration', 73 | 74 | 'class MyClass {}', 75 | 76 | 'class MyClass {}' 77 | ); 78 | 79 | RainbowTester.run( 80 | 'abstract class declaration', 81 | 82 | 'abstract class MyClass {}', 83 | 84 | 'abstract class MyClass {}' 85 | ); 86 | 87 | RainbowTester.run( 88 | 'sealed class declaration', 89 | 90 | 'sealed class TestClass\n' + 91 | '{\n' + 92 | '}', 93 | 94 | 'sealed class TestClass\n' + 95 | '{\n' + 96 | '}' 97 | ); 98 | 99 | RainbowTester.run( 100 | 'child class declaration', 101 | 102 | 'class MyCollection : ICollection {}', 103 | 104 | 'class MyCollection : ICollection {}' 105 | ); 106 | 107 | RainbowTester.run( 108 | 'test static', 109 | 110 | 'static void doSomethingElse() {}', 111 | 112 | 'static void doSomethingElse() {}' 113 | ); 114 | 115 | RainbowTester.run( 116 | 'test magic function', 117 | 118 | 'protected void Page_Load(object sender, EventArgs e)\n' + 119 | '{\n' + 120 | ' // do whatever\n' + 121 | '}', 122 | 123 | 'protected void Page_Load(object sender, EventArgs e)\n' + 124 | '{\n' + 125 | ' // do whatever\n' + 126 | '}' 127 | ); 128 | 129 | RainbowTester.run( 130 | 'test new class', 131 | 132 | 'new SomeClass();', 133 | 134 | 'new SomeClass();' 135 | ); 136 | 137 | RainbowTester.run( 138 | 'test new namespace class', 139 | 140 | 'var s = new Sonic.Database.Query();', 141 | 142 | 'var s = new Sonic.Database.Query();' 143 | ); 144 | 145 | RainbowTester.run( 146 | 'test static class call', 147 | 148 | 'var path = Sonic.App.getInstance();', 149 | 150 | 'var path = Sonic.App.getInstance();' 151 | ); 152 | 153 | RainbowTester.run( 154 | 'type hint', 155 | 156 | 'public static string getForUser(User user, Sort sort) {}', 157 | 158 | 'public static string getForUser(User user, Sort sort) {}' 159 | ); 160 | 161 | RainbowTester.run( 162 | 'generics', 163 | 164 | 'public IList<string> firstNames = new List<string>()', 165 | 166 | 'public IList<string> firstNames = new List<string>()' 167 | ); 168 | 169 | RainbowTester.endTest('csharp'); -------------------------------------------------------------------------------- /s5/_ui/rainbow/tests/language/r-test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * R tests 3 | * 4 | * @author Simon Potter 5 | */ 6 | RainbowTester.startTest('r'); 7 | 8 | RainbowTester.run( 9 | 'comments', 10 | 11 | '# A comment\n' + 12 | 'a <- "b" # Another comment', 13 | 14 | '# A comment\n' + 15 | 'a <- "b" # Another comment' 16 | ); 17 | 18 | RainbowTester.run( 19 | 'assignment', 20 | 21 | 'foo.bar <- "foo"\n' + 22 | 'baz1 = 1.62e-4', 23 | 24 | 'foo.bar <- "foo"\n' + 25 | 'baz1 = 1.62e-4' 26 | ); 27 | 28 | RainbowTester.run( 29 | 'constants', 30 | 31 | 'baz <- NA\n' + 32 | 'my.pi <- pi\n' + 33 | 'all.letters <- c(LETTERS, letters)\n' + 34 | 'xrange <- c(-Inf, TRUE)', 35 | 36 | 'baz <- NA\n' + 37 | 'my.pi <- pi\n' + 38 | 'all.letters <- c(LETTERS, letters)\n' + 39 | 'xrange <- c(-Inf, TRUE)' 40 | ); 41 | 42 | RainbowTester.run( 43 | 'operators', 44 | 45 | 'beta.hat <- solve(t(X) %*% X) %*% t(X) %*% y\n' + 46 | 'bound.rect <- grid::rectGrob()\n' + 47 | 'my_seq <- 1:10\n' + 48 | 'is_in_seq <- c(2, 7, 23) %in% my_seq\n' + 49 | 'plot(y ~ x, type = "l")', 50 | 51 | 'beta.hat <- solve(t(X) %*% X) %*% t(X) %*% y\n' + 52 | 'bound.rect <- grid::rectGrob()\n' + 53 | 'my_seq <- 1:10\n' + 54 | 'is_in_seq <- c(2, 7, 23) %in% my_seq\n' + 55 | 'plot(y ~ x, type = "l")' 56 | ); 57 | 58 | /** 59 | * Note that the second function is intentionally not a function call, 60 | * just testing that the regex is matching only 'function' and not .+function 61 | */ 62 | RainbowTester.run( 63 | 'function creation', 64 | 65 | 'square <- function(x) x * x\n' + 66 | 'square2 <- testfunction(x) x * x\n' + 67 | 'area <- function (r) {\n' + 68 | ' pi * r^2\n' + 69 | '}', 70 | 71 | 'square <- function(x) x * x\n' + 72 | 'square2 <- testfunction(x) x * x\n' + 73 | 'area <- function (r) {\n' + 74 | ' pi * r^2\n' + 75 | '}' 76 | ); 77 | 78 | RainbowTester.run( 79 | 'variable', 80 | 81 | 'tmp <- 1\n' + 82 | 'another.tmp <- 2\n' + 83 | 'this.is.a.var <- 3', 84 | 85 | 'tmp <- 1\n' + 86 | 'another.tmp <- 2\n' + 87 | 'this.is.a.var <- 3' 88 | ); 89 | 90 | RainbowTester.run( 91 | 'subsetting', 92 | 93 | 'tmp[1]\n' + 94 | 'tmp[["test"]]', 95 | 96 | 'tmp[1]\n' + 97 | 'tmp[["test"]]' 98 | ); 99 | 100 | RainbowTester.run( 101 | 'support functions', 102 | 103 | 'logical(10)\n' + 104 | 'test.logical(10)\n' + 105 | 'data.frame(a = 1:10, b = 15:24)\n' + 106 | 'complex(real = 1, imaginary = 0.5)', 107 | 108 | 'logical(10)\n' + 109 | 'test.logical(10)\n' + 110 | 'data.frame(a = 1:10, b = 15:24)\n' + 111 | 'complex(real = 1, imaginary = 0.5)' 112 | ); 113 | 114 | RainbowTester.endTest('r'); 115 | -------------------------------------------------------------------------------- /s5/_ui/pg/printlinks.js: -------------------------------------------------------------------------------- 1 | /* 2 | * footnote links cycles through the links from an html page, 3 | * and puts these at the foot of the printed page 4 | * 5 | */ 6 | var printFootnoteLinks = { 7 | 8 | /* 9 | * function runs on page load, collecting links and running sub-functions to check validity 10 | * 11 | * @param string containerID Id of the container within which to collect all links 12 | * @param string targetID Id of the container to append complete link list to 13 | * 14 | * @return void 15 | */ 16 | init: function(containerID,targetID) { 17 | 18 | //check to see if variables passed to function are contained in the html document 19 | if (!document.getElementById(containerID) || !document.getElementById(targetID)) return false; 20 | 21 | //get container object 22 | var container = document.getElementById(containerID); 23 | 24 | //get all link tags from the container 25 | var linkArray = container.getElementsByTagName('a'); 26 | 27 | //create an array to contain all unique links 28 | var uniqueLinkArray = []; 29 | 30 | //create an ordered list to display all unique links 31 | var ol = document.createElement('ol'); 32 | 33 | 34 | //cycle through all links 35 | for (var i=0; i