Fork me on GitHub
#clojurescript
<
2015-06-27
>
gadfly36100:06:39

Awesome, thanks!

mikethompson02:06:14

@bostonou: Be sure to also checkout shodan https://github.com/noprompt/shodan from @noprompt . He takes the macro approach, not the wrapping-function approach, and there are benefits.

bostonou02:06:53

@mikethompson: thanks for the link. i had seen the question but didn't see the follow up conversation. it was one of those that stuck in my head as something worth exploring

rui.yang02:06:27

there are some typos in the om advanced tutorial

rui.yang02:06:59

om/InitState --> om/IInitState

rui.yang03:06:56

and other minor issues. what's the process to fix it?

meow03:06:27

@rui.yang: My impression is that David would like the community to help with wiki maintenance, so I think it's safe to simply change the wiki pages so that they are correct. Your changes can always be undone if someone doesn't like them.

rui.yang03:06:08

@meow: is the wiki generated from a git repo?

meow03:06:36

It's the usual github wiki, so yes.

meow03:06:15

If you aren't sure about a change you can always ask. The #C06DT2YSY channel on slack is probably the best place for that.

rui.yang03:06:01

@meow: cool, I think I am sure the change

meow03:06:33

@rui.yang: Then thank you for finding and fixing them. simple_smile

ergl07:06:11

@gadfly361: this is what I use, m must have exactly those keys

(defn complies-schema? [m schema]
  (= (set (keys m)) (set schema)))

ergl07:06:26

you would use it like (complies-schema? {:foo 1 :bar 2} [:foo :bar])

gadfly36107:06:26

@ergl sweet, thanks for giving another option! For my use case, pre conditions ended up working out well, but ill try this out too.

Petrus Theron09:06:46

How do I run figwheel as a headless REPL that I can connect to from Cursive?

Petrus Theron09:06:54

I cannot for the life of me figure out how 😕

sander09:06:59

petrus: do you want to use nrepl, or is the 'clojure.main route' also ok?

Petrus Theron09:06:23

I don't know, I just want to be able to run browser repl commands without fighting with the crappy repl I get in the terminal

sander09:06:30

@petrus: create a figwheel.clj script like https://gist.github.com/sander/d9cbd3b734d31491e040 and create a "Use clojure.main in normal JVM process" repl with Parameters: path/to/figwheel.clj

sander09:06:54

@petrus: you may need to put [figwheel-sidecar "0.3.3"] in your leiningen deps for it to work

dnolen09:06:23

@meow there is no js namespace really. That just gives access to the global environment.

dnolen09:06:51

@meow: standard library loads a few Closure namespaces, they are in fact globally accessible.

dnolen09:06:35

@mattly fwiw IMO they really aren't that useful.

dnolen10:06:51

@meow: there really is no need to document JS globals this well covered elsewhere.

dnolen13:06:05

Look at the requires at the top of the standard library

meow13:06:44

This?

(ns cljs.core
  (:require [goog.string :as gstring]
            [goog.object :as gobject]
            [goog.array :as garray])
  (:import [goog.string StringBuffer]))

meow13:06:31

Okay, so those goog namespaces are globally available:

cljs.user=> (goog.string/isUnicodeChar 42)
false
Cool. simple_smile

meow13:06:46

But they aren't available as gstring for example because the :as option creates an alias symbol in the local namespace, which in this case is the global namespace for cljs apps, but even in this case the symbol isn't available globally, but the fully qualified libraries like goog.string and goog.object are available. (I hope I got that right.)

dnolen13:06:26

namespace aliases are supported by the compiler - not a runtime thing

meow13:06:22

But the fact that these google closure modules are available in the global namespace is kind of a side effect of cljs.core needing those modules for their functionality itself. It wasn't really the intent to make them part of the global namespace, was it? I mean, apps written in cljs should :require [goog.string] explicitly rather then relying on the fact that it is already available, right?

dnolen14:06:11

Normally they should but there are cases where accessing a namespace you know has already been loaded is useful. This is the case for some kinds macros you might write.

meow14:06:27

Yeah, I have noticed macros that didn't explicitly require namespaces that they knew would already be loaded and I didn't know if this was considered proper or not, but I suppose it is.

jrychter14:06:43

Does anybody have any hints on integrating external build tools into a leiningen build process? I need to build Semantic UI and other libs, they use gulp or grunt. I need to unpack, drop in a config file, build, and then extract the artifacts, placing them in resources and packaging for external static serving. Before I try reinventing the wheel, I thought I'd ask around for hints.

dnolen15:06:17

@meow: it's a pattern that exists in Clojure too. Otherwise using macros gets unnecessarily error prone.

jrychter15:06:40

@jackjames: thanks, but that seems like too much of a hack. Plus, I need to run the tools before I compile ClojureScript code, so that external JavaScript gets included in the app.

meow15:06:47

@dnolen: that's good to know, thanks.

jrychter15:06:49

I guess writing lein tasks is the way to go.

meow17:06:59

I give up. I can't figure out how cljs gets the js/ pseudo-namespace into its global namespace. 😞

jellea18:06:47

does somebody has a good example of time dependent animations/interpolation use in reagent/om/etc? how would approach such thing? core.async loop with timeouts updating a state?

jakemcc20:06:04

@jrychter could also use something like make

arohner21:06:34

How good of an idea is it to put <script src=“foo.js”> in an Om component?

arohner21:06:35

hrm, looks like not very