Skip to content

Instantly share code, notes, and snippets.

@JustinTulloss
JustinTulloss / start
Last active August 29, 2015 14:09
browserify/react bootstrap
// 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>
@JustinTulloss
JustinTulloss / flexbox.html
Created February 12, 2015 16:12
Simple Flexbox Demo
<!DOCTYPE html>
<html>
<head>
<title>Flexbox</title>
<style>
html, body {
height: 100%;
}
body {
margin: 0;
(ns index
(:use compojure))
(defservlet home
(GET "/"
(html [:h1 "Flockr"]
(html [:h2 "Twitter Portal"]))))
(run-server {:port 8080} "/*" home)
(ns flockr.template
(:use compojure ))
(defn page
([title body]
(html [:html
(html [:head
(html [:title title])
]
(html [:body
(ns index
(:use compojure))
(load-file "./template.clj")
(ns flockr
(:use compojure )
(:refer flockr.template))
(GET "/:twitter-name"
(page "Your Flock"
(html [:h1 "Welcome " (route :twitter-name)])))
(def *twitter-url* "http://twitter.com/statuses/public_timeline.json")
(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))))))
(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") ])])))