Skip to content

Instantly share code, notes, and snippets.

View maxweber's full-sized avatar

Max Weber maxweber

View GitHub Profile
(with-facebook-auth {:access-token "134211159981787|2._UqBc68omALVTLR_FM6DZg__.3600.129951..."}
(client/get "https://graph.facebook.com/me/friends"))
clj-facebook-graph.example> (with-facebook-auth-by-name "Max Weber" (client/get [:me :friends]))
clj-facebook-graph.example> (with-facebook-auth-by-name "Max Weber" (client/get [:me :home]))
clj-facebook-graph.example> (with-facebook-auth-by-name "Max Weber"
(client/get [:me :likes] {:query-params {:limit 2} :extract :data :paging true}))
http://localhost:8080/albums/Max_Mustermann
http://localhost:8080/albums/me
(def facebook-app-info {:client-id "107582059321384"
:client-secret "2022b10bce2b619aa9aee7b8a5f13aa7"
:redirect-uri "http://localhost:8080/facebook-callback"
:permissions ["user_photos" "friends_photos"]})
@maxweber
maxweber / gist:1156682
Created August 19, 2011 12:19
pathWithComponents
(ns path.core
(:use clojure.test)
(:require [clojure.string :as s]))
(defn clean-component [component]
(s/replace component #"/+" ""))
(defn path-prefix [components]
(if (re-find #"/+" (first components))
"/"
@maxweber
maxweber / gist:1177947
Created August 29, 2011 07:34
Vijual Swing example
(ns prototype.graph
(:use vijual)
(:import [javax.swing JFrame JLabel]
java.awt.image.BufferedImage
java.awt.Dimension))
(defn draw []
(let [frame (new JFrame)
image (draw-tree-image [[:north-america [:usa [:miami] [:seattle] [:idaho [:boise]]]] [:europe [:germany] [:france [:paris] [:lyon] [:cannes]]]])
canvas (proxy [JLabel] [] (paint [g] (.drawImage g image 0 0 this)))
(def app-state
(atom {:form {:email {:label "Email"
:error "invalid email"
:value "[email protected]"}}}))
(defn form-element [key]
(reagent/cursor app-state [:form key]))
(def cur (form-element :email))
@maxweber
maxweber / cartesian_product.clj
Last active August 31, 2015 10:49
Cartesian Product
(def data [[1 2] [11 22] [111 222]])
(defn combine [a b]
(mapcat
(fn [x]
(map
(fn [y]
(flatten [x y]))
b))
a))