Skip to content

Instantly share code, notes, and snippets.

@JustinTulloss
Created March 26, 2009 05:51
Show Gist options
  • Select an option

  • Save JustinTulloss/85920 to your computer and use it in GitHub Desktop.

Select an option

Save JustinTulloss/85920 to your computer and use it in GitHub Desktop.
(let [channel-agents [
; For every item in (:1 channels) (a list of channels), create
; an agent. Then do this for (:2 channels), which is a list of
; channels that belong in the second column.
(map
(fn [channel]
(send-off
(agent "")
(fn [_]
(flockr.channels/render-channel
channel
session))))
(:1 channels))
(map
(fn [channel]
(send-off
(agent "")
(fn [_]
(flockr.channels/render-channel
channel
session))))
(:2 channels))]]
; Wait for agents to return.
(apply
await
(concat
(first channel-agents)
(second channel-agents))))
;Render the output of the channels in our html.
(html
[:div#col1 {:class "feed-column left"}
(map
(fn [ch-agent]
(html [:div.feed-panel @ch-agent]))
(first channel-agents))
]
[:div#col2 {:class "feed-column right"}
(map
(fn [ch-agent]
(html [:div.feed-panel @ch-agent]))
(second channel-agents))
])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment