:ex .
:Ex
| # CLI Exercises | |
| 1. Create a new directory in your home directory named flowers. | |
| 2. Create four directories in flowers/: petunia, violet, marigold, and seeds. | |
| 3. Create four files in violet/ | |
| - marigold-seeds.txt | |
| - marigold-food.txt | |
| - violet-seeds.txt | |
| - petunia-bulbs.txt | |
| 4. Copy the marigold related files to the marigold directory |
| def gcd *args | |
| divisors = args.map do |arg| | |
| (1..arg).select { |n| arg % n == 0} # find all divisors | |
| end | |
| divisors.inject(:&).max # find intersection of all arrays, grab max value | |
| end | |
| p gcd( 12, 24, 36 ) |
| def count_to limit, index = 1, nums = [] | |
| if nums.empty? | |
| nums = [1,2] | |
| end | |
| if index == limit | |
| return (nums) | |
| else | |
| next_digit = nums[-2] + nums[-1] | |
| if next_digit <= limit | |
| nums << next_digit |
| require 'sinatra' | |
| require 'sinatra/reloader' | |
| get '/coin_toss' do | |
| return ['Heads','Tails'].sample | |
| end | |
| get '/dice_roll' do | |
| rand(1..6).to_s | |
| end |
| @mixin transitions($transition) { | |
| -webkit-transition: $transition; | |
| -moz-transition: $transition; | |
| -o-transition: $transition; | |
| transition: $transition; | |
| } | |
| body{ | |
| @include transitions(color .5s ease); | |
| } |
| $color:blue; | |
| a{ | |
| green(#3E123E, 5%); | |
| } |
| a { | |
| color: #521852; | |
| } |