Skip to content

Instantly share code, notes, and snippets.

View elizabrock's full-sized avatar

Eliza Brock Marcum elizabrock

View GitHub Profile
def starts_listing(line)
line.include? "\\begin{lstlisting}"
end
def ends_listing(line)
line.include? "\\end{lstlisting}"
end
def process_file_line(unique_words, line)
unique_words.each do |verb_word|
@elizabrock
elizabrock / gist:5389471
Created April 15, 2013 16:46
NSS Cheers Assignment
puts "Hey there! What's your name?"
name = gets.chomp
puts name
# Give me a K!
# Give me a e!
# Give me a i!
# Give me a t!
# Give me a h!
@elizabrock
elizabrock / gist:5468471
Created April 26, 2013 16:16
The shell of a program that takes arguments and prints a calendar (for NSS Spring 2013)
month = ARGV[0]
year = ARGV[1]
puts `cal #{month} #{year}`
@elizabrock
elizabrock / countdown.rb
Last active December 17, 2015 12:09
Countdown (with output always shown at the top of the terminal)
class Countdown
BELL = "\a"
COLORS = {
'black' => 30,
'red' => 31,
'green' => 32,
'yellow' => 33,
'blue' => 34,
'magenta' => 35,
'cyan' => 36,
@elizabrock
elizabrock / db schema.rb
Last active August 29, 2015 13:56
elizabrocksoftware.com's Freckle Integration. This drives: http://elizabrocksoftware.com/what_are_they_doing
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
@elizabrock
elizabrock / Instructions.md
Created April 7, 2014 16:38
Cheers Exercise

How do we start a new program?

Let’s try it by building:

A small program that takes input and does something with it.

Cheers, Pt. 1

#!/usr/bin/env ruby
# -*- ruby -*-
require 'rake/testtask'
Rake::TestTask.new() do |t|
t.pattern = "test/test_*.rb"
end
desc "Run tests"
task :default => :test
@elizabrock
elizabrock / cron.rb
Created May 5, 2014 18:29
Message Expectations Example
class Cron
def self.run!
User.send_digests!
end
end
@elizabrock
elizabrock / cheers.rb
Created July 7, 2014 16:43
Cheers Exercise - Cohort Blueberry
# Build on the results of our in-class exploration to output, for example:
# Give me an... A
# Give me a... B
# Give me a... B
# Give me a... Y
# ABBY’s just GRAND!
# When given the input of “Abby”.
# Note: the “a” vs. “an”