Skip to content

Instantly share code, notes, and snippets.

@dcmoore
dcmoore / BuildingResilientIntegrationsWorkshop.md
Last active November 15, 2023 19:06
Integrate with a really buggy fake gold mining service to practice your resilient integration patterns.

Welcome to the Building Resilient Integrations Workshop! If you're reading this, you should've seen the presentation portion of the workshop by now. This is the coding exercise portion. Below you'll find documentation for the buggy API:

Base URL: https://resilient-integration-workshop.onrender.com

Endpoints:
  - POST /v1/register?userName=X
  - POST /v1/excavate
  - POST /v1/store?userName=X&bucketId=X
 - GET /v1/totals?userId=X
@dcmoore
dcmoore / gilded_rose.py
Created February 17, 2016 18:47
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
dcmoore / FortuneTeller.ino
Created January 19, 2016 02:50
Crystal Ball exercise from the Arduino Projects Book with my little twist on the answers.
#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);
@dcmoore
dcmoore / gist:89f3a7480918cd94732c
Created May 16, 2014 01:26
PUT and DELETE methods
HTML Hidden Form Field
<form action="/wherever" id="something" method="post">
<input type="hidden" name="_method" value="put"/>
</form>
Clojure Middleware
(defn- change-to-put-and-delete [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
;;spec
(def hiccup [:key {}
[:nesting {}
[:match "first match"]]
[:nesting
[:match {} "second match"]]
[:miss ""]])
(describe "get-hiccup-nodes"
@dcmoore
dcmoore / gist:5723975
Last active December 18, 2015 04:18
test profile
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 @@
'leiningen.compile)
((ns-resolve 'leiningen.compile 'prep) project false))))
+(defn- merge-profiles-if-they-exist [project profiles]
+ (try
(def app-handler
(->
{:body "Hey Guys!", :headers {}, :status 200}
wrap-session
wrap-cookies
wrap-params))
(defn my-middleware [handler]
(fn [req]
(handler (assoc req :new-key "Hey Guys!"))))
(def app-handler
(my-middleware
(fn [req]
{:body (:new-key req)
:headers {}
:status 200})))
(defn my-middleware [handler]
(fn [req]
(handler (assoc req :new-key "Hey Guys!"))))
(def app-handler
(my-middleware
(fn [req]
{:body (:new-key req)
:headers {}
:status 200})))