Skip to content

Instantly share code, notes, and snippets.

Patrick Ryan phiat

Block or report user

Report or block phiat

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@phiat
phiat / gist:9968800
Created Apr 4, 2014
clojure best hand
View gist:9968800
(defn best-hand [hand]
(let [suit (fn [c] (first c))
rank (fn [c] (last c))
ranks [\2 \3 \4 \5 \6 \7 \8 \9 \T \J \Q \K \A]
four-of-a-kind? (fn [h] (if (some #(= 4 %) (vals (frequencies (map rank h)))) true false))
flush? (fn [h] (= 1 (count (vals (frequencies (map suit h))))))
straight? (fn [h] (let [indexed-ranks (sort (map #(.indexOf ranks %) (map rank h)))
ends-diff (- (first indexed-ranks) (last indexed-ranks))]
(cond
(and (= 5 (count (frequencies indexed-ranks)))
@phiat
phiat / gmaps-test.clj
Created Oct 14, 2013
A simple static google maps img using compojure (ring/jetty for server) and hiccup (for html generation).
View gmaps-test.clj
(ns gmaps-test.handler
(:use compojure.core)
(:require [compojure.handler :as handler]
[compojure.route :as route]
[hiccup.core :as h]))
(defn index-page []
(h/html [:img {:src "http://maps.googleapis.com/maps/api/staticmap?center=Brooklyn+Bridge,New+York,NY&zoom=13&size=600x300&maptype=roadmap&markers=color:blue%7Clabel:S%7C40.702147,-74.015794&markers=color:green%7Clabel:G%7C40.711614,-74.012318&markers=color:red%7Ccolor:red%7Clabel:C%7C40.718217,-73.998284&sensor=false"}]
))
@phiat
phiat / dabblet.css
Created Apr 11, 2013
The first commented line is your dabblet’s title
View dabblet.css
/**
* The first commented line is your dabblet’s title
*/
body {
border-bottom-color: #ffd300;
border-bottom-width: 10px;
border-collapse: collapse;
border-left-color: #fcfa02;
border-right-color: #fcfa02;
border-style: groove;
You can’t perform that action at this time.