├── .nojekyll ├── styles ├── ebook.css ├── epub.css ├── mobi.css ├── pdf.css └── website.css ├── quickstart └── .md ├── figwheel-project └── .md ├── libraries ├── edn.md ├── om.md └── index.md ├── install ├── lein-npm.md ├── plank.md ├── figwheel.md ├── java.md ├── lumo.md ├── leiningen.md ├── lighttable.md ├── cider.md └── chestnut.md ├── lighttable ├── index.md └── configure-keyboard-mappings.md ├── why-clojurescript └── .md ├── browser-devtools.md ├── gitbook ├── gitbook-plugin-toggle-chapters │ ├── toggle.css │ └── toggle.js ├── gitbook-plugin-disqus │ ├── plugin.css │ └── plugin.js ├── images │ ├── favicon.ico │ └── apple-touch-icon-precomposed-152.png ├── fonts │ └── fontawesome │ │ ├── FontAwesome.otf │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.ttf │ │ ├── fontawesome-webfont.woff │ │ └── fontawesome-webfont.woff2 ├── gitbook-plugin-gist │ └── plugin.js ├── gitbook-plugin-heading-anchors │ └── anchor-style.js ├── gitbook-plugin-codeblock-disable-glossary │ └── disable-glossary.js ├── gitbook-plugin-sectionx │ ├── sectionx.css │ └── sectionx.js ├── gitbook-plugin-ga │ └── plugin.js ├── gitbook-plugin-search │ ├── search.css │ ├── search-engine.js │ ├── search.js │ └── lunr.min.js ├── gitbook-plugin-toolbar │ └── buttons.js ├── gitbook-plugin-lunr │ ├── search-lunr.js │ └── lunr.min.js ├── gitbook-plugin-sharing │ └── buttons.js ├── gitbook-plugin-highlight │ └── ebook.css ├── gitbook-plugin-callouts │ └── plugin.css └── gitbook-plugin-fontsettings │ ├── fontsettings.js │ └── website.css ├── related-libraries └── index.html ├── figwheel └── clojurescript-repl.md ├── basic-om-next-project ├── create-project.md └── index.md ├── create-a-project ├── configure-main-project-function.md ├── configure-main-namespace.md ├── index.md ├── add-ring-dependency.md ├── run-webserver.md ├── coersing-types-and-java-lang.md └── add-a-webserver-function.md ├── images ├── chestnut.png ├── leiningen-logo.jpg ├── react-basics.png ├── clojurescript-logo.png ├── clojurescript-react.png ├── computer-opponent.jpg ├── favicon_io │ ├── favicon.ico │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ ├── apple-touch-icon.png │ ├── android-chrome-192x192.png │ ├── android-chrome-512x512.png │ └── site.webmanifest ├── lein-new-todo-list.png ├── chrome-devtools-dirac.png ├── gametheory-tictactoe.jpg ├── clojurescript-all-things.png ├── clojurescript-platforms.png ├── shouter-web-ui-example.png ├── chrome-devtools-dirac-fork.png ├── cljs-website-run--webpage.png ├── clojure-practicalli-banner.png ├── clojure-primatives-common.png ├── javascript-the-good-parts.jpg ├── web-development-landscape.png ├── clojurescript-circle-ci-webapp.png ├── clojurescript-react-native-logo.png ├── clojurex-project-bootsrap-panel.png ├── reagent-tictactoe-game-example.png ├── chrome-devtools-inline-source-maps.png ├── clojurescript-interop-code-transit.png ├── clojurescript-skeptics-real-world.png ├── clojurescript-the-mobile-web-sucks.png ├── tictactoe-game-board-dev-console.png ├── cljs-website-run-spacemacs-build-dev.png ├── cljs-website-run-spacemacs-repl-type.png ├── clojurescript-cljs-packages-examples.png ├── clojurescript-community-github-stars.png ├── clojurescript-reframe-stack-concept.png ├── clojurescript-skeptics-clojure-conj.png ├── clojurescript-source-maps-debugging.png ├── clojurex-project-bootstrap-jumbotron.png ├── purelyfunctional-tv-reframe-overview.png ├── clojurescript-its-for-single-page-apps.png ├── practicalli-clojurescript-book-banner.png ├── web-design-bootstrap-jumbotron-clojurex.png ├── cljs-website-run--webpage-live-reloading.png ├── clojurescript-google-closure-product-use.png ├── clojurescript-modules-code-optiomisation.png ├── clojurescript-skeptics-javascript-tooling.png ├── clojurescript-web-technologies-comparison.png ├── clojurescript-what-if-this-was-javascript.png ├── clojure-persistent-data-structures-sharing.png ├── clojurex-project-multiple-sessions-no-styles.png ├── lumo-clojure-repl-startup-times-comparison.png ├── clojurescript-reagent-tictactoe-create-project.png ├── clojurescript-web-technology-comparison-jquery.png ├── cljs-website--github-pages-source-docs-on-master.png ├── clojurescript-google-clojure-compiler-code-size.png ├── clojurescript-bloat-thinner-than-jquery-immutablejs.png ├── clojurescript-javascript-operator-precedence-table.png ├── clojurex-project-mutliple-sessions-style-container.png ├── clojurescript-project-reagent-tictactoe--js-alert-test.png ├── clojurescript-project-reagent-tictactoe--render-board.png ├── chrome-devtools-clojurescript-data-structure-formatting.png ├── clojurescript-project-reagent-tictactoe-new-project-tree.png ├── spacemacs--clojurescript-figwheel-main-select-repl-type.png ├── clojurescript-project-reagent-tictactoe--cli-repl-connected.png ├── clojurescript-project-reagent-tictactoe--git-initial-commit.png ├── clojurescript-project-reagent-tictactoe--js-alert-test-code.png ├── spacemacs--clojurescript-figwheel-main-select-figwheel-main-build.png ├── chrome-devtools-console--react--waringing-array-children-unique-key.png ├── clojurescript-project-reagent-tictactoe--new-project-tree-structure.png ├── clojurescript-project-reagent-tictactoe--game-board--computer-move-basic.png ├── clojurescript-project-reagent-tictactoe--devtools-project-profile-dependency.png ├── clojurescript-project-reagent-tictactoe--devtools-settings-custom-formatters.png ├── clojurescript-project-reagent-tictactoe--create-project-with-figwheel-template.png ├── clojurescript-project-reagent-tictactoe--project-description-and-license-updated.png ├── clojurescript-project-reagent-tictactoe--devtools-console--custom-formatters-not-rendered.png ├── clojurescript-project-reagent-tictactoe--game-board--computer-move-thinking-time-suggestion.png ├── react-logo.svg ├── reactive-traits.svg ├── react-basics.svg ├── clojurescript-platforms.svg └── clojurescript-reframe-stack-concept.svg ├── .gitignore ├── reagent ├── app.md ├── wip.md └── interact-with-the-repl.md ├── reagent-projects └── tic-tac-toe │ ├── clean-the-project.md │ ├── code-review-initial-project.md │ ├── detecting-victory--rows.md │ └── deploy-to-production.md ├── twilight-zone.md ├── deploy-to-gh-pages ├── clojure-syntax ├── data-structures.md └── namespace.md ├── intro-to-clojurescript.org ├── work-in-progress.md ├── overview └── data-types.md ├── README.md └── clojurescript-code └── index.md /.nojekyll: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /styles/ebook.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /styles/epub.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /styles/mobi.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /styles/pdf.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /quickstart/.md: -------------------------------------------------------------------------------- 1 | # 2 | -------------------------------------------------------------------------------- /figwheel-project/.md: -------------------------------------------------------------------------------- 1 | # 2 | -------------------------------------------------------------------------------- /libraries/edn.md: -------------------------------------------------------------------------------- 1 | # edn 2 | -------------------------------------------------------------------------------- /libraries/om.md: -------------------------------------------------------------------------------- 1 | # om 2 | -------------------------------------------------------------------------------- /install/lein-npm.md: -------------------------------------------------------------------------------- 1 | # Lein-NPM 2 | -------------------------------------------------------------------------------- /libraries/index.md: -------------------------------------------------------------------------------- 1 | # Libraries 2 | -------------------------------------------------------------------------------- /lighttable/index.md: -------------------------------------------------------------------------------- 1 | # Lighttable 2 | -------------------------------------------------------------------------------- /why-clojurescript/.md: -------------------------------------------------------------------------------- 1 | # Devcards 2 | -------------------------------------------------------------------------------- /browser-devtools.md: -------------------------------------------------------------------------------- 1 | # Browser DevTools 2 | -------------------------------------------------------------------------------- /gitbook/gitbook-plugin-toggle-chapters/toggle.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /related-libraries/index.html: -------------------------------------------------------------------------------- 1 | # Related Libraries 2 | -------------------------------------------------------------------------------- /figwheel/clojurescript-repl.md: -------------------------------------------------------------------------------- 1 | # ClojureScript REPL 2 | -------------------------------------------------------------------------------- /basic-om-next-project/create-project.md: -------------------------------------------------------------------------------- 1 | # Basic Om-Next project 2 | -------------------------------------------------------------------------------- /lighttable/configure-keyboard-mappings.md: -------------------------------------------------------------------------------- 1 | # Configure Keyboard mappings 2 | -------------------------------------------------------------------------------- /create-a-project/configure-main-project-function.md: -------------------------------------------------------------------------------- 1 | # Configure main project function 2 | -------------------------------------------------------------------------------- /gitbook/gitbook-plugin-disqus/plugin.css: -------------------------------------------------------------------------------- 1 | #disqus_thread { 2 | margin: 5px 15px; 3 | margin-top: 30px; 4 | } 5 | -------------------------------------------------------------------------------- /images/chestnut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/chestnut.png -------------------------------------------------------------------------------- /images/leiningen-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/leiningen-logo.jpg -------------------------------------------------------------------------------- /images/react-basics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/react-basics.png -------------------------------------------------------------------------------- /gitbook/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/gitbook/images/favicon.ico -------------------------------------------------------------------------------- /images/clojurescript-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-logo.png -------------------------------------------------------------------------------- /images/clojurescript-react.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-react.png -------------------------------------------------------------------------------- /images/computer-opponent.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/computer-opponent.jpg -------------------------------------------------------------------------------- /images/favicon_io/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/favicon_io/favicon.ico -------------------------------------------------------------------------------- /images/lein-new-todo-list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/lein-new-todo-list.png -------------------------------------------------------------------------------- /images/chrome-devtools-dirac.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/chrome-devtools-dirac.png -------------------------------------------------------------------------------- /images/gametheory-tictactoe.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/gametheory-tictactoe.jpg -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | .DS_Store 3 | ._* 4 | *~ 5 | *# 6 | .#* 7 | _book 8 | node_modules 9 | *.log 10 | book.pdf 11 | book.mobi 12 | book.epub 13 | -------------------------------------------------------------------------------- /images/clojurescript-all-things.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-all-things.png -------------------------------------------------------------------------------- /images/clojurescript-platforms.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-platforms.png -------------------------------------------------------------------------------- /images/favicon_io/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/favicon_io/favicon-16x16.png -------------------------------------------------------------------------------- /images/favicon_io/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/favicon_io/favicon-32x32.png -------------------------------------------------------------------------------- /images/shouter-web-ui-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/shouter-web-ui-example.png -------------------------------------------------------------------------------- /images/chrome-devtools-dirac-fork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/chrome-devtools-dirac-fork.png -------------------------------------------------------------------------------- /images/cljs-website-run--webpage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/cljs-website-run--webpage.png -------------------------------------------------------------------------------- /images/clojure-practicalli-banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojure-practicalli-banner.png -------------------------------------------------------------------------------- /images/clojure-primatives-common.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojure-primatives-common.png -------------------------------------------------------------------------------- /images/javascript-the-good-parts.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/javascript-the-good-parts.jpg -------------------------------------------------------------------------------- /images/web-development-landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/web-development-landscape.png -------------------------------------------------------------------------------- /images/favicon_io/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/favicon_io/apple-touch-icon.png -------------------------------------------------------------------------------- /gitbook/fonts/fontawesome/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/gitbook/fonts/fontawesome/FontAwesome.otf -------------------------------------------------------------------------------- /images/clojurescript-circle-ci-webapp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-circle-ci-webapp.png -------------------------------------------------------------------------------- /images/clojurescript-react-native-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-react-native-logo.png -------------------------------------------------------------------------------- /images/clojurex-project-bootsrap-panel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurex-project-bootsrap-panel.png -------------------------------------------------------------------------------- /images/reagent-tictactoe-game-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/reagent-tictactoe-game-example.png -------------------------------------------------------------------------------- /images/chrome-devtools-inline-source-maps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/chrome-devtools-inline-source-maps.png -------------------------------------------------------------------------------- /images/clojurescript-interop-code-transit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-interop-code-transit.png -------------------------------------------------------------------------------- /images/clojurescript-skeptics-real-world.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-skeptics-real-world.png -------------------------------------------------------------------------------- /images/clojurescript-the-mobile-web-sucks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-the-mobile-web-sucks.png -------------------------------------------------------------------------------- /images/favicon_io/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/favicon_io/android-chrome-192x192.png -------------------------------------------------------------------------------- /images/favicon_io/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/favicon_io/android-chrome-512x512.png -------------------------------------------------------------------------------- /images/tictactoe-game-board-dev-console.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/tictactoe-game-board-dev-console.png -------------------------------------------------------------------------------- /images/cljs-website-run-spacemacs-build-dev.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/cljs-website-run-spacemacs-build-dev.png -------------------------------------------------------------------------------- /images/cljs-website-run-spacemacs-repl-type.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/cljs-website-run-spacemacs-repl-type.png -------------------------------------------------------------------------------- /images/clojurescript-cljs-packages-examples.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-cljs-packages-examples.png -------------------------------------------------------------------------------- /images/clojurescript-community-github-stars.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-community-github-stars.png -------------------------------------------------------------------------------- /images/clojurescript-reframe-stack-concept.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-reframe-stack-concept.png -------------------------------------------------------------------------------- /images/clojurescript-skeptics-clojure-conj.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-skeptics-clojure-conj.png -------------------------------------------------------------------------------- /images/clojurescript-source-maps-debugging.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-source-maps-debugging.png -------------------------------------------------------------------------------- /images/clojurex-project-bootstrap-jumbotron.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurex-project-bootstrap-jumbotron.png -------------------------------------------------------------------------------- /images/purelyfunctional-tv-reframe-overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/purelyfunctional-tv-reframe-overview.png -------------------------------------------------------------------------------- /gitbook/fonts/fontawesome/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/gitbook/fonts/fontawesome/fontawesome-webfont.eot -------------------------------------------------------------------------------- /gitbook/fonts/fontawesome/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/gitbook/fonts/fontawesome/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /gitbook/fonts/fontawesome/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/gitbook/fonts/fontawesome/fontawesome-webfont.woff -------------------------------------------------------------------------------- /images/clojurescript-its-for-single-page-apps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-its-for-single-page-apps.png -------------------------------------------------------------------------------- /images/practicalli-clojurescript-book-banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/practicalli-clojurescript-book-banner.png -------------------------------------------------------------------------------- /images/web-design-bootstrap-jumbotron-clojurex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/web-design-bootstrap-jumbotron-clojurex.png -------------------------------------------------------------------------------- /reagent/app.md: -------------------------------------------------------------------------------- 1 | # Reagent app 2 | 3 | To get started with Reagent I recommend the [Reagent Rocks tutorial](http://www.mattgreer.org/articles/reagent-rocks/#on-to-reagent) 4 | 5 | -------------------------------------------------------------------------------- /gitbook/fonts/fontawesome/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/gitbook/fonts/fontawesome/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /gitbook/images/apple-touch-icon-precomposed-152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/gitbook/images/apple-touch-icon-precomposed-152.png -------------------------------------------------------------------------------- /images/cljs-website-run--webpage-live-reloading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/cljs-website-run--webpage-live-reloading.png -------------------------------------------------------------------------------- /images/clojurescript-google-closure-product-use.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-google-closure-product-use.png -------------------------------------------------------------------------------- /images/clojurescript-modules-code-optiomisation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-modules-code-optiomisation.png -------------------------------------------------------------------------------- /images/clojurescript-skeptics-javascript-tooling.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-skeptics-javascript-tooling.png -------------------------------------------------------------------------------- /images/clojurescript-web-technologies-comparison.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-web-technologies-comparison.png -------------------------------------------------------------------------------- /images/clojurescript-what-if-this-was-javascript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-what-if-this-was-javascript.png -------------------------------------------------------------------------------- /images/clojure-persistent-data-structures-sharing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojure-persistent-data-structures-sharing.png -------------------------------------------------------------------------------- /images/clojurex-project-multiple-sessions-no-styles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurex-project-multiple-sessions-no-styles.png -------------------------------------------------------------------------------- /images/lumo-clojure-repl-startup-times-comparison.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/lumo-clojure-repl-startup-times-comparison.png -------------------------------------------------------------------------------- /images/clojurescript-reagent-tictactoe-create-project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-reagent-tictactoe-create-project.png -------------------------------------------------------------------------------- /images/clojurescript-web-technology-comparison-jquery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-web-technology-comparison-jquery.png -------------------------------------------------------------------------------- /images/cljs-website--github-pages-source-docs-on-master.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/cljs-website--github-pages-source-docs-on-master.png -------------------------------------------------------------------------------- /images/clojurescript-google-clojure-compiler-code-size.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-google-clojure-compiler-code-size.png -------------------------------------------------------------------------------- /gitbook/gitbook-plugin-gist/plugin.js: -------------------------------------------------------------------------------- 1 | require(["gitbook", "jQuery"], function(gitbook, $) { 2 | gitbook.events.bind("page.change", function() { 3 | $('[data-gist-id]').gist(); 4 | }); 5 | }); -------------------------------------------------------------------------------- /gitbook/gitbook-plugin-heading-anchors/anchor-style.js: -------------------------------------------------------------------------------- 1 | anchors.options = { 2 | placement: 'left' 3 | } 4 | 5 | gitbook.events.bind('page.change', function(){ 6 | anchors.add('h1,h2,h3,h4,h5') 7 | }) 8 | -------------------------------------------------------------------------------- /images/clojurescript-bloat-thinner-than-jquery-immutablejs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-bloat-thinner-than-jquery-immutablejs.png -------------------------------------------------------------------------------- /images/clojurescript-javascript-operator-precedence-table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-javascript-operator-precedence-table.png -------------------------------------------------------------------------------- /images/clojurex-project-mutliple-sessions-style-container.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurex-project-mutliple-sessions-style-container.png -------------------------------------------------------------------------------- /images/clojurescript-project-reagent-tictactoe--js-alert-test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-project-reagent-tictactoe--js-alert-test.png -------------------------------------------------------------------------------- /images/clojurescript-project-reagent-tictactoe--render-board.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-project-reagent-tictactoe--render-board.png -------------------------------------------------------------------------------- /images/chrome-devtools-clojurescript-data-structure-formatting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/chrome-devtools-clojurescript-data-structure-formatting.png -------------------------------------------------------------------------------- /images/clojurescript-project-reagent-tictactoe-new-project-tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-project-reagent-tictactoe-new-project-tree.png -------------------------------------------------------------------------------- /images/spacemacs--clojurescript-figwheel-main-select-repl-type.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/spacemacs--clojurescript-figwheel-main-select-repl-type.png -------------------------------------------------------------------------------- /images/clojurescript-project-reagent-tictactoe--cli-repl-connected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-project-reagent-tictactoe--cli-repl-connected.png -------------------------------------------------------------------------------- /images/clojurescript-project-reagent-tictactoe--git-initial-commit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-project-reagent-tictactoe--git-initial-commit.png -------------------------------------------------------------------------------- /images/clojurescript-project-reagent-tictactoe--js-alert-test-code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-project-reagent-tictactoe--js-alert-test-code.png -------------------------------------------------------------------------------- /images/spacemacs--clojurescript-figwheel-main-select-figwheel-main-build.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/spacemacs--clojurescript-figwheel-main-select-figwheel-main-build.png -------------------------------------------------------------------------------- /images/chrome-devtools-console--react--waringing-array-children-unique-key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/chrome-devtools-console--react--waringing-array-children-unique-key.png -------------------------------------------------------------------------------- /images/clojurescript-project-reagent-tictactoe--new-project-tree-structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-project-reagent-tictactoe--new-project-tree-structure.png -------------------------------------------------------------------------------- /images/clojurescript-project-reagent-tictactoe--game-board--computer-move-basic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-project-reagent-tictactoe--game-board--computer-move-basic.png -------------------------------------------------------------------------------- /images/clojurescript-project-reagent-tictactoe--devtools-project-profile-dependency.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-project-reagent-tictactoe--devtools-project-profile-dependency.png -------------------------------------------------------------------------------- /images/clojurescript-project-reagent-tictactoe--devtools-settings-custom-formatters.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-project-reagent-tictactoe--devtools-settings-custom-formatters.png -------------------------------------------------------------------------------- /images/clojurescript-project-reagent-tictactoe--create-project-with-figwheel-template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-project-reagent-tictactoe--create-project-with-figwheel-template.png -------------------------------------------------------------------------------- /images/clojurescript-project-reagent-tictactoe--project-description-and-license-updated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-project-reagent-tictactoe--project-description-and-license-updated.png -------------------------------------------------------------------------------- /images/clojurescript-project-reagent-tictactoe--devtools-console--custom-formatters-not-rendered.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-project-reagent-tictactoe--devtools-console--custom-formatters-not-rendered.png -------------------------------------------------------------------------------- /images/clojurescript-project-reagent-tictactoe--game-board--computer-move-thinking-time-suggestion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/practicalli/clojurescript-manual-deployment/gh-pages/images/clojurescript-project-reagent-tictactoe--game-board--computer-move-thinking-time-suggestion.png -------------------------------------------------------------------------------- /images/favicon_io/site.webmanifest: -------------------------------------------------------------------------------- 1 | {"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"} -------------------------------------------------------------------------------- /reagent-projects/tic-tac-toe/clean-the-project.md: -------------------------------------------------------------------------------- 1 | # Cleaning up 2 | 3 | If the project is behaving strangely, a quick solution may be to clean the project. This removes anything built from source code and ensures your not picking up older versions. 4 | 5 | To clean all compiled files: 6 | 7 | ```bash 8 | lein clean 9 | ``` 10 | -------------------------------------------------------------------------------- /gitbook/gitbook-plugin-codeblock-disable-glossary/disable-glossary.js: -------------------------------------------------------------------------------- 1 | require(["gitbook"], function(gitbook) { 2 | gitbook.events.bind("page.change", function() { 3 | $('pre .glossary-term') 4 | .removeAttr('href') 5 | .removeAttr('title') 6 | .removeClass('glossary-term') 7 | .css('text-decoration', 'none'); 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /install/plank.md: -------------------------------------------------------------------------------- 1 | # Plank - stand-alone ClojureScript REPL for macOS and Linux 2 | 3 | 4 | Planck launches instantly and is useful for scripting. 5 | 6 | [Setup](http://planck-repl.org/setup.html) 7 | 8 | Get it: On macOS brew install planck, on Ubuntu install using apt-get. 9 | 10 | Read the [Planck User Guide](http://planck-repl.org/guide.html). 11 | 12 | Planck is free and open source. 13 | -------------------------------------------------------------------------------- /basic-om-next-project/index.md: -------------------------------------------------------------------------------- 1 | # Basic Om-Next project 2 | 3 | ## What is Om 4 | 5 | * V in MVC 6 | * Imediate mode rendering 7 | * Components 8 | 9 | ## Updating the DOM 10 | 11 | Om (and react) compares the latest changes to the virtual dom with the previous version of the dom, essentially creating a diff. This diff is then applied to the DOM in the browser. This approach avoids having to query the DOM in the browser which is an incredibly slow process. 12 | 13 | -------------------------------------------------------------------------------- /install/figwheel.md: -------------------------------------------------------------------------------- 1 | # Figwheel 2 | 3 | When you run your project with figwheel, `lein figwheel`, your project is compiled and a JavaScript REPL is started once you connect your browser to figwheel on port `3449`. 4 | 5 | 6 | 7 | Examples: 8 | 9 | * [Interactive programming Flappy Birds in ClojureScript](https://www.youtube.com/watch?v=KZjFVdU8VLI) 10 | * [Clojure West 2015 - Developing ClojureScript with Figwheel](https://www.youtube.com/watch?v=j-kj2qwJa_E) 11 | 12 | -------------------------------------------------------------------------------- /gitbook/gitbook-plugin-sectionx/sectionx.css: -------------------------------------------------------------------------------- 1 | .book.color-theme-2 .panel { 2 | background: #1A1A1A; 3 | border-style: solid; 4 | border-color: rgba(0,0,0,0.1); 5 | border-width: 1px; 6 | } 7 | 8 | .book.color-theme-2 .panel-heading { 9 | background-color: #2D3143; 10 | border-width: 0px; 11 | } 12 | 13 | .book.color-theme-2 .panel-body { 14 | background: #1A1A1A; 15 | } 16 | 17 | .book.color-theme-2 a.section { 18 | border-color: #373b4e !important; 19 | } 20 | 21 | .atTitle { 22 | display: flex; 23 | } 24 | -------------------------------------------------------------------------------- /reagent-projects/tic-tac-toe/code-review-initial-project.md: -------------------------------------------------------------------------------- 1 | # Tic-tac-toe: Code Review - Initial Project 2 | 3 | Lets take a quick look at the project files to see what the figwheel template created when we ran `lein new figwheel tictactoe-reagent -- --reagent` 4 | 5 | ## Project configuration 6 | 7 | The `project.clj` contains all the configuration for the ClojureScript project. This included the libraries (dependencies) that the project uses. 8 | 9 | 10 | 11 | 12 | ## Main ClojureScript file 13 | 14 | The `src/tictactoe-reagent/core.cljs` file contains the code that the project will call when run. 15 | -------------------------------------------------------------------------------- /twilight-zone.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | You unlock this door with the key of imagination, beyond it is another dimention 4 | a dimension of sound (sound design of a language) 5 | a dimension of sight (the repl lets you see clearly what is going on in your code) 6 | a dimention of mind (thinking functionally, thinking about pure functions and immutablility, thinking about data) 7 | 8 | Your moving into a land of both shadow and substance (javascript & Clojurescript) 9 | of things and ideas (data structures and functions) 10 | 11 | you just crossed over to the Clojurescript Zone... 12 | 13 | The boundaries are only your imagination 14 | -------------------------------------------------------------------------------- /images/react-logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 10 | -------------------------------------------------------------------------------- /create-a-project/configure-main-namespace.md: -------------------------------------------------------------------------------- 1 | # Configure main namespace 2 | 3 | > **Note** Set the default namespace for your Clojure project. 4 | 5 | Edit the `project.clj` file and add `:main todo-list.core` configuration option. 6 | 7 | Setting the default namespace will automatically call a function called `-main` when the Clojure project is run, i.e. via `lein run` 8 | 9 | ```clojure 10 | (defproject todo-list "0.1.0-SNAPSHOT" 11 | :description "A simple webapp using Ring" 12 | :url "http://example.com/FIXME" 13 | :license {:name "Eclipse Public License" 14 | :url "http://www.eclipse.org/legal/epl-v10.html"} 15 | :dependencies [[org.clojure/clojure "1.7.0"] 16 | [ring "1.4.0"]] 17 | :main todo-list.core) 18 | ``` 19 | 20 | Now you are ready to run your web server. 21 | 22 | -------------------------------------------------------------------------------- /gitbook/gitbook-plugin-ga/plugin.js: -------------------------------------------------------------------------------- 1 | require(["gitbook"], function(gitbook) { 2 | // Load analytics.js 3 | gitbook.events.bind("start", function(e, config) { 4 | (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ 5 | (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), 6 | m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) 7 | })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); 8 | 9 | var cfg = config.ga; 10 | ga('create', cfg.token, cfg.configuration); 11 | }); 12 | 13 | // Notify pageview 14 | gitbook.events.bind("page.change", function() { 15 | ga('send', 'pageview', window.location.pathname+window.location.search); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /gitbook/gitbook-plugin-toggle-chapters/toggle.js: -------------------------------------------------------------------------------- 1 | require(["gitbook", "jQuery"], function(gitbook, $) { 2 | 3 | function expand(chapter) { 4 | chapter.show(); 5 | if (chapter.parent().attr('class') != 'summary' 6 | && chapter.parent().attr('class') != 'book-summary' 7 | && chapter.length != 0 8 | ) { 9 | expand(chapter.parent()); 10 | } 11 | } 12 | 13 | gitbook.events.bind("page.change", function() { 14 | $('li.chapter').children('ul.articles').hide(); 15 | $chapter = $('li.chapter.active'); 16 | $children = $chapter.children('ul.articles'); 17 | $parent = $chapter.parent(); 18 | $siblings = $chapter.siblings().children('ul.articles'); 19 | 20 | expand($chapter); 21 | 22 | if ($children.length > 0) { 23 | $children.show(); 24 | } 25 | }); 26 | 27 | }); 28 | -------------------------------------------------------------------------------- /reagent-projects/tic-tac-toe/detecting-victory--rows.md: -------------------------------------------------------------------------------- 1 | # Dectecting Victory - rows only 2 | 3 | A function that will test to see if a row has a winning line 4 | 5 | ```clojure 6 | (defn winning-row 7 | "Return the winner, :nought or :cross if there is a winning row, otherwise return false" 8 | [cell-row] 9 | (if (and (apply = cell-row) 10 | (apply #(not= :empty %) cell-row)) 11 | (first cell-row) 12 | false)) 13 | ``` 14 | 15 | Lets add something simple to check if the first row is a winner 16 | 17 | ```clojure 18 | (defn check-for-winner 19 | "Checks the app-state to see if there is a current winner" 20 | [] 21 | (let [winner (winning-row (first (@app-state :board)))] 22 | (prn "The winner is:" winner) 23 | winner)) 24 | ``` 25 | 26 | Now lest update check-for-winner to try all rows. We will assume that there will be only one winning row. 27 | -------------------------------------------------------------------------------- /reagent-projects/tic-tac-toe/deploy-to-production.md: -------------------------------------------------------------------------------- 1 | ## Production builds 2 | 3 | To create a production build, run: 4 | 5 | ```bash 6 | lein do clean, cljsbuild once min 7 | ``` 8 | 9 | Open your browser in `resources/public/index.html`. You will not get live reloading, nor a REPL. 10 | 11 | 12 | > ####Hint::What does a production build do 13 | > Creating a production build in this way Minifys the resulting JavaScript code, reducing names of vars and function to a minimum number of characters. This result in a much smaller JavaScript file which takes a little less time to be transmitted. 14 | > 15 | > The production build also carries out Dead Code analysis, where any code that is never called is simply removed from the resulting JavaScript. 16 | > 17 | > Both these actions result in a much faster execution of the JavaScript code, resulting in a better experience in the web browser. 18 | -------------------------------------------------------------------------------- /deploy-to-gh-pages: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # A quick hack to deploy a generated website onto a Github repository, to be served as static content by github pages. 4 | 5 | # This should only be run from the root of the gitbook project 6 | 7 | # Trigger a clean and new build 8 | gitbook build . 9 | 10 | # Prevent Jekyll processing when pushing commits to GitHub 11 | touch _book/.nojekyll 12 | 13 | # Add Practicalli favicon 14 | cp -f images/favicon_io/favicon.ico _book/gitbook/images/favicon.ico 15 | 16 | # Add Apple touch icon 17 | cp -f images/favicon_io/apple-touch-icon.png _book/gitbook/images/apple-touch-icon-precomposed-152.png 18 | 19 | 20 | # Deploy new build 21 | cd _book && rm -rf .git && git init && git add . && git commit -m "Publish new version of book" && git branch -m live gh-pages && git remote add practicalli git@github.com:practicalli/clojurescript.git && git push -f practicalli gh-pages 22 | -------------------------------------------------------------------------------- /clojure-syntax/data-structures.md: -------------------------------------------------------------------------------- 1 | # Data Structures 2 | 3 | 4 | When you define a name for a persistent data structure (list, map, vector, set), that name is termed a `Var`. A var is a mutable reference that points to the data structure. A Var is mutable, because it can be changed to point to another data structure (or any other legal Clojure expression) 5 | 6 | When you pass a name as an argument to a function, you are passing a reference to a data structure. If that function modifies that data structure, it will create a new data structure and pass that back by value. 7 | 8 | The new data structure may include references to the original data structure if they have common values, an in-memory sharing model that makes persistent data structures very efficient in terms of memory use. 9 | 10 | Persistent data structures are held in memory as binary tree of values - TODO: how does this look for the different persistent data structures (eg. is the node value for a map the key & value) 11 | -------------------------------------------------------------------------------- /install/java.md: -------------------------------------------------------------------------------- 1 | ## Java 2 | 3 | You will need to have a Java Runtime Edition (usually installed on most computers by default) to run any Clojure applications. 4 | 5 | Check you have a Java runtime on your system path by typing the following in a terminal window: 6 | 7 | ```bash 8 | java -version 9 | ``` 10 | 11 | ## Install Java 12 | 13 | If Java is not found, please install it from [Oracle](http://www.oracle.com/technetwork/java/javase/downloads/index.html) or [OpenJDK](http://openjdk.java.net/projects/jdk8/). 14 | 15 | Java may also be available via your operating systems package manger, for example on Ubuntu / Debian systems this would be installed via sudo apt-get install openjdk-8-jre` 16 | 17 | 18 | > **Hint** ClojureScript uses the Google Closure compiler and build tools that require a Java Virtual machine. However, work is in progress to make ClojureScript self hosting. See articles such as [ClojureScript Next](http://swannodette.github.io/2015/07/29/clojurescript-17/) and [Bootstrapped ClojureScript FAQ](https://github.com/clojure/clojurescript/wiki/Bootstrapped-ClojureScript-FAQ) for pro's and con's of this approach. 19 | -------------------------------------------------------------------------------- /gitbook/gitbook-plugin-search/search.css: -------------------------------------------------------------------------------- 1 | /* 2 | This CSS only styled the search results section, not the search input 3 | It defines the basic interraction to hide content when displaying results, etc 4 | */ 5 | #book-search-results .search-results { 6 | display: none; 7 | } 8 | #book-search-results .search-results ul.search-results-list { 9 | list-style-type: none; 10 | padding-left: 0; 11 | } 12 | #book-search-results .search-results ul.search-results-list li { 13 | margin-bottom: 1.5rem; 14 | padding-bottom: 0.5rem; 15 | /* Highlight results */ 16 | } 17 | #book-search-results .search-results ul.search-results-list li p em { 18 | background-color: rgba(255, 220, 0, 0.4); 19 | font-style: normal; 20 | } 21 | #book-search-results .search-results .no-results { 22 | display: none; 23 | } 24 | #book-search-results.open .search-results { 25 | display: block; 26 | } 27 | #book-search-results.open .search-noresults { 28 | display: none; 29 | } 30 | #book-search-results.no-results .search-results .has-results { 31 | display: none; 32 | } 33 | #book-search-results.no-results .search-results .no-results { 34 | display: block; 35 | } 36 | -------------------------------------------------------------------------------- /create-a-project/index.md: -------------------------------------------------------------------------------- 1 | # Create a project 2 | 3 | Lets create a project called `todo-list` using Leiningen, the build automation tool for Clojure. This project will run the simplest possible webserver. 4 | 5 | On the command line: 6 | 7 | ```bash 8 | lein new todo-list 9 | ``` 10 | 11 |  12 | 13 |
Practicalli Clojure by Practicalli Creative Commons Attribution Share-Alike 4.0 International
Welcome to your first Clojure app. This message is returned regardless of the request, sorry
" 42 | :headers {}}) 43 | {:port (Integer. port-number)})) 44 | ``` 45 | 46 | > **Hint** Using a `-` at the start of the `-main` function is a naming convention, helping you see which function is the entry point to your program. Leiningen also looks for this -main function by default when running your application. 47 | 48 | > The `Integer.` function is a call to `java.lang.Integer`. The `.` is a special form that tells Clojure to treat this name as a call to Java. See [coersing types and java.lang](coersing-types-and-java-lang.html) 49 | 50 | > The `jetty/run-jetty` function takes two arguments. In our example, the first argument is an anonymous function that returns a map (the response to the browser request); the second argument is a port number to run the jetty server on expressed as a Java Integer object. 51 | 52 |Welcome to your first Clojure app. This message is returned regardless of the request, sorry
"
68 | :headers {}})
69 | {:port (Integer. port-number)}))
70 | ```
71 |
72 |
--------------------------------------------------------------------------------
/images/reactive-traits.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
54 |
--------------------------------------------------------------------------------
/gitbook/gitbook-plugin-callouts/plugin.css:
--------------------------------------------------------------------------------
1 | .panel {
2 | margin-bottom: 20px;
3 | background-color: #ffffff;
4 | border: 1px solid transparent;
5 | border-radius: 4px;
6 | -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
7 | box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
8 | }
9 |
10 | .panel-body {
11 | padding: 15px;
12 | }
13 |
14 | .panel-heading {
15 | padding: 10px 15px;
16 | border-bottom: 1px solid transparent;
17 | border-top-right-radius: 3px;
18 | border-top-left-radius: 3px;
19 | }
20 |
21 | .panel-title {
22 | margin-top: 0 !important;
23 | margin-bottom: 0 !important;
24 | font-size: 16px !important;
25 | color: inherit;
26 | }
27 |
28 | .panel-title > a,
29 | .panel-title > small,
30 | .panel-title > .small,
31 | .panel-title > small > a,
32 | .panel-title > .small > a {
33 | color: inherit;
34 | }
35 |
36 | .panel-default {
37 | border-color: #dddddd;
38 | }
39 | .panel-default > .panel-heading {
40 | color: #333333;
41 | background-color: #f5f5f5;
42 | border-color: #dddddd;
43 | }
44 |
45 | .panel-primary {
46 | border-color: #337ab7;
47 | background-color: #D8EDF8;
48 | }
49 |
50 | .panel-primary > .panel-heading {
51 | color: #ffffff;
52 | background-color: #337ab7;
53 | border-color: #337ab7;
54 | }
55 |
56 | .panel-success {
57 | border-color: #DFF0D7;
58 | background-color: #DFF0D7;
59 | }
60 | .panel-success > .panel-heading {
61 | color: #ffffff;
62 | background-color: #58B957;
63 | border-color: #DFF0D7;
64 | }
65 |
66 | .panel-info {
67 | border-color: #E7F2FA;
68 | background-color: #E7F2FA;
69 | }
70 | .panel-info > .panel-heading {
71 | background-color: #67AFE0;
72 | color: #ffffff;
73 | border-color: #E7F2FA;
74 | }
75 |
76 | .panel-warning {
77 | border-color: #FFEDCA;
78 | background-color: #FFEDCA;
79 | }
80 | .panel-warning > .panel-heading {
81 | color: #ffffff;
82 | background-color: #F1B37A;
83 | border-color: #FFEDCA;
84 | }
85 |
86 | .panel-danger {
87 | border-color: #F2DEDE;
88 | background-color:#F2DEDE;
89 | }
90 | .panel-danger > .panel-heading {
91 | color: #ffffff;
92 | background-color: #DB524B;
93 | border-color: #F2DEDE;
94 | }
95 |
96 | // Night Theme
97 |
98 | .book.color-theme-2 .panel {
99 | margin-bottom: 20px;
100 | background-color: #1c1f2b;
101 | border: 1px solid transparent;
102 | border-radius: 4px;
103 | -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
104 | box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
105 | }
106 |
107 | .book.color-theme-2 .panel-body {
108 | padding: 15px;
109 | }
110 |
111 | .book.color-theme-2 .panel-heading {
112 | padding: 10px 15px;
113 | border-bottom: 1px solid transparent;
114 | border-top-right-radius: 3px;
115 | border-top-left-radius: 3px;
116 | background-color: #1c1f2b;
117 | }
118 |
119 | .book.color-theme-2 .panel-title {
120 | margin-top: 0 !important;
121 | margin-bottom: 0 !important;
122 | font-size: 16px !important;
123 | color: inherit;
124 | }
125 |
126 | .book.color-theme-2 .panel-title > a,
127 | .book.color-theme-2 .panel-title > small,
128 | .book.color-theme-2 .panel-title > .small,
129 | .book.color-theme-2 .panel-title > small > a,
130 | .book.color-theme-2 .panel-title > .small > a {
131 | color: inherit;
132 | }
133 |
134 | .book.color-theme-2 .panel-default {
135 | border-color: #dddddd;
136 | }
137 | .book.color-theme-2 .panel-default > .panel-heading {
138 | color: #333333;
139 | background-color: #f5f5f5;
140 | border-color: #dddddd;
141 | }
142 |
143 | .book.color-theme-2 .panel-primary {
144 | border-color: #245784;
145 | background-color: #3F4346;
146 | }
147 |
148 | .book.color-theme-2 .panel-primary > .panel-heading {
149 | color: #ffffff;
150 | background-color: #245784;
151 | border-color: #245784;
152 | }
153 |
154 | .book.color-theme-2 .panel-success {
155 | border-color: #2A582A;
156 | background-color: #3B3E3A;
157 | }
158 | .book.color-theme-2 .panel-success > .panel-heading {
159 | color: #ffffff;
160 | background-color: #2A582A;
161 | border-color: #2A582A;
162 | }
163 |
164 | .book.color-theme-2 .panel-info {
165 | border-color: #3F6A88;
166 | background-color: #3A3C3E;
167 | }
168 | .book.color-theme-2 .panel-info > .panel-heading {
169 | background-color: #3F6A88;
170 | color: #ffffff;
171 | border-color: #3F6A88;
172 | }
173 |
174 | .book.color-theme-2 .panel-warning {
175 | border-color: #AF845E;
176 | background-color: #524D42;
177 | }
178 | .book.color-theme-2 .panel-warning > .panel-heading {
179 | color: #ffffff;
180 | background-color: #AF845E;
181 | border-color: #AF845E;
182 | }
183 |
184 | .book.color-theme-2 .panel-danger {
185 | border-color: #751712;
186 | background-color:#3A3434;
187 | }
188 | .book.color-theme-2 .panel-danger > .panel-heading {
189 | color: #ffffff;
190 | background-color: #751712;
191 | border-color: #751712;
192 | }
193 |
--------------------------------------------------------------------------------
/install/chestnut.md:
--------------------------------------------------------------------------------
1 | # Chestnut
2 |
3 | 
4 |
5 | [Chestnut](https://github.com/plexus/chestnut) is a Leiningen template for a ClojureScript app based on Om, featuring a great dev setup, and easy deployment.
6 |
7 | For smooth development you get instant reloading of Clojure, ClojureScript, and CSS. A browser-connected REPL is also included.
8 |
9 | For deployment you get uberjar support, meaning you can get all your code compiled, optimized, and packaged in a single executable JAR file. It also contains the necessary artifacts to work on Heroku out of the box.
10 |
11 | Need help? Ask on the [mailing list](http://chestnut.aren.io/)
12 |
13 |
14 | ## Chestnut 0.9.0-SNAPSHOT
15 |
16 | A major update is in the works. To try it out, use `lein new chestnut my-project --snapshot`.
17 |
18 | * Use Figwheel for REPL and Ring server
19 | * Remove boilerplate that's no longer needed
20 | * Drop Enlive and simplify the dev setup
21 | * Drop CLJX support
22 | * Better inline documentation
23 |
24 | ## Usage
25 |
26 | ```
27 | lein new chestnut ').html(content);
65 |
66 | $link.appendTo($title);
67 | $title.appendTo($li);
68 | $content.appendTo($li);
69 | $li.appendTo($searchList);
70 | });
71 | }
72 |
73 | function launchSearch(q) {
74 | // Add class for loading
75 | $body.addClass('with-search');
76 | $body.addClass('search-loading');
77 |
78 | // Launch search query
79 | throttle(gitbook.search.query(q, 0, MAX_RESULTS)
80 | .then(function(results) {
81 | displayResults(results);
82 | })
83 | .always(function() {
84 | $body.removeClass('search-loading');
85 | }), 1000);
86 | }
87 |
88 | function closeSearch() {
89 | $body.removeClass('with-search');
90 | $bookSearchResults.removeClass('open');
91 | }
92 |
93 | function launchSearchFromQueryString() {
94 | var q = getParameterByName('q');
95 | if (q && q.length > 0) {
96 | // Update search input
97 | $searchInput.val(q);
98 |
99 | // Launch search
100 | launchSearch(q);
101 | }
102 | }
103 |
104 | function bindSearch() {
105 | // Bind DOM
106 | $searchInput = $('#book-search-input input');
107 | $bookSearchResults = $('#book-search-results');
108 | $searchList = $bookSearchResults.find('.search-results-list');
109 | $searchTitle = $bookSearchResults.find('.search-results-title');
110 | $searchResultsCount = $searchTitle.find('.search-results-count');
111 | $searchQuery = $searchTitle.find('.search-query');
112 |
113 | // Launch query based on input content
114 | function handleUpdate() {
115 | var q = $searchInput.val();
116 |
117 | if (q.length == 0) {
118 | closeSearch();
119 | }
120 | else {
121 | launchSearch(q);
122 | }
123 | }
124 |
125 | // Detect true content change in search input
126 | // Workaround for IE < 9
127 | var propertyChangeUnbound = false;
128 | $searchInput.on('propertychange', function(e) {
129 | if (e.originalEvent.propertyName == 'value') {
130 | handleUpdate();
131 | }
132 | });
133 |
134 | // HTML5 (IE9 & others)
135 | $searchInput.on('input', function(e) {
136 | // Unbind propertychange event for IE9+
137 | if (!propertyChangeUnbound) {
138 | $(this).unbind('propertychange');
139 | propertyChangeUnbound = true;
140 | }
141 |
142 | handleUpdate();
143 | });
144 |
145 | // Push to history on blur
146 | $searchInput.on('blur', function(e) {
147 | // Update history state
148 | if (usePushState) {
149 | var uri = updateQueryString('q', $(this).val());
150 | history.pushState({ path: uri }, null, uri);
151 | }
152 | });
153 | }
154 |
155 | gitbook.events.on('page.change', function() {
156 | bindSearch();
157 | closeSearch();
158 |
159 | // Launch search based on query parameter
160 | if (gitbook.search.isInitialized()) {
161 | launchSearchFromQueryString();
162 | }
163 | });
164 |
165 | gitbook.events.on('search.ready', function() {
166 | bindSearch();
167 |
168 | // Launch search from query param at start
169 | launchSearchFromQueryString();
170 | });
171 |
172 | function getParameterByName(name) {
173 | var url = window.location.href;
174 | name = name.replace(/[\[\]]/g, '\\$&');
175 | var regex = new RegExp('[?&]' + name + '(=([^]*)|&|#|$)', 'i'),
176 | results = regex.exec(url);
177 | if (!results) return null;
178 | if (!results[2]) return '';
179 | return decodeURIComponent(results[2].replace(/\+/g, ' '));
180 | }
181 |
182 | function updateQueryString(key, value) {
183 | value = encodeURIComponent(value);
184 |
185 | var url = window.location.href;
186 | var re = new RegExp('([?&])' + key + '=.*?(&|#|$)(.*)', 'gi'),
187 | hash;
188 |
189 | if (re.test(url)) {
190 | if (typeof value !== 'undefined' && value !== null)
191 | return url.replace(re, '$1' + key + '=' + value + '$2$3');
192 | else {
193 | hash = url.split('#');
194 | url = hash[0].replace(re, '$1$3').replace(/(&|\?)$/, '');
195 | if (typeof hash[1] !== 'undefined' && hash[1] !== null)
196 | url += '#' + hash[1];
197 | return url;
198 | }
199 | }
200 | else {
201 | if (typeof value !== 'undefined' && value !== null) {
202 | var separator = url.indexOf('?') !== -1 ? '&' : '?';
203 | hash = url.split('#');
204 | url = hash[0] + separator + key + '=' + value;
205 | if (typeof hash[1] !== 'undefined' && hash[1] !== null)
206 | url += '#' + hash[1];
207 | return url;
208 | }
209 | else
210 | return url;
211 | }
212 | }
213 | });
214 |
--------------------------------------------------------------------------------
/gitbook/gitbook-plugin-fontsettings/fontsettings.js:
--------------------------------------------------------------------------------
1 | require(['gitbook', 'jquery'], function(gitbook, $) {
2 | // Configuration
3 | var MAX_SIZE = 4,
4 | MIN_SIZE = 0,
5 | BUTTON_ID;
6 |
7 | // Current fontsettings state
8 | var fontState;
9 |
10 | // Default themes
11 | var THEMES = [
12 | {
13 | config: 'white',
14 | text: 'White',
15 | id: 0
16 | },
17 | {
18 | config: 'sepia',
19 | text: 'Sepia',
20 | id: 1
21 | },
22 | {
23 | config: 'night',
24 | text: 'Night',
25 | id: 2
26 | }
27 | ];
28 |
29 | // Default font families
30 | var FAMILIES = [
31 | {
32 | config: 'serif',
33 | text: 'Serif',
34 | id: 0
35 | },
36 | {
37 | config: 'sans',
38 | text: 'Sans',
39 | id: 1
40 | }
41 | ];
42 |
43 | // Return configured themes
44 | function getThemes() {
45 | return THEMES;
46 | }
47 |
48 | // Modify configured themes
49 | function setThemes(themes) {
50 | THEMES = themes;
51 | updateButtons();
52 | }
53 |
54 | // Return configured font families
55 | function getFamilies() {
56 | return FAMILIES;
57 | }
58 |
59 | // Modify configured font families
60 | function setFamilies(families) {
61 | FAMILIES = families;
62 | updateButtons();
63 | }
64 |
65 | // Save current font settings
66 | function saveFontSettings() {
67 | gitbook.storage.set('fontState', fontState);
68 | update();
69 | }
70 |
71 | // Increase font size
72 | function enlargeFontSize(e) {
73 | e.preventDefault();
74 | if (fontState.size >= MAX_SIZE) return;
75 |
76 | fontState.size++;
77 | saveFontSettings();
78 | }
79 |
80 | // Decrease font size
81 | function reduceFontSize(e) {
82 | e.preventDefault();
83 | if (fontState.size <= MIN_SIZE) return;
84 |
85 | fontState.size--;
86 | saveFontSettings();
87 | }
88 |
89 | // Change font family
90 | function changeFontFamily(configName, e) {
91 | if (e && e instanceof Event) {
92 | e.preventDefault();
93 | }
94 |
95 | var familyId = getFontFamilyId(configName);
96 | fontState.family = familyId;
97 | saveFontSettings();
98 | }
99 |
100 | // Change type of color theme
101 | function changeColorTheme(configName, e) {
102 | if (e && e instanceof Event) {
103 | e.preventDefault();
104 | }
105 |
106 | var $book = gitbook.state.$book;
107 |
108 | // Remove currently applied color theme
109 | if (fontState.theme !== 0)
110 | $book.removeClass('color-theme-'+fontState.theme);
111 |
112 | // Set new color theme
113 | var themeId = getThemeId(configName);
114 | fontState.theme = themeId;
115 | if (fontState.theme !== 0)
116 | $book.addClass('color-theme-'+fontState.theme);
117 |
118 | saveFontSettings();
119 | }
120 |
121 | // Return the correct id for a font-family config key
122 | // Default to first font-family
123 | function getFontFamilyId(configName) {
124 | // Search for plugin configured font family
125 | var configFamily = $.grep(FAMILIES, function(family) {
126 | return family.config == configName;
127 | })[0];
128 | // Fallback to default font family
129 | return (!!configFamily)? configFamily.id : 0;
130 | }
131 |
132 | // Return the correct id for a theme config key
133 | // Default to first theme
134 | function getThemeId(configName) {
135 | // Search for plugin configured theme
136 | var configTheme = $.grep(THEMES, function(theme) {
137 | return theme.config == configName;
138 | })[0];
139 | // Fallback to default theme
140 | return (!!configTheme)? configTheme.id : 0;
141 | }
142 |
143 | function update() {
144 | var $book = gitbook.state.$book;
145 |
146 | $('.font-settings .font-family-list li').removeClass('active');
147 | $('.font-settings .font-family-list li:nth-child('+(fontState.family+1)+')').addClass('active');
148 |
149 | $book[0].className = $book[0].className.replace(/\bfont-\S+/g, '');
150 | $book.addClass('font-size-'+fontState.size);
151 | $book.addClass('font-family-'+fontState.family);
152 |
153 | if(fontState.theme !== 0) {
154 | $book[0].className = $book[0].className.replace(/\bcolor-theme-\S+/g, '');
155 | $book.addClass('color-theme-'+fontState.theme);
156 | }
157 | }
158 |
159 | function init(config) {
160 | // Search for plugin configured font family
161 | var configFamily = getFontFamilyId(config.family),
162 | configTheme = getThemeId(config.theme);
163 |
164 | // Instantiate font state object
165 | fontState = gitbook.storage.get('fontState', {
166 | size: config.size || 2,
167 | family: configFamily,
168 | theme: configTheme
169 | });
170 |
171 | update();
172 | }
173 |
174 | function updateButtons() {
175 | // Remove existing fontsettings buttons
176 | if (!!BUTTON_ID) {
177 | gitbook.toolbar.removeButton(BUTTON_ID);
178 | }
179 |
180 | // Create buttons in toolbar
181 | BUTTON_ID = gitbook.toolbar.createButton({
182 | icon: 'fa fa-font',
183 | label: 'Font Settings',
184 | className: 'font-settings',
185 | dropdown: [
186 | [
187 | {
188 | text: 'A',
189 | className: 'font-reduce',
190 | onClick: reduceFontSize
191 | },
192 | {
193 | text: 'A',
194 | className: 'font-enlarge',
195 | onClick: enlargeFontSize
196 | }
197 | ],
198 | $.map(FAMILIES, function(family) {
199 | family.onClick = function(e) {
200 | return changeFontFamily(family.config, e);
201 | };
202 |
203 | return family;
204 | }),
205 | $.map(THEMES, function(theme) {
206 | theme.onClick = function(e) {
207 | return changeColorTheme(theme.config, e);
208 | };
209 |
210 | return theme;
211 | })
212 | ]
213 | });
214 | }
215 |
216 | // Init configuration at start
217 | gitbook.events.bind('start', function(e, config) {
218 | var opts = config.fontsettings;
219 |
220 | // Generate buttons at start
221 | updateButtons();
222 |
223 | // Init current settings
224 | init(opts);
225 | });
226 |
227 | // Expose API
228 | gitbook.fontsettings = {
229 | enlargeFontSize: enlargeFontSize,
230 | reduceFontSize: reduceFontSize,
231 | setTheme: changeColorTheme,
232 | setFamily: changeFontFamily,
233 | getThemes: getThemes,
234 | setThemes: setThemes,
235 | getFamilies: getFamilies,
236 | setFamilies: setFamilies
237 | };
238 | });
239 |
240 |
241 |
--------------------------------------------------------------------------------
/images/react-basics.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
164 |
--------------------------------------------------------------------------------
/gitbook/gitbook-plugin-fontsettings/website.css:
--------------------------------------------------------------------------------
1 | /*
2 | * Theme 1
3 | */
4 | .color-theme-1 .dropdown-menu {
5 | background-color: #111111;
6 | border-color: #7e888b;
7 | }
8 | .color-theme-1 .dropdown-menu .dropdown-caret .caret-inner {
9 | border-bottom: 9px solid #111111;
10 | }
11 | .color-theme-1 .dropdown-menu .buttons {
12 | border-color: #7e888b;
13 | }
14 | .color-theme-1 .dropdown-menu .button {
15 | color: #afa790;
16 | }
17 | .color-theme-1 .dropdown-menu .button:hover {
18 | color: #73553c;
19 | }
20 | /*
21 | * Theme 2
22 | */
23 | .color-theme-2 .dropdown-menu {
24 | background-color: #2d3143;
25 | border-color: #272a3a;
26 | }
27 | .color-theme-2 .dropdown-menu .dropdown-caret .caret-inner {
28 | border-bottom: 9px solid #2d3143;
29 | }
30 | .color-theme-2 .dropdown-menu .buttons {
31 | border-color: #272a3a;
32 | }
33 | .color-theme-2 .dropdown-menu .button {
34 | color: #62677f;
35 | }
36 | .color-theme-2 .dropdown-menu .button:hover {
37 | color: #f4f4f5;
38 | }
39 | .book .book-header .font-settings .font-enlarge {
40 | line-height: 30px;
41 | font-size: 1.4em;
42 | }
43 | .book .book-header .font-settings .font-reduce {
44 | line-height: 30px;
45 | font-size: 1em;
46 | }
47 | .book.color-theme-1 .book-body {
48 | color: #704214;
49 | background: #f3eacb;
50 | }
51 | .book.color-theme-1 .book-body .page-wrapper .page-inner section {
52 | background: #f3eacb;
53 | }
54 | .book.color-theme-2 .book-body {
55 | color: #bdcadb;
56 | background: #1c1f2b;
57 | }
58 | .book.color-theme-2 .book-body .page-wrapper .page-inner section {
59 | background: #1c1f2b;
60 | }
61 | .book.font-size-0 .book-body .page-inner section {
62 | font-size: 1.2rem;
63 | }
64 | .book.font-size-1 .book-body .page-inner section {
65 | font-size: 1.4rem;
66 | }
67 | .book.font-size-2 .book-body .page-inner section {
68 | font-size: 1.6rem;
69 | }
70 | .book.font-size-3 .book-body .page-inner section {
71 | font-size: 2.2rem;
72 | }
73 | .book.font-size-4 .book-body .page-inner section {
74 | font-size: 4rem;
75 | }
76 | .book.font-family-0 {
77 | font-family: Georgia, serif;
78 | }
79 | .book.font-family-1 {
80 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
81 | }
82 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal {
83 | color: #704214;
84 | }
85 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal a {
86 | color: inherit;
87 | }
88 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h1,
89 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h2,
90 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h3,
91 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h4,
92 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h5,
93 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h6 {
94 | color: inherit;
95 | }
96 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h1,
97 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h2 {
98 | border-color: inherit;
99 | }
100 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h6 {
101 | color: inherit;
102 | }
103 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal hr {
104 | background-color: inherit;
105 | }
106 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal blockquote {
107 | border-color: inherit;
108 | }
109 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre,
110 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code {
111 | background: #fdf6e3;
112 | color: #657b83;
113 | border-color: #f8df9c;
114 | }
115 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal .highlight {
116 | background-color: inherit;
117 | }
118 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table th,
119 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table td {
120 | border-color: #f5d06c;
121 | }
122 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table tr {
123 | color: inherit;
124 | background-color: #fdf6e3;
125 | border-color: #444444;
126 | }
127 | .book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table tr:nth-child(2n) {
128 | background-color: #fbeecb;
129 | }
130 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal {
131 | color: #bdcadb;
132 | }
133 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal a {
134 | color: #3eb1d0;
135 | }
136 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h1,
137 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h2,
138 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h3,
139 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h4,
140 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h5,
141 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h6 {
142 | color: #fffffa;
143 | }
144 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h1,
145 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h2 {
146 | border-color: #373b4e;
147 | }
148 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h6 {
149 | color: #373b4e;
150 | }
151 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal hr {
152 | background-color: #373b4e;
153 | }
154 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal blockquote {
155 | border-color: #373b4e;
156 | }
157 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre,
158 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code {
159 | color: #9dbed8;
160 | background: #2d3143;
161 | border-color: #2d3143;
162 | }
163 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal .highlight {
164 | background-color: #282a39;
165 | }
166 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table th,
167 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table td {
168 | border-color: #3b3f54;
169 | }
170 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table tr {
171 | color: #b6c2d2;
172 | background-color: #2d3143;
173 | border-color: #3b3f54;
174 | }
175 | .book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table tr:nth-child(2n) {
176 | background-color: #35394b;
177 | }
178 | .book.color-theme-1 .book-header {
179 | color: #afa790;
180 | background: transparent;
181 | }
182 | .book.color-theme-1 .book-header .btn {
183 | color: #afa790;
184 | }
185 | .book.color-theme-1 .book-header .btn:hover {
186 | color: #73553c;
187 | background: none;
188 | }
189 | .book.color-theme-1 .book-header h1 {
190 | color: #704214;
191 | }
192 | .book.color-theme-2 .book-header {
193 | color: #7e888b;
194 | background: transparent;
195 | }
196 | .book.color-theme-2 .book-header .btn {
197 | color: #3b3f54;
198 | }
199 | .book.color-theme-2 .book-header .btn:hover {
200 | color: #fffff5;
201 | background: none;
202 | }
203 | .book.color-theme-2 .book-header h1 {
204 | color: #bdcadb;
205 | }
206 | .book.color-theme-1 .book-body .navigation {
207 | color: #afa790;
208 | }
209 | .book.color-theme-1 .book-body .navigation:hover {
210 | color: #73553c;
211 | }
212 | .book.color-theme-2 .book-body .navigation {
213 | color: #383f52;
214 | }
215 | .book.color-theme-2 .book-body .navigation:hover {
216 | color: #fffff5;
217 | }
218 | /*
219 | * Theme 1
220 | */
221 | .book.color-theme-1 .book-summary {
222 | color: #afa790;
223 | background: #111111;
224 | border-right: 1px solid rgba(0, 0, 0, 0.07);
225 | }
226 | .book.color-theme-1 .book-summary .book-search {
227 | background: transparent;
228 | }
229 | .book.color-theme-1 .book-summary .book-search input,
230 | .book.color-theme-1 .book-summary .book-search input:focus {
231 | border: 1px solid transparent;
232 | }
233 | .book.color-theme-1 .book-summary ul.summary li.divider {
234 | background: #7e888b;
235 | box-shadow: none;
236 | }
237 | .book.color-theme-1 .book-summary ul.summary li i.fa-check {
238 | color: #33cc33;
239 | }
240 | .book.color-theme-1 .book-summary ul.summary li.done > a {
241 | color: #877f6a;
242 | }
243 | .book.color-theme-1 .book-summary ul.summary li a,
244 | .book.color-theme-1 .book-summary ul.summary li span {
245 | color: #877f6a;
246 | background: transparent;
247 | font-weight: normal;
248 | }
249 | .book.color-theme-1 .book-summary ul.summary li.active > a,
250 | .book.color-theme-1 .book-summary ul.summary li a:hover {
251 | color: #704214;
252 | background: transparent;
253 | font-weight: normal;
254 | }
255 | /*
256 | * Theme 2
257 | */
258 | .book.color-theme-2 .book-summary {
259 | color: #bcc1d2;
260 | background: #2d3143;
261 | border-right: none;
262 | }
263 | .book.color-theme-2 .book-summary .book-search {
264 | background: transparent;
265 | }
266 | .book.color-theme-2 .book-summary .book-search input,
267 | .book.color-theme-2 .book-summary .book-search input:focus {
268 | border: 1px solid transparent;
269 | }
270 | .book.color-theme-2 .book-summary ul.summary li.divider {
271 | background: #272a3a;
272 | box-shadow: none;
273 | }
274 | .book.color-theme-2 .book-summary ul.summary li i.fa-check {
275 | color: #33cc33;
276 | }
277 | .book.color-theme-2 .book-summary ul.summary li.done > a {
278 | color: #62687f;
279 | }
280 | .book.color-theme-2 .book-summary ul.summary li a,
281 | .book.color-theme-2 .book-summary ul.summary li span {
282 | color: #c1c6d7;
283 | background: transparent;
284 | font-weight: 600;
285 | }
286 | .book.color-theme-2 .book-summary ul.summary li.active > a,
287 | .book.color-theme-2 .book-summary ul.summary li a:hover {
288 | color: #f4f4f5;
289 | background: #252737;
290 | font-weight: 600;
291 | }
292 |
--------------------------------------------------------------------------------
/images/clojurescript-platforms.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
209 |
--------------------------------------------------------------------------------
/clojurescript-code/index.md:
--------------------------------------------------------------------------------
1 | # ClojureScript code
2 |
3 | I have taken examples from a number of sources to give you a basic introduction to using Clojurescript. Please see [Clojurescript Unraveled](http://funcool.github.io/clojurescript-unraveled) for a more complete reference guide
4 |
5 | * Rafel Spacjer's blog: [Clojurescript: Javascript interop](http://www.spacjer.com/blog/2014/09/12/clojurescript-javascript-interop/)
6 |
7 | ## Defining scope
8 |
9 |
10 | ## Javascript scope included
11 |
12 | ClojureScript defines special js namespace to allow accessing JavaScript types/functions/methods/objects defined in global scope (i.e. window object for browser).
13 |
14 |
15 | ```cljs
16 | (def text js/globalName) ;; JS output: namespace.text = globalName;
17 | ```
18 |
19 | Creating objects
20 |
21 | We can create JavaScript objects from ClojureScript by adding . to the end of constructor function:
22 |
23 | (def t1 (js/MyType.)) ;; JS output: namespace.t1 = new MyType;
24 |
25 | (note: at first I thought that this generated JS code was wrong, because of the lack of parentheses, but as it clarifies it’s valid - if constructor function doesn’t have arguments, then parentheses can be skipped)
26 |
27 | with arguments:
28 |
29 | (def t2 (js/MyComplexType. "Bob")) ;; JS output: namespace.t2 = new MyComplexType("Bob");
30 |
31 | There is also a different way of creating objects, by using the new function (the name of JS constructor function should be without period):
32 |
33 | (def my-type (new js/MyComplexType "Bob")) ;; JS output: namespace.my_type = new MyComplexType("Bob");
34 |
35 | Invoking methods
36 |
37 | To invoke a JavaScript method we need to prefix the name of the method with the . (dot):
38 |
39 | (.hello js/window) ;; JS output: window.hello();
40 |
41 | which is a syntactic sugar of:
42 |
43 | (. js/window (hello))
44 |
45 | To pass arguments to the function we do:
46 |
47 | (.helloAgain js/window "John") ;; JS output: window.helloAgain("John");
48 |
49 | or
50 |
51 | (. js/window (helloAgain "John"))
52 |
53 | Same thing can be done with created object:
54 |
55 | (def my-type (js/MyComplexType. "Bob")) ;; JS output: namespace.my_type = new MyComplexType("Bob");
56 | (.hello my-type) ;; JS output: namespace.my_type.hello();
57 |
58 | Accessing properties
59 |
60 | ClojureScript provides a few ways of working with JavaScript properties. The simplest one is to use .- property access syntax:
61 |
62 | (def my-type (js/MyType.)) ;; JS output: namespace.my_type = new MyType;
63 | (def name (.-name my-type)) ;; JS output: namespace.name = namespace.my_type.name;
64 |
65 | similar thing can be achieved by aget function, which takes object and the name of the property (as a string) as arguments:
66 |
67 | (def name (aget my-type "name")) ;; JS output: namespace.name = namespace.my_type["name"];
68 |
69 | The aget allows also accessing nested properties:
70 |
71 | (aget js/object "prop1" "prop2" "prop3") ;; JS output: object["prop1"]["prop2"]["prop3"];
72 |
73 | the same thing (generated code is different) can be done by using .. syntax:
74 |
75 | (.. js/object -prop1 -prop2 -prop3) ;; JS output: object.prop1.prop2.prop3;
76 |
77 | You can also set a value of a property from the ClojureScript, to do this you can use aset or set! functions:
78 |
79 | The aset function takes name of the property as a string:
80 |
81 | (def my-type (js/MyType.))
82 | (aset my-type "name" "Bob") ;; JS output: namespace.my_type["name"] = "Bob";
83 |
84 | and the set! takes a property access:
85 |
86 | (set! (.-name my-type) "Andy") ;; JS output: namespace.my_type.name = "Andy";
87 |
88 | Arrays
89 |
90 | The aget function can be also used for accessing JavaScript array element:
91 |
92 | (aget js/globalArray 1) ;; JS output: globalArray[1];
93 |
94 | or if you want to get nested element you can use it in this way:
95 |
96 | (aget js/globalArray 3 1) ;; JS output: globalArray[3][1];
97 |
98 | Nested scopes
99 |
100 | This subject was a bit confusing for me. In my project I wanted to translate such a code:
101 |
102 | var map = new Microsoft.Maps.Map();
103 |
104 | to ClojureScript. As you can see the Map function is in nested scope. The idiomatic way of accessing nested properties is to use .. or aget functions but this can’t be done for constructor function. In such case, we need to use the dot notation (even it’s not idiomatic for Clojure code):
105 |
106 | (def m2 (js/Microsoft.Maps.Themes.BingTheme.))
107 |
108 | or with the new function:
109 |
110 | (def m1 (new js/Microsoft.Maps.Themes.BingTheme))
111 |
112 | If we write this expression like this:
113 |
114 | (def m3 (new (.. js/Microsoft -Maps -Themes -BingTheme)))
115 |
116 | we will get an exception:
117 |
118 | First arg to new must be a symbol at line
119 | core.clj:4403 clojure.core/ex-info
120 | analyzer.clj:268 cljs.analyzer/error
121 | analyzer.clj:265 cljs.analyzer/error
122 | analyzer.clj:908 cljs.analyzer/eval1316[fn]
123 | MultiFn.java:241 clojure.lang.MultiFn.invoke
124 | analyzer.clj:1444 cljs.analyzer/analyze-seq
125 | analyzer.clj:1532 cljs.analyzer/analyze[fn]
126 | analyzer.clj:1525 cljs.analyzer/analyze
127 | analyzer.clj:609 cljs.analyzer/eval1188[fn]
128 | analyzer.clj:608 cljs.analyzer/eval1188[fn]
129 | MultiFn.java:241 clojure.lang.MultiFn.invoke
130 | analyzer.clj:1444 cljs.analyzer/analyze-seq
131 | analyzer.clj:1532 cljs.analyzer/analyze[fn]
132 | analyzer.clj:1525 cljs.analyzer/analyze
133 | analyzer.clj:1520 cljs.analyzer/analyze
134 | compiler.clj:908 cljs.compiler/compile-file*
135 | compiler.clj:1022 cljs.compiler/compile-file
136 |
137 | Creating JavaScript objects
138 |
139 | There are many cases where we need to pass JavaScript object to a method from ClojureScript. In general ClojureScript works with its own data structures (immutable, persistent vector, map, set etc.) that can be converted to plain JS objects. There are several ways of doing it.
140 |
141 | If we want to create a simple JavaScript object from the list of key value pairs we can use js-obj macro:
142 |
143 | (def my-object (js-obj "a" 1 "b" true "c" nil)) ;; JS output: namespace.my_object_4 = (function (){var obj6284 = {"a":(1),"b":true,"c":null};return obj6284;
144 |
145 | Note that js-obj forces you to use strings as keys and basic data literals (string, number, boolean) as values. The ClojureScript data structures won’t be changed, so this:
146 |
147 | (def js-object (js-obj :a 1 :b [1 2 3] :c #{"d" true :e nil}))
148 |
149 | will create such JavaScript object:
150 |
151 | {
152 | ":c" cljs.core.PersistentHashSet,
153 | ":b" cljs.core.PersistentVector,
154 | ":a" 1
155 | }
156 |
157 | as you can see there are used internal types such as:
158 | cljs.core.PersistentHashSet
159 | cljs.core.PersistentVector
160 | and the ClojureScript keyword was changed to string prefixed with colon.
161 |
162 | To solve this problem we can use clj->js function that:
163 | “Recursively transforms ClojureScript values to JavaScript.
164 | sets/vectors/lists become Arrays, Keywords and Symbol become Strings,
165 | Maps become Objects.”
166 |
167 | (def js-object (clj->js :a 1 :b [1 2 3] :c #{"d" true :e nil}))
168 |
169 | will produce such object:
170 |
171 | {
172 | "a": 1,
173 | "b": [1, 2, 3],
174 | "c": [null, "d", "e", true]
175 | }
176 |
177 | There is also one more way of producing JavaScript objects - we can use #js reader literal:
178 |
179 | (def js-object #js {:a 1 :b 2})
180 |
181 | which generates code:
182 |
183 | namespace.core.js_object = {"b": (2), "a": (1)};
184 |
185 | When working with #js you need to be cautious, because this literal also won’t transform inner structures (it’s shallow):
186 |
187 | (def js-object #js {:a 1 :b [1 2 3] :c {"d" true :e nil}})
188 |
189 | will create such object:
190 |
191 | {
192 | "c": cljs.core.PersistentArrayMap,
193 | "b": cljs.core.PersistentVector,
194 | "a": 1
195 | }
196 |
197 | to solve this you need to add #js before every ClojureScript structure:
198 |
199 | (def js-object #js {:a 1 :b #js [1 2 3] :c #js ["d" true :e nil]})
200 |
201 | JavaScript object:
202 |
203 | {
204 | "c": {
205 | "e": null,
206 | "d": true
207 | },
208 | "b": [1, 2, 3 ],
209 | "a": 1
210 | }
211 |
212 | Using JavaScript objects
213 |
214 | There are situations when we need to convert JavaScript object or array into ClojureScript data structure. We can do this by using js->clj function that:
215 | "Recursively transforms JavaScript arrays into ClojureScript vectors, and JavaScript objects into ClojureScript maps. With
216 | option ‘:keywordize-keys true’ will convert object fields from
217 | strings to keywords.
218 |
219 | (def my-array (js->clj (.-globalArray js/window)))
220 | (def first-item (get my-array 0)) ;; 1
221 |
222 | (def my-obj (js->clj (.-globalObject js/window)))
223 | (def a (get my-obj "a")) ;; 1
224 |
225 | as the function doc states we can use :keywordize-keys true to convert string keys of created map to keywords:
226 |
227 | (def my-obj-2 (js->clj (.-globalObject js/window) :keywordize-keys true))
228 | (def a-2 (:a my-obj-2)) ;; 1
229 |
230 | Addition
231 |
232 | If all other methods of working with JavaScript failed, there is a js* that takes a string as an argument and emits it as a JavaScript code:
233 |
234 | (js* "alert('my special JS code')") ;; JS output: alert('my special JS code');
235 |
236 | Exposing ClojureScript functions
237 |
238 | It is worth noting that the exact form of JavaScript code generated from ClojureScript depends on compiler settings. Those settings can be defined in Leiningen project.clj file:
239 |
240 | Part of project.clj file:
241 |
242 | :cljsbuild {
243 | :builds [{:id "dev"
244 | :source-paths ["src"]
245 | :compiler {
246 | :main your-namespace.core
247 | :output-to "out/your-namespace.js"
248 | :output-dir "out"
249 | :optimizations :none
250 | :cache-analysis true
251 | :source-map true}}
252 | {:id "release"
253 | :source-paths ["src"]
254 | :compiler {
255 | :main blog-sc-testing.core
256 | :output-to "out-adv/your-namespace.min.js"
257 | :output-dir "out-adv"
258 | :optimizations :advanced
259 | :pretty-print false}}]}
260 |
261 | As you can see above, there are two defined builds: dev and release. Please note the :optimizations parameter - for :advanced value the code will be truncated (not used code is removed) and renamed (shorter names are used).
262 |
263 | For example, this ClojureScript code:
264 |
265 | (defn add-numbers [a b]
266 | (+ a b))
267 |
268 | will be compiled to such JavaScript code in :advanced mode:
269 |
270 | function yg(a,b){return a+b}
271 |
272 | The function name is completely “random”, so you can’t use it from JavaScript file. To be able to use defined in ClojureScript functions (with their original names) you should mark them with the :export metadata:
273 |
274 | (defn ^:export add-numbers [a b]
275 | (+ a b))
276 |
277 | The :export keyword tells compiler to export given function name to the outside world. (This is done by exportSymbol function from Google Closure Compiler - but I won’t go into the details). Then in your external JavaScript code you can invoke this function:
278 |
279 | your_namespace.core.add_numbers(1,2);
280 |
281 | Please, notice that all dashes were replaced by underscors.
282 | Using external JavaScript libraries
283 |
284 | The :advanced mode affects also invocation of the external libreries, because all functions/methods names are changed to minimal form. Lets take a ClojureScript code, that invokes PolarArea function form the Chart object:
285 |
286 | (defn ^:export creat-chart []
287 | (let [ch (js/Chart.)]
288 | (. ch (PolarArea []))))
289 |
290 | after compilation this code will look similar to this one:
291 |
292 | function(){return(new Chart).Bc(zc)}
293 |
294 | As you can see, the PolarArea method was changed to Bc name, which of course will cause runtime error. To prevent this, we need to tell compiler which names shouldn’t be changed. Those names should be defined in external JavaScript file (i.e. externs.js) and provided to the compiler. For our example the externs.js file should look like this one:
295 |
296 | var Chart = {};
297 | Chart.PolarArea = function() {};
298 |
299 | The compiler should be informed about this file by :externs setting in project.clj file:
300 |
301 | {:id "release"
302 | :source-paths ["src"]
303 | :compiler {
304 | :main blog-sc-testing.core
305 | :output-to "out-adv/your-namespace.min.js"
306 | :output-dir "out-adv"
307 | :optimizations :advanced
308 | :externs ["externs.js"]
309 | :pretty-print false}}
310 |
311 | If we do all those things, created JavaScript code will contain correct invocation of PolarArea function:
312 |
313 | function(){return(new Chart).PolarArea(Ec)}
314 |
315 | To get more details about using external JavaScript libraries in ClojureScript I recommend you to read excellent blog post by Luke VanderHart about this.
316 |
317 |
318 |
319 | # Interop
320 |
321 | (. js/document (getElementById "app"))
322 |
323 | (.-value input)
324 |
325 |
326 | ## core.async - communicating sequential processes
327 |
328 | * processes
329 | * channels
330 | * coordination
331 |
332 | using core.async allows you to write sequential logic that avoids the need for callback hell of hand-crafting asyncronous coding.
333 |
334 | ;; sudo code
335 | (str "do something")
336 | (send-to-channel)
337 | (str "keep doing something")
338 |
339 | ;; put something on the channel
340 | (put!)
341 | (>!)
342 |
343 | ;; get something from the channel
344 | (take!)
345 | (
2 |
3 |
4 |
255 |
--------------------------------------------------------------------------------
/gitbook/gitbook-plugin-lunr/lunr.min.js:
--------------------------------------------------------------------------------
1 | /**
2 | * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 0.5.12
3 | * Copyright (C) 2015 Oliver Nightingale
4 | * MIT Licensed
5 | * @license
6 | */
7 | !function(){var t=function(e){var n=new t.Index;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),e&&e.call(n,n),n};t.version="0.5.12",t.utils={},t.utils.warn=function(t){return function(e){t.console&&console.warn&&console.warn(e)}}(this),t.EventEmitter=function(){this.events={}},t.EventEmitter.prototype.addListener=function(){var t=Array.prototype.slice.call(arguments),e=t.pop(),n=t;if("function"!=typeof e)throw new TypeError("last argument must be a function");n.forEach(function(t){this.hasHandler(t)||(this.events[t]=[]),this.events[t].push(e)},this)},t.EventEmitter.prototype.removeListener=function(t,e){if(this.hasHandler(t)){var n=this.events[t].indexOf(e);this.events[t].splice(n,1),this.events[t].length||delete this.events[t]}},t.EventEmitter.prototype.emit=function(t){if(this.hasHandler(t)){var e=Array.prototype.slice.call(arguments,1);this.events[t].forEach(function(t){t.apply(void 0,e)})}},t.EventEmitter.prototype.hasHandler=function(t){return t in this.events},t.tokenizer=function(t){return arguments.length&&null!=t&&void 0!=t?Array.isArray(t)?t.map(function(t){return t.toLowerCase()}):t.toString().trim().toLowerCase().split(/[\s\-]+/):[]},t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions={},t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(e){var i=t.Pipeline.registeredFunctions[e];if(!i)throw new Error("Cannot load un-registered function: "+e);n.add(i)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(e){t.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(-1==i)throw new Error("Cannot find existingFn");i+=1,this._stack.splice(i,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(-1==i)throw new Error("Cannot find existingFn");this._stack.splice(i,0,n)},t.Pipeline.prototype.remove=function(t){var e=this._stack.indexOf(t);-1!=e&&this._stack.splice(e,1)},t.Pipeline.prototype.run=function(t){for(var e=[],n=t.length,i=this._stack.length,o=0;n>o;o++){for(var r=t[o],s=0;i>s&&(r=this._stack[s](r,o,t),void 0!==r);s++);void 0!==r&&e.push(r)}return e},t.Pipeline.prototype.reset=function(){this._stack=[]},t.Pipeline.prototype.toJSON=function(){return this._stack.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})},t.Vector=function(){this._magnitude=null,this.list=void 0,this.length=0},t.Vector.Node=function(t,e,n){this.idx=t,this.val=e,this.next=n},t.Vector.prototype.insert=function(e,n){this._magnitude=void 0;var i=this.list;if(!i)return this.list=new t.Vector.Node(e,n,i),this.length++;if(e');
54 |
55 | var $link = $('', {
56 | 'href': gitbook.state.basePath + '/' + res.url,
57 | 'text': res.title
58 | });
59 |
60 | var content = res.body.trim();
61 | if (content.length > MAX_DESCRIPTION_SIZE) {
62 | content = content.slice(0, MAX_DESCRIPTION_SIZE).trim()+'...';
63 | }
64 | var $content = $('