Skip to content

Instantly share code, notes, and snippets.

View timcreasy's full-sized avatar

Tim Creasy timcreasy

View GitHub Profile
// Lessons learned - use Clojure
const fs = require('fs')
function parseInstruction(instruction) {
const regex = /([a-z]+) ([a-z]+) ([-]*[0-9]+) if ([a-z]+) ([><=!]+) ([-]*[0-9]+)/g
return regex.exec(instruction)
}
function parseInput(filePath) {
const input = fs.readFileSync(filePath, 'utf8').trim().split("\n");
@timcreasy
timcreasy / cal.clj
Last active January 30, 2017 15:10 — forked from calebphillips/cal.clj
Clojure Unix Cal
(require '[clojure.string :as str])
(import [java.time Month LocalDateTime YearMonth])
(defn left-pad [desired-width s]
(let [padding (apply str (repeat (- desired-width
(count (str s)))
" "))]
(str padding s)))
(defn right-pad [desired-width s]