Skip to content

Instantly share code, notes, and snippets.

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, num)
if array.length < 2 || array.length == nil
false
How to do Files on the web 10:25
We are working in the "public" folder
if we want to use something in the public folder, go to views/where you want it/html page you want it
<%= image_tag "name/png%>
all the files are accesible immediately on the root.
anything that's in public is available to anyone all the time
if there are images that should be seen only when logged in, you put them in the asset pipelime
public is where developers (not users) put images
files that users can upload:
def all_permutations(array)
a = []
if array.length == 0
return [[]]
elsif array.length == 1
a << (array)
end
end
Would you rather use RubyMine, vim, or Sublime Text? Why?
Of the three, I would rather use Sublime text because I am most familiar with it. However, I have used both Sublime and Atom, and of the two, I prefer Atom. However, I'm interested in trying RubyMine because of various features including Cucumber and Shoulda tests.
What is the difference between an INNER JOIN and a LEFT JOIN? INNER JOIN gets all records from one table that have some related entry in a second table
Which of these behaviors in a Rails app would require JavaScript? (you can pick more than one)
Scrolling down to a different part of the page (smoothly) when you click on a link in a menu.
Making the color of a background change over time.
Git/GitHub
Git is a version control system, a tool to manage all the different versions of your code. GitHub is an online hosting service for your git repositories.
When you start a project, you want to 1. create a file locally (in C9), 2. create a new repository in GitHub** 3. connect the two
That’s (mostly) it.
**Check out this 1-minute tutorial on how to create a new repo on GitHub: https://www.youtube.com/watch?v=LR5BYZjuXMU