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
require 'spec_helper' | |
describe MyController do | |
describe "create" do | |
it "filters sensitive data from the log" do | |
invocations = Rails.logger.spy_on.add {|_, _, msg| msg} | |
post :create, :myobj => {:social_security_number => "123-45-6789"} | |
invocations.grep(/Parameters:/).first.should include('"social_security_number"=>"[FILTERED]"') |
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
(->> [jay john mike chris] | |
(filter (comp (partial = "new york") :current-city)) | |
(group-by :employer) | |
(#(update-in % ["drw.com"] (partial map :name)))) |
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
(->> [jay john mike chris] | |
(filter (comp (partial = "new york") :current-city)) | |
(group-by :employer) | |
(#(update-in % ["drw.com"] (partial map :name)))) |
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
;;; the data we're looking for as a result | |
{"drw.com" ("jay fields" "john dydo"), | |
"thoughtworks.com" [{:name "chris george", | |
:current-city "new york", | |
:employer "thoughtworks.com"}]} |
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
;;; the data we will start out with - | |
(def jay {:name "jay fields" :employer "drw.com" :current-city "new york"}) | |
(def john {:name "john dydo" :employer "drw.com" :current-city "new york"}) | |
(def mike {:name "mike ward" :employer "drw.com" :current-city "chicago"}) | |
(def chris {:name "chris george" :employer "thoughtworks.com" :current-city "new york"}) |
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
(-> [jay john mike chris] | |
(->> (filter (comp (partial = "new york") :current-city)) | |
(group-by :employer)) | |
(update-in ["drw.com"] (partial map :name))) |
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
(-> [jay john mike chris] | |
(->> (filter (comp (partial = "new york") :current-city))) | |
(->> (group-by :employer)) | |
(update-in ["drw.com"] (partial map :name))) |
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
(ns leiningen.tar | |
(:require leiningen.jar leiningen.clean | |
[clojure.java.io :as io]) | |
(:use clojure.java.shell)) | |
(defn normalize-path [root path] | |
(let [f (io/file path)] | |
(.getAbsolutePath (if (.isAbsolute f) f (io/file root path))))) | |
(defn tar [project & args] |
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 jay {:name "jay fields" :employer "drw.com" :current-city "new york"}) | |
(def john {:name "john dydo" :employer "drw.com" :current-city "new york"}) | |
(def mike {:name "mike ward" :employer "drw.com" :current-city "chicago"}) | |
(def chris {:name "chris george" :employer "thoughtworks.com" :current-city "new york"}) | |
[jay john mike chris] | |
[{:name "jay fields", :current-city "new york", :employer "drw.com"} | |
{:name "john dydo", :current-city "new york", :employer "drw.com"} | |
{:name "mike ward", :current-city "chicago", :employer "drw.com"} |
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
;; input | |
[{:name "jay fields", :current-city "new york", :employer "drw.com"} | |
{:name "john dydo", :current-city "new york", :employer "drw.com"} | |
{:name "mike ward", :current-city "chicago", :employer "drw.com"} | |
{:name "chris george", :current-city "new york", :employer "thoughtworks.com"}] | |
;; desired output | |
{"thoughtworks.com" ("chris george"), "drw.com" ("jay fields" "john dydo" "mike ward")} |