Let's say you want to use cljs.js
to eval
code using functions declared in your project.
Expressions that only use core functions are simple to evaluate:
(ns foo.try-eval
(:require [cljs.js :as cljs]))
(def compiler-state (cljs/empty-state))
__ __ | |
/ \ / | | |
λλ \ ______ ______ λλ/ | |
λλ \ / \ / \ / | | |
λλ \ λλλλλλ |/λλλλλλ |λλ | | |
λλ \ / λλ |λλ | λλ |λλ | | |
λλλλ \ /λλλλλλλ |λλ |__λλ |λλ | | |
λλ/ λλ |λλ λλ |λλ λλ/ λλ | | |
λλ/ λλ/ λλλλλλλ/ λλλλλλλ/ λλ/ | |
λλ | |
;; material-ui.macros.clj | |
(ns material-ui.macros) | |
(def material-tags | |
'[AppBar | |
AppCanvas | |
Circle | |
Checkbox | |
DatePicker | |
DialogWindow |
(ns history | |
"Light wrappers and utils for js/history") | |
(defn back! [] (.back js/history)) | |
(defn forward! [] (.forward js/history)) | |
(defn go! [idx] (.go js/history idx)) | |
(defn replace-state! |
(extend-type js/RegExp | |
cljs.core/IFn | |
(-invoke ([this s] (re-matches this s)))) | |
(#"foo.*" "foobar") ;=> "foobar" | |
(#"zoo.*" "foobar") ;=> nil | |
(filter #".*foo.*" ["foobar" "goobar" "foobaz"]) ;=> ("foobar" "foobaz") |
(ns n01se.externs-for-cljs | |
(:require [clojure.java.io :as io] | |
[cljs.compiler :as comp] | |
[cljs.analyzer :as ana])) | |
(defn read-file [file] | |
(let [eof (Object.)] | |
(with-open [stream (clojure.lang.LineNumberingPushbackReader. (io/reader file))] | |
(vec (take-while #(not= % eof) | |
(repeatedly #(read stream false eof))))))) |
# A class-based template for jQuery plugins in Coffeescript | |
# | |
# $('.target').myPlugin({ paramA: 'not-foo' }); | |
# $('.target').myPlugin('myMethod', 'Hello, world'); | |
# | |
# Check out Alan Hogan's original jQuery plugin template: | |
# https://github.com/alanhogan/Coffeescript-jQuery-Plugin-Template | |
# | |
(($, window) -> |
Let's say you want to use cljs.js
to eval
code using functions declared in your project.
Expressions that only use core functions are simple to evaluate:
(ns foo.try-eval
(:require [cljs.js :as cljs]))
(def compiler-state (cljs/empty-state))
(ns datatable.core | |
(:require [reagent.core :as reagent] | |
[cljsjs.fixed-data-table])) | |
(def Table (reagent/adapt-react-class js/FixedDataTable.Table)) | |
(def Column (reagent/adapt-react-class js/FixedDataTable.Column)) | |
(defn gen-table | |
"Generate `size` rows vector of 4 columns vectors to mock up the table." | |
[size] |
Tricks to add encrypted private SSH key to .travis.yml file | |
To encrypt the private SSH key into the "-secure: xxxxx....." lines to place in the .travis.yml file, generate a deploy key then run: (to see what the encrypted data looks like, see an example here: https://github.com/veewee-community/veewee-push/blob/486102e6f508214b04414074c921475e5943f682/.travis.yml#L21 | |
base64 --wrap=0 ~/.ssh/id_rsa > ~/.ssh/id_rsa_base64 | |
ENCRYPTION_FILTER="echo \$(echo \"-\")\$(travis encrypt veewee-community/veewee-push \"\$FILE='\`cat $FILE\`'\" | grep secure:)" | |
split --bytes=100 --numeric-suffixes --suffix-length=2 --filter="$ENCRYPTION_FILTER" ~/.ssh/id_rsa_base64 id_rsa_ | |
;; Copyright (c) Alan Dipert. All rights reserved. | |
;; The use and distribution terms for this software are covered by the | |
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) | |
;; By using this software in any fashion, you are agreeing to be bound by | |
;; the terms of this license. | |
;; You must not remove this notice, or any other, from this software. | |
(ns alandipert.kahn | |
(:require [clojure.set :refer [difference union intersection]])) |