- Driver code
- Recursion
- Looping
- Enumerables
- Arrays
- Ping pong pairing
- Debugging
- Pseudocode
- Refactoring
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 choose_team(n, k) | |
return n if k == 1 | |
return 0 if n == 0 | |
choose_team(n-1, k-1) + choose_team(n-1,k) | |
end | |
puts choose_team(6,3) == 20 | |
puts choose_team(6,2) == 15 | |
puts choose_team(24,4) == 10626 |
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
# 1. Describe | |
# Contianer- A container is is simply a place to contain a collection of other objects | |
# They are used for storing objects in a specific way under set rules. | |
# ------------ | |
# 2. Implement a container with all even numbers from 1..100 | |
def container(array) | |
ray = Array.new | |
array.each do |x| | |
if x % 2 == 0 |
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
# 1: Grab a solution to Roman Numerals | |
# | |
# Source: https://gist.github.com/leeacto/ece0c63cfda0d022b536 | |
# Author: Nick lee | |
# ------------ | |
# 2. Explain the code in plain English | |
# Given a number, translate that number into a roman numeral. | |
# You have to create a set of numbers. The assign those numbers letters. | |
#Take your original number and run it through the set of numbers. |
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
class Die | |
def initialize(sides = 6) | |
@sides = sides | |
end | |
# Remember: rand(N) randomly returns one of N consecutive integers, starting at 0 | |
# So rand(N) returns a random integer in (0..N-1) | |
# And 1 + rand(N) returns a random integer in (1..N) | |
# See: http://www.ruby-doc.org/core-1.9.3/Kernel.html#method-i-rand | |
def roll |
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
# Feel free to ask other people to explain things to you. | |
#Remember, your understanding is the most important part. | |
# Include links to all three gists here. Ruby_Racer && Sudoku | |
# 1. https://gist.github.com/tarynsauer/d6e99f07b25a429cd755 | |
# 2.https://gist.github.com/nlprater/c2af4e1ff3b7074252f6 | |
# 3.https://gist.github.com/bahrieinn/65aee31bb545bbb089f9 | |
# Now, redo your most difficult week review challenge. |
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
<!doctype html> | |
<html> | |
<head> | |
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css"> | |
<link rel="stylesheet" href="main.css"> | |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800"> | |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900"> | |
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css"> | |
</head> |
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
<!doctype html> | |
<html> | |
<head> | |
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css"> | |
<link rel="stylesheet" href="main.css"> | |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800"> | |
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900"> | |
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css"> | |
</head> |
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
function Animal (name, legs) { | |
this.name = name; | |
this.legs = legs; | |
} | |
Animal.prototype.identify = function() { | |
console.log("I am a" + this.name "with 2 legs." "," this.name "have" +this.legs "legs"); | |
}; |
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
defmodule Todo do | |
use GenServer | |
## Client side code | |
def start(tasks \\ "") do | |
{:ok, pid} = GenServer.start(__MODULE__, tasks) | |
pid | |
end | |
def add_task(pid, task) do |
OlderNewer