[ClojureScript] Tao, two-way data binding between edn and browser history (with Om in mind)

2014-04-11 Thread Dylan Butman
Wrote a very small library on top of secretary that allows for two way data 
binding between edn (think application-state) and browser history. 

https://github.com/pleasetrythisathome/tao

Thoughts, comments, pull requests, greatly appreciated!

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] OM: What is the best way of introducing animation/effects during application state transition ?

2014-04-12 Thread Dylan Butman
CSSTransition groups are cool, but often what you want to do is transition 
state (or props). I wrote a tiny thing along the same lines for React which 
I've used a lot in production 
https://github.com/pleasetrythisathome/react.animate

Haven't had time to write the corresponding Om stuff yet, but the concept is 
very simple. Basically you just want to define an interpolator between your 
start and end value, and then write a function that gets called faster than 
request animation frame and then invokes an interpolator with 0-1 and calls 
set-state! or transact! with the result. 

Not sure if any of this is helpful at all...

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] Om cursors, external updates and internal data transformations, and future behavior

2014-04-12 Thread Dylan Butman
Pulled Tao out of a recent project. Handles the route problems your 
describing...would love feedback

https://github.com/pleasetrythisathome/tao

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] Tao, two-way data binding between edn and browser history (with Om in mind)

2014-04-25 Thread Dylan Butman
On Thursday, April 24, 2014 10:50:21 PM UTC-4, Don Jackson wrote:
> On Apr 11, 2014, at 3:28 PM, Dylan Butman  wrote:
> 
> 
> 
> > Wrote a very small library on top of secretary that allows for two way data 
> > binding between edn (think application-state) and browser history. 
> 
> > https://github.com/pleasetrythisathome/tao
> 
> > Thoughts, comments, pull requests, greatly appreciated!
> 
> 
> 
> Very cool, thanks for sharing!
> 
> 
> 
> I have some questions/thoughts:
> 
> 
> 
> Would it possible (and a good/OK/reasonable idea) to keep the routing state 
> in the component local state of the Om root component, instead of the 
> app-state?
> 
> 
> 
> If so, would it also be possible to initialize things like nav-chan, 
> init-history, and deftao routes in the iWillMount implementation of the Om 
> root component?

You only need to (and should) call init-history once, which starts watching 
browser history for changes and then dispatches secretary routes. 

Under the hood, deftao does two things. 
1. Creates a secretary route (that is dispatched on matching history changes). 
When the route is matched it's params are passed through the :->state 
transformations, merged into together into a single hashmap at :path, and then 
put! [:route state] into the channel passed into deftao.

2. Adds an entry to an atom of state-matchers. When update-history is called, 
the state-matchers are mapped over, params are extracted from state at :path, 
and passed through :->route transformations. Tao then chooses the LAST route 
for while all params are non-nil (filter identity). 

I'm planning on adding optional dispatch functions that define when a route is 
valid, which would allow you to have multiple routes where all params might be 
non-nil and define criteria for when they should be considered valid.

The way things work right now, you could absolutely put the output of the 
nav-chan into local state, and you could similarly call update-history with 
local state in IDidUpdate (or somewhere else).

The problem with defining routes inside IWillMount is that you would no longer 
have control over the order in which routes are defined. I'm somewhat 
uncomfortable with the convention of picking the last matching route, but since 
secretary (and all other routing libraries i've used) do the same to match 
history to route, I'm ok with it for now.

It might be possible to figure out a way to handle the matching order of 
asynchronously defined routes for state->route, but secretary doesn't support 
anything like that so it'd break the route->state portion.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] ANN: DataScript, in-memory database and datalog queries in ClojureScript

2014-04-26 Thread Dylan Butman
On Saturday, April 26, 2014 2:07:57 AM UTC-4, David Nolen wrote:
> This is not completely accurate. Cursors  abstract away the particular state 
> strategy. Even with DataScript you will want some indirection for reusable 
> components. I suspect widgets will take entities or composites and in order 
> for rendering to be efficient you will want entity caching.
> 
> 
> On Saturday, April 26, 2014, Nikita Prokopov  wrote:
> 
> суббота, 26 апреля 2014 г., 1:31:52 UTC+7 пользователь Daniel Neal написал:
> 
> > Is this something that could potentially work *with* Om or is it going down 
> > a different road?
> 
> >
> 
> > I'm really enjoying Om for client side work but totally love the idea of 
> > being able to do database-like queries over the application state as you 
> > describe.
> 
> 
> 
> I thinks DataScript is something that can be used instead of Om cursors. Of 
> course you can mix, it’s just a library. But for proper integration cursors 
> will be just a dead weight, so it would be easier to integrate with pure 
> React or some thin wrapper around React like Quiescent.
> 
> 
> 
> 
> But that’s just my opinion, David already started to toy with Om integration 
> :)
> 
> 
> 
> --
> 
> Note that posts from new members are moderated - please be patient with your 
> first post.
> 
> ---
> 
> You received this message because you are subscribed to the Google Groups 
> "ClojureScript" group.
> 
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojurescript+unsubscr...@googlegroups.com.
> 
> 
> To post to this group, send email to clojurescript@googlegroups.com.
> 
> Visit this group at http://groups.google.com/group/clojurescript.

Very interested to see how this pans out. Being able to write real queries for 
views is a big leap forward. In a current project I'm dynamically filtering on 
3 criteria and then sorting 5000+ items, and while clojurescript offers a 
pretty rich toolset, a datalog query would be a pretty significant 
simplification of that process.

As far as Om integration, I could see separating concerns a little being a 
possible solution. If you keep the parameters for your queries in app state, 
and pass the database as a shared cursor, any change in app state that would 
change the query a component uses to retrieve it's view of the database would 
cause a rerender. 

The issue would become keeping the app in sync with database changes. You could 
just trigger a root rerender on any db change, but the whole point of Om is 
that you don't want to rerender the entire app on change, just the components 
with affected cursors. 

A little wrapper might do the trick. What if you mediate all component queries 
to the database, and cache a list of returned entities. Anytime any of those 
entities change, the component should be rendered (you could even implement 
more advanced update to the query result instead of triggering a new query). 
Anytime a new entity is added to the database, check if it would be included in 
the result of any component query, and mark those components as dirty.

Thoughts?

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] ANN: DataScript, in-memory database and datalog queries in ClojureScript

2014-04-28 Thread Dylan Butman
On Monday, April 28, 2014 9:11:46 AM UTC-4, Mike Haney wrote:
> Dylan,
> 
> Your app sounds very similar to what I am working on right now and was 
> thinking of using Datascript for.  I have ~10k items (construction materials) 
> I need to present in a list with dynamic filtering (category, size/gauge, 
> etc.).  Running datalog queries on the client instead of the server would be 
> a big win.
> 
> I'm worried now about performance, since Nikita says he had much smaller data 
> sets in mind.  Have you progressed enough yet to determine if performance is 
> a problem with these large data sets?

Nikita, we're rewriting https://www.cosponsor.gov/ in a full clojure stack. 
Hoping to be able to open source the whole project once it's done. We've been 
able to get the folks in charge (in congress) excited about immutability and 
clojure as a new paradigm and they seem on board so far.

I'm dynamically sorting a filtering 5000+ bills. Currently supporting search on 
keyup (Om is crazy fast!), category and status filtering, as well as dynamic 
sorting. 

Mike, I'm hoping to play with integration today or tomorrow, so I'll get back 
to you. I can't imagine performance will be worse than using my current (-> 
filter-by-topic filter-by-search filter-by-status sort) pipeline. If anything 
I'd expect it to be much better, and considerably more fluent. 

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] Om: Active channels on a removed component

2014-05-01 Thread Dylan Butman
IWillReceiveProps is trigged when component props change (cursor passed into 
om/build). Not called on initial render 
http://facebook.github.io/react/docs/component-specs.html

This differs from IWillUpdate in that IWillUpdate is trigged when local 
component state changes as well. In React, the convention is to use 
willReceiveProps to update local state in response to prop changes. If you were 
to change state in willUpdate you could cause an infinite loop (React internals 
prevent this, but it's a bad idea!). 

On Thursday, May 1, 2014 5:24:14 AM UTC-4, Daniel Kersten wrote:
> I've added IWillUnmount and IDisplayName to the documentation. I don't 
> understand what IWillReceiveProps is for exactly, so didn't add that.
> 
> 
> 
> 
> On 30 April 2014 18:44, David Nolen  wrote:
> 
> 
> 
> 
> Feel free to document!
> 
> 
> 
> 
> 
> On Wed, Apr 30, 2014 at 1:38 PM, Daniel Kersten  wrote:
> 
> 
> 
> 
> 
> 
> 
> Since version 0.5.1 (I think), there is also an IWillUnmount with function 
> (will-unmound [this]). It doesn't seem to be documented yet.
> 
> 
> 
> 
> 
> 
> https://github.com/swannodette/om/blob/master/src/om/core.cljs#L31
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> On 30 April 2014 18:17, Sean Corfield  wrote:
> 
> 
> 
> 
> 
> 
> 
> On Apr 28, 2014, at 8:10 AM, David Nolen  wrote:
> 
> 
> 
> 
> 
> 
> 
> > I would create all go loops so that they listen on a kill channel. Write to 
> > the kill channel when the component unmounts.
> 
> 
> 
> I see will-mount and did-mount but nothing for hooking into a component 
> unmount. What am I missing?
> 
> 
> 
> Sean Corfield -- (904) 302-SEAN
> 
> An Architect's View -- http://corfield.org/
> 
> 
> 
> "Perfection is the enemy of the good."
> 
> -- Gustave Flaubert, French realist novelist (1821-1880)
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> 
> Note that posts from new members are moderated - please be patient with your 
> first post.
> 
> --- 
> 
> You received this message because you are subscribed to the Google Groups 
> "ClojureScript" group.
> 
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojurescrip...@googlegroups.com.
> 
> To post to this group, send email to clojur...@googlegroups.com.
> 
> Visit this group at http://groups.google.com/group/clojurescript.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> 
> Note that posts from new members are moderated - please be patient with your 
> first post.
> 
> --- 
> 
> You received this message because you are subscribed to the Google Groups 
> "ClojureScript" group.
> 
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojurescrip...@googlegroups.com.
> 
> To post to this group, send email to clojur...@googlegroups.com.
> 
> Visit this group at http://groups.google.com/group/clojurescript.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] Om: Active channels on a removed component

2014-05-01 Thread Dylan Butman
IWillReceiveProps is trigged when component props change (cursor passed into 
om/build). Not called on initial render 
http://facebook.github.io/react/docs/component-specs.html 

This differs from IWillUpdate in that IWillUpdate is trigged when local 
component state changes as well. In React, the convention is to use 
willReceiveProps to update local state in response to prop changes. If you were 
to change state in willUpdate you could cause an infinite loop (React internals 
prevent this, but it's a bad idea!). 

I added IWillReceive props to the docs with a little more explanation on the 
differences...

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] [ANN] Ominate - animate your Om components

2014-05-06 Thread Dylan Butman
I've thought about React and Om animation a lot and have been meaning to strip 
the animation code out of some of my projects and get it organized. I wrote 
https://github.com/pleasetrythisathome/react.animate for react a little while 
ago, and haven't quite got around to porting all the functionality to cljs. 

Your easing functions are definitely helpful. 

To me it seems like an anti pattern and a generally dangerous thing to do to 
mutate the DOM directly. The whole point of using something like React or Om is 
that the DOM is the result of a pure render function that takes props 
(app-state) and component state as inputs. If you mutate the DOM yourself, this 
is no longer true.

For my uses, I'd greatly prefer a more minimal library that will transition two 
values with an easing function over a set duration. Automatic interpolation of 
standard data types would also be great (like the d3 interpolators I use in 
react.animate)

I'll spend some time tonight and the next few days on getting something going 
and then we can compare notes!

The big question for me has always been how to deal with the add/remove item 
from a list enter/exit animation that Jack is talking about. 

Ideally animation could shouldn't pollute your application, and should be an 
arbitrary addition. 

It's straightforward to init-state at some state (say :width 0) and then start 
a transition to :width 100 in IWillMount, which would happen for any entering 
component. IWillUnmount is called when a component exits, but since the 
component is actually unmounted right after it'd be useful to call a transition 
here. 

ReactTransitionGroup http://facebook.github.io/react/docs/animation.html tries 
to solve this by providing methods like componentWillLeave(callback) where you 
are intended to call the callback when you're done with whatever animation to 
actually trigger DOM removal. 

You could definitely do something similar with Om, but I think there are 
probably more elegant ways...I need to spend some time experimenting and see 
what happens...

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] [ANN] Ominate - animate your Om components

2014-05-07 Thread Dylan Butman
The generators you're describing are exactly what I was envisioning and have 
been working with in the past. 

So I managed to get some code together. 
https://github.com/pleasetrythisathome/bardo Heavily based off the d3 code I 
used in react.animate. It's definitely still a work in progress but it works! 

transition [state target duration ease]

returns a channel that outputs values interpolated using IInterpolate protocol 
in ease.cljs

Integration with om would be easy, just merge the output a transition into 
app-state or local component state.

Path generators, color transitions, etc are all great ideas. You could just 
define a type for path, and implement IInterpolate (or implement IInterpolate 
on string as a multimethod to dispatch to color, path, etc interpolators.)

I like the idea of adding pause, resume etc. It'd be pretty straightforward to 
add a control channel that could dispatch on different action keywords to pause 
or resume. 

You get on end event for free when the channel is closed (take returns nil). 

As far as lists go, I'm thinking that there need to be definable (with default) 
enter and exit interpolators for list items. Basically it's implementing 
IInterpolate on nil and also for each type that doesn't implement ISeq, 
implementing a case where the second arg is nil. If this could be overridden at 
runtime, you could define list transitions with different nil behaviors. For 
example, sometimes you could immediately add the new item with value 0, and 
then transition normally, or maybe you want to add it half way through. Etc. 

Currently the implementation of IInterpolate don't check that the second args 
is of the same type, which it definitely should. There are probably only three 
meaningful cases. If the target is the same type, interpolate, if nil, try to 
dispatch an exit interpolator (maybe another protocol?), and if not the same 
type, fail in a meaningful way.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] [ANN] Ominate - animate your Om components

2014-05-07 Thread Dylan Butman
Just a few additional comments.

The reason I'm so strongly for this approach vs DOM mutation is that there are 
huge benefits to the transparency of interpolation generators. At any step of 
the process, there is the opportunity to introduce arbitrary control flow based 
on the output of the generator. 

For example, say you want to transition width from 0 to 100. Easy enough in 
jquery syntax, just get your element.animate({width: 100}, 500, callback); Now 
what if you want to transition the height to 100 starting halfway through the 
animation. Okay, well delay and then start it and run twice as fast. Now what 
if I want to start the height animation when width > 60. What about more 
complicated criteria? 

If you're animation by transitioning state using values coming out of a 
generator, you can introduce arbitrarily complex control flow around 
animations. For example, you could check at every step of the animation if some 
condition is satisfied or else cancel the animation. Or following the above 
example, you could transition a value, and then trigger another transition when 
it crosses a certain threshold. etc. etc. 

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


[ClojureScript] Source mapped stack traces

2014-06-25 Thread Dylan Butman
I'm working on a fun interactive documentation system for an Om app. The idea 
is that functions and components submit messages similar to doc strings to a 
documentation channel that prints the manages printing the messages to the 
console along with additional information. I'd love to include the line numbers 
that the messages are submitted from.

In the past I've gotten printable stack traces in javascript by creating errors 
and printing them (instead of throwing).

In cljs, if you 

(defn stack-trace []
(throw)

with :optimization :none :source-maps true

in the js console you see (in chrome)

Uncaught null
  my-function my-file.cljs:##
  (anonymous function)

if you

(.log js/console (.-stack (js/Error.)))

you see

Error
at my-function (http://localhost:3000/js/out/ccs3/utils/helpers.js:140:66)
at http://localhost:3000/js/out/ccs3/utils/helpers.js:142:65 helpers.cljs:28

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


[ClojureScript] Source Mapped Stack Traces

2014-06-25 Thread Dylan Butman
I'm working on a fun interactive documentation system for an Om app. The idea 
is that functions and components submit messages similar to doc strings to a 
documentation channel that prints the manages printing the messages to the 
console along with additional information. I'd love to include the line numbers 
that the messages are submitted from.
In the past I've gotten printable stack traces in javascript by creating errors 
and printing them (instead of throwing).

In cljs, if you

(defn stack-trace []
  (throw))
(stack-trace)

with :optimization :none :source-maps true

in the js console you see (in chrome)

Uncaught null
  stack-tracemy-file.cljs:line#
  (anonymous function)

if you
(defn stack-trace []
  (.-stack (js/Error.)))
(.log js/console (stack-trace)

you see

Error
at stack-trace (http://localhost:3000/js/out/my-file.js:line#:col#)
at http://localhost:3000/js/out/my-file.js:line#:col#   
 my-file.cljs:line#

this is great in the console. But is it possible to get the line# of the 
function call directly?

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] Source Mapped Stack Traces

2014-06-26 Thread Dylan Butman
Thanks David that's exactly what I was looking for

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


[ClojureScript] Re: Om - component local state as cursor?

2014-07-22 Thread Dylan Butman
I've done this quite a bit before with a parent form component and many child 
input components.

here's a striped down version of form and input components. there's lots of 
other fun stuff you can do with validation and whatnot, but this is the meat. 
The cool part is having an input component that can take either a cursor, or 
local state, and by passing an on-change function you can either have it update 
it's cursor by default, or parent local state (or just about anything else you 
might want).

https://gist.github.com/pleasetrythisathome/3e14892686846ef33ef6

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


[ClojureScript] [ANN] Om Server Rendering Example

2014-08-02 Thread Dylan Butman
I was really excited to see [Dom Kiva-Meyer](https://github.com/DomKM)'s 
article on [Isomorphic 
Clojure[script]](http://domkm.com/posts/2014-06-15-isomorphic-clojure-1/) and 
the accompanying example project [Omelette](https://github.com/DomKM/omelette). 
His server rendering implementation is very elegant, and his thinking about 
routing as bidirectional pure functions between state and uri closely mirror my 
thinking with [Tao](https://github.com/pleasetrythisathome/tao). 

However, I wanted a minimal test case for server rendering as a way to wrap my 
head around exactly what's happening for future use, so here it is!

[Om Server Rendering Example 
Project](https://github.com/pleasetrythisathome/om-server-rendering)

The one limitation I found is that the 
[weasel](https://github.com/tomjakubowski/weasel/) repl of which I've grown so 
fond is incompatible with Nashorn. clojure.browser.events extends js/Element 
which is undefined in Nashorn. I've found some suggestion that this is also 
true in ie8 and below, but haven't tested. I logged the issue 
[here](https://github.com/tomjakubowski/weasel/issues/20). If anyone else is 
inspired to port weasel to 
[goog.clojure](http://docs.closure-library.googlecode.com/git/class_goog_net_WebSocket.html),
 let me know and maybe we can collaborate, I don't think it's a huge lift, but 
I'm not terribly familiar with repl implementations...

The project also currently using :optimizations :whitespace to merge all output 
code into a single file to simplify Nashorn evaluation. Dom does the same thing 
in Omelette, but I'm sure you could add additional eval statements in order to 
use :whitespace :none for faster development, which is especially needed 
without a repl (I know Austin works, but I've had so many frustrating days with 
it, I've given up). Additional, although wrap-reload reloads the server on file 
save, the compiled js file is read on compile when the routes are defined, 
which means that you have to redefine the routes to pick up changes for server 
rendering. Definitely not an ideal development environment...fixes and/or ideas 
to streamline the process are welcome.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] [ANN] Om Server Rendering Example

2014-08-06 Thread Dylan Butman
Hey Dom,

Saw the release ANN for Silk early today. It's on my shortlist of things to 
take a deep look at. Hopefully tomorrow. The routing code in omelette looked 
pretty reasonable, and I'm interested to see how you've abstracted it. Will get 
back to you with comments as soon as I've had some time to digest.

I got pretty close to getting :optimizations :none working with Nashorn, but 
ran into a few too many errors along the way and then had to move on to other 
things. the relevant parts of 
https://github.com/mike-thompson-day8/cljsbuild-none-test-seed/blob/master/test/bin/runner-none.js
 is exactly what's needed, but modified for Nashorn syntax. I'll work on it! 
Would also be nice to pick up build paths from project settings. maybe 
incorporating something like https://github.com/taoeffect/slothcfg

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


[ClojureScript] Evaluating js compiled with :optimization :none in Nashorn

2014-08-06 Thread Dylan Butman
I'm working on getting server rendering running with Nashorn. I've been 
successful with :optimization :simple, following 
https://github.com/DomKM/omelette (i stripped out the minimal server rendering 
example here https://github.com/pleasetrythisathome/om-server-rendering.

I'm trying to evaluate the require dependencies/files in Nashorn so that I can 
then call an arbitrary function within a namespace (in this case, 
render-to-string).

Mike Thompson's example of :optimization :none testing was helpful 
(specifically his PhantomJs runner file 
https://github.com/mike-thompson-day8/cljsbuild-none-test-seed/blob/master/test/bin/runner-none.js),
 but  since he's using PhantomJs rather than Nashorn I'm a little stuck on my 
issue.

(let [js (doto (.getEngineByName (ScriptEngineManager.) "nashorn")
 (.eval (-> "public/out/goog/base.js"
io/resource
io/reader))
 (.eval (-> "public/out/goog/deps.js"
io/resource
io/reader))
 ;; React requires either "window" or "global" to be defined.
 (.eval "var global = this;")
 ;; parse the compiled js file
 (.eval (-> "public/main.js"
io/resource
io/reader))
 (.eval "for(var namespace in goog.dependencies_.nameToPath) 
goog.require(namespace);")
 )
core (.eval js "main.core")])

errors saying that "main" is not defined.

replacing the goog.require line with a simpler "goog.require("\main.core\")" 
produces the same error

any thoughts?

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


[ClojureScript] Re: [ANN] unitesting using :optimizations :none

2014-08-06 Thread Dylan Butman
Hey Mike,

This is indeed awesome! Not to derail this...but any thoughts on 
https://groups.google.com/forum/#!topic/clojurescript/sIJGt2x6ce0?

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


[ClojureScript] Re: [ANN] Silk, an isomorphic routing library for Clojure and ClojureScript

2014-08-07 Thread Dylan Butman
I agree with Joel that I've found that secretary works very well with Om, 
especially with a few abstractions built over it to built the corresponding 
state. The opposite direction is tricky though, and the biggest problem I've 
run into is that matching order is based on runtime route declaration order, 
and as Dom points out, if you try to do this across namespaces, you're in for 
trouble. In practive, I've never wanted or needed to define routes in any way 
but top to bottom in a single file. 

That said, I think the Silk approach is very elegant. First, isomorphism is 
great, good one. Second, being able to easily define subsets of routes and 
match/unmatch on arbitrary combinations of them is very powerful and highly 
composable. You could use the same (Google History) hash change token → 
dispatch! → data → transition! (Om), where dispatch! is a match on a group of 
routes. 

The state -> route direction is much cleaner with silk. It simplifies the 
problem a lot to be able to filter your routes to only include those dealing 
with your current app state, then selecting from your app state and matching on 
the filtered routes. I was trying to do something similar with Tao (although it 
was an alpha level mess), but ended up being hampered by the somewhat hidden 
nature of secretary matching/unmatching. 

I agree it's a shame to keep reinventing the wheel, but while I like secretary, 
I've never felt that it's approach was the be all end all. I appreciate some of 
the sentiment of "if it ain't broke, don't fix it," but more good ideas in the 
mix only push us all to write better code. 

Dom, some questions and thoughts for improvement. 

If you define routes with :path and :query, will the route match/unmatch with 
undefined query keys? If so, how are they handled? If not, I'd suggest making 
query matching optional, where nils are substituted. 

It's a little unclear how your matching functions relate to route. It looks 
like Silk always breaks at / in path and matches, is that correct?

There are some really good things in secretary. What do you think about them? 

Splat, regex, format matchers. 

protocol based render function for multiple arity "unmatching." this is really 
great.

and more I'm sure I'm missing

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


[ClojureScript] [ANN] lein-templater - automagically generate templates from your existing projects

2014-08-19 Thread Dylan Butman
I've been writing a lot of templates lately for various web stacks and whatnot, 
and I got really tired of having to copy my files into a template every time 
they changes. I figured it wouldn't be too hard to generate them 
programmatically, and after a few more days than expected, here you have it.

Introducing lein-templater - 
https://github.com/pleasetrythisathome/lein-templater

It generates templates for you! It has options! 

Feedback appreciated. I'm sure there are some kinks to iron out.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


[ClojureScript] Re: I thinking using Om + Kioo or Enfocus, and I'm wondering: are these good for SEO?

2014-08-20 Thread Dylan Butman
I have an example repo of om server rendering here 

 https://github.com/pleasetrythisathome/om-server-rendering

it's pretty easy once you get the hang of it.


On Wednesday, August 20, 2014 7:14:50 AM UTC-4, Leon Talbot wrote:
> Le mercredi 20 août 2014 05:39:11 UTC-4, Zubair Quraishi a écrit :
> 
> > On Wednesday, August 20, 2014 2:02:09 AM UTC+1, Leon Talbot wrote:
> 
> > 
> 
> > > Le mardi 19 août 2014 08:52:58 UTC-4, Zubair Quraishi a écrit :
> 
> > 
> 
> > > 
> 
> > 
> 
> > > > No, if you use Om you will either have to render from the server, 
> > > > otherwise it willbe terrible for SEO, as AJAX updates are not very 
> > > > useful for SEO since google does not index them in the same way as 
> > > > static sites.
> 
> > 
> 
> > > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > Thanks for your answer. Would you have the same answer for Enfocus?
> 
> > 
> 
> > 
> 
> > 
> 
> > Yes, you will have the same problem with Enfocus. This is because Enfocus 
> > updates the DOM after the initial HTML page load, and google indexes the 
> > DOM content on the initial page load, not on the AJAX updates that happen 
> > afterwards (they are trying to figure out a way to do this but it doesn't 
> > work yet, as they have been trying for several years)
> 
> 
> 
> Ok, thank you!

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] DevArt Co(de)Factory open source release

2014-08-21 Thread Dylan Butman
This is really awesome Karsten!

I first got obsessed with programming writing particle systems in processing 
with toxiclibs. Thanks for all your work! Will definitely be digging deep into 
this one. 

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


[ClojureScript] Clojure(script) Job Opportunity in NYC

2014-08-27 Thread Dylan Butman
We're looking for a full-time clojure(script) dev to join our team in NYC. 
Here's the posting. Shoot be an email at dy...@ib5k.com if you're interested. 

Posting:

We are IB5k ( http://ib5k.com ), a software dev shop based in SOHO, and we are 
looking for a promising developer to become a core part of our team.  We are 
looking for either a senior developer or a junior developer who feels that they 
can become a senior developer with the proper training. We specialize in data 
visualization and analytics, interactive development, and progressive UI 
design. In addition to high end commercial work, we incubate start-ups, provide 
direct equity to our employees within them, and provide a supportive, 
collaborative environment to help our developers excel and our start-ups 
succeed. We are looking for a seasoned developer or a younger developer who 
"just gets it" and possesses the as many of the following as possible: 

Has some (or a lot of!) experience with functional programming and/or 
Clojure(script)
An thorough understanding full-stack web development: from DB to API, and from 
PSD to HTML
Has a strong attention to detail. Messy code is unfinished code, margins must 
be exact to comps, animation timing and easing matters, etc. 
Has a strong desire to think critically about language, development, and 
project level issues, and to develop creative solutions to solve them
The ability to make reasonable time estimations and to make strong pragmatic 
decisions based on time-constraints (you know when it's time to refactor and 
clean up ugly code, and you know when you're biting off more than you can chew)
Is highly motivated to succeed.
Is a team player. Someone who knows how to listen AND is not afraid of 
contributing to the conversation

More about us: 

We love the Clojure programming language and functional programming in general. 
Our ideal candidate will do some research on the subject and develop a 
legitimate interest to learn more. Our work environment is laid back. You don't 
need to dress up, you don't have time sheets to fill out, you can work from 
home when you're getting your work done or don't have a meeting. We’re 
committed to open source and our developers have the opportunity to release 
software under both their personal means and under the company umbrella.

To apply:

Send us a link to your Github account if you have one and address at least two 
of the below:
Tell us something about yourself (what borough you live in, favorite band, 
anything) 
Tell us the web development stack you are most comfortable with and defend your 
choice
Tell us the personal project you’d work on right now if someone paid your 
salary for a year to do it
Tell us something you find interesting about Clojure and why.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] Consequences of not closing channels in browser?

2014-09-01 Thread Dylan Butman
I use a mixin for this purpose all the time!

(defmixin go-loop-aware
  (init-aware [owner]
  {:chans {:mounted (async/chan)}})
  (will-unmount [owner]
(async/close! (om/get-state owner [:chans :mounted])))
  (go-loop-aware [owner read-chan callback]
(when (exists? js/window)
  (let [mounted (om/get-state owner [:chans :mounted])]
(go-loop []
  (when-some [v (first (async/alts! [read-chan mounted]))]
 (callback v)
 (recur)))

I like the kill channel solution better personally since like Daniel point out, 
it doesn't require the read-chan to be owned or controlled by the component. 

When [:chans :mounted] is closed, the go-loop exits. I always use when-some 
over when-let here since when-let would close the go block if false was ever 
submitted to your read channel, whereas when-some only evaluates (not= nil)

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


[ClojureScript] Re: iOS app in ClojureScript

2014-09-16 Thread Dylan Butman
Hey Mike,

I haven't written anything like this yet, but I've started playing around with 
phonegap intending to use clojurescript as well. Do you have any experience 
with phonegap or cordova (the library phonegap is built on)? Is there any 
particular reason you used straight Objective-C?

On Monday, September 15, 2014 6:50:15 PM UTC-4, Mike Fikes wrote:
> I have an iOS app in the App Store where the view controllers and other code 
> are written in ClojureScript instead of Objective-C. Otherwise, it is a 
> native app, based on storyboards. The JavaScript is running in 
> JavaScriptCore, manipulating UI elements via the Objective-C / JavaScript 
> bridge. The Objective-C is minimal, with the bulk of the implementation in 
> ClojureScript.
> 
> 
> 
> It is a paid app—so I'm definitely not interested in promoting the app in any 
> way via this forum. Instead, I'm interested in:
> 
> 
> 
> 1) Asking whether anyone else has gone down the same road.
> 
> 
> 
> 2) Offering help to anyone who might be considering, or involved in the same.
> 
> 
> 
> Basically, just looking to share ideas with respect to this particular use of 
> ClojureScript.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] Om: Question about how best to structure app state and use cursors

2014-09-24 Thread Dylan Butman
Ian, I've been wanting to do something similar with a database store. It seems 
like the best way to support arbitrary data structures and prevent being forced 
to model your data as a tree. I've played around with 
https://github.com/tonsky/datascript and have been thinking about writing a 
similar wrapper that does what you're calling per-query dependency tracking 
(great name by the way). 

This is what I'm thinking, let me know if this is what you're doing! Couldn't 
find the derive code on github, is the repo public?

Instead of passing cursors containing data to components, pass a cursor 
containing a query. init-state runs query against database. any changes to the 
query will trigger did-update and rerun the query. init-state will also 
register the query with a central database controller and subscribe to events 
that will trigger component refresh on stale state. What i'm assuming you mean 
by per-query dependency tracking, is that you can run a query against a 
database transaction to determine if its effect on the entire dataset would 
cause the query output to change. if so, you submit an event back to the 
component to trigger a refresh.

I personally prefer channels for process communications, it sounds like you 
prefer functions now? Can you elaborate on why you've moved away from channels? 
I use a similar setup of event submission to central controller(s) that process 
events either into further events handled elsewhere, api calls, etc. ending in 
app-state (or database) transactions. I create channels around om/root and pass 
both the channels to which events can be submkit, and mults/pubs created from 
them that can then be listened to by controllers.

On Tuesday, September 23, 2014 7:36:35 PM UTC-4, Ian Eslick wrote:
> Actually, it turns out if you call a child with a merged {:shared ...} 
> argument to pass shared values down the subtree.  
> 
> (om/build child app {:shared {:actions (merge-actions owner {...})}})
> 
> You can tighten this up with macros, etc.  Hopefully David won't make this 
> impossible in future versions because I find it INSANELY useful both for 
> testing and for selective overrides of default state.   
> 
> For example, I've had issues with the somewhat non-deterministic behavior and 
> operational latency of core.async particularly in the mobile app / browser 
> context at scale (especially on the abandoned Pedestal App 0.3 which we have 
> in limited production).  
> 
> In our current project, we've dropped core.async and instead manage all side 
> effects via direct transacts on cursors and calls to "actions" which are 
> passed in shared state from the root of the tree via shared.  We use 
> controller components to coordinate the behavior of sets of related 
> components (like all the authentication screens of a mobile app) which 
> capture all the child actions and then call the service layer actions passed 
> into the root.  Most of our interactions fall into these camps:
> 
> Event -> om/set-state!
> Event -> om/transact!
> Event -> Action -> Service Call -> (swap! data ...)
> Event -> Action -> Service Call -> Callback -> om/transact!
> Event -> Action -> Parent Handler -> Action -> Service Call ...
> 
> Actions are synchronous and explicitly named, so short and easy to reason 
> about.  We added callbacks to handle things like 'loading' notifications, 
> error handling, etc.  Again, lightweight.  For heavy interactions, the 
> service calls just side effects the top level atom, or
> 
> We manage most of our state in a client-side database (NativeStore) that does 
> per-query dependency tracking so we can automatically call refresh! on 
> components that have stale state (open source project at github 
> vitalreactor/derive).  We'll post about this when we get our app done and 
> roll out v0.2 of the derive library and nativestore.
> 
> 
> 
> On Tuesday, September 23, 2014 4:38:33 AM UTC-7, Michiel Borkent wrote:
> > What I would like to see is something like :shared but only shared within a 
> > subtree, so for example:
> > 
> > (defn child [app owner]
> >   (om/component
> > (dom/p nil (str "Yo, I've got"
> >(om/get-shared owner :some)
> >:state
> > 
> > (defn parent [app owner]
> >   om/IShared
> >   (shared [_]
> >  {:some :state})
> >   om/IRender
> >   (render [_]
> > (om/build child app))
> >  
> > This way you can share state with child components and you don't have to 
> > deal with channels/callbacks as much in certain situations. What do you 
> > think?

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http:/

[ClojureScript] Re: [ANN] Silk, an isomorphic routing library for Clojure and ClojureScript

2014-10-07 Thread Dylan Butman
Sorry i don't have time to really explain any of this...

but here's some code I pulled out of a recent project. maybe it'll be helpful 
to you. unfortunately I can't share the whole project.

https://gist.github.com/pleasetrythisathome/7adbdc9c8b7ab689df45

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


[ClojureScript] Re: [ANN] Silk, an isomorphic routing library for Clojure and ClojureScript

2014-10-10 Thread Dylan Butman
 

I’ve been using silk in conduction with compojure. Most middleware aren’t 
compojure specific, but I’ve just found it easier to stick with base level 
compojure routes and then pass uris to silk for pattern matching. This is 
mostly because there is such a wealth of documentation and examples to draw 
from with compojure. For example, session management, login flows with 
friends, etc have already been solved and there is plenty of code to strip. 
Silk wouldn’t complicated them (in some cases it might simplify), but when 
the wheel rolls, push it.


I’ve been approaching silk solely as a library for pattern matching within 
the specific domain of urls, which it does very cleanly. More importantly, 
it’s currently the only one that does it in both clojure and clojurescript, 
which makes it possible to have the same routing code used on client and 
server, which is necessary if you want to do server rendering, or more 
complicated websocket updates. 

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


[ClojureScript] Re: [ANN] quile/component 0.2.2 - ClojureScript port of stuartsierra.com/component

2014-10-30 Thread Dylan Butman
I was gearing up to have to do this myself in the next coming months! Awesome 
stuff, really much needed addition to cljs. 

I'll dig in next week. point me towards your failing tests and maybe I can try 
to lend a hand.

On Wednesday, October 29, 2014 9:05:56 PM UTC-4, Kyle Dawkins wrote:
> Hey all
> 
> A few weeks ago I spent some time porting 
> https://github.com/stuartsierra/component to ClojureScript.  The results are 
> here:
> 
> github: https://github.com/quile/component-cljs
> Clojars: [quile/component "0.2.2"]
> 
> My motivation is pretty straightforward: I am keen to make node.js a really 
> pleasant experience for cljs development.  I've done a large amount of 
> vanilla node.js dev, and the dependency-injection problem always reared its 
> ugly head at inopportune moments, so making 
> https://github.com/stuartsierra/component work in cljs seemed like a good 
> idea.  And it was!  It works like a charm.
> 
> This port is fairly soft: there are still some failing tests (commented out) 
> due to the differences in exception-handling between clj and cljs.  Also, I 
> had to port the underlying "dependency" library too:
> 
> github: https://github.com/quile/dependency-cljs
> 
> The upshot of all of this is that it's now very easy to create nicely modular 
> node.js apps in ClojureScript, with their dependencies injected correctly.  
> Fun.
> 
> Cheers!
> Kyle

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] Re: [ANN] quile/component 0.2.2 - ClojureScript port of stuartsierra.com/component

2014-10-30 Thread Dylan Butman
Interesting I’ll take a look. That makes sense about a valid but alternative 
topological sort. Perhaps changing the test to test for validity rather than 
expected would be a good solution. 

On Oct 30, 2014, at 12:41 PM, Kyle Dawkins  wrote:

> Hey!
> 
> Glad to help out - really we owe Stuart for making it all possible.  I'm just 
> stoked to have this facility in node.js now - makes node dev a whole lot more 
> fun.
> 
> There are a couple of test failures in the dependency project
> 
> https://github.com/quile/dependency-cljs
> 
> but on deeper inspection I noticed a couple of things:
> 
> 1) Tests fail in the same manner (but with slightly different results) in 
> clojure 1.6
> 2) The tests are regarding topological sorting, and there are actually many 
> valid topological sorts of the same graph, but the tests only check for a 
> specific one - so IMHO the code is producing a valid sort, but the tests are 
> failing because it's not the expected sort.
> 
> Also, in the component-cljs project, a lot of the exception-related code 
> doesn't port well because Javascript handles exceptions so differently.  This 
> is where the chief problems are on the cljs side, and those tests are marked 
> to only compile in Clojure, not ClojureScript for the time being.  If you put 
> them back in, you'll get the failures.
> 
> Cheers!
> Kyle
> 
> 
> 
> 
> 
> 
> On Thursday, October 30, 2014 8:46:22 AM UTC-7, Dylan Butman wrote:
>> I was gearing up to have to do this myself in the next coming months! 
>> Awesome stuff, really much needed addition to cljs. 
>> 
>> I'll dig in next week. point me towards your failing tests and maybe I can 
>> try to lend a hand.
>> 
>> On Wednesday, October 29, 2014 9:05:56 PM UTC-4, Kyle Dawkins wrote:
>>> Hey all
>>> 
>>> A few weeks ago I spent some time porting 
>>> https://github.com/stuartsierra/component to ClojureScript.  The results 
>>> are here:
>>> 
>>> github: https://github.com/quile/component-cljs
>>> Clojars: [quile/component "0.2.2"]
>>> 
>>> My motivation is pretty straightforward: I am keen to make node.js a really 
>>> pleasant experience for cljs development.  I've done a large amount of 
>>> vanilla node.js dev, and the dependency-injection problem always reared its 
>>> ugly head at inopportune moments, so making 
>>> https://github.com/stuartsierra/component work in cljs seemed like a good 
>>> idea.  And it was!  It works like a charm.
>>> 
>>> This port is fairly soft: there are still some failing tests (commented 
>>> out) due to the differences in exception-handling between clj and cljs.  
>>> Also, I had to port the underlying "dependency" library too:
>>> 
>>> github: https://github.com/quile/dependency-cljs
>>> 
>>> The upshot of all of this is that it's now very easy to create nicely 
>>> modular node.js apps in ClojureScript, with their dependencies injected 
>>> correctly.  Fun.
>>> 
>>> Cheers!
>>> Kyle
> 
> -- 
> Note that posts from new members are moderated - please be patient with your 
> first post.
> --- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "ClojureScript" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/clojurescript/Yt8zWOpF_zU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> clojurescript+unsubscr...@googlegroups.com.
> To post to this group, send email to clojurescript@googlegroups.com.
> Visit this group at http://groups.google.com/group/clojurescript.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


[ClojureScript] Re: Architecture Question / Handling app-state transactions outside of the component hierarchy?

2014-10-31 Thread Dylan Butman
There was some more work done on supporting query change binding in datascript 
https://github.com/tonsky/datascript/pull/12

and there's also a larger project https://github.com/vitalreactor/derive that 
aims to provide similar functionality on top of either their own in memory db 
NativeStore or on top of datascript. There was a larger thread about it 
https://groups.google.com/forum/#!searchin/clojurescript/derive/clojurescript/WCz57-k8leY/cdLHHpBJ6qEJ
 before ref cursors.

Next rainy day I want to sit down and write parallel implementations of 
something like a chat system using

Om w/ ref cursors
Datascript w/
  Derive
  Unmerged query watching
Reagent w/ multiple atoms

Maybe a port of tonky's chatting cats example? Any thoughts on other 
combinations that might be useful in a side-by-side comparison?

On Thursday, October 30, 2014 2:52:23 PM UTC-4, Mike Haney wrote:
> On Wednesday, October 29, 2014 3:48:35 PM UTC-5, Scott Nelson wrote:
> > When using Om's cursors I had a number of top level entries in the app 
> > state (i.e. things like current route, error messages, current user, etc.). 
> >  Mike, how are you modeling these kind of singleton objects as DataScript 
> > entities?  Or are you using separate atoms for this kind of thing?
> 
> There are a couple of ways to do this.  You can create separate entities in 
> Datascript to store these things.  This is generally the approach I used and 
> I created some helper functions to more easily setup and track these 
> "singleton" entities.  But I was evolving towards the second approach, as my 
> app grew.
> 
> The second approach is to decorate existing entities with additional 
> attributes.  For something like current-user, assuming you already have a 
> list of users in your DB, you could add a :user/selected boolean attribute.  
> For single selection you have a DB fn that resets all users to 'false' except 
> the selected one, but you could change that to multi-selection simply by not 
> resetting the flag on other users.  It's more work on a case by case basis, 
> but if you start thinking in abstractions like this you can create generic DB 
> functions that can be applied across a wide range of entities.  Abstractions 
> like "selectable", "hideable", "toggleable" can be reused in many parts of 
> most UIs.
> 
> I'm speaking in past tense, because I have temporarily had to stop using this 
> approach in my app.  As my app grew I began to notice substantial lag at 
> times running on my target mobile devices.  It was never a problem testing on 
> a desktop browser, but of course mobile browsers have much less horsepower.  
> 
> The problem stemmed from a few things:
> 1) the binding code was very inefficient
> 2) each reagent component simply binds whatever state it needs, so for 
> example if 5 different components need the user list, they each bind their 
> own r/atom.
> 3) the combination of 1 and 2 means several dozen inefficient binding 
> listeners running after every transaction, which became noticeable on mobile.
> 
> I had a couple of choices - remove Reagent and use Quiescient or React 
> directly for rendering, as tonsky did in his demo app, or remove Datascript 
> and continue to use Reagent.  I chose the latter, with the intention to be 
> able to go back to using Datascript once I work through the problems.
> 
> I think the key to fixing this is this feature: 
> https://github.com/tonsky/datascript/issues/32 which fortunately has now been 
> implemented (just noticed that when I popped over to grab the link).  Having 
> transaction metadata should allow me to optimize the binding code 
> significantly.  
> 
> Since I can't risk these experiments in my production app at this point, I'll 
> probably pull out code and create a demo app I can experiment on and share, 
> then when I am confident that I have the binding code optimized I can 
> re-introduce Datascript to my production app.  I'm in the process of setting 
> up my blog and my goal is to have the first post or two on this finished 
> before the Conj, so look for something over the next 2-3 weeks.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


[ClojureScript] Re: Good repl dev workflow for developing a library?

2014-11-30 Thread Dylan Butman
checkouts is definitely the way to do. 

symlink the directory of your library to

application/checkouts/library

you can then cljsbuild auto the library and changes will be automatically 
picked up by the application

I don't have a minimal test case in front of me, so I'm not sure if cljsbuild 
auto in the application will recompile when the library recompiles, but I'm 
fairly sure that it will. You shouldn't need to clean, since the dependency 
itself will have changed causes it to be rebuilt. 

even better, you can use https://github.com/bhauman/lein-figwheel in the 
application project, which is essentially a drop in replacement for cljsbuild 
auto. 

for om apps, I have a idempotent render function that calls om/root. so I use 

(fw/watch-and-reload
  :websocket-url "ws://localhost:3449/figwheel-ws"
  :jsload-callback #(render/render-mounted))

to rerender the app on recompile.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] Server-side rendering of reagent components.

2014-12-01 Thread Dylan Butman
I had a somewhat rough time getting nashorn to work with optimatizations none, 
but it does work!

Here's a snippet from a nashorn server rendering component I've been meaning to 
wrap up and document. I've been using variations inside a variety of projects 
for a while now. It plays very nicely with stuart sierra's component. One 
caveat. The nashorn engine takes a while to warm up and optimize code. this 
means you should call the renderer a few times on server spin up before 
accepting requests...

https://gist.github.com/pleasetrythisathome/30c2cec625c9fcd81163


On Tuesday, November 25, 2014 10:22:59 AM UTC-5, Max Gonzih wrote:
> I'm trying now to do it in noshorn, for now I'm stuck with stubbing 
> things and moving lot of logic inside components creation logic.
> 
> On 11/25/2014 03:45 PM, David Nolen wrote:
> > I've heard people use Node.js to server side render React.
> >
> > On Tue, Nov 25, 2014 at 4:22 AM, Max Gonzih  wrote:
> >> Hi everyone.
> >>
> >> How can I render reagent components on server side?
> >> I saw examples with jjs (nashorn) but problem is that my backend stack is 
> >> mostly Ruby. Of course JRuby is possible, but are there any other ways of 
> >> doing that?
> >> I looked at PhantomJS but got stuck with goog.require calls that are 
> >> trying to use document.createElement('script') to load dependencies.
> >>
> >> Any advice is welcome, thank you!
> >>
> >> --
> >> Note that posts from new members are moderated - please be patient with 
> >> your first post.
> >> ---
> >> You received this message because you are subscribed to the Google Groups 
> >> "ClojureScript" group.
> >> To unsubscribe from this group and stop receiving emails from it, send an 
> >> email to clojurescript+unsubscr...@googlegroups.com.
> >> To post to this group, send email to clojurescript@googlegroups.com.
> >> Visit this group at http://groups.google.com/group/clojurescript.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


[ClojureScript] [ANN] Bardo v0.1.0 - A clojure(script) library to assist with transitions between dimensions

2014-12-13 Thread Dylan Butman
TL:DR 

Bardo https://github.com/pleasetrythisathome/bardo 
 is a clojure(script) library 
that provides semantics for defining interpolators between data structures as 
well as utilities for composing them with each other, easing curves, and other 
transformations. It can be extended through clojure protocols to define other 
interopolateable types. 

This is great for animations, but can be useful in a variety of contexts where 
state is not binary.
 
I come from a design and graphics background and got into programming initially 
writing particle systems and music visualizers. When I started doing web 
development and interactive work, transitions and animation we’re always an 
interest. I was deeply unsatisfied with the current state of black box Jquery 
animation, where one must be content with pressing play, and then watching the 
side effects flow. 

When I first started using React around the time it came out, and I was 
thrilled by the declarative nature. I realized that by instead of animation dom 
properties, if you transition component state, then suddenly you have the 
opportunity to insert arbitrary control flow into running animations. I wrote 
https://github.com/pleasetrythisathome/react.animate 
 based on d3 
interpolators. This library is a big step forward, based on an entirely 
functional approach and greatly aided clojure’s expressiveness. 

I’ve been using some version of this code in production projects for a while. 
That said, this is definitely still alpha software. Thoughts, issues, pull 
request, etc. are very welcome. I hope someone finds it useful!

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


[ClojureScript] Re: [ANN] Bardo v0.1.0 - A clojure(script) library to assist with transitions between dimensions

2014-12-14 Thread Dylan Butman
I was mostly doing repl testing. I had a few tests but when you're trying to 
test composition of a number of transformation functions it becomes pretty 
impossible to write well formed tests. Next on my list is adding some more 
robust tests using https://github.com/cemerick/double-check

On Sunday, December 14, 2014 9:08:45 AM UTC-5, pand...@gmail.com wrote:
> This is really cool. I'd been bringing in D3 just to use scales and other 
> math; I think bardo obviates that, which is great from a payload standpoint.
> 
> Slightly off-topic, sorry, but what's the story with all the tests being 
> commented out, just out of curiosity?

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] Re: [ANN] Bardo v0.1.0 - A clojure(script) library to assist with transitions between dimensions

2014-12-15 Thread Dylan Butman
Let me know how it goes for you and if there are use cases it doesn't cover or 
directions you'd like to see explored. I'm hoping to have some time to write a 
few more composition examples this week



> On Dec 14, 2014, at 2:50 PM, Daniel Kersten  wrote:
> 
> This is great! Thanks for sharing. Looks really flexible. I'm looking forward 
> to replacing my own sightly buggy easing functions with this. :)
> 
>> On Sun, 14 Dec 2014 17:47 null  wrote:
>> Yeah I can imagine it isn't easy to test that stuff well. (So it wasn't 
>> directly cljx/cljs related, which was my interest.)
>> 
>> Thanks for the report.
>> 
>> --
>> Note that posts from new members are moderated - please be patient with your 
>> first post.
>> ---
>> You received this message because you are subscribed to the Google Groups 
>> "ClojureScript" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojurescript+unsubscr...@googlegroups.com.
>> To post to this group, send email to clojurescript@googlegroups.com.
>> Visit this group at http://groups.google.com/group/clojurescript.
> 
> -- 
> Note that posts from new members are moderated - please be patient with your 
> first post.
> --- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "ClojureScript" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/clojurescript/JROUw58NPX0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> clojurescript+unsubscr...@googlegroups.com.
> To post to this group, send email to clojurescript@googlegroups.com.
> Visit this group at http://groups.google.com/group/clojurescript.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] Re: [ANN] Bardo v0.1.0 - A clojure(script) library to assist with transitions between dimensions

2014-12-18 Thread Dylan Butman
Hey Aaron,

Bardo interpolators are meant to be able to handle the transition case that 
you’re talking about, although the semantics for doing so are still relatively 
low level and thus not the easiest thing to understand. 

The om example in the repo does exactly what you’re talking about. 
https://github.com/pleasetrythisathome/bardo/blob/master/examples/om.cljs#L34 


Essentially,mMixes between interpolators that represent overlapping time 
domains can be mixed by shifting the domains of the interpolators. Here’s a 
more step by step explanation.

(def a 0)
(def b 10)
(def intrpl (interpolate a b))
(map intrpl [0 0.5 1])
;; => (0 5.0 10)
;; => (fn [t]) : t [0 -> 1] : a -> b

;; interrupt at dt and interpolate to c
(def dt 0.6)
(def c 50)
(def dintrpl (interpolate (intrpl dt) c))
(map dintrpl [0 0.5 1])
;; => (6.0 28.0 50.0)
;; (fn [t]) : t [0 -> 1] : (intrpl dt) -> c

;; to mix, we need to shift the domain of the input to intrpl
(def sintrpl (ease/shift intrpl 0 (- 1 dt) dt 1))
(map sintrpl [0 (- 1 dt) 1])
;; => (6.0 10.0 16.0)
;; we get a higher output at 1 because we've extended the domain
;; (fn [t]) ; t [0 -> (- 1 dt)] : (intrpl dt) -> b
(-> identity
(ease/shift 0 (- 1 dt) dt 1)
(map [0 (- 1 dt) 1]))
;; => (0.6 1.0 1.6)

(def mixed (mix sintrpl dintrpl))
(map mixed [0 0.25 0.5 0.75 1])
;; => (6.0 10.625 19.5 32.625 50.0)

Does that make sense?

I added this to the readme, but a more thorough blog post exploring more of the 
possibilities here is probably in order. 

I’m still exploring the interaction points myself. I plan on writing some more 
composition helper functions that help simplify these operations.

> On Dec 17, 2014, at 10:30 PM, Aaron Craelius  wrote:
> 
> Looks good... I've updated freactive's README to reference bardo's easing 
> functions.
> 
> I want to make sure people can use bardo's interpolators as well with some 
> overload of freactive's start-easing!. I'm wondering how (or if) to handle 
> the case where an animation in progress is interrupted and then sent in a 
> different direction (which freactive currently has some basic naive support 
> for). I don't know if you might have any thoughts on how best to deal with 
> this case in general and/or how it might or might not be possible to do with 
> bardo's interpolators? For an example of what I'm talking about you can see 
> in freactive's little demo that it's possible to interrupt the animation in 
> progress and it guesses (linearly) about the correct speed.
> 
> -- 
> Note that posts from new members are moderated - please be patient with your 
> first post.
> --- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "ClojureScript" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/clojurescript/JROUw58NPX0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> clojurescript+unsubscr...@googlegroups.com.
> To post to this group, send email to clojurescript@googlegroups.com.
> Visit this group at http://groups.google.com/group/clojurescript.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] Server-side rendering of reagent components.

2015-02-09 Thread Dylan Butman
Yes I was able to get :none running. I remember having issues with :advanced, 
although I do remember it working. I had some idea about writing some tests 
that would try to render your builds whenever a new one was made, so you'd 
catch issues earlier rather than later, but didn't get around to it. Here's 
some old code 
https://github.com/IB5k/agency/blob/master/modules/cljs/src/ib5k/components/cljs_render.clj
 that might not work anymore, but maybe parts will be helpful. This was the 
trick for :none 
https://github.com/IB5k/agency/blob/master/modules/cljs/src/ib5k/components/cljs_render.clj#L67

I found the console polyfill necessary
https://github.com/IB5k/agency/blob/master/modules/cljs/resources/polyfills/console.js

I also found that core.async go blocks will always break nashorn, which you can 
either wrap in conditionals where you check for something that doesn't exist in 
nashorn, or you can put them in component-did-mount, which will never be 
called. 

On Monday, February 9, 2015 at 5:22:55 AM UTC-5, Max Gonzih wrote:
> I was also unable to run advanced compilation mode in V8. I suspect that it's 
> due to issues inside goog module system. Simple mode seems to be broken, only 
> whitespace works.
> 
> On Sunday, February 8, 2015 at 10:35:50 PM UTC+1, pand...@gmail.com wrote:
> > Hi everyone,
> > 
> > I should've tacked my post from earlier today on to this thread, but I only 
> > saw it now. I'm really interested in this topic b/c I have projects that 
> > are best implemented as SPA's but require static HTML be produced for some 
> > endpoints as well.
> > 
> > Anyway, from trying to implement a server-rendered Reagent app recently 
> > (https://gist.github.com/pandeiro/c5d2728bd04aab4f31c3), I can comment on a 
> > few of the issues mentioned here.
> > 
> > First, stubbing is definitely necessary for Nashorn, though it is minimal. 
> > See here: 
> > https://github.com/pandeiro/agua/blob/master/src/agua/core.clj#L35-L36 -- 
> > as far as I can tell, this is all that's needed to deal with the global 
> > environment, environment-sniffing conditionals and routing, which appear to 
> > me to be the major concerns for this type of app.
> > 
> > Re: optimizations, I could not get my example to work with :advanced and I 
> > did not even try with :none, as I don't think Nashorn will work with 
> > manually retrieving Google Closure namespaces. As for :advanced, I did not 
> > try to debug why it wasn't working. So for now, I used :simple. (My example 
> > uses ring-gzip middleware and its total payload is in the 120kb range.)
> > 
> > Dylan and Max -- have you made any more attempts or progress with this in 
> > the last couple months?
> > 
> > Cheers, M

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] Server-side rendering of reagent components.

2015-02-10 Thread Dylan Butman
also the new Nashorn Repl bindings will probably simplify the Nashorn approach 
a ton 
https://github.com/clojure/clojurescript/commit/d0c9451035d3a9adf9a32e16e759d1e4384268dc

On Monday, February 9, 2015 at 1:41:01 PM UTC-5, Dylan Butman wrote:
> Yes I was able to get :none running. I remember having issues with :advanced, 
> although I do remember it working. I had some idea about writing some tests 
> that would try to render your builds whenever a new one was made, so you'd 
> catch issues earlier rather than later, but didn't get around to it. Here's 
> some old code 
> https://github.com/IB5k/agency/blob/master/modules/cljs/src/ib5k/components/cljs_render.clj
>  that might not work anymore, but maybe parts will be helpful. This was the 
> trick for :none 
> https://github.com/IB5k/agency/blob/master/modules/cljs/src/ib5k/components/cljs_render.clj#L67
> 
> I found the console polyfill necessary
> https://github.com/IB5k/agency/blob/master/modules/cljs/resources/polyfills/console.js
> 
> I also found that core.async go blocks will always break nashorn, which you 
> can either wrap in conditionals where you check for something that doesn't 
> exist in nashorn, or you can put them in component-did-mount, which will 
> never be called. 
> 
> On Monday, February 9, 2015 at 5:22:55 AM UTC-5, Max Gonzih wrote:
> > I was also unable to run advanced compilation mode in V8. I suspect that 
> > it's due to issues inside goog module system. Simple mode seems to be 
> > broken, only whitespace works.
> > 
> > On Sunday, February 8, 2015 at 10:35:50 PM UTC+1, pand...@gmail.com wrote:
> > > Hi everyone,
> > > 
> > > I should've tacked my post from earlier today on to this thread, but I 
> > > only saw it now. I'm really interested in this topic b/c I have projects 
> > > that are best implemented as SPA's but require static HTML be produced 
> > > for some endpoints as well.
> > > 
> > > Anyway, from trying to implement a server-rendered Reagent app recently 
> > > (https://gist.github.com/pandeiro/c5d2728bd04aab4f31c3), I can comment on 
> > > a few of the issues mentioned here.
> > > 
> > > First, stubbing is definitely necessary for Nashorn, though it is 
> > > minimal. See here: 
> > > https://github.com/pandeiro/agua/blob/master/src/agua/core.clj#L35-L36 -- 
> > > as far as I can tell, this is all that's needed to deal with the global 
> > > environment, environment-sniffing conditionals and routing, which appear 
> > > to me to be the major concerns for this type of app.
> > > 
> > > Re: optimizations, I could not get my example to work with :advanced and 
> > > I did not even try with :none, as I don't think Nashorn will work with 
> > > manually retrieving Google Closure namespaces. As for :advanced, I did 
> > > not try to debug why it wasn't working. So for now, I used :simple. (My 
> > > example uses ring-gzip middleware and its total payload is in the 120kb 
> > > range.)
> > > 
> > > Dylan and Max -- have you made any more attempts or progress with this in 
> > > the last couple months?
> > > 
> > > Cheers, M

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


[ClojureScript] Re: [ANN] thi.ng collection update (CLJ/CLJS)

2015-02-25 Thread Dylan Butman
Hey Karsten,

Really glad to see you've been continuing the awesome work here! I used 
toxiclibs extensively when I first starting programming in processing and it 
was hugely influential for me! I've been drifting away from computational 
design since then but I'm hoping to get some serious time to play with your 
clojure work soon.

Best
Dylan

On Wednesday, February 25, 2015 at 12:07:01 AM UTC-5, Karsten Schmidt wrote:
> Hi guys,
> 
> thi.ng is a collection of over a dozen largely x-platform Clojure &
> Clojurescript libs for computational/generative design & data
> visualization tasks.
> 
> I just wanted to give a little heads up that this project has recently
> seen a number of releases and, as a whole, by now is generally quite
> stable and usable (*is used*) for realworld projects (although most
> libs remain in constant parallel development to make them more feature
> complete). I've collated a number of images of projects and links to
> the most important libs here:
> 
> http://thi.ng/
> 
> Most notably of those:
> 
> http://thi.ng/geom
> By far the largest sub-project and backbone for most others: A 2D/3D
> geometry package w/ comprehensive vector algebra, swizzling,
> intersections, matrix types & helpers, quaternions, pure shape
> primitives with ~50 protocols for polymorphic enquiry & manipulation,
> meshes (incl. I/O), mesh subdivisions, CSG mesh ops, Verlet physics
> engine (only particles, springs, behaviors)... Most of this lib is
> pure geometry w/ no rendering specifics, although there're separate
> modules for SVG rendering w/ shader support & decorators [1], WebGL
> wrapper and converters from shapes/meshes to VBOs and various shader
> presets/utils.
> 
> http://thi.ng/shadergraph
> GLSL (WebGL) pure function library & dependency graph (based on
> com.stuartsierra/dependency), GLSL minification during CLJS compile
> time
> 
> http://thi.ng/color
> RGB, HSV, CMYK, CSS conversions, color presets (incl. D3 category schemes)
> 
> http://thi.ng/luxor
> Complete scene compiler DSL for http://luxrender.net, based around thi.ng/geom
> 
> http://thi.ng/morphogen
> Declarative 3D form evolution through tree-based transformations,
> basically an AST generator of geometric operations to transform a
> single seed node into complex 3D objects
> 
> http://thi.ng/tweeny
> Interpolation of nested (presumably animation related) data
> structures. Allows tweening of deeply nested maps/vectors with
> completely flexible tween fns/targets and hence easy definition of
> complex timelines
> 
> http://thi.ng/validate
> Purely functional, composable data validation & optional corrections
> for nested data. Supports both maps & vectors, wildcards, comes with
> many predefined validators, but extensible...
> 
> http://thi.ng/trio
> A generic, non-RDF specific triple store API and feature rich
> SPARQL-like query engine
> (and my prime example of using the literate programming approach with
> org-mode[2][3])
> 
> Last but not least: Super special thanks are due to the following people:
> 
> Rich, Alex + rest of clojure.core
> David (+everyone else involved) for the immense effort on making CLJS
> proper useful,
> Chas, Kevin and anyone else working on CLJX...
> none of this would have been possible without these amazing tools!
> 
> Best, K.
> 
> Ps. There're a number of other libs in this collection which are in
> dire need of updating (last touched spring 2013) - these are related
> to general OpenCL functionality and voxel rendering. Some of the
> example images on the above site were created with these...
> 
> [1] https://github.com/thi-ng/geom/blob/master/geom-svg/src/examples.org
> [2] https://github.com/thi-ng/trio/blob/master/src/query.org
> [3] http://orgmode.org/
> 
> -- 
> Karsten Schmidt
> http://postspectacular.com | http://thi.ng/

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] [ANN] thi.ng collection update (CLJ/CLJS)

2015-02-25 Thread Dylan Butman
I totally thought that map was a photo of 3d printed shapes, but it makes
sense that you're using luxrender now. Is there a video of the animation
online somewhere?

On Wed Feb 25 2015 at 6:13:25 PM Karsten Schmidt  wrote:

> That's a good point, Bruce! To be honest, I don't know anymore, but it
> makes complete sense to change it. Consider it done! :)
>
> As for your mapping question, yes, of course! I've done a few of them.
> E.g. the first pic on the website [1] was a project for The ODI in
> 2013 and is a map of different council/borough stats of London (here
> knife crime). The shape files were first retrieved & processed with
> the thi.ng/trio lib directly from the UK statistics office's SPARQL
> endpoint [2], then projected to Mercator, converted to 2d polygons,
> smoothed them and then extruded as 3D walled meshes and exported as
> STL files using geom. To create that rendered image, another function
> then combined all borough meshes into a complete render scene for
> Luxrender (using the luxor lib). Since this all was for a 60sec
> animation, I also wrote the tweeny lib for that project to allow me to
> define the timeline for the various camera, mesh, light & shader
> changes. The whole bundle was then sent to EC2 and rendered on 340+
> CPUs... basically, spawned a private render farm.
>
> Alternatively with < 30 lines of code you could query any UK
> constituency (or use similar endpoints for other countries), do those
> initial shape transformations and send the resulting STL mesh file
> straight to a 3D printer... For online use, of course the SVG or WebGL
> modules would be more interesting, but these really would just deal
> with that last transformation/visualization step, i.e. turning a
> thi.ng.geom.Polygon2 into an SVG  node or tesselate it and
> stuff it into WebGL buffer to display...
>
> For more flexible mapping, it'd be great to port some/all of the
> projections from [3] in its own clj lib for easier (and non-JS
> related) access...
>
> [1] http://thi.ng/img/04.jpg
> [2] http://statistics.data.gov.uk/doc/statistical-geography
> [3] https://github.com/d3/d3-geo-projection/
>
> Hth!
>
> On 25 February 2015 at 22:34, Bruce Durling  wrote:
> > Karsten,
> >
> > Is there a reason why you went with a README.md and then an index.org
> > rather than a plain README.org?
> >
> > (love all the rest of it and loved your use of it at The Barbican. I
> > need to get my head around it all. I'm wondering if I can use it for
> > some of the geographic and other charting things I do a lot of).
> >
> > cheers,
> > Bruce
> >
> > On Wed, Feb 25, 2015 at 5:06 AM, Karsten Schmidt 
> wrote:
> >> Hi guys,
> >>
> >> thi.ng is a collection of over a dozen largely x-platform Clojure &
> >> Clojurescript libs for computational/generative design & data
> >> visualization tasks.
> >>
> >> I just wanted to give a little heads up that this project has recently
> >> seen a number of releases and, as a whole, by now is generally quite
> >> stable and usable (*is used*) for realworld projects (although most
> >> libs remain in constant parallel development to make them more feature
> >> complete). I've collated a number of images of projects and links to
> >> the most important libs here:
> >>
> >> http://thi.ng/
> >>
> >> Most notably of those:
> >>
> >> http://thi.ng/geom
> >> By far the largest sub-project and backbone for most others: A 2D/3D
> >> geometry package w/ comprehensive vector algebra, swizzling,
> >> intersections, matrix types & helpers, quaternions, pure shape
> >> primitives with ~50 protocols for polymorphic enquiry & manipulation,
> >> meshes (incl. I/O), mesh subdivisions, CSG mesh ops, Verlet physics
> >> engine (only particles, springs, behaviors)... Most of this lib is
> >> pure geometry w/ no rendering specifics, although there're separate
> >> modules for SVG rendering w/ shader support & decorators [1], WebGL
> >> wrapper and converters from shapes/meshes to VBOs and various shader
> >> presets/utils.
> >>
> >> http://thi.ng/shadergraph
> >> GLSL (WebGL) pure function library & dependency graph (based on
> >> com.stuartsierra/dependency), GLSL minification during CLJS compile
> >> time
> >>
> >> http://thi.ng/color
> >> RGB, HSV, CMYK, CSS conversions, color presets (incl. D3 category
> schemes)
> >>
> >> http://thi.ng/luxor
> >> Complete scene compiler DSL for http://luxrender.net, based around
> thi.ng/geom
> >>
> >> http://thi.ng/morphogen
> >> Declarative 3D form evolution through tree-based transformations,
> >> basically an AST generator of geometric operations to transform a
> >> single seed node into complex 3D objects
> >>
> >> http://thi.ng/tweeny
> >> Interpolation of nested (presumably animation related) data
> >> structures. Allows tweening of deeply nested maps/vectors with
> >> completely flexible tween fns/targets and hence easy definition of
> >> complex timelines
> >>
> >> http://thi.ng/validate
> >> Purely functional, composable data validation & optional corrections
> >

[ClojureScript] Re: Om with react-motion

2015-10-08 Thread Dylan Butman
have you considered using a more functional approach to transitions? I wrote an 
interpolator library you might find helpful.

https://github.com/pleasetrythisathome/bardo

On Friday, October 2, 2015 at 2:31:16 PM UTC-4, Petr Gladkikh wrote:
> Hello,
> 
> I am working on Om application that uses react-motion to animate a component 
> transitions. The problem is that nested/children components that are inside 
> animated component are not re-rendered when their local state changes e.g. 
> with "om/set-state!". 
> Application state is stored in single tree. When application state is altered 
> via cursors then re-rendering is performed.
> 
> I suspect that problem could be that react-motion does something strange that 
> breaks React or it is a problem with interaction of react-motion with Om 
> components.
> 
> So the question is, how handling of local state is different in Om components 
> vs. plain react components? How can I diagnose this problem? 
> 
> I use Om 0.9.0 (with React 0.13.3, and react-motion 0.3.0), on page load 
> React issues warnings that likely caused by react-motion:
> 
> > Warning: Don't set .props.children of the React component. Instead, specify 
> > the correct value when initially creating the element or use 
> > React.cloneElement to make a new element with updated props.
> 
> > Warning: Don't set .props.__om_init_state of the React component. Instead, 
> > specify the correct value when initially creating the element or use 
> > React.cloneElement to make a new element with updated props.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


Re: [ClojureScript] Re: ANN: DataScript, in-memory database and datalog queries in ClojureScript

2015-10-27 Thread Dylan Butman
Does anyone know David's thinking about doing server push to update local
data?

In the case of datomic/datascript, it'd be pretty straightforward to push
datoms to a client that are within a user's scope. In the case of user
scoped data, it should be possible (although not always desirable) to
structure your data so that all data relevant to that user is contained
within a single graph (the user node is a edge that transitively connects
to all data). This means that is you take the initial set of entity ids
relevant to the user, any new datoms with entity ids in the initial set are
relevant changes, and can be pushed directly to that particular client.
Datoms not in the set can be ignored.

I've been thinking about how this can be efficiently translated into
triggering the correct rereads in the client. I haven't spent enough time
yet with the Om Next internals to fully understand what's going on, but my
current understanding of is that queries are registered, and that mutations
must return queries as :value which then trigger reads.

If you just transact the datoms, you won't get rereads because you're not
returning specific query :value to be reread. If you're able register the
entities used to produce the result of a query (not sure how to do this
unless your queries always return entity ids directly or in some parseable
format), then you could do the same entity id set contains? to see if the
query needs to be reread. However this will only work if the query is a
single graph like the above mentioned user data graph. If you have a query
that gets a set of edges, for example, all users in the system, as opposed
to all todos of a particular user, then the set of entity ids returned by
the query is dynamic, and can't be used as described above. Perhaps you
could just override the default behavior for edge queries?

On Tue, Oct 27, 2015 at 2:20 PM Alan Moore 
wrote:

> FYI: Om Next has new built-in affordances for using pull syntax to resolve
> local/remote datom fetching that plays nicely with local datascript
> instances. Nothing in Om Next is Datomic or Datascript specific but there
> are working examples of using both including the proverbial TODO app.
>
> If you can't use Om Next you could do something similar in your own code.
> David Nolan has put in a lot of thinking around this and seems to have hit
> a sweet spot in this area. Replicating all the features/aspects he has
> designed in might be a challenge.
>
> Alan
>
> --
> Note that posts from new members are moderated - please be patient with
> your first post.
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "ClojureScript" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/clojurescript/o0W57ptvPc8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> clojurescript+unsubscr...@googlegroups.com.
> To post to this group, send email to clojurescript@googlegroups.com.
> Visit this group at http://groups.google.com/group/clojurescript.
>

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


[ClojureScript] Re: ANN: Reanimated - An animation library for Reagent (ClojureScript)

2015-10-30 Thread Dylan Butman
On Thursday, October 29, 2015 at 11:46:55 PM UTC-4, Timothy Pratley wrote:
> Animation as reactions.
> 
> http://timothypratley.github.io/reanimated/#!/timothypratley.reanimated.examples
> https://github.com/timothypratley/reanimated
> 
> Regards,
> Timothy

Hey Timothy, cool stuff! You might get some additional mileage out of the 
interpolators and easing functions in 
https://github.com/pleasetrythisathome/bardo. Happy to see other people working 
with animation stuff

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.


[ClojureScript] Re: CSS in CLJS

2017-02-03 Thread Dylan Butman
On Thursday, February 2, 2017 at 11:36:43 PM UTC+1, Thomas Heller wrote:
> Hello,
> 
> I'm not sure how many of you are in this horrible situation where you have to 
> write CSS for your React Components. I typically have to write way more than 
> I'd like and always hated the way I wrote it. Until a few weeks ago.
> 
> I wrote this thing and so far I really like it. Too early to tell whether 
> this is actually a good idea but I already prefer it over pretty much 
> everything else I have used in the past (CSS, SCSS, OOCSS, BEM, ...).
> 
> Anyways here it goes:
> 
> (ns my.fancy.component
>   (:require [shadow.markup.css :as css :refer (defstyled)]))
> 
> (defstyled title :h1
>  [env]
>  {:color "red"})
> 
> (h1 {} "hello world")
> 
> In Clojure this produces hello 
> world. There are also ways to generate the appropriate CSS so the 
> element is actually styled in your page. Not totally settled on the final API 
> but it works well enough for now.
> 
> In ClojureScript this produces a ReactElement and should work with React 
> natively and most CLJS React Wrappers like OM (although I tried no other than 
> my own). No extra CSS generation is required here, just include it in your 
> page and it will be styled.
> 
> More here: https://github.com/thheller/shadow/wiki/shadow.markup
> 
> This is basically my take on the whole css-in-js thing that is happening in 
> the JS world if anyone follows this. I wasn't happy with any of their 
> implementations so I wrote this.
> 
> If you'd like to use this try it with this:
> 
> [thheller/shadow-client "1.0.180"]
> 
> The Clojure part also requires hiccup, the CLJS parts require React via 
> cljsjs.react.
> 
> If anyone is actually interested in this I'd be happy to go over some more 
> details. I just open-sourced this as I wanted to use it in another project 
> and needed a place to put it. Consider this very ALPHA though, you have been 
> warned. ;)
> 
> Cheers,
> /thomas

This is interesting. A few thoughts...

Have you considered using garden syntax for the style generation? I have a ton 
of garden styles already, and I imagine others do to, direct porting would be 
awesome.

Is there a way to reuse css classes? Generating classes for each element 
potentially produces a lot of redundant css, and in cases where performance is 
an issue, the same class being applied to many elements will be faster

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at https://groups.google.com/group/clojurescript.