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
type rank = Ace | Two | Three| Four | Five | Six | Seven| Eight | Nine | Ten | Jack | Queen | King ; | |
type suit = Spade | Hearts | Diamond | Club | |
type card = { rank, suit } | |
type deck = list(card) | |
/* type deck = List(card) | EmptyDeck */ | |
/* draw card(s) (don't forget the effect on the deck) | |
ensure the deck is shuffled |
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
class Address < ActiveRecord::Base | |
attr_accessible :postcode | |
validates_format_of :postcode, :with => /^([A-PR-UWYZ]([0-9]{1,2}|([A-HK-Y][0-9]|[A-HK-Y][0-9]([0-9]|[ABEHMNPRV-Y]))|[0-9][A-HJKS-UW])\s?[0-9][ABD-HJLNP-UW-Z]{2}|(GIR\ 0AA)|(SAN\ TA1)|(BFPO\ (C\/O\ )?[0-9]{1,4})|((ASCN|BBND|[BFS]IQQ|PCRN|STHL|TDCU|TKCA)\ 1ZZ))$$/i, :message => "invalid postcode" | |
end |
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
0 |
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
(require '[clojure.spec :as s]) | |
(require '[clojure.spec.gen :as gen]) | |
;; PASSPHRASES - generate a random 5 word passphrase | |
;; naive approach was to generate a random string and contrain to match a five word pattern | |
;; however this hit 100 generation limit imposed by clojure.spec | |
(defn words [str] (clojure.string/split str #" ")) | |
(def five-words? (comp (partial = 5) count words)) | |
(gen/generate (s/gen (s/and string? five-words?))) |
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
for i in *; do ( cd $i; pwd; git --no-pager log --since="2016-02-12T16:36:00-07:00" --author jason --format=oneline; pwd ); done | less |
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 timeout [ms] | |
(let [c (chan)] | |
(js/setTimeout (fn [] (close! c)) ms) | |
c)) | |
(defn run-kmean | |
[] | |
(go | |
(dotimes [iteration 10] | |
(<! (timeout 1000)) |
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
subscriptions : Model -> Sub Msg | |
subscriptions model = | |
Time.every second NextRunTicktions : Model -> Sub Msg |
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
randomPoints : Generator (List(Point)) | |
randomPoints = | |
Random.list 200 (Random.map (\(x, y) -> Point x y) (Random.pair (int 1 999) (int 1 399))) | |
-- here we create a command that the elm runtime will execute and then pass the results back via the Update function | |
initialModel : (Model, Cmd Msg) | |
initialModel = | |
(Model [] [] 6 0 False, (Random.generate DrawPoints randomPoints)) |
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 random-point [] | |
{:x (rand-int 1000) :y (rand-int 500)}) |
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
xively.setKey( "YOUR API KEY HERE" ); | |
var startOfYesterday = moment().subtract("day", 1).startOf('day'); | |
var endOfYesterday = moment().startOf('day'); | |
console.log(startOfYesterday); | |
console.log(endOfYesterday); | |
var query = { | |
start: startOfYesterday.toJSON(), |
NewerOlder