-
user signs up with email and password:
- if the email exists, validation error.
- if the email is linked to a facebook account, they'll see the "merge?" box when they try to link later
- if the email doesn't exist, create the account!
- Username is auto-generated
- we send a welcome! email
- we send a verification email
-
user decides to link a Facebook account:
-
when the user clicks on the "Link Facebook" link in profile, login with javascript SDK
| # Add Docker PPA and install latest version | |
| sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 | |
| sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list" | |
| sudo apt-get update | |
| sudo apt-get install lxc-docker -y | |
| # Install fig | |
| sudo sh -c "curl -L https://github.com/docker/fig/releases/download/1.0.0/fig-`uname -s`-`uname -m` > /usr/local/bin/fig" | |
| sudo chmod +x /usr/local/bin/fig |
| (ns example.errors) | |
| (defn clean-address [params] | |
| "Ensure (params :address) is present" | |
| (if (empty? (params :address)) | |
| [nil "Please enter your address"] | |
| [params nil])) | |
| (defn clean-email [params] | |
| "Ensure (params :email) matches *@*.*" |
Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.
| (ns aud_cas.print_fields | |
| (:use cascalog.api) | |
| (:require [clojure.string :as str]) | |
| ) | |
| (defn parse_input_record | |
| "Parse the text of the input record into fields in a map" | |
| [input_record] | |
| (let [prefix_string (get (str/split input_record #"\: ") 0) | |
| prefix_pairs (str/split prefix_string #" ") |
| (ns rbl.feature-extraction.user-agent | |
| (:use [clojure.core.memoize :only [memo]]) | |
| (:require [clojure.tools.logging :as log]) | |
| (:import [nl.bitwalker.useragentutils UserAgent DeviceType Browser OperatingSystem])) | |
| (defn str->features [string] | |
| (try | |
| (let [user-agent (UserAgent. (or string ""))] | |
| {:browser_group (-> user-agent .getBrowser .getGroup .getName) | |
| :os_group (-> user-agent .getOperatingSystem .getGroup .getName) |
In this tutorial, we'll take an in-depth view of what's happening when you execute a simple Onyx program. All of the code can be found in the Onyx Starter repository if you'd like to follow along. The code uses the development environment with HornetQ and ZooKeeper running in memory, so you don't need additional dependencies to run the example for yourself on your machine.
At the core of the program is the workflow - the flow of data that we ingest, apply transformations to, and send to an output for storage. In this program, we're going to ingest some sentences from an input source, split the sentence into individual words, play with capitalization, and add a suffix. Finally, we'll send the transformed data to an output source.
Let's examine the workflow pictorially:
| ; it's a bit cumbersome to set up and there's the unfortunate need to ignore the tag | |
| ; in the individual methods, but this allows you to leave the interpretation of open | |
| ; variants, well, *open* for extension by multimethod. | |
| ; dispatch off the first argument, which will be the tag | |
| (defmethod command-multi (fn [tag & data] tag)) | |
| ; the first argument to the *method* is still the tag | |
| (defmulti command-multi :print [_ val] (println val)) | |
| (defmulti command-multi :read [_ fname] (slurp fname)) |
| (ns mqtt-insertion.core | |
| (:require [clojure.core.async :refer :all]) | |
| (:import (org.eclipse.paho.client.mqttv3 | |
| MqttCallback | |
| MqttAsyncClient | |
| MqttConnectOptions | |
| MqttDeliveryToken | |
| MqttException | |
| MqttMessage | |
| MqttTopic |
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(query_start, clock_timestamp()), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(query_start, clock_timestamp()), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |