Skip to content

Instantly share code, notes, and snippets.

View amaxwellblair's full-sized avatar

Allan Maxwell Blair amaxwellblair

View GitHub Profile
  1. Add gem 'rails_12factor' to your Gemfile. This will add error logging and the ability for your app to serve static assets.
  2. bundle
  3. Run RAILS_ENV=production rake db:create db:migrate db:seed
  4. delete username and password in database.yml first!
  5. Run rake secret and copy the output
  6. From the command line: export SECRET_KEY_BASE=output-of-rake-secret
  7. To precompile your assets, run rake assets:precompile. This will create a folder public/assets that contains all of your assets.
  8. Run RAILS_ENV=production rails s and you should see your app.

Remember to clobber your assets (rake assets:clobber) and re-precompile (rake assets:precompile) if you make changes.

@amaxwellblair
amaxwellblair / setting_expectations.markdown
Created February 29, 2016 21:00
Setting Expectations

Setting Group Expectations

Group Member Names: Adrienne, Chelsea, Allan

  1. When are group members available to work together? What hours can each group member work individually? Are there any personal time commitments that need to be discussed? None of us have scheduling conflicts (Allan has one meet-up per week).
    We'll go home at 7 every night, if we need or want to work individually after that, we will do that. Allan has a side project he's working on after 7. We'll be here over the weekend.

  2. How will group members communicate? How often will communication happen, and how will open lines of communication be maintained?

@amaxwellblair
amaxwellblair / enums.md
Last active February 24, 2016 15:18 — forked from biglovisa/enums.md
Posse Challenge week 4, February 22 2016

Enumerables

An enumerable is an object that may be enumerated. "Enumerated" means to count off the members of a set/collection/category one by one (usually in order, usually by name).

"Enumerable" is Ruby's way of saying that we can access each element in a collection, one at a time. Enumerable is a mixin in the Array class and it provides several enumerators such as each, map, select and many more. Find all enumerables and enumerators in the Ruby docs.

Ruby has a tons of enumerables which means that if we pick the right enumerable for the job, our implementation will be very clean and easy to read.

This week we are going to be writing enumerables from scratch. The groups are only allowed to use each, until loops, while loops and for loops.

@amaxwellblair
amaxwellblair / cfu_crud_in_sinatra.markdown
Last active February 3, 2016 00:51 — forked from rwarbelow/cfu_crud_in_sinatra.markdown
CRUD in Sinatra -- Check for Understanding
  1. Define CRUD.
  • Create
  • Read
  • Update
  • Delete
  1. There are seven verb + path combinations that are necessary in a basic Sinatra app in order to provide full CRUD functionality. List each of the seven combinations, and explain what each is for.
  2. VERB: GET | PATH: /thing_all - Allows for reading of a database
  3. VERB: GET | PATH: /new_thing
  • Allows for rendering of the create form
@amaxwellblair
amaxwellblair / .gitignore
Last active January 2, 2016 05:07 — forked from julsfelic/new_ruby_project.bash
Bash Function to Quickly Create Ruby Project Structure
coverage/

String and Integer Riddles

Strings

How can I tell how many characters are in a string? Do spaces count?

.length, yes

How can I capitalize the first character of a string? What happens if it is a number?

def supafizbuz(max_num)
range = (0..max_num).to_a
range.each do |num|
if num % 3 == 0
if num % 7 == 0
if num % 5 == 0
puts("SuperFizzBuzz")
next
end
puts("SuperFizz")
def supafizbuz(max_num)
range = (0..max_num).to_a
range.each do |num|
a = num % 7 == 0 ? "Super" : ""
b = num % 3 == 0 ? "Fizz" : ""
c = num % 5 == 0 ? "Buzz" : ""
puts (a + b + c) == "" ? num : (a + b + c)
end
return nil