Instantly share code, notes, and snippets.

# Justin Tallant jtallant

Last active August 29, 2015 14:02
vagrant-demo

# Generate an SSH Key

You probably already have a public and private key. Check and make sure.

`ls -a ~/.ssh | grep id`

=> id_rsa
=> id_rsa.pub

Created February 23, 2012 06:55
Set height of Genesis Footer Widgets to equal height of tallest widget (Javascript)
Last active October 3, 2015 02:28
Code Academy Long Challenge 1: Shopping Cart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 # Long challenge: Based on the following data, # write code that prints out the customer's total, including estimated # sales tax, based on the shipping address they entered. # Your code should work even if the values of the data change. # Your output should look like this: "Your total with tax is \$4455.54." shopping_cart = [ {:name => "iPad 2", :price => 499, :quantity => 2},
Created April 24, 2012 08:49
Amazon Cart With Classes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 class Cart def initialize @the_cart = [] end def add(item, quantity) @the_cart << { :item => item, :quantity => quantity } end def total
Created June 25, 2012 13:51
Project Euler Problem 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 # Project Euler Problem 2 # Each new term in the Fibonacci sequence is generated by adding the previous two terms. # By starting with 1 and 2, the first 10 terms will be: # 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... # By considering the terms in the Fibonacci sequence whose values do not exceed four million, # find the sum of the even-valued terms.
Created July 1, 2012 17:24
Project Euler Problem 1 Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 # If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. # Find the sum of all the multiples of 3 or 5 below 1000. sum, i = 0, 0 while i < 1000 sum += i if i % 3 == 0 || i % 5 == 0 i += 1 end puts sum # => 233168
Created July 2, 2012 01:00
Project Euler Problem 3 Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 # if n is 1, end the method and return empty array # set var factor = first number in range 2..n # that has a remainder of 0 when divided by x # x being the current iteration of 2..n # put factor var into an array and then call the # method we are currently in again passing the # value of n divided by the current value of factor def prime_factors(n) return [] if n == 1
Created July 2, 2012 03:21
is_prime? ruby method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 def is_prime?(n) ((2..(Math.sqrt(n)))).each do |i| return false if n % i == 0 end return true end
Created July 7, 2012 05:31
Project Euler Problem 4 Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 # A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 99. # Find the largest palindrome made from the product of two 3-digit numbers. def looped_palindrome(num1,num2=num1) product = 0 while num1 > 900 product = num1 * num2 return product if product.to_s == product.to_s.reverse if num2 > 900 num2 -= 1
Created July 11, 2012 23:04
Ruby Getters and Setters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 class Prescription # setter for rx_name def rx_name=(value) @rx_name = value end # setter for patient name def patient_name=(value) @patient_name = value end