This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Here's the bootstrap, in something like "start.js" | |
import App from './components/App'; | |
import React from 'react'; | |
React.render(<App data={global.MyData}/>, document.getElementById('app')); | |
// Here's the index | |
<!DOCTYPE html> | |
<html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Flexbox</title> | |
<style> | |
html, body { | |
height: 100%; | |
} | |
body { | |
margin: 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns index | |
(:use compojure)) | |
(defservlet home | |
(GET "/" | |
(html [:h1 "Flockr"] | |
(html [:h2 "Twitter Portal"])))) | |
(run-server {:port 8080} "/*" home) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns flockr.template | |
(:use compojure )) | |
(defn page | |
([title body] | |
(html [:html | |
(html [:head | |
(html [:title title]) | |
] | |
(html [:body |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns index | |
(:use compojure)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(load-file "./template.clj") | |
(ns flockr | |
(:use compojure ) | |
(:refer flockr.template)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(GET "/:twitter-name" | |
(page "Your Flock" | |
(html [:h1 "Welcome " (route :twitter-name)]))) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def *twitter-url* "http://twitter.com/statuses/public_timeline.json") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(GET "/:twitter-name" | |
(page "Your Flock" | |
(html [:h1 "Welcome " (route :twitter-name)] | |
(map twitter-status | |
(read-json-string (let [[status headers body] | |
(http-get *twitter-url*)] body)))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn twitter-status | |
([tweet] | |
(html [:p {:class "tweet"} | |
(html [:div {:class "tweet-text"} (get tweet "text")]) | |
(html [:div {:class "tweet-user"} (get (get tweet "user") "name") ])]))) |
OlderNewer