Skip to content

Instantly share code, notes, and snippets.


Dave Moore dcmoore

View GitHub Profile
dcmoore /
Created Feb 17, 2016
python gilded rose kata mid-refactor
# -*- coding: utf-8 -*-
class GildedRose(object):
def __init__(self, items):
self.items = items
def update_quality(self):
for item in self.items:
dcmoore / FortuneTeller.ino
Created Jan 19, 2016
Crystal Ball exercise from the Arduino Projects Book with my little twist on the answers.
View FortuneTeller.ino
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int switchPin = 6;
int switchState = 0;
int previousSwitchState = 0;
int reply;
void setup() {
lcd.begin(16, 2);
View gist:89f3a7480918cd94732c
HTML Hidden Form Field
<form action="/wherever" id="something" method="post">
<input type="hidden" name="_method" value="put"/>
Clojure Middleware
(defn- change-to-put-and-delete [request]
View Effectively Reviewing a Pull Request
Effectively Reviewing a Pull Request
How do they work?
- code on a branch or fork
- open pull request
- have people review code
- potentially update the code
- merge pull request
View gist:8848185
(def hiccup [:key {}
[:nesting {}
[:match "first match"]]
[:match {} "second match"]]
[:miss ""]])
(describe "get-hiccup-nodes"
dcmoore / gist:5723975
Last active Dec 18, 2015
test profile
View gist:5723975
diff --git a/src/leiningen/spec.clj b/src/leiningen/spec.clj
index 33e404a..c6d39bd 100644
--- a/src/leiningen/spec.clj
+++ b/src/leiningen/spec.clj
@@ -42,6 +42,13 @@
((ns-resolve 'leiningen.compile 'prep) project false))))
+(defn- merge-profiles-if-they-exist [project profiles]
+ (try
View gist:1604850
(def app-handler
{:body "Hey Guys!", :headers {}, :status 200}
View gist:1604845
(defn my-middleware [handler]
(fn [req]
(handler (assoc req :new-key "Hey Guys!"))))
(def app-handler
(fn [req]
{:body (:new-key req)
:headers {}
:status 200})))
View gist:1604837
(defn my-middleware [handler]
(fn [req]
(handler (assoc req :new-key "Hey Guys!"))))
(def app-handler
(fn [req]
{:body (:new-key req)
:headers {}
:status 200})))