typeof(3) 'number'
typeof(3) === typeof(4.32) true
5/0 Infinity
3/" bob"
| "use strict"; | |
| window.onload = function(){ | |
| for(var i = 1; i<=9; i++){ | |
| var canvas = document.getElementById(i.toString()); | |
| var context = canvas.getContext("2d"); | |
| context.fillStyle = "#111"; | |
| context.fillRect(0,0,90,90); | |
| } | |
| var board = document.getElementById("board"); |
| Code of Conduct | |
| We believe our events should be open for everyone. | |
| We are committed to providing a friendly, safe, and welcoming environment for all, | |
| regardless of gender, sexual orientation, disability, ethnicity, religion, | |
| preferred operating system, programming language, or text editor. | |
| We expect all event participants to help us realize a safe and positive experience for everyone. | |
| At all of our events, we expect everyone will: |
| class Person < ActiveRecord::Base | |
| attr_accessible :username, :password, :age, :graduation_year | |
| #must have first and last name. | |
| #If not present, throw an error message (optional) | |
| validates_presence_of :username | |
| validates_presence_of :password |
typeof(3) 'number'
typeof(3) === typeof(4.32) true
5/0 Infinity
3/" bob"
| class DFS | |
| attr_reader :adj_list, :parent | |
| def initialize(adj_list={}) | |
| @adj_list = adj_list | |
| @parent = {} | |
| end | |
| def dfs_run!(starting_node) |
| require '../lib/Queue' | |
| frontier = Queue.new | |
| neighbors = {} | |
| neighbors = {:a => [:b,:f], | |
| :b => [:a,:c,:d], | |
| :c => [:b,:e], | |
| :d => [:b,:e], | |
| :e => [:c,:d], | |
| :f => [:a,:g,:h,:i], | |
| :g => [:f], |
| def fibo(n) | |
| if n < 2 | |
| n | |
| else | |
| fibo(n-1) + fibo(n-2) | |
| end | |
| end | |
| puts fibo(8) |
| @fib_hash = {} | |
| @fib_hash = {0 => 0, 1 => 1 } | |
| def fibo_finder(n) | |
| if @fib_hash.has_key?(n) | |
| return @fib_hash[n] | |
| else | |
| @fib_hash[n] = fibo_finder(n-1) + fibo_finder(n-2) | |
| end | |
| end |
| class Queue | |
| include Enumerable | |
| attr_reader :queue | |
| def initialize | |
| @queue = Array.new | |
| end | |
| #enqueue(item) adds item to the end of the queue |
| #defines DFS Object. | |
| #currently only implements dfs_visit!, which only traverses the graph from one node | |
| #to fully implement DFS, need to loop through ALL starting nodes | |
| class DFS | |
| attr_reader :adj_list, :parent | |
| def initialize(adj_list={}) | |
| @adj_list = adj_list |