Just do the following one by one, and you should be fine.
You will need Java to work with this Clojure workshop content.
| // Prompt: "Create an amazing animation using p5js" | |
| let particles = []; | |
| let center; | |
| let centerDriftSpeed = 0.05; | |
| function setup() { | |
| createCanvas(windowWidth, windowHeight); | |
| center = createVector(width/2, height/2); | |
| colorMode(HSB, 255); // Use HSB color mode | |
| } |
| # Collection of routines that will be sourced in a shell to manage huggingface settings and environment variables | |
| # Expects huggingface_hub python dependency installed, python executable as "python" (and not python3), and fzf | |
| _EXEDIR=$(dirname $0) | |
| _PRELUDE="import sys; sys.path.insert(0, '$_EXEDIR'); import hf_shell_fns as hf" | |
| function hf_home() { | |
| python -c "$_PRELUDE; print(hf.hf_home())" | |
| } |
| // Copy static resources from your node modules - CSS files, font files etc. | |
| let publicDir = "resources/public"; | |
| const copyStatics = async () => { | |
| var katex = { | |
| "css/fonts": {"pattern": "katex/dist/fonts/**/*"}, | |
| "css": {"pattern": "katex/dist/**/*.min.css"} | |
| } | |
| var normalize = { |
| (ns etaoin-play.core | |
| (:require [etaoin.api :refer :all] | |
| [etaoin.keys :as k])) | |
| (defonce drivers (atom {})) | |
| (defmacro a [action _ & body] | |
| `(for [[_# driver#] @drivers] | |
| (future (~action driver# ~@body)))) | |
| ;; You can try evaluating individual expressions in steps instead of calling the function `steps` by itself. |
| ;; So that we don't repeat figwheel config options in two places. | |
| (use 'figwheel-sidecar.repl-api) | |
| ;; See - http://stackoverflow.com/questions/16270805/how-to-get-the-version-of-the-current-clojure-project-in-the-repl | |
| ;; This script should be invoked from the base project directory. | |
| (def project (->> "project.clj" | |
| slurp | |
| read-string | |
| (drop 2) | |
| (cons :version) |
| (ns s-and-l.main) | |
| #?(:cljs (set! *print-fn* #(.log js/console %))) | |
| #?(:cljs (def log print)) | |
| #?(:clj (def log println)) | |
| (def max-board-value 100) | |
| (defn roll-dice [] | |
| (-> #?(:cljs (.random js/Math) :clj (java.lang.Math/random)) | |
| (* 100) |
| ;;; Some NS which has the gen-class directive | |
| (defn -main-that-wont-work [] | |
| (let [coll (some-collection-returning-function)] | |
| (for [c coll] | |
| (transform c) | |
| ) | |
| ) | |
| ) |
| // do "sbt run" to see exceptions while running main (although main is discovered fine.) | |
| trait Foo[+A] | |
| // Change trait to class, and it works. | |
| object Foo { | |
| def main(args: Array[String]) : Unit = println("Hello, Foo!") | |
| } |
| require 'java' | |
| require 'mvn:org.scala-lang:scala-library' | |
| require 'case' | |
| module Akka | |
| include_package 'akka.actor' | |
| include_package 'akka.util.duration' | |
| java_import 'akka.routing.RoundRobinRouter' | |
| java_import 'akka.util.Duration' | |
| end |