Skip to content

Instantly share code, notes, and snippets.

@TylerRockwell
TylerRockwell / gist:3ff0cfeeb1a98c2f6dc6
Created September 23, 2015 13:24
Enumerable Challenge
require 'minitest/autorun'
require 'minitest/pride'
# Write a series of methods which use the .any, .all, .map, .select, .reject, and
# .reduce methods in Enumerable. Each of your methods should be one line.
def has_even?(arr)
arr.any?(&:even?)
end
@TylerRockwell
TylerRockwell / gist:b4a759870d96f9789105
Last active September 28, 2015 14:10
Include Challenge
require 'minitest/autorun'
require 'minitest/pride'
# Write modules which will be included in the classes below which will give
# intelligent and bipedal behavior.
#
# You may not write any methods in the existing classes, but you may write
# `include` statements in them.
module Speak
def say_name
@TylerRockwell
TylerRockwell / gist:b6e7b5e19772331f18ed
Last active September 29, 2015 13:42
In Class Challenge - 9-29-15
Detailed Ruby Questions
When would you use a hash instead of an array?
An array would be used to store multiple values in an ordered list. A hash should be used when you
need to store key value pairs. For example, if you were to store a person's information, putting it in
an array would require that you remember the order that the information is stored in, and this could change
as the information is changed or updated. Using a hash, however would allow you to store information by named keys.
So, to access a person's phone number you could use person[:phone_number] instead of person[3].
When would you use a symbol instead of a string?
What command do you run if you want to discard all changes since your last commit?
git stash
What command do you use if you run git add and then want to revert it?
git reset
What command do you use if you run git commit and then want to revert it?
git checkout **previous commit id**
that other command that fixes detached head mode that I always have to google.
require 'minitest/autorun'
require 'minitest/pride'
# Write a method which returns the first n primes, where n is provided to the
# method as a parameter.
#
# Remember that the % operator (modulo) is your friend. It returns a zero if one
# number is divisible by another number. In other words, 4 % 2 == 0.
# WRITE YOUR CODE HERE. Name your method `primes`.
@TylerRockwell
TylerRockwell / challenge.rb
Last active October 27, 2015 13:32
Challenge 10-27.rb
require 'minitest/autorun'
require 'minitest/pride'
# Write a method which accepts an array as the first paramater and a number
# as the second parameter. Return true if two of the numbers in the array sum
# to the second parameter.
def complements?(array, sum)
return false unless array
return false if array.length < 2

D3

d3.select("item"); - selects an element on the page. Stores much more than DOM

d3.selectAll("item"); - selects all items of a given element on a page

d3.select(this);

d3.select("svg").select("circle");

@TylerRockwell
TylerRockwell / FP Overview.md
Created October 29, 2015 22:57
Final Project Stuff

This web app will allow a business to:

  • Track sales

  • Quickly identify most profitable products and categories

  • Know what to keep on shelves and what to drop

  • Stop wasting time on unprofitable activities

  • Produce visual at-a-glance data about sales performance

  • Track inventory levels

password
123456
12345678
1234
qwerty
12345
dragon
pussy
baseball
football
password
123456
12345678
1234
qwerty
12345
dragon
pussy
baseball
football