This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-11
Channels
- # announcements (1)
- # beginners (84)
- # boot (325)
- # cbus (1)
- # cider (13)
- # cljs-dev (1)
- # cljsjs (1)
- # cljsrn (15)
- # clojars (8)
- # clojure (221)
- # clojure-czech (2)
- # clojure-ireland (8)
- # clojure-madison (28)
- # clojure-poland (176)
- # clojure-russia (111)
- # clojurebridge (7)
- # clojurescript (75)
- # community-development (70)
- # conf-proposals (19)
- # core-async (29)
- # css (12)
- # cursive (66)
- # datavis (15)
- # datomic (61)
- # devcards (15)
- # dirac (2)
- # editors (13)
- # emacs (9)
- # funcool (7)
- # hoplon (13)
- # jobs-discuss (5)
- # ldnclj (39)
- # ldnproclodo (1)
- # lein-figwheel (3)
- # leiningen (21)
- # liberator (26)
- # off-topic (12)
- # om (153)
- # onyx (168)
- # parinfer (165)
- # proton (21)
- # quil (5)
- # re-frame (58)
- # reagent (4)
- # ring-swagger (12)
- # spacemacs (3)
- # yada (120)
I’ve got a little toy duct app with one endpoint that accepts parameters when I run it in the repl & browser, but the handler doesn’t get any parameters when I try to test it with kerodon. code is here: https://github.com/stig/accounts/pull/1 - I would be very grateful for some assistance as I’ve spent all evening getting nowhere :-(
I’m not actually sure if it makes sense to call kerodon’s session
with a handler that I lift out of a component… that may very well be my problem.
@sooheon: I'm not familiar with that library, but I think you should use get
.
Hm reading more, I guess map.controls is an array? so the square brackets are accessign the array, and putting input into that place?
Your last line would look like (.push (get (.controls map) js/google.maps.ControlPosition.TOP_LEFT) input))
codonnell: I’m getting map.controls is not a function
, even though it’s clearly an instance of js/google.maps.Map.
any idea what could be wrong?
Hm, actually, .SearcBox
above is not working either, Uncaught TypeError: Cannot read property 'SearchBox' of undefined
I think controls
is a property of map
, not a method.
So you would access it with .-
instead of .
I'm not sure why you would get your searchbox error message.
^^ the error was because I had not loaded the places
library (it’s not included in the maps api by default)
It turned out I had neglected to include an app component in my test-system, so none of the middleware was wrapping my handler.
I found this: http://www.mattgreer.org/articles/embedding-svg-into-a-reagent-component/ and i'm trying to figure out how this would work.. form what I understand the tagsoup dependency is clojure whereas reagent is clojurescript
@roberto: if working on the filesystem directly: (file-seq (io/file "resources"))
naomarik: in the example, tagsoup is used in a macro which means it’s executed as clojure when clojurescript is compiled.
naomarik: you can use reagent’s hiccup syntax to create svg elements for rendering.
naomarik: the point of the article is, that you typically do not want to create an SVG from scratch so this code parses the SVG during clojurescript compile time to a hiccup datasctructure.
@ordnungswidrig: to give some background of my project: it's a rails application with some reagent baked in. i've got some SVG files that I'd like to inline
but i'm unsure how this would work since i'm only including javascript in the project (no clojure backend)
so i would love to be able to parse the SVG data structure and include it in a reagent component
I'm starting to look into om.next, and I have a doubt: is it worth to use it with a db like mongo? It seems it's made to be used with datomic/datascript mainly
@naomarik: with a clojurescript macro, as in the article, the parsed SVG would be embedded into the js as a clojurescript value.
@naomarik: yes, clojurescrupt macros are actually clojure code executed at compiliation time. Do the SVGs change over time?
they're just images from a design, so once it's compiled it's fine, i just want to be able to style and animate them easily
in that case, the svg will end up as a „value“ in the js. you can manipulate that in clojurescript as you need.
so in order to get this to actually work, i add [clj-tagsoup "0.3.0"] as a dependency to my project then include the snippet he has for the macro in src/clj/embed/svg.clj right?
with (def svg (embed-svg "cool-svg-image.svg“))
you will end up having the SVG as a „hiccup“ data structure in svg
i.e. [:svg {:x 0 :y 0 :width 50 :height 50} [:rect {:x 10 :y 10 :width 10 :height 10}]]
That looks sensible. I’m no expert with boot but you’d follow the general recommendation with clojurescript and boot, I think
okay so my confusion now is how to use this.. i've got the macro in src/clj/embed/svg.clj exactly as the author put it. in my cljs file when I attempt to refer to it, i get this error No such namespace: embed.svg,
[embed.svg :refer [embed-svg]]
is on top of my cljs file, this doesn't seem to work cause the macro is a clojure file not clojurescript
Using postgres hstores, the db expects a value string such as:
'"paperback" => "5",
"publisher" => "",
"language" => "English",
"ISBN-13" => "978-1449370001",
"weight" => "1 ounces”’
What is the best way to write a query for this in Yesql? If my Yesql query looks like
UPDATE foo-table
SET hstore-field = :data :: hstore
WHERE id = :id:
It’s not clear to me how :data
should be shaped on the clojure end.Specifically because clojure doesn’t have single and double quotes. I’ve tried escaping strings, which didn’t work.
But if you had to do it literally, I would expect "'\"paperback\" => \"5\", ..."
to work.
Ah I must have been out of it I only thought to do "\"paperback\" => \"5\", …”
… without the single quote in there. That might have worked.
@eggsyntax: Hello, my friend.
@meow thanks but don't need specific SVG help - just basic config for setting this up
is :as
the way to alias a required namespace? e.g. (require ‘overtone.inst.synth :as synth)
would give let me type synth
instead of overtone.inst.synth
?
hmm… what have I done?!??
live> (require 'overtone.inst.piano)
nil
live> (require 'overtone.inst.piano :as piano)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: piano in this context, compiling:(*cider-repl replovin*<2>:141:6)
hmm… so that works fine in REPL-land, but when I require
the file/namespace containing those piano/drum/etc requires I get a compilation error:
CompilerException java.lang.Exception: Found lib name 'overtone.inst.drum' containing period with prefix 'quote'. lib names inside prefix lists must not contain periods, compiling:(live.clj:1:1)
(ns live
;; (:use [overtone.inst.drum :as drum]
;; [overtone.inst.synth :as synth])
(:require '[overtone.inst.drum :as drum]
'[overtone.inst.synth :as synth]
'[overtone.inst.piano :as piano]
[repl :refer [reset]]))
(println "WE'RE DOIN' IT LIVE!")
yeah, it's a common stumbling block. In a ns
declaration, "libspecs" should have keywords :require
When mucking around in the REPL, the opposite: require and use are regular functions, and thus no keywords, and their arguments are quoted
with korma
what’s the best way to create a record (if one with particular value not already exists in db)? i tried raw SQL but postgres 9.4.4 do not support ON CONFLICT
can someone help me understand how this counts the elements in a list?
reduce (fn [c _] (inc c)) 0
might only make sense with the rest of the code...
(= ( reduce (fn [c _] (inc c)) 0 '(1 2 3 3 1)) 5)
That's short but seems like a confusing use of reduce
im working through 4clojure and i'm having trouble discerning good solutions and ones that are short.
@drewverlee: reduce
calls an accumulator function for each element in the list. Looks like each time it is called the accumulator is simply incrementing c
.
@bridget yea. Solutions from the ppl you can follow.