Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A test for potential devs
Ruby
tree: ff3de6929b

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
haml
rails
ruby
sql
.DS_Store
.gitignore
README.markdown

README.markdown

Jingle Punks Developer Exam

We're really excited that you've made it this far in the process!
The resources you'll find in this repo will help you answer the following questions:

HAML

Over 86% of our markup is haml so it'll be important to get up to speed with haml as soon as possible. I've added rendered markup from our contact page.

  • Convert ./haml/contact.html into ./haml/contact.html.haml

ANSWER:

  • haml/contact.html.haml

SQL

We're a MySQL shop so this test is MySQL centric. The './sql/setup.sql' file contains 'creates' and 'inserts' that only work for MySQL databases.
Also, though questions (1) & (2) are standard SQL questions, question (3) must be answered for MySQL databases.

** If you're a Postgres user, you'll have to perform your own translations to get the schema into your local db. **

Based on the schema & data ...

1) Find the users who are either a 'writer' or an 'editor' (You can only use the keyword 'SELECT' once):

REQUIRED OUTPUT COLUMNS:

  • user id,
  • first name,
  • last name,
  • role name,
  • state

ANSWER:

  • writersandeditors.sql

2) Find the count of all users WITHOUT addresses that are 'writers' and have '9' in their 'first_name' (You can only use the keyword 'SELECT' once):

REQUIRED OUTPUT COLUMNS:

  • 'homeless writers'

ANSWER:

  • homelesswriters.sql

3) Add indexes that would make the query in question 2 run faster.

ANSWER:

  • indexes.sql

RAILS

The models in this folder correspond to the database we created in the SQL section. Please perform the following tasks and add your work to the ./rails folder:

1) Create 2 Named Scopes that, when chained, can return all 'admins' that live in a specific state. Here are some example result sets the scopes should be able to get:

  • Scope1: All of the 'writers'
  • Scope2: Everyone that lives in 'FL'
  • Scope1 + Scope1: All of the 'editors' that live in 'MA'

ANSWER:

  • rails/user.rb

2) Add validation on the Address model.

  • We should only create an Address record if the zip code contains 5 numbers.

ANSWER:

  • rails/address.rb

3) Write 2 UNIT tests to confrim that your validation in Question(2) works. Those test should...

  • Confirm that VALID records PASS validation and CAN be created.
  • Confirm that INVALID records FAIL validation CANNOT be created.

ANSWER:

  • rails/test/unit/address_test.rb

4) The relationship between Users and Roles is pretty limited.

  • Update the relationship in 'user.rb' & 'role.rb' to allow a single user to have multiple roles.
  • Create any new files you'll need.

ANSWER:

  • rails/role_user.rb
  • rails/role.rb
  • rails/user.rb
  • rails/db/migrate/create_role_users.rb

5) Write a data migration script (in Ruby or SQL) that updates the existing records in the database to use the new code you created in Question (4).

ANSWER:

  • rails/db/migrate/create_role_users.rb
  • rails/lib/tasks/populateRoleUsers.rake

BONUS RUBY QUESTION

You don't have to answer this one, but if you wanted to, it'd be cool :)

Create a ruby deamon that monitors a domain (ex: www.google.com) in ./ruby . It should...

  • Ping every 5 seconds.
  • If the script doesn't get the response it expects, it should email 'admin@google.com'.
  • For Bonus Bonus Points: Report the isssue via growl using the 'ruby-growl' gem instead of sending an email.

ANSWER:

  • ruby/daemon.rb
Something went wrong with that request. Please try again.