Skip to content

Instantly share code, notes, and snippets.

View andersr's full-sized avatar
😅
Focusing

Anders Ramsay andersr

😅
Focusing
View GitHub Profile
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
// removed /sitewide from require_tree
//
@andersr
andersr / gist:6140333
Created August 2, 2013 14:36
application.rb
require File.expand_path('../boot', __FILE__)
require 'rails/all'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
@andersr
andersr / gist:6140340
Created August 2, 2013 14:37
application.rb
require File.expand_path('../boot', __FILE__)
require 'rails/all'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
@andersr
andersr / gist:6626928
Last active December 23, 2015 11:18
FS 003 Ruby Assessment
# Ruby Assessment: https://gist.github.com/aviflombaum/ae78e0559cf51a58aad7
# Name: Anders Ramsay
### 1. Arrays ###
array = ["Blake","Ashley","Jeff"]
# a. Add an element to an (existing) array.
array << "Bill"
1. Hello Alien!
2. IF you have a left and a right arm AND IF you have something at the end of each arm that can grasp objects AND IF you are able to visually distinguish between different object shapes and colors, continue to the next step, ELSE stop here. No PBJ sandwich for you, sorry!
3. Henceforth, your Left Hand will be referred to as "LH" and your Right Arm will be referred to as "RH"
4. Next, we will collect and label all the objects on the table.
5. Reach out and grasp an object on the table.
6. IF the object is round and flat, this object is a "Plate" ELSE IF the object is soft to the touch, this object is "Bread Loaf" ELSE IF the object is narrow with one side that is sharp to the touch, this object is a "Knife" ELSE IF the object is hard, has a cylindrical shape and you can see a brown substance inside, this is a "Peanut Butter Jar" ELSE the object is a "Jelly Jar"
7. Set down the object in an empty space on the table and note the location of where you placed the object.
8. Repeat steps 5,6, a
@andersr
andersr / anders_ramsay_profile.md
Last active December 23, 2015 19:39
FS Profile
@andersr
andersr / SQL Command 1: Create Table artists
Last active December 23, 2015 21:49
FS 003 - SQL Schema and Tables
CREATE TABLE artists(
name TEXT,
age INTEGER,
instruments TEXT,
songs TEXT,
genres TEXT
);
@andersr
andersr / fizzbuzz.rb
Last active December 23, 2015 23:19
FizzBuzz
fizz, buzz, fizz_buzz, no_buzz = [], [], [], []
(1..50).each do |n|
if (n % 3 == 0) && (n % 5 == 0)
fizz_buzz.push(n)
elsif n % 3 == 0
fizz.push(n)
elsif n % 5 == 0
buzz.push(n)
else
@andersr
andersr / gist:6728873
Last active December 24, 2015 02:09
phone
# Download this file:
# https://gist.github.com/scottcreynolds/ac1b5c8d96de0c91bf7c/download
# Run it from your terminal with:
# ruby ruby_phone_format.rb
# (Just make sure you are in the right directory)
# ======================================
# Ignore All This Code
# ======================================

You're new on the job and have been given ownership of the company's jukebox application. Unfortunately, before you can even begin adding cool new features to make it much, much more awesome than it is now, you fire it up and it won't even run! Now you have to go through the code and squash all the bugs (there's a bunch!).

Given the following spec, dive into the code and fix one problem at a time until the program's output matches the spec and there are no errors!

to run the program, type ruby runner.rb

Remember!

  1. read your error messages carefully, check error messages and line numbers
  2. use pry or irb to check your assumptions!
  3. not all bugs will throw errors, check the output against the spec!