This file contains hidden or 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
.card { | |
padding:1.5rem; | |
box-shadow:0 1px 2px #aaa; | |
background:white; | |
margin:0 1rem 1rem; | |
border-radius:3px; | |
user-select:none; | |
animation:fly-in-from-left .5s 1s ease both; | |
transform-origin:top left; | |
} |
This file contains hidden or 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
puts '====================' | |
puts '======BOWERIZE======' | |
puts '====================' | |
puts '1. What\'s the name of your super awesome Bower package?' | |
@package_name = gets.chomp | |
puts '2. What is your GitHub username?' | |
@github_username = gets.chomp |
This file contains hidden or 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
# load libraries | |
require 'rubygems' rescue nil | |
require 'wirble' | |
#require 'json' | |
alias q exit | |
class Object | |
def local_methods | |
(methods - Object.instance_methods).sort |
This file contains hidden or 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 power_sum(base, expo) | |
num = base | |
2.upto(expo) { |i| num *= base } | |
sum = 0 | |
num.to_s.split(//).each { |i| sum += i.to_i } | |
p sum | |
end |
This file contains hidden or 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?(num) | |
2.upto(num-1) { |i| return false if ((num % i) == 0) } | |
true | |
end | |
def largest_prime(num) | |
primes = [] | |
1.upto(num) { |i| primes << i if num % i == 0 && is_prime?(i) } | |
p primes.last |
This file contains hidden or 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 three_five(max) | |
nums = [] | |
1.upto(max-1) { |i| nums << i if i % 3 == 0 || i % 5 == 0 } | |
p nums.reduce(:+) | |
end |
This file contains hidden or 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_palindrome?(num) | |
num == num.to_s.reverse.to_i ? true : false | |
end | |
def palindromatic | |
range = *(100..999) | |
results = [] | |
range.each { |i| range.each { |x| results << (i*x) if is_palindrome?(i*x) } } |
This file contains hidden or 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 small_multiple(max) | |
range = *(1..max) | |
nums = [] | |
results = [] | |
range.each { |i| range.each { |x| nums << i*x } } | |
nums.each { |i| | |
range.each { |x| | |
answers = [] | |
i % x == 0 ? answers << 'true' : answers << 'false' | |
results << i if !(answers.include? 'false') |
This file contains hidden or 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?(num) | |
2.upto(num-1) { |i| return false if ((num % i) == 0) } | |
true | |
end | |
def sum_primes(max) | |
sum = 0 | |
2.upto(max-1) { |i| sum += i if is_prime?(i) } | |
p sum | |
end |
This file contains hidden or 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 largest_product(num) | |
nums = num.to_s.split(//) | |
products = [] | |
i = 5 | |
0.upto(nums.length-1) { |i| | |
products << nums[i].to_i*nums[i-1].to_i*nums[i-2].to_i*nums[i-3].to_i*nums[i-4].to_i | |
} | |
p products.sort.last |