Permalink
Browse files

Use https://github.com/flatland/useful instead of amalloy-utils

  • Loading branch information...
1 parent 579ae3a commit 8653f8b450c699b8437d220a48a469cedc5a87dd @amalloy amalloy committed Sep 7, 2011
View
@@ -8,7 +8,7 @@
[sandbar "0.4.0-SNAPSHOT"]
[org.clojars.christophermaier/congomongo "0.1.4-SNAPSHOT"]
[org.jasypt/jasypt "1.7"]
- [amalloy/utils "[0.3.7,)"]
+ [useful "0.7.0-beta1"]
[amalloy/ring-gzip-middleware "[0.1.0,)"]
[clj-github "1.0.1"]
[ring "0.3.7"]
@@ -7,16 +7,15 @@
(:use [compojure.core :only [defroutes GET]]
[foreclojure.utils :only [from-mongo]]
[somnium.congomongo :only [fetch-one]]
- [amalloy.utils.transform :only [with-adjustments]]
- [amalloy.utils.reorder :only [reorder]]))
+ [useful.utils :only [with-adjustments]]))
(defn un-group
"Turn a compact set of [data-point num-repetitions] pairs into a
bunch of repeated data points so that incanter will make a histogram
of them."
[frequencies]
- (mapcat (partial apply (reorder repeat))
- frequencies))
+ (apply concat (for [[x count] frequencies]
+ (repeat count x))))
(defn fetch-score-frequencies [problem-id]
(into {}
@@ -5,7 +5,7 @@
(:use [hiccup.form-helpers :only [form-to label text-field password-field]]
[foreclojure.utils :only [def-page from-mongo flash-error flash-msg with-user form-row assuming send-email login-url]]
[compojure.core :only [defroutes GET POST]]
- [amalloy.utils :only [rand-in-range keywordize]]
+ [useful.map :only [keyed]]
[clojail.core :only [thunk-timeout]]
[clojure.stacktrace :only [print-cause-trace]]
[somnium.congomongo :only [update! fetch-one]]))
@@ -106,7 +106,7 @@
(let [pw (apply str
(repeatedly 10 #(rand-nth pw-chars)))
hash (.encryptPassword (StrongPasswordEncryptor.) pw)]
- (keywordize [pw hash]))))
+ (keyed [pw hash]))))
(defn try-to-email [email name id]
(let [{:keys [pw hash]} (random-pwd)]
@@ -15,8 +15,7 @@
[hiccup.form-helpers :only [form-to text-area hidden-field label text-field drop-down]]
[hiccup.page-helpers :only [link-to]]
[hiccup.core :only [html]]
- [amalloy.utils.debug :only [?]]
- [amalloy.utils.reorder :only [reorder]]
+ [useful.debug :only [?]]
[amalloy.utils :only [defcomp]]
[compojure.core :only [defroutes GET POST]]
[clojure.contrib.json :only [json-str]]))
@@ -76,10 +75,10 @@
()
(get-recent-problems n)))
-(defcomp mongo-key-from-number
+(defn mongo-key-from-number
"Turn an integer into a key suitable for fetching from mongodb."
[id]
- keyword str int)
+ (keyword (str (int id))))
(defn trim-code [code]
(when code (.trim code)))
@@ -1,7 +1,7 @@
(ns foreclojure.solutions
(:require [clojure.string :as s])
(:use [somnium.congomongo :only [fetch-one update!]]
- [amalloy.utils.debug :only [?]]))
+ [useful.debug :only [?]]))
(defn get-solution [user-id problem-id]
(:code (fetch-one :solutions
@@ -7,7 +7,7 @@
(:use [hiccup.core :only [html]]
[hiccup.page-helpers :only [doctype include-css javascript-tag link-to include-js]]
[hiccup.form-helpers :only [label]]
- [amalloy.utils.transform :only [transform-if]]
+ [useful.fn :only [to-fix]]
[somnium.congomongo :only [fetch-one]]
[foreclojure.config :only [config]]))
@@ -89,7 +89,7 @@
~@code)))
(defn from-mongo [data]
- (walk/postwalk (transform-if float? int)
+ (walk/postwalk (to-fix float? int)
data))
(defn get-user [username]

0 comments on commit 8653f8b

Please sign in to comment.