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
# #How many different ways are there to flip a fair coin 5 times and not have three or more heads in a row? | |
# def combination(length=5) | |
# return [[]] if length == 0 | |
# combination(length-1).collect {|c| [:h] + c } + | |
# combination(length-1).collect {|c| [:t] + c } | |
# end | |
# combination | |
# puts "*There are #{combination.length} ways" | |
# puts combination.inspect |
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 SudokuBoard | |
attr_reader :rowdata, :columns | |
attr_writer :rowdata, :columns | |
def initialize(rowdata) | |
@rowdata = rowdata | |
@columns = create_columns | |
end | |
def create_columns | |
@columns = @rowdata.transpose |
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 SudokuBoard | |
attr_reader :rows, :columns, :data | |
attr_writer :rows, :columns, :data | |
def initialize(data) | |
if (data.respond_to? :join) | |
@data = data.join | |
else # If argument looks like an array of lines | |
@data = data | |
end |
Date: May 30, 2009
- Design is all about dependencies
- If you refer to something, you depend on it.
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
require 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
require 'uri' | |
puts "what website would you like to scrape?" | |
link = gets.chomp | |
URL = link |
- Download this application skeleton.
- Convert the app to use AJAX.
- Add any files you changed to your gist and submit your code.
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
<!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 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
//------------------------------------------------------------------------------------------------------------------ | |
// YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here. | |
//------------------------------------------------------------------------------------------------------------------ | |
function Animal(name, legs){ | |
this.name = name, | |
this.legs = legs | |
} | |
Animal.prototype = { | |
identify: function(){ |
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
$(document).ready( function() { | |
setInterval(function(){ | |
$(".frames").animate({ | |
marginLeft: '-=100%' | |
},1000, function(){ | |
$(this).find("li:last").after($(this).find("li:first")); | |
$(this).css({marginLeft:0}); | |
}) | |
},30); | |
}); |