This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-06
Channels
- # bangalore-clj (2)
- # beginners (55)
- # boot (32)
- # bristol-clojurians (4)
- # cider (16)
- # clara (13)
- # cljsrn (6)
- # clojure (110)
- # clojure-india (1)
- # clojure-italy (69)
- # clojure-spec (32)
- # clojure-uk (15)
- # clojurescript (102)
- # community-development (6)
- # cursive (1)
- # datomic (9)
- # docs (2)
- # duct (1)
- # emacs (39)
- # events (3)
- # fulcro (131)
- # garden (1)
- # immutant (4)
- # jobs (1)
- # jobs-discuss (5)
- # keechma (1)
- # lein-figwheel (6)
- # leiningen (6)
- # mount (6)
- # nrepl (2)
- # off-topic (69)
- # om (54)
- # parinfer (7)
- # re-frame (63)
- # reagent (13)
- # remote-jobs (1)
- # shadow-cljs (90)
- # spacemacs (8)
- # specter (6)
- # sql (16)
- # testing (1)
- # unrepl (3)
- # vim (4)
- # yada (1)
some intelij expert who can help me figure out what to enter on the module part : https://pasteboard.co/H6lRPXp.png
does anyone know a more sophisticated re-frame app that I can learn some reg-event-fx testing from?
@roelof I’m guessing the “no module selected” message is because the Leiningen Project field isn’t showing your project. If you created your project with lein new
and then opened it in IntelliJ using File -> Open, it’s possible that IntelliJ failed to recognize it as a Clojure project. The way I start new Clojure projects is by creating it with lein new
, and then in IntelliJ, under the File menu, select New -> From Existing Sources. That will let you create the project as a leiningen-based Clojure setup, and things like this should just work.
oke, after a few times importing the project and deleting the .idea folder everything works fine
hey there, I am watching lambda island '33. Running ClojureScript Tests' and he uses emacs. I am using spacemacs and I wonder if I should use inf-clojure as well. it looks good! hitting a key and having output in the repl seems awesome. How do you do it with spacemacs? Is there an alternative way?
@timok I haven’t seen the episode, but I assume you could do a cider-jack-in-javascript (SPC-m-“). Once connected, you could do (SPC-m-e-e) and see the result of each expression inline. (Or open a repl buffer and do SPC-m-s-e)
that's actually a good post: https://paultopia.github.io/posts-output/figwheel-emacs/
@timok you’ll get that if you don’t have a repl connected (cider-jack-in-javascript) and its buffer open (so that the code buffer can “send it” to it).
why is here timbre/info
not resolved :
(ns hipstr.handler
(:require [compojure.core :refer [defroutes]]
[hipstr.routes.home :refer [home-routes]]
[hipstr.middleware :refer [load-middleware]]
[hipstr.session-manager :as session-manager]
[noir.response :refer [redirect]]
[noir.util.middleware :refer [app-handler]]
[ring.middleware.defaults :refer [site-defaults]]
[compojure.route :as route]
[taoensso.timbre :as timbre]
[taoensso.timbre.appenders.rolling :as rolling]
[selmer.parser :as parser]
[environ.core :refer [env]]
[cronj.core :as cronj]))
(defroutes base-routes
(route/resources "/")
(route/not-found "Not Found"))
(defn init
"init will be called once when
app is deployed as a servlet on
an app server such as Tomcat
put any initialization code here"
[]
(timbre/set-config!
[:appenders :rolling]
(rolling/make-rolling-appender {:min-level :info}))
(timbre/set-config!
[:shared-appender-config :rolling :path] "logs/hipstr.log")
(defn destroy
"destroy will be called when your application
shuts down, put any clean up code here"
[]
(timbre/info "hipstr is shutting down...")
(cronj/shutdown! session-manager/cleanup-job)
(timbre/info "shutdown complete!"))
;; timeout sessions after 30 minutes
(def session-defaults
{:timeout (* 60 30)
:timeout-response (redirect "/")})
(defn- mk-defaults
"set to true to enable XSS protection"
[xss-protection?]
(-> site-defaults
(update-in [:session] merge session-defaults)
(assoc-in [:security :anti-forgery] xss-protection?)))
(def app (app-handler
;; add your application routes here
[home-routes app-routes]
;; add custom middleware here
:middleware (load-middleware)
;; timeout sessions after 30 minutes
:session-options {:timeout (* 60 30)
:timeout-response (redirect "/")}
;; add access rules here
:access-rules []
;; serialize/deserialize the following data formats
;; available formats:
;; :json :json-kw :yaml :yaml-kw :edn :yaml-in-html
:formats [:json-kw :edn]))
@roelof what’s the actual error message you are getting? I’m wondering if you’ve added them to your :dependencies
in your project.clj
. They won’t get installed until you do that. I have to restart my lein
when I do that because it does not know to install additional dependencies unless you restart
when doing so I see this error message : exception in thread "main" java.lang.RuntimeException: Unable to resolve symbol: app-routes in this context, compiling:(hipstr/handler.clj:53:10)
@roelof Well, you don't have app-routes
defined so that error is correct.
You have base-routes
-- did you rename something?
Right, but that has
[home-routes album-routes test-routes base-routes]
So you've replaced that with [home-routes app-routes]
but you have not defined app-routes
.
if you want to assign defaults, (let [m (merge my-defaults-map m)]
is usually how it's done
The way destructuring works in Clojure, :or can create default values for individual pieces that you extract, but they do not change the result assigned using :as
right, think of that destructuring as functionally equivalent to (defn [movie] (let [category (get movie :category "Category not found")] (str category))
It may be surprising to some, of course, but I very strongly suspect it is working as designed.
destructuring doesn't describe the input data structure, it just pulls out parts of it
Personally, I would only say that if I recalled a CLJ bug report that was declined with such a reason given (which might even exist)
But @bronsa has dug much deeper into many of these things than I have.
"What is Destructuring? Destructuring is a way to concisely bind names to the values inside a data structure"
There isn't much there explicitly about any kind of interaction when using both :as
and :or
in the same map destructuring, although this sentence is a good strong hint: "If you need access to the entire map, you can use the :as key to bind the entire incoming value"
If I were to use (let [m (merge my-defaults-map m)]
then I would I have to create conditionals for each key that doesn’t exist if I want to default it to some value?
meaning that every binding in the defaults map that already exists in your map, will be overridden by the value in your map
@roelof: You're looking for a book to learn ouminus?
@shaun-mahood yep, im looking for a book to learn luminus and not a todo site
@roelof: You picked a good thing to want a book about - https://pragprog.com/book/dswdcloj2/web-development-with-clojure-second-edition Written by the author of Luminus