This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from funcy import mapcat | |
class Pyfe: | |
def __init__(self): | |
self._living_cells = set() | |
@property | |
def living_cells(self): | |
return self._living_cells |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns slagyr.async) | |
(den foo [] | |
(js/setTimeout | |
(fn [] (throw (js/Error. "foo"))) | |
100)) | |
(try | |
(foo) | |
(catch js/Object e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Micah's Autumn setup | |
*/ | |
alert('Running Autumn!'); | |
/** | |
* Window management | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn neighbors-of [cell] | |
(set (for [dx [-1 0 1] dy [-1 0 1] :when (not (= [dx dy] [0 0]))] | |
[(+ dx (first cell)) (+ dy (second cell))]))) | |
(defn alive? [[cell freqs] world] | |
(or (and (= 2 freqs) (contains? world cell)) (= 3 freqs))) | |
(defn tick [world] | |
(let [frequencies (frequencies (reduce #(concat %1 (neighbors-of %2)) [] world))] | |
(set (keys (filter #(alive? % world) frequencies))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def sm {:sleeping {:_on-entry [:tracking-0] | |
:_default [:sleeping] | |
:start [:taxiing [:start-leg]] | |
:stop [:sleeping [:cancel-leg]] | |
:entry [:treading] | |
:scud [:scudding [:start-leg]] | |
:cruise [:cruising [:start-leg]]} | |
:treading {:_on-entry [:tracking-1] | |
:_default [:treading] | |
:start [:taxiing [:start-leg]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name <%= @server_name %>; | |
return 301 https://<%= @server_name %>$request_uri; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ledger Part Nine | |
statement() prints in order | |
chronological | |
payment number | |
Add dates to all deposits and payments, autogenerate payment numbers | |
|script|empty ledger| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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" |
NewerOlder