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
| #!/usr/bin/env ruby | |
| fizz = 3 | |
| buzz = 5 | |
| puts 'Please enter an integer: ' | |
| number = gets.to_i | |
| puts '' | |
| puts 'Start' |
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
| people = { | |
| :fred => { :name => "Fred", :age => 23 }, | |
| :joan => { :name => "Joan", :age => 18 }, | |
| :pete => { :name => "Pete", :age => 54 } | |
| } | |
| people.sort_by { |k, v| | |
| v[:age] | |
| } |
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
| http://html5quintus.com/ |
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
| # Say hi to everybody | |
| def say_hi | |
| if @names.nil? | |
| puts "..." | |
| elsif @names.respond_to?("each") | |
| # @names is a list of some kind, iterate! | |
| @names.each do |name| | |
| puts "Hello #{name}!" | |
| end | |
| else |
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
| Thor | |
| Built-in ARGV | |
| Commander | |
| Slop | |
| http://www.sitepoint.com/ruby-command-line-interface-gems/ |
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 Github | |
| include HTTParty | |
| base_uri 'https://api.github.com' | |
| end | |
| Github.post("/user/repos", :query => { | |
| :access_token => @token | |
| }, | |
| :body => { | |
| :name => name, |
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
| require 'json' | |
| require 'httparty' | |
| class Github | |
| include HTTParty | |
| base_uri 'http://github.com/api/v2/json' | |
| # @param [String] username GitHub username | |
| # @param [String] password Password or API token | |
| def initialize(username, password) |
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 Board | |
| def initialize(height, width) | |
| @height = height | |
| @width = width | |
| @number_spaces = height * width | |
| end | |
| def height | |
| @height |
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 Board | |
| attr_reader :all_cells | |
| def initialize | |
| @all_cells = [] | |
| (0..99).each do |x| | |
| (0..99).each do |y| | |
| @all_cells << Cell.new(x, y) | |
| end | |
| 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
| http://ondras.zarovi.cz/sql/demo/ |
OlderNewer