Skip to content

Instantly share code, notes, and snippets.

View slagyr's full-sized avatar

Micah Martin slagyr

  • Clean Coders, LLC
  • Scottsdale, AZ
View GitHub Profile
(micahmartin) ~/Projects/clojure/clojurescript
$ ./script/repl
Clojure 1.6.0
user=> (require '[cljs.repl :as repl])
nil
user=> (require '[cljs.repl.rhino :as rhino])
nil
user=> (def env (rhino/repl-env))
#'user/env
user=> (repl/repl env)
@slagyr
slagyr / gist:2aed1ccfd8ec702d7051
Created November 24, 2014 03:53
stubbing fns in another namespace
;; On the console:
;$ lein new speclj stubby
;; stubby/spec/stubby/core_spec.clj
(ns stubby.core-spec
(:require [speclj.core :refer :all]
[stubby.core :as p]))
(defn fn-under-test []
(p/foo))
@slagyr
slagyr / gist:41040748cf6335d01f1d
Created September 10, 2014 19:14
Bowling Game
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class GameTest
{
public Game game;
server {
  listen 80;
  server_name <%= @server_name %>;
  return 301 https://<%= @server_name %>$request_uri;
}
(defn not-set
"Returns true if attr is not set for e"
[db e attr]
(let [result (api/q '[:find ?v
:in $ ?e ?a
:where [?e ?a ?v]]
db e attr)]
(-> result first empty?)))
(defn pets-without-tails [owner-id]
@slagyr
slagyr / gist:5961714
Created July 9, 2013 22:04
Frustrations with GAE
GAE made it really easy to get a scalable site up and running. I first used it while building cleancoders.com. But there were several things that irked me.
- The SDK is huge. And it was a bit challenging to integrate with the maven workflow.
- The 30 second hard limit was frustrating problem. We build measures into Gaeshi to handle this, but every once in a while, GAE would boot our app on exceptionally slow servers that couldn't serve our app on time.
- The use of Google login for administration was good and bad. At the time there was a 10 app limit, and collaborating with clients on the GAE admin site was awkward.
- The tight coupling with GAE's API and the Datastore made me uncomfortable.
- The straw that finally broke the camel's back was the blacklisted classes. We build an client app on GAE that worked fine locally, but when we pushed to GAE, it just wouldn't work because, to our surprise, java.awt is blacklisted.
Since starting cleancoders.com, I became much more familiar with Amazon's AWS. U
Ledger Part Nine
statement() prints in order
chronological
payment number
Add dates to all deposits and payments, autogenerate payment numbers
|script|empty ledger|
(ns doppler.auth.auth-controller
(:require [cheshire.core :refer [parse-string]]
[clj-oauth2.client :as oauth2]
[compojure.core :refer [defroutes GET context]]
[joodo.env :refer [env]]
[joodo.middleware.request :refer [*request*]]
[ring.util.response :refer [redirect]]))
(def google-com-oauth2 (merge (env :google-oauth )
{:authorization-uri "https://accounts.google.com/o/oauth2/auth"
@slagyr
slagyr / gist:4061420
Created November 12, 2012 19:37
SCNA 2012 Lightning Talks
How long is your talk? Who are you? What is the title of your lightning talk?
1 Tom Macklin Fuzzing Test Data with Peach
2 Aaron Kalin You have only yourself
2 Jason Wynja How do we inspire new programmers?
2 Richard Yu The Programmer's Rap
3 John Paul Ashenfelter Muscle-Driven Development
5 Patrick Welsh Everything I Need to Know About the SRP I Learned in Gradeschool
5 Brad Wilkening Top 10 reasons you should probably quit your job
5 Aaron Kalin Don't be nervous
5 Carlos Sirias Fostering Craftsmen. What a company can do?
@slagyr
slagyr / gist:3156498
Created July 21, 2012 17:30
Router error
INFO 12:28:15:457 router: Routing request: {:response_key "routing_response.navigator.33240", :correlation_id 1342891695455600, :start {:link_id 23771258}, :goal {:link_id 724942281}, :response "navigable", :departure_time -1, :arrival_time 1342711800}
WARNING 12:28:15:457 router: Failure while handling routing request. 1342891695455600
WARNING 12:28:15:458 router: java.lang.NullPointerException
at router.restrictions$turn_restricted_by_links_QMARK_.invoke(restrictions.clj:21)
at router.cost$rpath_cost.invoke(cost.clj:12)
at router.cost$traffic_pattern_cost.invoke(cost.clj:27)
at router.memory$eval1243$fn__1244.invoke(memory.clj:183)
at router.a_star$eval1031$fn__1084$G__1014__1095.invoke(a_star.clj:6)
at router.a_star$collect_neighbor_cost_pairs$iter__1106__1110$fn__1111.invoke(a_star.clj:19)
at clojure.lang.LazySeq.sval(LazySeq.java:42)