View gilded_rose.py
# -*- coding: utf-8 -*- | |
class GildedRose(object): | |
def __init__(self, items): | |
self.items = items | |
def update_quality(self): | |
for item in self.items: |
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"/> | |
</form> | |
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
;;spec | |
(def hiccup [:key {} | |
[:nesting {} | |
[:match "first match"]] | |
[:nesting | |
[:match {} "second match"]] | |
[:miss ""]]) | |
(describe "get-hiccup-nodes" |
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 @@ | |
'leiningen.compile) | |
((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} | |
wrap-session | |
wrap-cookies | |
wrap-params)) |
View gist:1604845
(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}))) |
View gist:1604837
(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}))) |