Skip to content

Instantly share code, notes, and snippets.

View MichaelDrogalis's full-sized avatar

Michael Drogalis MichaelDrogalis

  • Confluent
  • Seattle, WA
View GitHub Profile
(defrecord Value [name value])
(defrecord Card [value suit])
(def values
(map #(Value. %1 %2) [:two :three :four :five :six :seven :eight :nine :ten :jack :queen :king :ace] (range 1 14)))
(def suits #{:clubs :diamonds :hearts :spades})
(def deck (mapcat (fn [value]
(map (fn [suit] (Card. value suit)) suits))
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(cua-mode t nil (cua-base))
'(tool-bar-mode nil nil (tool-bar)))
(custom-set-faces
;; custom-set-faces was added by Custom.
7[color]
8 branch = auto
9 diff = auto
10 status = auto
;; .emacs
;;; uncomment this line to disable loading of "default.el" at startup
;; (setq inhibit-default-init t)
;; turn on font-lock mode
(when (fboundp 'global-font-lock-mode)
(global-font-lock-mode t))
;; enable visual feedback on selections
@MichaelDrogalis
MichaelDrogalis / capybara.rb
Created June 27, 2012 19:10 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
# =Navigating=
visit('/projects')
visit(post_comments_path(post))
# =Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@MichaelDrogalis
MichaelDrogalis / gist:3409349
Created August 20, 2012 23:45
Architecture and Testing talk notes
Ripping the Heart out of Complexity
- Here to talk about 2 things:
- Simple architectures
- Multidimensional testing
- What's a simple architecture?
- Not a measure of LOC
- Not a measure of time spent producing it
- Not about least amount of work done
- Measure of understandablility, clarity, independence
- What's multidimensional testing?
(defprotocol Differentiate
(birth-a-different [this]))
(extend java.lang.Long
Differentiate
{:birth-a-different
(fn [this]
5)})
(defn has-a-different [description attribute]
@MichaelDrogalis
MichaelDrogalis / gist:3921862
Created October 20, 2012 03:06
Draft for database seeding using Zombie
(generate-seeds
{:database :simulation :table :jobs}
(make-seed (has-a-random :priority)
(has-a-random :status)
(has-a-random :name)
(n-instances 500))
(make-seed (randomized :priority :status :name) ;;; Short-hand for the former form
(n-instances 500))
(make-seed (has-a-random :priority)
(has-a :status :error)
mysql> desc persons;
+--------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+-------------+------+-----+---------+-------+
| name | varchar(32) | YES | | NULL | |
| number | int(11) | YES | | NULL | |
+--------+-------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
mysql> desc pets;
(deftable pets
{:database db :table :pets :policy :clean-slate}
(seed (inherit :id)
(randomized :nickname)))
(deftable people
{:database db :table :people :fk [pets] :policy :clean-slate :n 50}
(seed (randomized :name {:fk {:pets :id}})
(randomized :number)))