The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.
Send messages to iframe using iframeEl.contentWindow.postMessage
Recieve messages using window.addEventListener('message')
(ns aws.s3 | |
(:refer-clojure :exclude [get]) | |
(:use [clojure.walk :only (keywordize-keys stringify-keys)] | |
[clojure.contrib.def :only (defonce-)] | |
[clojure.contrib.json :only (read-json write-json)]) | |
(:import [java.io PrintWriter InputStreamReader ByteArrayInputStream ByteArrayOutputStream] | |
[java.util.zip GZIPInputStream GZIPOutputStream] | |
[com.google.common.base Charsets] | |
[com.amazonaws.services.s3 AmazonS3Client] | |
[com.amazonaws.services.s3.model Region CreateBucketRequest ObjectMetadata |
First, install nginx for mac with "brew install nginx". | |
Then follow homebrew's instructions to know where the config file is. | |
1. To use https you will need a self-signed certificate: https://devcenter.heroku.com/articles/ssl-certificate-self | |
2. Copy it somewhere (use full path in the example below for server.* files) | |
3. sudo nginx -s reload | |
4. Access https://localhost/ | |
Edit /usr/local/etc/nginx/nginx.conf: |
user=> (def buffer (StringBuilder.)) | |
#'user/buffer | |
user=> | |
(defn appender [^StringBuilder buffer] | |
(fn [& args] | |
(when-let [arg (first args)] | |
(.append buffer arg) | |
(recur (rest args))))) | |
user=> #'user/appender | |
user=> |
#!/bin/bash | |
# | |
# (Above line comes out when placing in Xcode scheme) | |
# | |
# Inspired by original script by incanus: | |
# https://gist.github.com/1186990 | |
# | |
# Rewritten by martijnthe: | |
# https://gist.github.com/1379127 | |
# |
(defn handle-file-select [evt] | |
(.stopPropagation evt) | |
(.preventDefault evt) | |
(let [files (.-files (.-dataTransfer evt))] | |
(dotimes [i (.-length files)] | |
(let [rdr (js/FileReader.) | |
the-file (aget files i)] | |
(set! (.-onload rdr) | |
(fn [e] | |
(let [file-content (.-result (.-target e)) |
.container-fixed { | |
bottom: 0; | |
position: fixed; | |
left: 0; | |
right: 0; | |
top: 0; | |
} | |
.container-fixed .col { | |
height: 100%; |
(def ptrn | |
{ | |
:a {:pattern #"a(?!b)" | |
:purpose "Only allow a if it is not preceded by a 'b' (negative lookahead)" | |
:samples ["acdefg" ; ok | |
"abcdef" ; nil | |
]} | |
:b {:pattern #"(?i)(<title.*?>)(.+?)(</title>)" |
#!/bin/sh | |
# Restartes the parse log if it crashes | |
# stdbuf flushes the Parse log buffer so they come in real time | |
until stdbuf -oL /usr/local/bin/parse log -f > info.log; do | |
echo "Parse log crashed with exit code $?. Respawning.." >&2 | |
sleep 1 | |
done | |
(def inputs [{:korks :email} | |
{:korks [:name :first]} | |
{:korks [:name :last]}]) | |
(defn form [app owner] | |
(reify | |
om/IInitState | |
(init-state [this] | |
(reduce (fn [state {:keys [korks]}] | |
(assoc-in state korks nil)) |