Skip to content

Commit

Permalink
2023 Init
Browse files Browse the repository at this point in the history
  • Loading branch information
pcorliss committed Dec 1, 2023
1 parent e5db3c6 commit 521db2b
Show file tree
Hide file tree
Showing 13 changed files with 1,035 additions and 0 deletions.
1 change: 1 addition & 0 deletions 2023/.ruby-gemset
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
advent_of_code
1 change: 1 addition & 0 deletions 2023/.ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.2.2
17 changes: 17 additions & 0 deletions 2023/blank/Guardfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#guard :shell do
# watch(%r{^*\.rb}) { `bundle exec rspec --force-color -f doc spec/ ` }
#end

guard 'rspec', cmd: 'bundle exec rspec --force-color -f doc spec/', :all_on_start => true do
watch(%r{^([^/]+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^spec/.*_spec\.rb$})
end

notification :tmux,
display_message: true,
timeout: 5, # in seconds
default_message_format: '%s >> %s',
success: "green",
failed: "red",
pending: "yellow",
default: "green"
Empty file added 2023/blank/README.md
Empty file.
18 changes: 18 additions & 0 deletions 2023/blank/blank.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require 'set'
require '../lib/grid.rb'
require '../lib/ring.rb'

module Advent

class Blank
attr_accessor :debug

def initialize(input)
@debug = false
end

def debug!
@debug = true
end
end
end
Empty file added 2023/blank/input.txt
Empty file.
7 changes: 7 additions & 0 deletions 2023/blank/run.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env ruby

require_relative 'blank'

input = File.read('./input.txt')

ad = Advent::Blank.new(input)
21 changes: 21 additions & 0 deletions 2023/blank/spec/blank_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
require './blank.rb'
require 'rspec'
require 'pry'

describe Advent do

let(:input) {
<<~EOS
EOS
}

describe Advent::Blank do
let(:ad) { Advent::Blank.new(input) }

describe "#new" do
end

context "validation" do
end
end
end
21 changes: 21 additions & 0 deletions 2023/daily.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

set -o errexit
set -o nounset
set -o pipefail
set -o verbose

NAME=$1
DATE=$(date "+%d")
DAY=${2:-$DATE}
NAME="$(tr '[:lower:]' '[:upper:]' <<< ${NAME:0:1})${NAME:1}"
FNAME=$(echo ${NAME} | tr '[:upper:]' '[:lower:]')

cp -pr blank ${DAY}
pushd ${DAY}
find . | grep rb | xargs gsed -i "s/blank/${FNAME}/g"
find . | grep rb | xargs gsed -i "s/Blank/${NAME}/g"
mv blank.rb ${FNAME}.rb
mv spec/blank_spec.rb spec/${FNAME}_spec.rb
touch input.txt
popd
Loading

0 comments on commit 521db2b

Please sign in to comment.