This file contains hidden or 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
;;;Server Side code which retrieves a html fragment from client | |
(ns faiz.client.transforms | |
(:require [enfocus.core :as ef]) | |
(:use-macros [enfocus.macros :only [append defsnippet content at set-attr html-content]]) | |
(:require-macros [fetch.macros :as fm]) | |
(:use [faiz.client.utils :only [log]])) | |
(defn doc [] js/document) |
This file contains hidden or 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
var FB = {}; | |
FB.api = function(location, callback){}; | |
FB.getLoginStatus = function(callback){}; | |
FB.init = function(options){}; | |
FB.login = function(callback, scope){}; | |
FB.logout = function(callback){}; | |
FB.Event = {}; | |
FB.Event.subscribe = function(evt, callback){}; |
This file contains hidden or 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 urls (array "http://a.tile.openstreetmap.org/${z}/${x}/${y}.png" | |
"http://b.tile.openstreetmap.org/${z}/${x}/${y}.png" | |
"http://c.tile.openstreetmap.org/${z}/${x}/${y}.png")) | |
(def OSM (js/OpenLayers.Layer.XYZ. "OSM (with buffer)" urls (extend-object! (js-obj) {"transitionEffect" "resize" | |
"buffer" 2 | |
"wrapDateLine" true | |
"sphericalMercator" true}))) | |
(def plot (js/OpenLayers.Map. (extend-object! (js-obj) {"div" "plot" |
This file contains hidden or 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
(use '[datomic.api :only [q db] :as d]) | |
(def uri "datomic:mem://accounts") | |
;; create database | |
(d/create-database uri) | |
;; connect to database | |
(def conn (d/connect uri)) |
This file contains hidden or 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
(setq indent-tabs-mode nil) | |
(setq load-path | |
(append | |
(list | |
(expand-file-name "~/emacs-setup") | |
) | |
load-path)) | |
(setq-default split-width-threshold 77) |
This file contains hidden or 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
/** | |
* FizzBuzz with CSS | |
*/ | |
body { | |
counter-reset: fizzbuzz; | |
} | |
div { |
This file contains hidden or 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
import org.vertx.java.core.Handler; | |
import org.vertx.java.core.http.HttpServerRequest; | |
import org.vertx.java.deploy.Verticle; | |
/* | |
Compile: | |
$ javac Server.java -Xlint:unchecked -cp $VERTX_HOME/lib/jars/vert.x-core.jar:$VERTX_HOME/lib/jars/vert.x-platform.jar | |
Run |
This file contains hidden or 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
;;DuckDuckgo search | |
(defun duckduckgo-search (text) | |
"Search DuckDuckGo from Emacs." | |
(interactive "sSearch: ") | |
(browse-url | |
(concat "https://duckduckgo.com/?q=" | |
(replace-regexp-in-string " " "+" text)))) |
This file contains hidden or 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
(extend-type js/RegExp | |
cljs.core/IFn | |
(-invoke ([this s] (re-matches this s)))) | |
(#"foo.*" "foobar") ;=> "foobar" | |
(#"zoo.*" "foobar") ;=> nil | |
(filter #".*foo.*" ["foobar" "goobar" "foobaz"]) ;=> ("foobar" "foobaz") |
This file contains hidden or 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
;; Datomic sample code | |
;; schema query for attribute types in specified namespaces | |
(q '[:find ?attr | |
:in $ [?include-ns ...] ;; bind ?include-ns once for each item in collection | |
:where | |
[?e :db/valueType] ;; all schema types (must have a valueType) | |
[?e :db/ident ?attr] ;; schema type name | |
[(datomic.Util/namespace ?attr) ?ns] ;; namespace of name | |
[(= ?ns ?include-ns)]] ;; must match one of the ?include-ns |