Skip to content

Instantly share code, notes, and snippets.

@mfikes
Last active May 30, 2018 09:31
Show Gist options
  • Save mfikes/e600e965da916699a703c9b1f1ff6d3b to your computer and use it in GitHub Desktop.
Save mfikes/e600e965da916699a703c9b1f1ff6d3b to your computer and use it in GitHub Desktop.
Try running this in your terminal: clojure -Sdeps '{:deps {github-mfikes/e600e965da916699a703c9b1f1ff6d3b {:git/url "https://gist.github.com/mfikes/e600e965da916699a703c9b1f1ff6d3b" :sha "aa946e43d193fa719544057b0561b03ce2a72977"}}}' -m cljs.main -m hello-clojure
{:paths ["."]
:deps {org.clojure/clojurescript
{:git/url "https://github.com/clojure/clojurescript"
:sha "08beee84b05f911a6bb0eff0dd1235c201b26c70"}}}
(ns hello-clojure
(:require
[clojure.string :as string]
[resources]))
(def styles
{\b "\u001b[38;44m \u001b[m"
\g "\u001b[38;42m \u001b[m"
\w "\u001b[38;47m \u001b[m"
\- " "})
(defn colorize-line [line]
(->> line
(map #(string/escape % styles))
(apply str)))
(defn -main []
(run! #(println (colorize-line %)) (string/split-lines resources/logo)))
(ns resources)
(def logo "-----------wwwwwwwwww-----------
---------wwwwwbbbbwwwww---------
-------wwwbbbbbbbbbbbwwww-------
------wwbbbbbbbbbbbbbbbwww------
-----wwbbbbbbbbbbbbbbbbbbww-----
----wwbbbbbbbbbbbbbbbbbbbbww----
---wwwwwwwwbbbbbbbbbbbbbbbbww---
--wwwwwwwwwwwwwwwwwbbbbbbbbbww--
--wwwwgggwwwwwbbbbwwwbbbbbbbww--
-wwwwggggwwgwwbbbbbbwwbbbbbbbww-
-wwwgggggwwggwwbbbbbbwwbbbbbbww-
wwwgggggwwgggwwbbbbbbbwwbbbbbbw-
wwgggggwwgggggwwbbbbbbbwbbbbbbww
wwgggggwwgggggwwbbbbbbbwwbbbbbww
wggggggwgggggggwbbbbbbbwwbbbbbww
wggggggwgggggggwbbbbbbbbwbbbbbww
wggggggwggggggwwwbbbbbbbwbbbbbww
wggggggwgggggwwgwbbbbbbwwbbbbbww
wwgggggwwggggwggwwbbbbbwwbbbbbww
wwggggggwgggwwggwwbbbbbwbbbbbbw-
-wggggggwwggwggggwwbbbwwbbbbbww-
-wgggggggwwgwggggwwbbwwbbbbbwww-
-wwgggggggwwwgggggwwwwbbbbwwww--
--wwgggggggwwwwggwwwwwwwwwwwww--
--wwgggggggggwwwwwwgggwwwwggw---
---wwggggggggggggggggggggggww---
----wwggggggggggggggggggggww----
-----wwggggggggggggggggggww-----
------wwwggggggggggggggwww------
--------wwwggggggggggwww--------
----------wwwwwwwwwwww----------
-------------wwwwww-------------")
@omendezmorales
Copy link

Pardon my ignorance -I'm new to Clojure; trying that on my box shows me the following:
Exception in thread "main" java.io.FileNotFoundException: -Sdeps (No such file or directory)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.(FileInputStream.java:138)
at java.io.FileInputStream.(FileInputStream.java:93)
at clojure.lang.Compiler.loadFile(Compiler.java:7314)
at clojure.main$load_script.invokeStatic(main.clj:275)
at clojure.main$load_script.invoke(main.clj:268)
at clojure.main$script_opt.invokeStatic(main.clj:337)
at clojure.main$script_opt.invoke(main.clj:330)
at clojure.main$main.invokeStatic(main.clj:421)
at clojure.main$main.doInvoke(main.clj:384)
at clojure.lang.RestFn.invoke(RestFn.java:512)
at clojure.lang.Var.invoke(Var.java:409)
at clojure.lang.AFn.applyToHelper(AFn.java:178)clojure -Sdeps '{:deps {github-mfikes/e600e965da916699a703c9b1f1ff6d3b {:git/url "https://gist.github.com/mfikes/e600e965da916699a703c9b1f1ff6d3b" :sha "aa946e43d193fa719544057b0561b03ce2a72977"}}}' -m cljs.main -m hello-clojure
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)
I have installed Clojure 1.8, and don't know how to fix this. Can you please help me? thanks

@MageMasher
Copy link

Hey @ormendezmorales , I think you might want to upgrade to clojure 1.9. You also want to copy the deps.edn file up above to the current working directory where you are planning on executing this. Otherwise you can put it in ~/.clojure/deps.edn You should be able to determine how to copy the clojurescript dependency into your global deps.edn Then you can put the other two files next to each other and try re-running your script.

I haven't tested this, but I hope it helps!

@4mitch
Copy link

4mitch commented Feb 24, 2018

Excuse me! But how can I run this with lein but not clojure itself?

@metacritical
Copy link

@4mitch it has deps.edn instead of project.clj so you dont need lein.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment