This file contains 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
(ns myapp.domain.user | |
(:require clj-record.boot) | |
(:require | |
[myapp.util.date :as date-util] | |
[clj-time.core :as clj-time] | |
[clojure.contrib.sql :as sql] | |
[clj-record.validation.built-ins :as valid] | |
[clj-record.callbacks.built-ins :as cb] | |
[clj-time.core :as clj-time] | |
[myapp.config :as config] |
This file contains 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
mymap = [] | |
# neither of these works: | |
mymap += { a: 1, b : 2 } | |
mymap = mymap + { a: 1, b : 2 } |
This file contains 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
user=> (def a 1) | |
#'user/a | |
user=> (def b 1) | |
#'user/b | |
user=> (defn f [x y z] [x y z]) | |
#'user/f | |
user=> (f (inc a) (dec b) (+ a b)) | |
[2 0 2] | |
user=> |
This file contains 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
$('#main_menu li#setup_interview a').bind 'click', | |
{ callback: () => @interviewEditor.setup() | |
menuId: '#setup_interview' }, | |
@menuClickCallback |
This file contains 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
; I've got | |
(if-let [session (last (find @*sessions* session-token))] | |
(something) (something-else)) | |
; The (last (find @*sessions* session-token)) expression evaluates | |
; to nil but (something) is then evaluated when I would expect | |
; that (something-else) should be evaluated. What gives? |
This file contains 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
(ns my.util.sql | |
(:use clojure.contrib.condition) | |
(:require | |
[clojure.contrib.sql :as sql] | |
[clj-record.core :as rec] | |
[my.util.error :as err])) | |
(def *transaction-error* nil) ; While a transaction-wrapper is running, bound to the last error message set by rollback-with-raise | |
(defn rollback-with-raise |
This file contains 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
##################################### | |
# | |
# Register | |
beta_registration_complete_dialog = -> | |
div id:'registration-complete', -> | |
p class: 'msg-title', -> 'Your registration is complete' | |
div class: 'msg-body', -> | |
p 'Thank you!' | |
p 'You have successfully registered for our beta.' |
This file contains 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
# Coffeescript gives an "unclosed INDENT" on the line 5 | |
# API.login takes 4 args: two strings and two callback functions | |
finishRegistrationCb (userDetails) -> | |
API.login userDetails.email, passwordPlaintext | |
(userSession) -> | |
$.modal $.tempest('beta-registration-complete_dialog', { email, userDetails.email_addr } | |
$('#continue-button').bind 'click', (event) -> | |
window.location = '/' | |
(error) -> |
This file contains 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
class MyAPI | |
objectToXml: (obj) -> | |
'<?xml version="1.0"?>' + (new XMLSerializer()).serializeToString objectToDOM(obj) | |
login: (email, password, success_callback, error_callback) -> | |
console.log "API login. email: [#{email}], password: [#{password}]" | |
xmlData = objectToXml { login: { email: email, password: password }} | |
# do something with xmlData |
NewerOlder