Skip to content

Instantly share code, notes, and snippets.


Tim Creasy timcreasy

View GitHub Profile
View day-eight.js
// 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 / cal.clj
Last active Jan 30, 2017 — forked from calebphillips/cal.clj
Clojure Unix Cal
View cal.clj
(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]
You can’t perform that action at this time.