blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
4
137
path
stringlengths
2
355
src_encoding
stringclasses
31 values
length_bytes
int64
11
3.9M
score
float64
2.52
5.47
int_score
int64
3
5
detected_licenses
listlengths
0
49
license_type
stringclasses
2 values
text
stringlengths
11
3.93M
download_success
bool
1 class
5c360283eb64f5081bc0e8cc2d73c33561eb4f16
Ruby
arnabs542/Programming-Interview-Questions
/Problems/Ruby/Sorting/merge_2_sorted_lists.rb
UTF-8
1,180
4.09375
4
[ "MIT" ]
permissive
require_relative 'implement_linked_list' # Write a merge_2_sorted_lists function that takes two lists, each of which is sorted in increasing order, # and merges the two together into one list which is in increasing order. # merge_2_sorted_lists should return the new list, which should be made by splicing together the ...
true
c0ff51553e5a2e07d853854913eff2f58ffb24a1
Ruby
randy-darsh/ultra_battleship
/test/board_test.rb
UTF-8
1,128
3.046875
3
[]
no_license
require 'minitest/autorun' require 'minitest/emoji' require './lib/board' class BoardTest < Minitest::Test def setup @b = Board.new end def test_it_exists assert_instance_of Board, @b end def test_it_has_a_grid assert_equal [[' ', ' ', ' ', ' '], [' ', ' ', ' ', ' '], ...
true
ed9011e28585cd1247ecd4d4fe21005312abfa9c
Ruby
adamjkalt/Upcoming_Nintendo_Switch_Games_cli_app
/UpcomingNintendoSwitchGames/lib/UpcomingNintendoSwitchGames/cli.rb
UTF-8
829
3.34375
3
[ "MIT" ]
permissive
class UpcomingNintendoSwitchGames::CLI attr_accessor :name, :release_date, :url, :developer, :genre, :rating, :summary, :games def call list_games menu end def list_games puts "Upcoming Nintendo Switch Games" @games = Game.today @games.each_with_index {|game, index| puts "#{index + 1}. #{game.name} - #{g...
true
6662a3c76d2ddd5af01696ae2bbc90899e693520
Ruby
neugierige/prep-work
/coding-test-1/practice-problems/problems/13-capitalize-words.rb
UTF-8
1,256
4.65625
5
[]
no_license
# Write a method that takes in a string of lowercase letters and # spaces, producing a new string that capitalizes the first letter of # each word. # # You'll want to use the `split` and `join` methods. Also, the String # method `upcase`, which converts a string to all upper case will be # helpful. # # Difficulty: medi...
true
1b8f91f0be65d6a302eb93c61e156cf36f808b0e
Ruby
appsignal/appsignal-ruby
/spec/support/helpers/std_streams_helper.rb
UTF-8
2,435
3.09375
3
[ "MIT" ]
permissive
module StdStreamsHelper def std_stream Tempfile.new SecureRandom.uuid end # Capture STDOUT in a variable # # Given tempfiles are rewinded and unlinked after yield, so no cleanup # required. You can read from the stream using `stdout.read`. # # Usage # # out_stream = Tempfile.new # cap...
true
66c5d9cba365095a1046cd1a35231866c6d59920
Ruby
StefanoMartin/active-orient
/examples/books.rb
UTF-8
3,702
2.734375
3
[ "MIT" ]
permissive
=begin Books Example There are several Books. And there is a Table with Keywords. These are our Vertex-Classes The Keywords are associated to the books, this is realized via an Edge »has_content« This Example demonstrates how to build a query by using OrientSupport::OrientQuery =end class BooksExample def init...
true
56b98782355be6ba2d7356cb566b6b6158656fb7
Ruby
AntonFagerberg/BM-Elite-Force
/levels/fly_by.rb
UTF-8
4,286
2.8125
3
[]
no_license
require 'levels/level' require 'backgrounds/space_background' require 'entities/players/monkey_cat' require 'entities/players/mewfinator' require 'entities/players/tommy_gun' require 'entities/players/dunderino' require 'entities/players/doris' require 'entities/players/metal_mack' class FlyBy < Level def initialize...
true
76077e72dd59939e8d62700bec30e3858b4d3c84
Ruby
henriquegavabarreto/learn_ruby
/05_book_titles/book.rb
UTF-8
635
3.78125
4
[]
no_license
class Book attr_accessor :title def title lil_word = ["for", "and", "nor", "but", "or", "yet", "so", "in", "the", "of", "a", "an"] new_title = "" words = @title.split(" ") words.each_with_index do |word, index| is_lil_word = false lil_word.each do |con| if word == con &&...
true
997a0f6d1029c927120b70ec772e68010488335a
Ruby
mmarroquin/tdi.1.2014
/Spree/mystore/app/models/crm.rb
UTF-8
4,140
2.578125
3
[]
no_license
class Crm < ActiveRecord::Base require 'rest_client' require 'uri' require 'json' def self.crm(rut, direc) @rut_empresa=rut @input_id=direc #Aca definimos los parametros para acceder a la API # @r guarda la informacion del login. @r="" #usuario... @user='grupo1' #URL's del webservi...
true
cb86b61e3118cc55ae1d90bc23a416b45e6dac4d
Ruby
Nadav-Rosenberg/takeaway-challenge
/lib/customer.rb
UTF-8
513
2.984375
3
[]
no_license
class Customer attr_reader :name, :telephone, :order def initialize name, telephone @name = name @telephone = telephone @order end def start_order order_class @order = order_class.new end def look_at_menu order.present_menu end def pick(*options) order.pick_items options end ...
true
e49421edb792239d723e070b3096579fc9641a08
Ruby
reednj/i2c-oled
/oled-rect.rb
UTF-8
312
2.9375
3
[]
no_license
require './lib/oled' class App def main display = OLEDDisplay.new display.fill_color = OLEDDisplay::COLOR_WHITE w = 16 h = 16 x = -w loop do display.clear_buffer display.fill_rect x, 4, w, h display.write_buffer x += 1 x = -w if x >= display.width end end end App.new.main
true
a5c3b1d266cdb5b180cbb7d0b41598a848aa015e
Ruby
knightjoe2222/Advent-of-Code-2017
/day11.rb
UTF-8
929
3.953125
4
[]
no_license
# Take input in, split and assign to directions input = open("text11.txt").read directions = input.strip.split(',') # I will manipulate x, y and z in accordance to # hexagonal grids as described: https://www.redblobgames.com/grids/hexagons/#distances x = 0 y = 0 z = 0 distances = [] # The increment/decrement rules a...
true
5b6bb70b37eaa1d0ce0c21a00282b36ace7b5506
Ruby
AnjaLaube3000/Rentosaurus2.0
/db/seeds.rb
UTF-8
778
2.625
3
[]
no_license
puts "Cleans DB..." Booking.destroy_all Dinosaur.destroy_all User.destroy_all puts "Adds 5 new User records..." 5.times do user = User.create!( name: Faker::FunnyName.name, password: 'valid_password', password_confirmation: 'valid_password', email: Faker::Internet.email ) puts "Adds 2 new Dinos...
true
8452bf1932820414f0e32b3f5dfc7c8106207917
Ruby
MikhailMS/TwitterProject
/auto_follow.rb
UTF-8
901
2.640625
3
[]
no_license
require 'timers' def autoFollow @potentialUsers = Hash.new() timers = Timers::Group.new auto_timer = timers.every(7200) file = File.open('lastID.txt', 'r') last = file.read file.close @most_recent = @client.search('Company Name').take(50) first = true newLast = '' @m...
true
0dcf41143e00162ac928c943d0796d272687cd7b
Ruby
lingdudefeiteng/pipette
/bulk/join_bams.rb
UTF-8
1,239
2.515625
3
[]
no_license
#!/usr/bin/env ruby $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'sample_report' bam_dir = ARGV[0] output_dir = File.join(bam_dir, "joined_bams") system("mkdir -p #{output_dir}") sample_report_filename = File.join(bam_dir, "Sample_Report.csv") if !File.exists? sample_report_filename puts "ERROR: no sample ...
true
bf59080e17e08a23b8472bff70c8ff8c1d9d2860
Ruby
univbox/CodeEval
/Ruby/Easy/SELF DESCRIBING NUMBERS/selfdescribeingnumbers.rb
UTF-8
330
3.265625
3
[]
no_license
File.open('in.txt').each_line do |line| num_arr = [0,0,0,0,0,0,0,0,0,0] line.chop! numbers = line.split("") numbers.each do |num| num_arr[num.to_i] += 1 end right = 1 position = 0 numbers.each do |num| if num != num_arr[position.to_i].to_s right = 0 end position += 1 end puts ...
true
28de202370c93f6be28e9c2fea85ac5c34218829
Ruby
t6d/blacksmith
/lib/blacksmith/font_builder.rb
UTF-8
1,162
2.828125
3
[ "MIT" ]
permissive
class Blacksmith::FontBuilder class << self def execute(*args, &block) new(*args, &block).execute end end def initialize(filename = nil, &block) raise "Expects filename or block" unless filename || block raise "Expects either a block or a filename - not both" if filename and blo...
true
269a5cde2227f9ca59fcf44f14fc2bfa5fdf31ed
Ruby
loveo/ID2222
/2/lib/item_set.rb
UTF-8
1,161
3.421875
3
[]
no_license
# Represents an item set of any size class ItemSet attr_reader :item_ids attr_reader :id, :support def initialize(ids, support=0) @id = ids[0] @item_ids = ids[1 .. -1] @support = support @mutex = Mutex.new end # Checks this item set against a basket # and increases its support ...
true
61c87dd64af00e201946e6a02f6437f8d8a025ce
Ruby
MIKEALGEE/Homework_day3
/excervise_B.rb
UTF-8
1,596
3.015625
3
[]
no_license
users = { "Jonathan" => { :twitter => "jonnyt", :lottery_numbers => [6, 12, 49, 33, 45, 20], :home_town => "Stirling", :pets => [ { :name => "fluffy", :species => "cat" }, { :name => "fido", :species => "dog" }, { :name => "spike", :species => "d...
true
e06017589db23bfa3afa2b6419b2283c0a130450
Ruby
takafan/hessian2
/test/fiber_concurrency/mysql2_query.rb
UTF-8
659
2.515625
3
[ "MIT" ]
permissive
require 'em-synchrony' require 'em-synchrony/mysql2' require 'em-synchrony/fiber_iterator' require 'yaml' options = YAML.load_file(File.expand_path('../../../spec/database.yml', __FILE__)) puts options.inspect number_of = 10 concurrency = 2 connection_pool_size = 4 results = [] db = EM::Synchrony::ConnectionPool.new...
true
2bf3c874c6629f34e07b850b0960729d82fbc968
Ruby
freegeek-pdx/fgdiag
/bin/fake_badblocks
UTF-8
331
2.9375
3
[]
no_license
#!/usr/bin/ruby count = 10 count.times {|i| $stderr.puts "%s: %d / %d" % ['meow' * 20, i+1, count] $stderr.flush sleep 1 } $stderr.puts "meow" * 100 $stdout.puts "bad sector found at sector 10" $stdout.flush while true $stderr.puts "%s: %d / %d" % ['meow' * 20, count + 1, count] $stderr.flush s...
true
211cb73a99d61faa8c5cccb563d70f4a6e34e3bc
Ruby
jcreiff/exercism
/ruby/triangle/triangle.rb
UTF-8
347
3.28125
3
[]
no_license
class Triangle def initialize(sides) @sides = sides.sort @valid = @sides[0..1].sum > @sides.last @lengths = sides.uniq.count end [['equilateral?', :==, 1], ['isosceles?', :<=, 2], ['scalene?', :==, 3]].each do |name, operator, number| define_method(name.to_sym) { @valid && @lengths.send(ope...
true
1baa166653b60ee1678a2302e9b5f7a9e820e91f
Ruby
ssheehan1210/ruby-reps-101
/reps.rb
UTF-8
3,728
4.875
5
[]
no_license
# write your reps here # makes sure to either `p my_output` or `puts my_output`. # `p _variablename_` prints the full Object # `puts _variablename_` prints the Object.to_s (.toString()) # to run, just `ruby reps.rb` # Round 1: # Write a function lengths that accepts a single parameter as an argument, # namely an arr...
true
b41389958d4a06f344ecd220b7b69cd03c57197a
Ruby
SchmuhlFace/phase-0-tracks
/ruby/gps2_2.rb
UTF-8
4,947
4.15625
4
[]
no_license
# Release 0 def create_grocery_list(str_items) grocery_list = {} str_items.split(" ").each do |item| grocery_list[item]= 1 end grocery_list end <<<<<<< HEAD def add_item(list, str_item, num) list[str_item] = num list end def update_quantity(list,str_item,new_num) list[s...
true
6d0ecca188712cc6ea6afdb81f2934cd3d493d13
Ruby
daveroberts/script-runner
/backend/app/models/queue_item.rb
UTF-8
4,382
2.5625
3
[]
no_license
require './app/database/database.rb' require 'securerandom' # manages scripts in database class QueueItem def self.columns [:id, :queue_name, :state, :item, :summary, :image_id, :created_at] end def self.add(queue_name, item, options={ summary: nil, image_id: nil }) image_id = options[:image_...
true
2d5c01155d57412f573249d8b6ebf8221f5b111c
Ruby
nkhosla91/ruby-enumerables-reverse-each-word-lab-nyc-web-082619
/reverse_each_word.rb
UTF-8
138
3.609375
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def reverse_each_word(string) newarray = string.split(" ") revarray = newarray.collect { |word| word.reverse} revarray.join(" ") end
true
1103f539fe07d85e2af98ca7265371a09c1620df
Ruby
cameronjkelley/the_odin_project
/ruby/tic_tac_toe/tic_tac_toe.rb
UTF-8
2,828
3.828125
4
[]
no_license
module TicTacToe class Player attr_accessor :name, :mark, :moves def initialize(name, mark) @name = name @mark = mark @moves = [] end end class Grid attr_accessor :grid, :cells def initialize @grid = [ ["1", "|", "2", "|", "3"], ["-", "|", "-", "|", "-"], ["4", "|", "5", "|", ...
true
9c3cc4336c91dfd10675d0be305116048bd95ff8
Ruby
micahboyd/shame-bot
/shamebot/bot.rb
UTF-8
1,944
2.84375
3
[]
no_license
module ShameBot class Bot < SlackRubyBot::Bot help do title 'Wall of Shame' desc 'Here are recorded those who have made embarassing blunders' command 'add team' do desc 'Add a team to the Wall of Shame' long_desc 'type "add team "TEAM NAME"" to add a team to the Wall of Shame'...
true
ba186e2b99b4ca84eabc06e11067349d442b857a
Ruby
silvstar0/leaderbits-ReactRoR
/lib/organization_monthly_activity_report.rb
UTF-8
2,190
2.53125
3
[]
no_license
# frozen_string_literal: true class OrganizationMonthlyActivityReport include ActionView::Helpers::NumberHelper def initialize(organizations) @organizations = organizations fetch_data end def increment_for_organization(organization) user_ids = organization.users.pluck(:id) was = @two_months...
true
5f6980164f8b782788a64040a7fb5690d4c0ed7c
Ruby
rfleur01/RB101-109
/Small_Problems/easy_3/oddities.rb
UTF-8
151
3.546875
4
[]
no_license
def oddities(array) odd_elements = [] index = 0 while index < array.size odd_elements << array[index] index += 2 end odd_elements end
true
87db4057ace96e26dbf9a9a083c06b64bb94ee51
Ruby
chiwenchen/awesome_list
/app/services/graphql/response.rb
UTF-8
502
2.609375
3
[]
no_license
module Graphql class Response attr_reader :raw_response def initialize(raw_response) @raw_response = raw_response end def success? errors.blank? end def fail? !success? end # for successful response def json_data JSON.parse(raw_response.data.to_json) ...
true
7efaa17221e6d20b7e62fa3e694d2ace181c35b9
Ruby
jesperglad/vikiwar
/app/models/order.rb
UTF-8
14,391
2.609375
3
[]
no_license
class Order < ActiveRecord::Base belongs_to :unit belongs_to :area_element validates_numericality_of :turn # # Order Parser # def Order.next_part the_order_string the_comma_index = the_order_string.index(',') the_return_string = the_order_string.slice!(0, the_comma_index+1) ...
true
bbd899e3ce820e01f4ca166028105191dab066be
Ruby
jjwyse/sniktau
/app/services/user_mountains/create_service.rb
UTF-8
940
2.84375
3
[]
no_license
module UserMountains class CreateService def self.execute!(activity:) # Find any Mountains close to the given Activity mountains = activity .locations .map { |location| mountains_within(lat: location.lat, lng: location.lng) } .compact .flatten .uniq # Cr...
true
c906a81fac2cd9c63cd596d3b5fe02c52097e97c
Ruby
sarahvoshall/rb101
/easy_3/palindrome_2.rb
UTF-8
378
3.53125
4
[]
no_license
def palindrome?(string) string == string.reverse end def real_palindrome?(string) mod_string = string.downcase.delete(" ").gsub(/[[:punct:]]/, '') palindrome?(mod_string) end p real_palindrome?('madam') p real_palindrome?('Madam') p real_palindrome?("Madam, I'm Adam") p real_palindrome?('356653') p r...
true
6c66c1a0ae4599ccfb194ec8c71ba74c336319d2
Ruby
preiser/ruby-object-initialize-lab-q-000
/lib/dog.rb
UTF-8
275
3.359375
3
[]
no_license
class Dog def initialize(name,breed = "Mut") @name = name @breed = breed end def name @name end def name=(dog_name) @name=(dog_name) end def breed @breed end def breed=(breed_name) @breed=(breed_name) end end
true
e7379a595184d71d651539f59a463840b0f19b3b
Ruby
yazan9/joinshift
/app/controllers/perspectives_controller.rb
UTF-8
1,536
2.546875
3
[]
no_license
require 'DimensionsCalculator' class PerspectivesController < ApplicationController def new @Questions = Question.all @Perspective = Perspective.new end def all @Perspectives = Perspective.all end def create #@Perspective = Perspective.new(perspective_para...
true
fc3c25003c22326c5a30f3f6904ffb518ffe127e
Ruby
xTriad/whiteboard
/app/models/user.rb
UTF-8
3,729
2.609375
3
[]
no_license
class User < ActiveRecord::Base rolify # Setup selected Devise modules devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable # Setup accessible (or protected) attributes for your model attr_accessible :role_ids, :as => :admin attr_accessible :name, :email, ...
true
fc3a2fe4cc2c05f3d36f76c4d685b7681f8d590b
Ruby
brockboland/daily_file_parse
/parse.rb
UTF-8
1,494
3.375
3
[]
no_license
require 'date' # Get the file (first argument to the script) path = ARGV[0] if (!path || path.empty?) puts "Usage: ruby parse.rb <path to file>" exit # Make sure the file exists elsif (!File.exists?(path)) puts "File does not exist." exit end # Initialize variables date = '' date_logs = {} text_lines = [] #...
true
d19bb3dc39298ec804aa60b53950ed5808bbb47f
Ruby
hkeefer18/RB101-and-Small-Problems
/small_problems/medium_1/4.rb
UTF-8
754
3.859375
4
[]
no_license
=begin Create an array (1..n).to_a array product ['on'] Create hash from array counter = 2 Iterate through hash. If hash key is a multiple of counter, and value is on, set value to off or if off set value to on. If statement with ternary operator. Counter += 1 Break if counter > n Convert hash back to array Se...
true
d81308d4bd6bada57d7f513c2b72f07c3071f31f
Ruby
bmulvihill/apriori
/lib/apriori/list.rb
UTF-8
659
3.046875
3
[ "MIT" ]
permissive
module Apriori class List attr_reader :sets def self.create_subsets(set) (1).upto(set.size - 1).flat_map { |n| set.combination(n).to_a } end def initialize(sets) @sets = sets end def size return 0 if sets.empty? sets.first.size end def make_candidates ...
true
298665f863248ef454531a5efea2f99b8be57535
Ruby
AlejandroFrias/Aerospace-Services
/hmcBuildingService/db/seeds.rb
UTF-8
1,025
2.859375
3
[]
no_license
# Seeds the database from hand inputted data def classes?(b) class_rooms = "SHAN, LAC, PA, ON, GA, BK, KE, JA, SP" !class_rooms[b.code].blank? end def dining_hall?(b) dining_halls = "HOCH" !dining_halls[b.code].blank? end def food?(b) food = "HOCH, SHAN" !food[b.code].blank? end def music?(b) musi...
true
ebe8750b6c747ad9aa07fe456d212c8c185ac0e8
Ruby
bureaucratix/oo-counting-sentences-seattle-web-career-042219
/lib/count_sentences.rb
UTF-8
330
3.5
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' class String def sentence? self[-1] == '.' end def question? self[-1] == '?' end def exclamation? self[-1] == '!' end def count_sentences punctuation = ['.', '?', '!'] split_string = split(Regexp.union(punctuation)) split_string.delete('') split_string.length ...
true
de31ad89933e84cacc0d89f0bc71c4006f3f542b
Ruby
alicia0408/desafio_2_arreglos
/desafio2.rb
UTF-8
373
3.546875
4
[]
no_license
nombres = ['Violeta', 'Andino', 'Clemente','Javiera', 'Paula', 'Pía', 'Ray'] name1=nombres.select {|x|x.length>5} print name1 puts name2= nombres.map {|x|x.downcase} print name2 puts name3=nombres.select {|x|x if x[0]=="P"} print name3 puts name4=nombres.count {|x|x if x[0]=="A" || x[0]=="B"|| x[0]=="C"} print name4 p...
true
fa8970dacb3b04f5b322d9c89c82c9378e7d84cb
Ruby
jamespmernin/Ruby-Cars
/cars.rb
UTF-8
1,188
3.84375
4
[]
no_license
class Car attr_accessor :make, :model, :year, :color, :miles def initialize(make, model, year, color) @make = make @model = model @year = year @color = color @miles = 0 end def seen_another_year @miles += 15000 end def details details_string = "This #{year} #{make} #{model} has #...
true
2b898f8fa2cc97cb7db6e5ec333413bea87a8adf
Ruby
imkaruna/flatiron-bnb-methods-v-000
/app/models/city.rb
UTF-8
1,595
2.625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class City < ActiveRecord::Base has_many :neighborhoods has_many :listings, :through => :neighborhoods has_many :reservations, :through => :listings extend Statistics::ClassMethods def city_openings(date1, date2) open_listings = self.listings.select do |listing| !listing.reservations.any?{|rese...
true
2b7bd199bfa84c5e4f373b92e24832f64039c995
Ruby
401ChemistryGenealogy/ChemistryGenealogy
/backend/app/models/supervision.rb
UTF-8
16,410
2.65625
3
[]
no_license
# Model for handling supervisions class Supervision < ActiveRecord::Base belongs_to :degree, :class_name => 'Degree' belongs_to :person, :class_name => 'Person' belongs_to :supervisor, :class_name => 'Person' # Tracks changes has_paper_trail on: [:update], :ignore => [:created_at, :updated_at, :approved, :id...
true
6052698ad1c559a92cb2f7677fe16f8dd8f13ff6
Ruby
swistak35/dotfiles
/bin/grafana_send_weight
UTF-8
783
2.828125
3
[]
no_license
#!/usr/bin/env ruby require 'influxdb' class SendWeight InfluxConfigFile = File.join(ENV['HOME'], ".grafana_influxdb") DatabaseName = "carbon" TimeSeries = "weight" def initialize raise InfluxConfigDoesntExist unless File.exists?(InfluxConfigFile) initialize_influxdb end def initialize_influxdb ...
true
82fd965b2d2eb3a0a3b948a234754d2424f947be
Ruby
tae10954/square_array-ruby-apply-000
/square_array.rb
UTF-8
162
3.03125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def square_array(array) # your code here arr = [] array.each do |x| arr.push(x ** 2) end arr #ADVANCED #array.collect{|element| element ** 2} end
true
7125afd9e71ccc1d34fb7f4d17a997d1c7da11a3
Ruby
yamanoie/cherry
/yield.rb
UTF-8
2,755
4.4375
4
[]
no_license
def greeting puts "おはよう" yield yield puts "こんばんは" end greeting do puts "こんにちは" end def greeting puts "おはよう" if block_given? yield end puts "こんばんは" end greeting greeting do puts "こんばんは" end def greeting puts "おはよう" text = yield "hello" puts text puts "こんばんは" end greeting do |text| text * 2 end de...
true
73331314d8bcd934a3e109b67a36b507fd8273f6
Ruby
typhaon/systems_check_2
/test2.rb
UTF-8
201
2.671875
3
[]
no_license
require 'csv' def export_csv(filename) teams = [] CSV.foreach(filename, headers: true) do |row| teams << row.to_hash end teams end teams = export_csv('./public/nfl_data.csv') puts teams
true
1344cca6a97a45f4a6be6626604f31c1f3b39489
Ruby
azheng249/flatiron-bnb-methods-v-000
/app/models/reservation.rb
UTF-8
3,077
2.828125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Reservation < ActiveRecord::Base belongs_to :listing belongs_to :guest, :class_name => "User" has_one :review # Validations validates_presence_of :checkin, :checkout # Compares host id with guest id to prevent reserving at own listing validate :not_host? def not_host? listing = Listing.fin...
true
3e32349eb1a01b9a2a0a49fbb77eae9cd7e453fe
Ruby
b-artem/library
/library.rb
UTF-8
1,906
3.296875
3
[]
no_license
$LOAD_PATH << '.' require 'yaml' require 'library_utils.rb' require 'book.rb' require 'author.rb' require 'reader.rb' require 'order.rb' class Library include LibraryUtils attr_accessor :books, :authors, :readers, :orders def initialize(books = nil, authors = nil, readers = nil, orders = nil) @books = boo...
true
9525e08b3c190cba53acab338fe1876d26d5b9a6
Ruby
rumman07/rubyonrails
/ruby_code_sample/classes/candidate.rb
UTF-8
1,080
3.90625
4
[]
no_license
#Hash as initialize argument #Whenever you have a hash that is being passed as the very last argument to the method call you can exclude and omit the curly braces around the hash class Candidate attr_accessor :name, :occupation, :age, :hobby, :birthplace def initialize(name, details = {}) #Assigning the deta...
true
03172c6688aef237fda5454c895549dd5af6a799
Ruby
rails/rails
/activerecord/test/cases/type/time_test.rb
UTF-8
1,143
2.8125
3
[ "MIT", "Ruby" ]
permissive
# frozen_string_literal: true require "cases/helper" require "models/topic" module ActiveRecord module Type class TimeTest < ActiveRecord::TestCase def test_default_year_is_correct expected_time = ::Time.utc(2000, 1, 1, 10, 30, 0) topic = Topic.new(bonus_time: { 4 => 10, 5 => 30 }) ...
true
7377ad84b341c38bc4faa9a1da4bc235e3288c7d
Ruby
yfcai/paraphernalia
/bin/wctoday
UTF-8
302
2.546875
3
[]
no_license
#!/usr/bin/ruby # estimate how many words you wrote today if ARGV.empty? exec "git diff -M05 -C05 --word-diff=porcelain 'HEAD@{yesterday.23:59}' | grep -e '^+[^+]' | wc -w" else exec "git diff -M05 -C05 --word-diff=porcelain 'HEAD@{yesterday.23:59}' -- #{ARGV[0]} | grep -e '^+[^+]' | wc -w" end
true
d15cb2973e8717206da3ea5771f62e8b0f23e1b0
Ruby
Pawgrammers/Shakespeare-Script-Editor
/script_editor/app/controllers/create_scripts.rb
UTF-8
8,868
2.828125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'nokogiri' # Loop through all available plays and parse XML for each one def createAllScripts() # List of lists that pairs all play names with their Folger's acronyms plays = [["MND", "a_midsummer_nights_dream"], ["AWW", 'alls_well_that_ends_well'], ["Ant", 'antony_and_cleopatra'], ["AYL", 'as_you_li...
true
d9c08623838e431e91eed7d1279ec354bf2816c1
Ruby
kou1203/furima-34471
/spec/models/user_spec.rb
UTF-8
5,183
2.6875
3
[]
no_license
require 'rails_helper' RSpec.describe User, type: :model do before do @user = FactoryBot.build(:user) end describe '新規登録' do context '新規登録ができる時' do it 'ニックネーム,メールアドレス,パスワード、パスワード(確認用)、苗字、名前、苗字(振り仮名)、名前(振り仮名)、生年月日があれば登録できる。' do expect(@user).to be_valid end it 'パスワードが6文字以上で半...
true
584bc36de9fa8fa1aa9131e94e97816f47b961be
Ruby
pacuum/vtc_payment
/lib/vtc_payment/bank/request.rb
UTF-8
4,836
2.515625
3
[ "MIT" ]
permissive
require "digest" require "cgi" require "date" # terminology # account: the login account used to login VTC website # website_id: You first need to create a business account in vtc website and then register your website. # After the registration you visit the registraion management screen and see the id of y...
true
e4f61d72c9b7264949ebafad4afa9923e7e0f7a1
Ruby
azma03/cc_week2_day5_homework
/specs/room_spec.rb
UTF-8
1,502
3.015625
3
[]
no_license
require ("minitest/autorun") require ("minitest/rg") require_relative("../room.rb") require_relative("../song.rb") require_relative("../guest.rb") class RoomTest < Minitest::Test def setup @room = Room.new("Room1", 20) end def test_can_get_room_name assert_equal("Room1", @room.name) end def test_ca...
true
ab9db2cf208194d0c150dad6e03bcc28e6034350
Ruby
bunmiaj/CodeAcademy
/Web-Development/Ruby/1-Introduction/11.rb
UTF-8
789
4.0625
4
[]
no_license
=begin Multi-Line Comments You can write a comment that spans multiple lines by starting each line with a #, but there's an easier way. If you start with =begin and end with =end, everything between those two expressions will be a comment. Take a look at this example: =begin I'm a comment! I don't need any # sy...
true
c0569f7bfe40e5b1ac38ec66143143851af1fc6c
Ruby
dani8439/well-grounded-rubyist
/sample_code/chapter_six/loops.rb
UTF-8
1,677
4.9375
5
[]
no_license
# loop { puts "Looping forever!"} # loop do # puts "Looping forever!" # end # Controlling the loop: # n = 1 # loop do # n = n + 1 # break if n > 9 # end # => won't be an output, will just execute(loop). # n = 1 # loop do # n = n + 1 # next unless n == 10 # end # => won't be an output, will just execute. # ...
true
e28820db9348abef0595a0d94e433a6d6cc62306
Ruby
Roakz/interactive-erd
/mapper.rb
UTF-8
4,538
2.90625
3
[]
no_license
require './lib/data_types.rb' require 'json' class InvalidDataType < StandardError def message "SQL file contains an invalid data type!" end end class Mapper attr_accessor :file, :load_file attr_reader :calculate_top_level, :split_entities, :entities_to_json def initialize(params = {}) @file = para...
true
fbe661e0cf65ce6931c79517a846acc92094d0ec
Ruby
szagar/pyzts
/daemons/ibgw2filed/lib/tc2000_entry_filters.rb
UTF-8
1,499
2.625
3
[]
no_license
module Tc2000EntryFilters def pre_buy?(tc,params) puts "Tc2000EntryFilters#pre_buy?=true" true end def descretionary?(tc,params) puts "Tc2000EntryFilters#descretionary?=true" true end def manual?(tc,params) puts "Tc2000EntryFilters#manual?" params[:setup_src][/manual/] end def...
true
a4adcf37ab4dce8ec206831502e9b2489b8c5c9a
Ruby
dantetekanem/rpn-calculator
/lib/tokens/addition_operator_token.rb
UTF-8
169
2.875
3
[]
no_license
class AdditionOperatorToken < OperatorToken def run(operand_1, operand_2) OperandToken.new(operand_1 + operand_2) end def self.expression /^\+/ end end
true
e6a28ec7ca957c772b9d8576762022e1150c35ff
Ruby
jpmermoz/sms_sender
/app/models/sms_gateway.rb
UTF-8
1,020
2.5625
3
[]
no_license
class SmsGateway include Singleton def cmd(param) @port.write("#{param}\r") wait end def connect_to_serialport begin @port = SerialPort.new('/dev/ttyUSB0', 9600) rescue begin @port = SerialPort.new('/dev/ttyUSB1', 9600) rescue @port = SerialPort.new('/dev/ttyU...
true
b7cca480550fd18a7ea59ecc4bae32cfb84c2799
Ruby
frescoraja/rubymvc
/lib/sqllitedb.rb
UTF-8
989
2.734375
3
[]
no_license
# frozen_string_literal: true require 'sqlite3' # DBConnection provides an interface to connect to and run queries on a DB class DBConnection def self.open(db_file_name) @db = SQLite3::Database.new(db_file_name) @db.results_as_hash = true @db.type_translation = true @db end def self.reset ...
true
0aae7ccedc5688f5ed661944049305313baeb481
Ruby
Loratt/03
/learnrubythehardway(Уроки 1-39)/ex33.rb
UTF-8
355
3.84375
4
[]
no_license
i = 0 numbers = [] puts "Choose number" number = gets.chomp.to_i puts "Choose number of increments " increment = gets.chomp.to_i while i < number puts "At the top i is #{i}" numbers.push(i) i += increment puts "Numbers now: ", numbers puts "At the bottom i is #{i}" end puts "The numbers: ...
true
c1281fc7fd48dce944597da1a124083426de5d71
Ruby
kkznch/learn-ruby-on-ruby
/practice4-8-2.rb
UTF-8
966
3.40625
3
[]
no_license
# coding: utf-8 require "minruby" def evaluate(tree) case tree[0] when 'lit' tree[1] when '+' left = evaluate(tree[1]) right = evaluate(tree[2]) left + right when '-' left = evaluate(tree[1]) right = evaluate(tree[2]) left * right when '*' left = evaluate(tree[1]) right =...
true
21b05ccfc93a17b56e916ea6e744a6b3d10f5c60
Ruby
alfosco/puppy_love
/app/models/shelter.rb
UTF-8
684
2.703125
3
[]
no_license
class Shelter attr_reader :id, :name, :email, :phone, :city, :state, :zip, :google_map_api_key def initialize(shelter = {}) @id = shelter[:id][:$t] @name = shelter[:name][:$t] @email = shelter[:email][:$t]...
true
44b796315f95e08c8a09059fd496ba37a290c50d
Ruby
nathanpena/what-you-know-about-the-gil-is-wrong
/concurrent_ruby.rb
UTF-8
1,586
2.859375
3
[]
no_license
require 'concurrent' require 'benchmark' SYMBOLS = ['MA', 'PCLN', 'ADP', 'V', 'TSS', 'FISV', 'EBAY', 'PAYX', 'WDC', 'SYMC', 'AAPL', 'AMZN', 'KLAC', 'FNFV', 'XLNX', 'MSI', 'ADI', 'VRSN', 'CA', 'YHOO'] def modify_symbols(symbol) symbol += " is a symbol." end def serial_modify_sybmols SYMBOLS.collect do ...
true
fb46e1178a850d41e5b56db3b90c8b06abebb70f
Ruby
srt32/exercism
/fizzbuzz/fizzbuzz.rb
UTF-8
352
3.234375
3
[]
no_license
class Fizzbuzz < Struct.new(:max) MUTATIONS = { 'fizzbuzz' => ->(i) {i % 3 == 0 && i % 5 == 0}, 'fizz' => ->(i) {i % 3 == 0}, 'buzz' => ->(i) {i % 5 == 0} } def fizzle 1.upto(max).map do |i| mutations.find(-> {[i]}) do |k, v| v.call(i) end[0] end end private def mu...
true
5bfda76962660e03eece23192fbcecd0d95339b3
Ruby
co2co2/MarsRover
/marsRover.rb
UTF-8
1,312
4.09375
4
[]
no_license
class Rover def initialize (x, y, dir) @x_coordinate = x @y_coordinate = y @direction = dir end def read_instruction (instruction) @array = instruction.split("") #.split is useful for spliting string into array @array.each do |k| if k == "M" move else turn(k) ...
true
d2d902546e4120c50f1bb09c9c8757c075f021e3
Ruby
jcmuller/backup_jenkins
/lib/backup_jenkins/backup.rb
UTF-8
4,096
2.5625
3
[ "MIT" ]
permissive
require 'fileutils' module BackupJenkins class Backup include BackupJenkins::Formatter def initialize(config = Config.new) @config = config end def do_backup raise "Backup directory already exists! (#{backup_directory})" if FileTest.directory?(backup_directory) copy_files c...
true
e571d1b9e1fd65b40ba6626423dae6c04fc31a27
Ruby
wdoogz/ruby-learning
/learning.rb
UTF-8
1,574
4.25
4
[]
no_license
puts "This is the opposite of a while loop" counter = 1 until counter == 10 puts counter counter += 1 end puts "\n\nThis is a for loop" for i in 1..15 puts i end puts "\n\nThis is a \"loop\" method" i = 0 loop do i += 1 print "#{i}" break if i > 20 end puts "\n\nThis is the loop method with a 'next' key ...
true
28484936f4390648a41e2c94961d35bf13a051b5
Ruby
Hinbin/tenjin
/app/services/user/change_user_role.rb
UTF-8
1,450
2.6875
3
[ "MIT" ]
permissive
# frozen_string_literal: true # Adds a role to a user class User::ChangeUserRole < ApplicationService def initialize(user, role, action, subject = nil) @user = user @role = role @action = action @subject = Subject.find(subject) unless subject.blank? end def call return return_error('User not...
true
37eb38f4348fb63e7927267b2ea3bb0c1a4fb875
Ruby
cassiejdelacruz/course101
/small_problems/easy_set_1/easy1_2.rb
UTF-8
194
3.65625
4
[]
no_license
def is_odd?(integer) integer % 2 == 1 end def is_odd?(number) number.remainder(2) == 1 || number.remainder(2) == -1 end p is_odd?(8) p is_odd?(7) p is_odd?(0) p is_odd?(-4) p is_odd?(-5)
true
f86edace51e57ace7657dfb1e882354c24afcd42
Ruby
aleckyler/voter_sim_folder
/voter_sim_main.rb
UTF-8
3,772
3.875
4
[]
no_license
# main menu file # will contain a case block in which each different option will run a # different method def welcome puts <<-END Welcome to the voting simulator! Have fun! END end def main_menu puts <<-END What would you like to do? (A)Create (B)List (C)Update (D)Vote END end def split_lists(list) ...
true
41c2d2463f5ce087b54bf0f79b705ad651bc37c3
Ruby
Aldyn306429/Backup
/RubyProjects/ConnectFour/lib/board.rb
UTF-8
2,022
3.515625
4
[]
no_license
# frozen_string_literal: true # Colors for the player pieces class String # colorization def colorize(color_code) "\e[#{color_code}m#{self}\e[0m" end def red colorize(31) end def yellow colorize(33) end def bg_yellow colorize(43) end end # The board of the game class Board attr_...
true
15b86264b340fbd22353463d364c21bdff947df8
Ruby
dtelaroli/google_visualization_test
/app/controllers/chart_controller.rb
UTF-8
1,512
2.59375
3
[]
no_license
class ChartController < ApplicationController def index data_table = GoogleVisualr::DataTable.new data_table.new_column('string' , 'Name') data_table.new_column('number' , 'Salary') data_table.new_column('boolean' , 'Full Time Employee') data_table.add_rows(4) data_table.set_cell(0, 0, 'Mike...
true
3675dc2da7c01005f742d6e475f1ef1dfc2a50e2
Ruby
AvraamMavridis/ruby-exercises
/like_this/like_this.rb
UTF-8
387
3.5
4
[]
no_license
def get_text(prefix, plural = "") "#{prefix} like#{plural} this" end def likes(names) case names.size when 0 get_text("no one", "s") when 1 get_text(names[0], "s") when 2 get_text("#{names[0]} and #{names[1]}") when 3 get_text("#{names[0]}, #{names[1]} and #{names[2]}") else get_text(...
true
e86e6c0e0bdd45e18d04379e1c6baf5551b4f031
Ruby
rodolfopeixoto/problem-ruby-matriz-area-0-1
/lib/matrix.rb
UTF-8
1,711
3.75
4
[]
no_license
require 'byebug' class Matrix def initialize(matrix) @matrix = matrix @submatrix_temporary = [] @maximum_square_size = 0 @previous = 0 @temporary = 0 end def analyze_minimum(index_j) @submatrix_temporary[index_j] = 0 if @submatrix_temporary[index_j].nil? temporary_minimum = [@submat...
true
7efaff7ea581936269cda517512a79540d3108c9
Ruby
aryaziai/programming-univbasics-4-square-array-sf-web-091619
/lib/square_array.rb
UTF-8
89
3
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def square_array(array) while squared < array.length puts array**2 sqaured end
true
9f10761d009d4b95cd89aabf3e3e47fc9e7a0229
Ruby
demental/csv2hash
/lib/csv2hash.rb
UTF-8
2,190
2.734375
3
[ "MIT" ]
permissive
require 'csv2hash/version' require 'csv2hash/definition' require 'csv2hash/validator' require 'csv2hash/validator/mapping' require 'csv2hash/validator/collection' require 'csv2hash/parser' require 'csv2hash/parser/mapping' require 'csv2hash/parser/collection' require 'csv2hash/csv_array' require 'csv2hash/data_wrapper'...
true
6a8b05342bf73dd9b97740a79b8f0ee728ed7480
Ruby
YizheWill/aA_Homework
/W4D2/Simon/lib/simon.rb
UTF-8
1,022
3.671875
4
[]
no_license
class Simon COLORS = %w(red blue green yellow) attr_accessor :sequence_length, :game_over, :seq def initialize @sequence_length = 1 @game_over = false @seq = [] end def play p "let's play the game" until game_over take_turn end game_over_message reset_game end def...
true
92c5ffa1d492eebb8d0f4c7f80cf2192eb978b21
Ruby
cstrynatka/ruby_fundamentals1
/exercise1.rb
UTF-8
1,019
4.21875
4
[]
no_license
puts 2 != 3 puts 2 puts 3 puts 2 != 3 puts 2 puts 3 puts 2 != 3 # puts 2 puts 3 puts 2 != 3 puts "Enter name" name = gets.chomp puts "Your name is #{name}" a = 20 b = 65 puts "The value of a is #{a}." #The value of a is 20 puts "The value of a is #{b}." #The value of a is 65 puts "The value of a plus b is #{a + b}." ...
true
ff64d998a2990443db466ae7d5357b05f45349c6
Ruby
cowlibob/armadillo
/lib/armadillo/project.rb
UTF-8
393
2.71875
3
[]
no_license
require 'armadillo/certificate' require 'inifile' class Project def initialize end def load( project_path ) @data = IniFile::load( project_path ) end def certificates re = /Project#Certificate\d$/ certs = @data.match( re ).collect{ |cert_data| Certificate.new(self, cert_data) } return cer...
true
88561889bec8f18acbfee093f1f75a45a063111b
Ruby
DianaM10/ccc
/room.rb
UTF-8
584
3.171875
3
[]
no_license
class Room attr_reader(:name, :songs, :guests) def initialize(name) @name = name @songs = [] @guests = [] end def check_in_one_guest(a_guest) @guests << a_guest end def add_a_song(a_song) @songs << a_song end # def add_songs_to_room(all_songs) # @songs << all_songs...
true
9c0e2ff42d3cf90b9c9a1fe3dfad11fe5767a8fc
Ruby
Loris1123/RbScheme
/test/symboltable.rb
UTF-8
1,615
3.03125
3
[ "Beerware" ]
permissive
require_relative "../lang/symboltable" require_relative "../lang/objects" module SymboltableTest def self.test raise "Symboltable should be empty" unless Symboltable.fill_level == 0 Symboltable.get_or_add("foo") raise "Symboltable fill_level should be 1, is #{Symboltable.fill_level}" unless Symboltable.fill_lev...
true
5144c3144e2462a708f6990287abea0b6e56d837
Ruby
alu0100600643/Practica12
/spec/rspec_p8_spec.rb
UTF-8
3,027
3.25
3
[ "MIT" ]
permissive
#Realizado por Daura Hernández Díaz y Miguel Aurelio García González require "matriz.rb" require "fraccion.rb" describe MatrizDensa do before :each do @matriz = MatrizDensa.densa([[8, 16], [21, 34]]) @matriz2 = MatrizDensa.densa([[1, 2], [3, 4]]) @m1 = MatrizDensa.densa([[Fraccion.new(1, 2), Fraccion.new(3, ...
true
1b4636872ad1645d2f31b51d34859dc102b5bf43
Ruby
csbenge/depot_v2_rails3
/app_script/api/api.rb
UTF-8
3,017
2.671875
3
[]
no_license
################################################################################ # Copyright @ 2012,2013 CloudDepot, Inc. # # All Rights Reserved # ##########################################################################...
true
c98bec66c00174dc92c6d2714c68c89da99d5e4e
Ruby
antwolfe/Launch-School
/RB101/Exercises/Small-Problems/Easy1/Repeat_Yourself.rb
UTF-8
550
4.90625
5
[]
no_license
# Write a method that takes two arguments, a string and a positive integer, # and prints the string as many times as the integer indicates. # Problem: # **Rules** # - Method # - Takes two arguments # - Input: a string, a positive integer # - Output: string or multiple strings # - Must output string according ...
true
f5a3372900929724a94c67d8b7b8e282e16fe2b1
Ruby
JasonPKnoll/relational_rails
/spec/features/artists/index_spec.rb
UTF-8
4,852
2.6875
3
[]
no_license
require 'rails_helper' RSpec.describe 'the artists index page' do # => Story 1 # => As a visitor # => When I visit '/artists' # => I see the name of each artist record in the system it 'displays all artists names' do artist = Artist.create!(name: "Povi", description: "From scratch avatar creator", years...
true
8d6f42929d7aa49cc00eb576387d9e9a8fc3eb3e
Ruby
shuhei/webland-scraper
/export.rb
UTF-8
356
2.890625
3
[]
no_license
require 'json' require './database' db = Database.new isFirst = true print '[' db.places.find.each do |place| lat = place['lat'] lng = place['lng'] price = place['price'] next if lat.nil? || lng.nil? || lat == 0 || lng == 0 || price.nil? if isFirst isFirst = false else print ',' end print "#{...
true
a100aeac8d7036e4a12b2b81ef338834951de726
Ruby
emanon001/atcoder-ruby
/abc158/b/main.rb
UTF-8
108
2.703125
3
[]
no_license
N, A, B = gets.split.map(&:to_i) c = N / (A + B) rest = N - (A + B) * c ans = A * c + [rest, A].min puts ans
true
43b88a6edb5d17b86a107455cac14d3dd8f78468
Ruby
unheavenlycreature/tic-tac-toe
/tic_tac_toe_manager.rb
UTF-8
2,197
3.984375
4
[]
no_license
# frozen_string_literal: true require_relative 'player' require_relative 'board' # Mediates a game of Tic-Tac-Toe. class TicTacToeManager POSITION_HASH = { UL: [0, 0], UM: [0, 1], UR: [0, 2], ML: [1, 0], MM: [1, 1], MR: [1, 2], BL: [2, 0], BM: [2, 1], BR: [2, 2] }.freeze def...
true
a8ff81d4ebef027690ecd5e8e3738256ea171b47
Ruby
watmin/zombie_battleground-api
/lib/zombie_battleground/api/requests/get_matches_request.rb
UTF-8
3,414
2.609375
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'active_record' require 'zombie_battleground/api/validation_helper' require 'zombie_battleground/api/requests/request_helper' module ZombieBattleground class Api class Requests ## # Request validator for GetMatches class GetMatchesRequest include ...
true
495c4fddb352bcc3e5f3c8cfbcd13101fab55275
Ruby
krekoten/brain_love
/lib/brain_love/parser.rb
UTF-8
991
2.59375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'parslet' module BrainLove class Parser < Parslet::Parser rule(:increment_pointer) { str('>').as(:increment_pointer) } rule(:decrement_pointer) { str('<').as(:decrement_pointer) } rule(:increment_byte) { str('+').as(:increment_byte) } rule(:decrement_byte) { str('-').as(:decrement_b...
true
1df00b4ef9f8332b3cc50d94d5722ecfe000e627
Ruby
zpatten/sockit
/lib/sockit/v5/support.rb
UTF-8
2,612
2.71875
3
[ "Apache-2.0" ]
permissive
module Sockit module V5 module Support # 0x00 = request granted # 0x01 = general failure # 0x02 = connection not allowed by ruleset # 0x03 = network unreachable # 0x04 = host unreachable # 0x05 = connection refused by destination host # 0x06 = TTL expired # 0x07 = ...
true
355ef540ee67609e27e5e8802e7302259f4a0aa1
Ruby
thesteady/warmup-exercises
/01-99-bottles/beer_example.rb
UTF-8
887
4.375
4
[]
no_license
class Beer def self.verse puts "#{@number} bottles of #{@drink} on the wall, #{@number} bottles of #{@drink}." puts "Take one down and pass it around, #{@number-1} bottles of #{@drink} on the wall." end def self.song printf "How many bottles will you start with?" @number = gets.chomp.to_i printf...
true
77b3880a7550bb6bc30a679e8df25e8c002b6d41
Ruby
walter-petkanych/lessons
/equation.rb
UTF-8
1,342
3.671875
4
[]
no_license
#вітання puts('Hello, enter a') #отримую значення, конвертую в цифру і присвоюю значення змінній a = gets().chomp().to_f() puts('enter b') b = gets().chomp().to_f() puts('enter c') c = gets().chomp().to_f() #перевіряю що значееня змінної "а" дорівнює "0" і вивожу помилку if(a == 0) puts('ERROR') exit() #TO...
true