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
7e5da9e9af1cad34ebb146856b6917f842c759fa
Ruby
jilion/sublime_video_custom_logs_parsing
/app/services/log_line_parser.rb
UTF-8
654
2.953125
3
[]
no_license
require 'geoip_wrapper' class LogLineParser REGEX = %r{^ (\d+|\-)\s # cache_miss_reason (\d+|\-)\s # cache_status (\S*)\s # client ip }x attr_accessor :line def initialize(line) @line = line end def ip _scan[2] end def country_code GeoIPWrapper.country(ip) end def v...
true
673987788d7a9de5f33c958e6327c5e1c8665e35
Ruby
ClementineOldfield/pokemon-terminal-app
/src/index.rb
UTF-8
9,706
3.75
4
[]
no_license
#Defines class for all moves used by pokemon #TODO: Move classes to new files class Move attr_accessor :name, :power, :type def initialize(name, power, type) @name = name @power = power @type = type end end #Instantiates all moves to be used by pokemon #TODO: Create unique moves f...
true
652a50079a359f743a2a50f2af4659f243fbc31d
Ruby
MagneticRegulus/Back-End-Prep-100-Ruby-Basics
/conditionals/6_stoplight1.rb
UTF-8
604
4.21875
4
[]
no_license
# Exercise: Write a case statement that prints "Go!" if stoplight equals 'green', # "Slow down!" if stoplight equals 'yellow', and "Stop!" if stoplight equals 'red'. stoplight = ['green', 'yellow', 'red'].sample # puts stoplight # for vaildation only if stoplight == 'green' puts 'Go!' elsif stoplight == 'yellow' p...
true
fb833bfe1b06ec723938b16e96a493918ac52420
Ruby
nikhilgupte/shk-fas
/app/models/currency.rb
UTF-8
465
2.703125
3
[]
no_license
class Currency < ActiveRecord::Base validates_numericality_of :inr_value, :greater_than_or_equal_to => 0 named_scope :all, :order => 'name' def self.inr_value(name) find_by_name(name).inr_value rescue nil end def self.usd_in_inr(value) value * inr_value('USD') end def self.eur_in_inr(value) value * ...
true
6e705e0abbef2859d6fda0ca244bfd178c01aec9
Ruby
rafaspinola/scf
/app/helpers/application_helper.rb
UTF-8
1,273
2.625
3
[ "MIT" ]
permissive
module ApplicationHelper def ntc(value) number_to_currency(value, :format => "%u %n", :separator => ",", :delimiter => ".", :unit => "R$") end def clear_number(data) data.gsub(/[^\d]/, "") end def format_phone(data) data = clear_number(data) m = data.match(/(\d{2})(\d{4,5})(\d{4})/) if m...
true
57457bd7701376e204c1d52a0b80bedbd72e598c
Ruby
joshsilverman/QuizMe
/test/models/topic_test.rb
UTF-8
3,495
2.65625
3
[]
no_license
require 'test_helper' describe Topic do let(:course) {create(:course, :with_lessons)} let(:lesson) {course.lessons.sort.first} let(:questions) {lesson.questions} let(:user) {create(:user)} let(:asker) do asker = course.askers.first asker.followers << user asker end describe ".percentage_complete...
true
fb187322c5e305f64ef36a7751b0d3cb100763fe
Ruby
kmckee/babysitter_kata
/lib/hours_worked_calculator.rb
UTF-8
269
3.203125
3
[]
no_license
class HoursWorkedCalculator NUMBER_OF_SECONDS_IN_AN_HOUR = 3600 def hours_between(start_time, end_time) elapsed_time_in_seconds = end_time - start_time elapsed_hours = elapsed_time_in_seconds / NUMBER_OF_SECONDS_IN_AN_HOUR elapsed_hours.round end end
true
c2738eecea4d13bd0dc74eba6ee07b6c68e461b6
Ruby
saipat/AA-Daily
/W1D1/Enumerables/enumerables.rb
UTF-8
1,532
3.5625
4
[]
no_license
class Array def my_each(&prc) self.length.times do |i| prc.call(self[i]) end self end def my_select(&prc) array = [] self.my_each { |el| array << el if prc.call(el) } array end def my_reject(&prc) array = [] self.my_each { |el| array << el unless prc.call(el) } arr...
true
aed1917b98f59e849cfc03a18b96b521a44a6414
Ruby
khanhhuy288/Ruby-Aufgaben
/PruefungPRP12013/a4/Enumerable.rb
UTF-8
221
3.171875
3
[]
no_license
module Enumerable def count(&b) if block_given?() ct = 0; self.each(){|x| if b.call(x) ct +=1 end } return ct else return self.size() end end end
true
abe7aade956d65c484a0988060f1f1551672f872
Ruby
JoacoA/Evaluacion_Ruby
/Tester.rb
UTF-8
497
2.609375
3
[]
no_license
require "test/unit" # == Class Tester # # Author :: Joaquin Abeiro # # This class test the server # # === Composition # # Definition of the _Tester_ class composed of : # * method test_parse # * method test_failure class Tester < Test::Unit::TestCase implements ITester def test_parse(request) assert_equal(3, (...
true
43633292ac84c438b407b52022da27654779eee2
Ruby
biscuitlegs/tic-tac-toe
/lib/tic_tac_toe.rb
UTF-8
4,255
4
4
[]
no_license
require 'pry' class Board attr_accessor :squares def initialize @squares = { A3: Square.new, B3: Square.new, C3: Square.new, A2: Square.new, B2: Square.new, C2: Square.new, A1: Square.new, B1: Square.new, ...
true
fffb218e1b5cd8d6317a1de8c40e1c5ddfcb9623
Ruby
jonahyounus/W2D4-homework
/big_octopus.rb
UTF-8
1,494
3.4375
3
[]
no_license
def quadratic(fishes) fishes.each_with_index do |el1, idx1| max_length = true fishes.each_with_index do |el2, idx2| next if idx1 == idx2 max_length = false if el2.length > el1.length end return el1 if max_length end end class Array def merge_sort(&prc) prc ||= Proc.new { |x, y...
true
e9b6ceefcaaf56f73154b5bac07ce0ad4f00683c
Ruby
aidenmendez/sweater-weather
/spec/services/api/v1/directions_service_spec.rb
UTF-8
1,033
2.5625
3
[]
no_license
require 'rails_helper' describe 'Directions Service' do describe '(happy path)' do it 'returns direction data for start to end point', :vcr do origin = 'denver,co' destination = 'pueblo,co' data = DirectionsService.get_data(origin, destination) expect(data[:route][:realTime]).to be_an(I...
true
aea53ca85ad72b774ce689e1327b712e1bf70e58
Ruby
simonmaddox/SiriProxy-Spotify
/lib/siriproxy-spotify.rb
UTF-8
2,160
2.6875
3
[]
no_license
require 'cora' require 'siri_objects' require 'open-uri' require 'json' require 'uri' ####### # Control Spotify with your voice. # Simply say "Spotify, play me some Nirvana" ###### class SiriProxy::Plugin::Spotify < SiriProxy::Plugin SPOTIFY_CHECK = '(spotify|spotter five|spot of phi|spot fie|spot a fight|specify...
true
8fede723d7ca71765c5b3d42de8c0d304631dc5e
Ruby
michaeloboyle/sprig
/lib/sprig/process_notifier.rb
UTF-8
1,163
2.78125
3
[ "MIT" ]
permissive
require 'active_support/inflector' module Sprig class ProcessNotifier include Logging def initialize @success_count = 0 @error_count = 0 @errors = [] end def success(seed) log_info seed.success_log_text @success_count += 1 end def error(seed) @errors << ...
true
4525fd6c17c02bba78d7d5212f91f7e6de030c01
Ruby
GovTechSG/micropurchase
/app/models/status_presenter_factory.rb
UTF-8
472
2.71875
3
[ "CC0-1.0", "LicenseRef-scancode-public-domain" ]
permissive
class StatusPresenterFactory attr_reader :auction def initialize(auction) @auction = auction end def create Object.const_get("StatusPresenter::#{status_name}").new(auction) end private def status_name if auction_status.expiring? 'Expiring' elsif auction_status.over? 'Over' ...
true
8c6f45b5d99960cc05d0546981e5e505acd44634
Ruby
tobymao/rolling_stock
/models/player.rb
UTF-8
756
2.921875
3
[ "MIT" ]
permissive
require './models/passer' require './models/purchaser' class Player < Purchaser include Passer include Ownable attr_reader :id, :name, :shares attr_accessor :order, :log def initialize id, name, log = nil super 30 @id = id @name = name @shares = [] @log = log || [] end def...
true
38ed3c07b97be3aca8c4d087bec032bd0fec1153
Ruby
groovestation31785/phase-0-tracks
/databases/superheroes/heroes.rb
UTF-8
3,286
3.6875
4
[]
no_license
# require the two gems in order to use them throughout the program require 'sqlite3' require 'faker' # Create a new database (SQLite3) db = SQLite3::Database.new("tech_heroes.db") db.results_as_hash = true # This will create a new table in the database file heroes_table_cmd = <<-SQL CREATE TABLE IF NOT E...
true
389d9337e42fba8fc126ea58619c0d38f03f05ca
Ruby
Tahirbhalli/technical_test
/lib/tasks.rb
UTF-8
1,088
2.546875
3
[]
no_license
require 'net/http' require 'json' require_relative './process_url' class Task include ProcessUrl attr_accessor :url def task_one(currencies) @url = build_url('currencies/ticker') @url = add_query({ ids: currencies }) payload = Net::HTTP.get(@url) data = JSON.parse(payload) data end def ...
true
29e6ae08d2043504220ac4ae759b16e74f36cea3
Ruby
Alicespyglass/codewars
/lib/Square.rb
UTF-8
103
3.046875
3
[]
no_license
def find_next_square(sq) # Return the next square if sq is a perfect square, -1 otherwise -1 end
true
66278b64b15320b3b7997cd8ab2073da241c77c0
Ruby
eoinshea/trappist1-ruby-trip
/app/person.rb
UTF-8
1,020
2.984375
3
[]
no_license
require 'active_model' class Person include ActiveModel::Validations validates_presence_of :name, :age, :spoken_languages validate :at_least_one_spoken_language_and_be_an_array attr_accessor :name, :age, :computer_os, :spoken_languages, :location, :developer_type, :seating_position # # languages should b...
true
90df91859426548edd406226432d330bf3bb28fc
Ruby
thedrummeraki/csi2132-project
/app/models/booking.rb
UTF-8
1,003
2.796875
3
[]
no_license
class Booking < ApplicationRecord belongs_to :customer, foreign_key: :customer_sin belongs_to :room, foreign_key: [:room_number, :hotel_id] # We will be converting a booking into a renting def check_in! ensure_can_check_in! self.update(status: :complete) end def can_check_in? status.to_s == 's...
true
35bcf9a723c2d2cb0c93eacc6ce2639013b972c3
Ruby
bulters/retry_once
/lib/retry_once.rb
UTF-8
434
2.53125
3
[ "MIT" ]
permissive
module Kernel def retry_exception_once_with(__exception, __proc_or_symbol, __retried=false, &__body) begin __body.call rescue *(Array(__exception)) raise if __retried if not __retried if Symbol === __proc_or_symbol send(f) else __proc_or_symbol.call ...
true
f31aaa7de680f666a1f134ad287f32076e6e4097
Ruby
Ortuna/writing
/vendor/kitana/spec/libs/chapter_spec.rb
UTF-8
1,117
2.546875
3
[]
no_license
require "#{File.dirname(__FILE__)}/../spec_helper.rb" describe Kitana::Chapter do before :each do path = "#{FIXTURE_ROOT}/sample_book" @book = Kitana::Book.new(path) end it 'Should take the name of the folder' do @book.chapters.map{|c| c.title }.include?('Chapter 1').should == true end it 'Sh...
true
8ba595ba5793aa51ebb9916444c8c916ea5b3ccb
Ruby
whatalnk/cpsubmissions
/atcoder/ruby/abc121/abc121_d/4534332.rb
UTF-8
574
3.703125
4
[]
no_license
# Contest ID: abc121 # Problem ID: abc121_d ( https://atcoder.jp/contests/abc121/tasks/abc121_d ) # Title: D. XOR World # Language: Ruby (2.3.3) # Submitted: 2019-03-10 02:57:23 +0000 UTC ( https://atcoder.jp/contests/abc121/submissions/4534332 ) A, B = gets.chomp.split(" ").map(&:to_i) def f(x) if x.even? a =...
true
c37a08a68733b7f476c263f666d3b7b0b28f3b47
Ruby
afaraone/chitter-challenge
/models/user.rb
UTF-8
866
2.84375
3
[]
no_license
class User include DataMapper::Resource property :id, Serial property :name, String property :user, String property :email, String property :password, String def self.add(args) User.create(args) unless User.exists?(args[:user], args[:email]) end def self.login(username, password) return unl...
true
008e9c00cd2f033d4e5666e069f5773e5c83518b
Ruby
erikbenton/AppAcademyFullStackOnline
/Ruby/Data Structures/poly_tree_node/skeleton/lib/00_tree_node.rb
UTF-8
1,353
3.59375
4
[]
no_license
require "byebug" class PolyTreeNode attr_reader :value, :children def initialize(value) @value = value @parent = nil @children = [] end def parent=(new_parent) @parent.children.delete(self) unless @parent.nil? @parent = new_parent new_parent.children << self unless new_parent.nil? en...
true
00663c1093b31b7706b6121a8d7e0bc5cd8c6adc
Ruby
colinwarmstrong/battleship
/test/board_test.rb
UTF-8
1,447
3.21875
3
[]
no_license
require './test/test_helper.rb' require './lib/board.rb' require './lib/space.rb' require 'colorize' class BoardTest < Minitest::Test def test_board_exists board = Board.new assert_instance_of Board, board end def test_board_initializes_as_a_four_by_four_grid board = Board.new assert_equal 4, ...
true
2d83bb0bfd7c282447b06ebcd5a4d0a5b301e37c
Ruby
njpa/launchschool-course-100
/08_more_stuff/01_boolean_regex.rb
UTF-8
200
3.390625
3
[]
no_license
# boolean_regex.rb def has_b?(string) if string =~ /b/ puts "Has a 'b'" else puts "Does not have a 'b'" end end has_b?("Bolivia") has_b?("bolivia") has_b?("United States of America")
true
fe8c8b5c6bd0bb9b46bcb26ca81950d47eb73190
Ruby
newmetl/empty-demo-repo
/fizz_buzz.rb
UTF-8
528
4.34375
4
[]
no_license
class FizzBuzzCalculator def initialize(count) @count = count end def output puts 'Let\'s go!' @count.times do |i| number = i + 1 string = '' if number % 3 == 0 string += 'fizz' end if number % 5 == 0 string += 'buzz' end if number % 3 != 0 &&...
true
3ac57a4248cdb25f0a7674012c62137086b908cb
Ruby
Diazblack/museo
/test/curator_test.rb
UTF-8
5,205
3.078125
3
[]
no_license
require "minitest/autorun" require "minitest/pride" require './lib/curator' class CuratorTest < Minitest::Test def setup @curator = Curator.new @photo_1 = { id: "1", name: "Rue Mouffetard, Paris (Boy with Bottles)", artist_id: "1", year: "1954" } @photo_2 = { id: ...
true
6af6fdb0a0681056d56f999532c82ffda0aa73ae
Ruby
MasafumiKabe/Project_Euler
/009-a.rb
UTF-8
477
4.03125
4
[]
no_license
def sum_of_pithagoras(sum) a = 1 b = a + 1 c = b + 1 loop do if (a + b + c) == sum && pithagoras?(a, b, c) return a, b, c end c += 1 if c > sum b += 1; c = b + 1 end if b > sum / 2 a += 1; b = a + 1; c = b + 1 end if a > sum / 3 return nil end e...
true
28014a321920dc300982b326f123d7905edd3ae8
Ruby
ykmr1224/json_validate
/spec/json_validate_spec.rb
UTF-8
4,019
3.015625
3
[ "MIT" ]
permissive
require 'spec_helper' require 'json' # define an utility metod class Array def except(*value) self - value end end describe JSONValidate do it 'should have a version number' do expect(JSONValidate::VERSION).not_to be_nil end describe "#validate" do it 'should not raise error for valid object...
true
c49ce93db42ba897a6ebd55ccb14b5b68da016f6
Ruby
yann021/thp_training
/formation/s3/j1/mon_projet/lib/event.rb
UTF-8
801
3.453125
3
[]
no_license
require "pry" require 'time' class Event attr_accessor :start_date, :length, :title, :attendees def initialize(start_date, length, title, attendees) @start_date = Time.parse(start_date) @length = length.to_i @title = title.to_s @attendees = attendees end def postpone_24h @start_date = @start_date ...
true
1f50e2799455d479934f99697d8e4c68700d89b2
Ruby
karino-minako/paiza-c-rank-level-up-menu
/Standard-input:output-final.rb
UTF-8
678
3.1875
3
[]
no_license
# 毎年 5 月 1 日に、自分が運営している会社の社員一覧表を作成しています。表は年度ごとに更新され、社員の名前と年齢が載っています。 # ところで、会社のメンバーは昨年度から全く変わらず、社員の誕生日は全員 7 月 7 日だったので、前年度の一覧表の年齢欄をそれぞれ +1 するだけで今年度の表が作れることにパイザ君は気づきました。 # 昨年度の一覧表が与えられるので、今年度の一覧表を出力してください。 line = gets.to_i line.times do s = gets.chomp.split(" ") i = s[1].to_i puts "#{s[0]}" + " #{i + 1}\n" end
true
67a5ed694efa613941200cbbb8af7ce286f40757
Ruby
oooooooo/slip
/lib/slip/cli.rb
UTF-8
1,359
2.5625
3
[ "MIT" ]
permissive
require 'slip' require 'thor' module Slip class CLI < Thor include Thor::Actions include On include Source class_option :verbose, aliases: :v, type: :boolean, desc: 'verbose mode' # desc 'info NAME', 'NAME is what changes to the Gemfile, config/application.rb, etc.' # def info(name) # ...
true
ac4092e5149f7ab228eb54d173f1b56b4a93379b
Ruby
zachaysan/BaseUnit
/units.rb
UTF-8
3,288
3.390625
3
[]
no_license
#figure out this sitax =begin class Float def *(multiple) if multiple.is_a? BaseUnit multiple * self.to_f else super end end end =end class BaseUnit attr_accessor :base_units, :starting_units, :quantity, :unit_table def initialize starting_units raise "shit" unless starting_units.is_...
true
057d7398e636855bbc6fb7e1cd05420850ef172b
Ruby
rvna/black_thursday
/lib/merchant_analyst.rb
UTF-8
3,396
3.09375
3
[]
no_license
require_relative '../lib/statistics' class MerchantAnalyst attr_reader :all_merchants include Statistics def initialize(all_merchants) @all_merchants = all_merchants end def active_merchants all_merchants.find_all do |merchant| average_item_price_for_merchant(merchant.id) != nil end en...
true
6bc43c618db47211dfeaadddbb6602aedbfc754d
Ruby
ladybando/dynamic-orms-readme-v-000
/bin/run
UTF-8
662
2.84375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
#!/usr/bin/env ruby require 'sqlite3' require_relative "../lib/song.rb" require_relative "../config/environment.rb" song = Song.new(name: "Hello", album: "25") puts "song name: " + song.name puts "song album: " + song.album song.save song = Song.new(name: "sweetener", album: "sweetener") puts "song name: #{song.na...
true
60f1c7095ab94bcc03e31e779cd1df8f6fb45d09
Ruby
busster/VirtualGraffiti
/Server/app/models/location.rb
UTF-8
445
2.671875
3
[]
no_license
class Location < ActiveRecord::Base has_many :pictures validates :latitude, :longitude, { presence: true } def self.coords_near_me(lat, long, radius) lat_min = lat - radius lat_max = lat + radius long_min = long - radius long_max = long + radius Location.all.select{ |loc| (loc.latitude.to...
true
ae8c3e08928c00a36d33451547844dd72adda67e
Ruby
shen-sat/hackney_pirates
/test.rb
UTF-8
996
2.71875
3
[]
no_license
require 'rubygems' require 'twitter' require 'spreadsheet' #set up virtual spreadsheet book = Spreadsheet::Workbook.new sheet1 = book.create_worksheet #twitter dev login client = Twitter::REST::Client.new do |config| config.consumer_key = "t3F5fBiVwUjsZyzxAcpDWGHF4" config.consumer_secret = "YjEpZW...
true
df457e0f91479716e20ae8a221ffe2e058847458
Ruby
svramusi/temporal-coupling
/spec/lib/statistic_generator_spec.rb
UTF-8
2,565
2.53125
3
[]
no_license
require 'temporal_coupling/statistic_generator' describe StatisticGenerator do let(:file_source) { double("file source") } subject { StatisticGenerator.new(file_source) } context "computing the frequency of input files" do it "handles a single file" do file_source.stub(:files_by_commit) { [['a']] } ...
true
904b0e7c9f039204b4e552518cdd4728850f357c
Ruby
robertobuso/screenwriting-app-backend
/app/models/structure.rb
UTF-8
5,867
2.671875
3
[]
no_license
class Structure < ApplicationRecord belongs_to :project ##Convert hash into array of Idea objects def self.generate_array(structure_hash) all_scenes = [] structure_hash.each do |arr| arr.each do |key, value| if (Idea.find(value).inspiration.nil? || Idea.find(value).inspiration.empty?) && (Ide...
true
27f1ed5f73b30b36c327fcdc5472bc2e88d33008
Ruby
santoshjoseph99/Euler
/REuler/problem45.rb
UTF-8
642
3.359375
3
[]
no_license
def get_triangle(n) return (n * (n +1))/2 end def get_pentagonal(n) return (n * (3*n -1))/2 end def get_hexagonal(n) return n * (2*n - 1) end pentagonlStart = 166 triangle = 286 pentagonal = pentagonlStart hexagonal = 144 triNum = 0 penNum = 0 hexNum = 0 while true do triNum = get_triangle(triangle) while...
true
3e0364cce2ae3dbc10148bad81d16ffb17e63f31
Ruby
eriksk/ld26
/lib/game.rb
UTF-8
612
2.828125
3
[]
no_license
module LD26 class Game attr_accessor :window def initialize window @window = window @scenes = [] push_scene LD26::SplashScene.new self end def pop_scene log "Popping scene: #{@scenes.last.class}" @scenes.delete_at(@scenes.size - 1) end def push_scene scene @scenes.push scene e...
true
a4e1dffd42cddf754bd63757441401c5fd186576
Ruby
moeenah/ar-exercises
/exercises/exercise_1.rb
UTF-8
537
2.84375
3
[]
no_license
require_relative '../setup' puts "Exercise 1" puts "----------" # Your code goes below here ... burnabyStore = Store.new(:name => "Burnaby", :annual_revenue => 300000, :mens_apparel => true, :womens_apparel => true) burnabyStore.save richmondStore = Store.new(:name => "Richmond", :annual_revenue => 1260000, :mens_ap...
true
7c75958506d5cceea89302507c9b0dd0227b0ece
Ruby
mevanoff24/playground
/stanford/dijkstra.rb
UTF-8
1,757
3.8125
4
[]
no_license
require 'priority_queue' class Dijkstra def initialize() @vertices = {} @distances = {} @previous = {} @nodes = PriorityQueue.new end def add_vertex(name, edges) @vertices[name] = edges end def shortest_path(start, finish) maxint = Float::INFINITY # INITIALIZE VERTICES @vertices.each do |vertex...
true
1640cf66b2d4436544f94552d25898d29fdb275e
Ruby
virtualpain/fiction
/lib/fiction/backup.rb
UTF-8
663
2.5625
3
[ "MIT" ]
permissive
require "zip" class Fiction def self.backup zip_filename = File.basename(Dir.getwd) + ".zip" FileUtils.rm(File.join(@wd,zip_filename)) if File.exists?(File.join(@wd,zip_filename)) print "Generating backup..." files = Dir.glob("*.md") files += ["summary","config.yml","docs"] Zip::File.open(zip_filename,Zip:...
true
7fd5e84084271a87be39b20260382f935a3e0435
Ruby
wesfree163/cs-hu
/CSC-308/Ruby/Add.rb
UTF-8
254
3.890625
4
[ "MIT" ]
permissive
# # Add Two Numbers # print "Enter the first number\n" number1 = gets.to_i print "Enter the second number\n" number2 = gets.to_i result = number1 + number2 print "The sum is ", result, "\n" print "Press any key to continue . . ." gets
true
a1b86a848eb6f854768151bd24dff949fdfac5e2
Ruby
kevinchen93/odin-learn-ruby
/04_pig_latin/pig_latin.rb
UTF-8
739
3.953125
4
[]
no_license
Vowels = ["a", "e", "i", "o", "u"] def letter_is_vowel(letter) Vowels.include?(letter) end def first_letters(word) letters = word.split('') prev_letter = '' starting_consonant = [] letters.each do |letter| if letter_is_vowel(letter) && (letter != 'u' && prev_letter != 'q') break else starting_consonan...
true
5b24475ba6ebe55c47b60a41aa863a9c30869312
Ruby
Astrodynamo/tic-tac-toe-rb-online-web-sp-000
/lib/tic_tac_toe.rb
UTF-8
2,160
4.25
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# State methods WIN_COMBINATIONS = [ [0,1,2], # Top row [3,4,5], # Middle row [6,7,8], # Bottom row [0,3,6], # Left column [1,4,7], # Middle column [2,5,8], # Right column [0,4,8], # diagonal from top left [2,4,6] # diagonal from top right ] def display_board(board) p...
true
99751598f6dc912f358985a39990adbca236ed01
Ruby
WahidKadri/rails-mister-cocktail2
/db/seeds.rb
UTF-8
383
2.546875
3
[]
no_license
require 'open-uri' require 'json' url = 'https://www.thecocktaildb.com/api/json/v1/1/list.php?i=list' ingredients_serialized = open(url).read parsed_ingredients = JSON.parse(ingredients_serialized) ingredients_array = parsed_ingredients["drinks"] ingredients_array.each do |hash_ingredient| ingredient = hash_ingredie...
true
36f53d3a2c3015d95579b7b7c4bfdff733639f6b
Ruby
chrisgre/yt
/lib/yt/models/search.rb
UTF-8
1,352
2.828125
3
[ "MIT" ]
permissive
require 'yt/models/base' module Yt module Models class Search < Base attr_reader :id, :snippet, :data, :kind, :channel_title # @!attribute [r] title # @return [String] the channel’s title. delegate :title, to: :snippet # @!attribute [r] description # @return [String] the...
true
d22aedd3b2f99fde6362aa16bef557f73caccf9c
Ruby
pokharelmanish/acceptance_testing
/helpers/date_time_helper.rb
UTF-8
748
2.84375
3
[]
no_license
# frozen_string_literal: true # date time helper def past_date(date: nil, **args) if date.blank? date = Faker::Time.between(DateTime.now - args.fetch(:a, 10).to_i, DateTime.now - args.fetch(:b, 5).to_i) end date.strftime('%m/%d/%Y') end def past_date_time(date_time: nil, **arg...
true
0f6462d799c70164716833578cc50c303e306466
Ruby
AngusGMorrison/OO-Get-Swole-london-web-082619
/lib/membership.rb
UTF-8
303
2.96875
3
[]
no_license
class Membership attr_reader :gym, :lifter, :cost @@all = [] ###### Instance methods ###### #Works! def initialize(gym, lifter, cost) @gym = gym @lifter = lifter @cost = cost @@all << self end ###### Class methods ###### #Works! def self.all @@all end end
true
1717941861d5ac01e62ea78489a0e78b95fef8a4
Ruby
rocky/ps-watcher
/ps-watcher.rb
UTF-8
5,589
2.75
3
[]
no_license
#!/usr/bin/env ruby # Copyright (C) 2011 Rocky Bernstein <rockyb@rubyforge.net> require 'yaml' require_relative 'app/options' require_relative 'app/msg' class PSWatcher # Information for each section of a ps-watcher configuration file. PS_Struct = Struct.new(:re, :action, :trigger, :occurs) def initialize(opts=...
true
8a852615dd529577da597c03346bf7f78cf48f0a
Ruby
joalorro/collections_practice_vol_2-dumbo-web-071618
/collections_practice.rb
UTF-8
2,020
3.421875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require "pry" def begins_with_r array array.each do |tool| if tool.start_with?("r") == false return false end end true end def contain_a array array_with_As = [] array.each do |element| if element.include?("a") == true array_with_As << element end end array_with_...
true
4190be2bdebf411bd486ebe5ebb978c88ae716d2
Ruby
karayusuf/oh-auth-server
/lib/oh_auth/data_store.rb
UTF-8
600
2.609375
3
[ "MIT" ]
permissive
require 'redis' require 'json' require 'pry' module OhAuth class DataStore DB = Redis.new def self.find(id, &block) data = DB.get(id) data ? JSON(data) : (block || not_found(id)).call end def self.has_key?(id) DB.exists(id) end def self.create!(id, attributes) expir...
true
9e067f291ce2846d886ee18fb15b8fb789c360c4
Ruby
aleh/fastlane
/spaceship/lib/spaceship/tunes/availability.rb
UTF-8
2,396
3.109375
3
[ "MIT" ]
permissive
require_relative 'territory' module Spaceship module Tunes class Availability < TunesBase # @return (Bool) Are future territories included? attr_accessor :include_future_territories # @return (Array of Spaceship::Tunes::Territory objects) A list of the territories attr_accessor :territor...
true
045ad5f52514eb1a70577af1d6fd40d9b392a664
Ruby
x-itec/heatmap
/test/test_geometry.rb
UTF-8
966
2.75
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'helper' class TestGeometry < Test::Unit::TestCase should "properly generate the image bounds" do area = [Heatmap::Area.new(1,10), Heatmap::Area.new(10,20)] bounds = Heatmap::Geometry.bounds(area, 50) assert_equal 60, bounds.width assert_equal 70, bounds.height end should "properly ge...
true
30a47350f00b5678bc23160fe173136a4b377bf1
Ruby
LisaDuschek/contacts
/spec/phone_spec.rb
UTF-8
1,237
2.890625
3
[]
no_license
require('rspec') require('contacts') require('phone') describe('Phone') do before() do Phone.clear() end describe('.all') do it('creates an empty array')do expect(Phone.all()).to(eq([])) end end describe('#save') do it('takes user input saves into array') do test_number = Phone.new({:area_...
true
002d65b666d60f32840b2f81f20e5826278c416f
Ruby
spaldingVance/RB101
/lesson_2/stringy_strings.rb
UTF-8
287
3.734375
4
[]
no_license
def stringy(num) final_string = "" num.times do |x| if x%2 == 0 final_string += '1' else final_string += '0' end end return final_string end puts stringy(6) == '101010' puts stringy(9) == '101010101' puts stringy(4) == '1010' puts stringy(7) == '1010101'
true
c533eaee76f8d6e1b667a88a897bc4b5e808e296
Ruby
Fultzy/ConnectFour
/lib/player.rb
UTF-8
302
3.3125
3
[]
no_license
# frozen_string_literal: true class Player attr_reader :name, :color attr_accessor :checkers def initialize(name, color) @name = name @color = color @checkers = 21 end def input_request puts 'Enter a number' print "#{@name}'s turn =>" gets.chomp.to_i - 1 end end
true
4854a900ee735436fc98cb71596f5c83d723ea11
Ruby
bfcpzk/RubyLearn
/src/chapter03/read_file.rb
UTF-8
637
3.234375
3
[]
no_license
puts "一次性读取全部文件" filename = ARGV[0] fileDesc = File.open(filename) text = fileDesc.read print text fileDesc.close puts "\n========" puts "一次性读取全部文件,一行实现" puts File.read(ARGV[0]) puts "========" puts "逐行读取文件" fileName = ARGV[0] fileDesc = File.open(fileName) fileDesc.each_line do |line| puts line end fileDesc.clo...
true
9588b118d5429e4705ac02964e6227e58eb516f6
Ruby
brenopolanski/labs
/casa-do-codigo/ruby-aprenda-a-programar-na-linguagem-mais-divertida/plural.rb
UTF-8
102
3.09375
3
[]
no_license
def plural(palavra) "#{palavra}s" end puts plural("caneta") # canetas puts plural("carro") # carros
true
c969babc630b6d029f0c07a8e192eb64e5c4f82e
Ruby
igorfrenkel/spread_calculator
/calculate.rb
UTF-8
428
2.890625
3
[]
no_license
require 'csv' require 'lib' csv_file = ARGV[0] government_bonds = [] corporate_bonds = [] CSV.read(csv_file).each_with_index do |row,idx| next if idx == 0 bond = CSVBondFormatter.bond_from(row) case bond.type when 'corporate' corporate_bonds << bond when 'government' government_bonds << bond else ...
true
274bb623ab252e4276bc3bbdb2358aea08104adc
Ruby
pact-foundation/pact-support
/lib/pact/shared/form_differ.rb
UTF-8
780
2.71875
3
[ "MIT" ]
permissive
require 'uri' module Pact class FormDiffer def self.call expected, actual, options = {} require 'pact/matchers' # avoid recursive loop between this file and pact/matchers ::Pact::Matchers.diff to_hash(expected), to_hash(actual), options end def self.to_hash form_body if form_body.is_a...
true
72ab2bba4cdddeeb80ffcbe795982a4fff651410
Ruby
WallasFaria/opencoop
/app/models/Withdrawal.rb
UTF-8
410
2.609375
3
[]
no_license
class Withdrawal < Operation belongs_to :account belongs_to :operable, polymorphic: true validates :value, :account, :operable, presence: true validates :value, numericality: { greater_than: 0 } validate :available_account_balance def change_value -1 * value end private def available_account_b...
true
54e8757230ca2c17064a3637ff3d01503f90a00f
Ruby
cassar/skrol_basic
/lib/program/scwts_compiler.rb
UTF-8
1,019
3
3
[]
no_license
# Compiles the Sentence Constituent Word Total Score (SCWTS) for all sentences # in a given sentence array and updates the given psts_scores_obj module SCWTSCompiler def self.compile(content_manager, wts_scores_obj, psts_scores_obj) standard_script = content_manager.tar_stn_spt helper = SCWTSHelper.new(standa...
true
dbbd29f5aebc84e24a7a2b2bb5cfbc53f258431e
Ruby
krdiamond/ruby-objects-belong-to-lab-web-010818
/lib/song.rb
UTF-8
183
3.15625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Song attr_accessor :title, :artist def initialize(title="") @title = title @artist = artist #storing all the authors that we are writing about by title end end
true
138dd696298eadffec85e50893d3311e5f6a9d44
Ruby
amfarrell/coach-todo
/app/middleware/identify_visitor.rb
UTF-8
332
2.640625
3
[]
no_license
require 'pry' class IdentifyVisitor < Coach::Middleware provides :visitor def call return [ 401, {}, ['You may not enter.']] if unwelcome? provide(visitor: visitor) next_middleware.call end def unwelcome? ['ants', 'mould'].include? visitor end def visitor @visitor ||= params[:person...
true
f06bde3ed97e74f5d2151fcbf31b52177a939755
Ruby
magupisoft/Coins
/lib/coins.rb
UTF-8
1,411
3.484375
3
[]
no_license
require "coins/version" require "utils/extensions" module Coins MIN_VALUE = 0 MAX_VALUE = 1000000000 class Converter def to_usd(denominations) valid_coins = [] converted_coins = [] if denominations.kind_of?(Array) valid_coins = sanatize(denominations).map{ |d| Integer(d) } else ...
true
040b7b595650754399dc69b4015c160a5ae0b8e1
Ruby
akinom/dspace-rails
/app/models/ability.rb
UTF-8
916
2.53125
3
[ "MIT" ]
permissive
class Ability # the ideas are based on the cancancan gem # https://github.com/CanCanCommunity/cancancan/wiki/Defining-Abilities def initialize(user) @user = user end def can?(obj, actn) return true if actn.nil? return obj.can?(actn.to_sym, @user) end def authorize!(obj, actn) unless act...
true
a622e6935fe91d6d1f9ce84db1fc8faaa12182fc
Ruby
stijoh/rogue-wave
/db/seeds.rb
UTF-8
3,126
2.875
3
[]
no_license
require 'faker' require 'betterlorem' require 'date' # Remove all current entries in the DB puts '---> Destroying all DB entries' User.destroy_all Address.destroy_all Boat.destroy_all # Config -> set to what you want to generate user_number = 10 booking_number = 3 image_number = 3 # Making one user we can always use...
true
66f4a46d433c9654f617436fb06cadcaa578e2a1
Ruby
shvets/scriptlandia
/scriptlandia-tech-examples/DP/structural/bridge.rb
UTF-8
812
4.09375
4
[]
no_license
# bridge.rb # Decouples an abstraction from it's implementation so that the two can vary independently. # 1. implementor class Material def make end end # 2. concrete implementors class MyMaterial1 < Material def make puts "make: my material 1" end end class MyMaterial2 < Material...
true
6b81e16d0af05e5929bad0b30bef52a3d7df658b
Ruby
yaechan/algorithm
/spec/bubble_sort_spec.rb
UTF-8
217
2.515625
3
[]
no_license
# -*- coding: utf-8 -*- require "spec_helper" RSpec.describe Array do describe "#bubble_sort" do it "returns sorted array" do expect([*1..9].shuffle.bubble_sort).to eq [*1..9] end end end
true
b1f58bff393827d4e612d86d3b3ac5fb9c7c056f
Ruby
dimtruck/hERmes_viewer
/Models/request.rb
UTF-8
241
2.859375
3
[ "MIT" ]
permissive
module Models class Request attr_reader :method, :uri, :headers, :body def initialize(method = "GET" ,uri = "/" ,headers = [],body = "") @method = method @uri = uri @headers = headers @body = body end end end
true
547b26516d6c1f98400eb82ec5b10b931d087e8b
Ruby
siruguri/critpickr
/app/services/scrapers/generic_scraper.rb
UTF-8
4,069
2.546875
3
[ "MIT" ]
permissive
require 'open-uri' module Scrapers class GenericScraper attr_reader :payload, :crawl_links, :rules_json def initialize(uri_string, rules_json) @uri_string = uri_string @rules_json = rules_json @payload = {} @crawl_links = {} end def has_links? @_has_links ||= (@c...
true
b0899e122f7a2b545f448e528a71ca7a3d3dc418
Ruby
Fukkatsuso/AtCoder
/JoinedContest/ABC131B.rb
UTF-8
267
3.296875
3
[]
no_license
n, l = gets.chomp.split(" ").map(&:to_i) sum = 0 tastes = [] (0..n-1).each do |i| tastes << (l + i) sum += (l + i) end max = tastes[n-1] min = tastes[0] if min > 0 puts sum - min elsif max < 0 puts sum - max else puts sum end
true
69e1c091ca35b513014345cf066fb8881cdcf016
Ruby
jerrykuo7727/chess
/spec/chess_spec.rb
UTF-8
14,903
3
3
[]
no_license
require 'chess' describe Chess do let(:chess) { Chess.new } describe '#valid_move_for_king?' do it 'returns true when clear to move' do chess.instance_variable_set(:@board, [['.', '.', '.', '.', '.', '.', '.', '.'], ['.', '.', '.', '.', '.', '.', '.', '.'], ...
true
ceae87258f8a48fa0d81175c238a0fdc7fa2e954
Ruby
infinith4/crawler_amazon
/csv.rb
UTF-8
3,238
2.8125
3
[]
no_license
require 'open-uri' require 'nokogiri' require 'csv' require 'kconv' require 'date' this_year =2017 # 集計する年 format = '%Y年%m月%d日' current_dir = Dir.pwd dataList = [] num = 0 while true num += 1 filename = "#{this_year}-#{num}.html" if ! File.exist?(filename) then break end puts "Loading... #{filename}" ...
true
52527f281bbb34e08223aab87ea8364ebca52193
Ruby
Miirindra/vendredi
/exo_17.rb
UTF-8
407
4.09375
4
[]
no_license
=begin un programme qui va faire la même chose, sauf que si X et Y sont égaux, il dira "Il y a x ans, tu avais la moitié de l'age que tu as aujourd'hui". =end puts "Quelle est votre age? " print "> " user_age = gets.chomp.to_i for i in 0..user_age puts "il y a #{user_age - i}ans , tu avais #{i}ans " if user...
true
4f11a21cc2b5090433447a9a593c13f5df2ade20
Ruby
SinkLineP/RubyOnRails-18.08.2021
/Ruby on rails/coalla-cosmetology-ddcbe64f3200/app/models/used_time.rb
UTF-8
1,891
2.65625
3
[]
no_license
# == Schema Information # # Table name: used_times # # id :integer not null, primary key # date :date # time :time # created_at :datetime not null # updated_at :datetime not null # consultation_id :integer # # Indexes # # index_used_times_on_c...
true
7dbd8508232b5e6da72aab2831823337523b4236
Ruby
timminkov/rover
/spec/parser_spec.rb
UTF-8
564
2.96875
3
[]
no_license
require 'parser' describe Parser do describe "#parse!" do it "parses and readies a file to be used" do file = StringIO.new("5 5\n1 2 N\nLMRLM") parser = Parser.new(file) parser.parse! parser.plateau_size.should == [5, 5] parser.instructions.should == { ['1', '2', 'N'] => ['L', 'M', ...
true
0be098dc0ed893ccc409b308795316de1b167033
Ruby
andrewtrent/ruby-objects-has-many-through-lab-v-000
/lib/genre.rb
UTF-8
720
3.28125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Genre attr_accessor :name @@all = [] def initialize(genre_name) @name = genre_name @@all << self end def self.create(genre) if genre.class == Genre genre else if genre.exists?(artist) find_genre(genre) else self.new(genre) end end end d...
true
10fd6e0a476df5877b825ea92e95ceeb66b13811
Ruby
lordnynex/CLEANUP
/FORKS/C/nginx_http_push_module/tree/dev/pub.rb
UTF-8
2,675
2.828125
3
[ "WTFPL", "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
permissive
#!/usr/bin/ruby require 'securerandom' require_relative 'pubsub.rb' require "optparse" server= "localhost:8082" msg=false loop=false repeat_sec=0.5 content_type=nil msg_gen = false on_response=Proc.new {} method=:POST runonce=false accept = nil timeout = 3 opt=OptionParser.new do |opts| opts.on("-s", "--server SERVE...
true
14236b9bfb4f732bc2bf2021625a532cce487ccb
Ruby
jcperillaj/ruby-path
/Introduction to Ruby/3-Strings I/case_methods.rb
UTF-8
195
2.9375
3
[]
no_license
puts "hello".capitalize puts "heLLo".capitalize puts "123hello world".capitalize puts "hello".upcase puts "HELLO".downcase puts "hElLo".swapcase # Resume downcase, upcase, capitalize, swapcase
true
fcfe99dbdc40d07086892e94cef572e574974ee8
Ruby
kclercin/armory
/spec/armory/data/achievements_spec.rb
UTF-8
5,659
2.703125
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
# coding: utf-8 require 'helper' describe Armory::Data::Achievements do def i_to_time(i) Time.at(i/1000) end before do @achievements_hash = { achievementsCompleted: [9141, 9146, 9618], achievementsCompletedTimestamp: [1516270000000, 1616280000000, 1716290000000], cr...
true
d5c985a88ae4e5de5cfda9d995af8bdf47e376ff
Ruby
workbooks/client_lib
/ruby/api_data_example.rb
UTF-8
3,998
2.640625
3
[ "MIT" ]
permissive
# # Processes often need to store their state between runs. The 'API Data' facility provides # a simple way to do this. # # A demonstration of using the Workbooks API to manipulate API Data via a thin Ruby wrapper # # # Last commit $Id: api_data_example.rb 22501 2014-07-01 12:17:25Z jkay $ # License: www.workbooks...
true
c0cb694e7c5681020347f90c870d8869caa28d65
Ruby
dfwheeler394/algorithms-practice
/coding_problems/resolve_dependency_list.rb
UTF-8
877
2.8125
3
[]
no_license
DEP_LIST = { A: [:B], B: [:E, :F], D: [:C], E: [:G], } # G => E # | # v # F => B => A # # C => D def topo_sort(dependencies) # tarjan's algorithm dependencies.default = [] # no need for #default_proc because array never gets mutated seen = {} ordering = [] dependen...
true
1fb68333dee43db200a33d90178dfacec6ef0ad1
Ruby
melatran/i-scream-arcade-microservice
/poros/game_results.rb
UTF-8
2,596
2.859375
3
[]
no_license
class GameResults def service GameService.new end def game_result(params) result = {data: { age_ratings: run_array(:get_age_ratings, :rating, params[:age_ratings]), release_date: Time.at(params[:first_release_date]).year, cover: "https:#{cover_url(params[:cover])}", ...
true
ce9863842ef25ef7e802eba85ae4cb619694daf2
Ruby
jdunphy/qer
/test/test_qer.rb
UTF-8
7,501
2.5625
3
[ "MIT" ]
permissive
require 'test_helper.rb' class TestQer < Test::Unit::TestCase def setup queue = File.join(File.dirname(__FILE__), 'testqueue.tmp') File.delete(queue) if File.exists?(queue) @config = File.join(File.dirname(__FILE__), 'config') @todo = Qer::ToDo.new(@config) end context "push" do setup do ...
true
159aa361631088971739fb1eff979922034a4447
Ruby
CosmicSpagetti/brownfield-of-dreams
/app/services/github_service.rb
UTF-8
694
2.578125
3
[]
no_license
# frozen_string_literal: true # service for grabbind data from github class GithubService def initialize(user) @user = user end def repos getting_json('/user/repos') end def followers getting_json('/user/followers') end def following getting_json('/user/following') end def invitee...
true
01032c1407c8542e9a062e63631273da90adf6b1
Ruby
Ross-L/skillcrush-ruby
/if_else.rb
UTF-8
877
4.375
4
[]
no_license
puts "What is 1 + 1?" answer = gets.chomp.to_i if answer == 2 puts "1 and 1 does indeed equal 2" else puts "1 + 1 does not equal #{answer}." end puts "What is your name?" my_name = gets.chomp if my_name == "Skillcrush" puts "Helooooo, Skillcrush!" else puts "Oops, I thought your name was Skillcrush. Sorry ab...
true
e73e066a3a8e2f2f7cd77d75476f82af89f68489
Ruby
Romantiktak/lessons
/lesson8/validation.rb
UTF-8
386
3.171875
3
[]
no_license
module Validation def valid? validate! true # возвращаем true, если метод validate! не выбросил исключение rescue false # возвращаем false, если было исключение end def valid_zero(number) raise "Ты не можешь вставить нулевое значение" if number.zero? end end
true
520e54dfc752575ad6615b2b74540bd04d5081c2
Ruby
ajace/guestbook
/app/models/person.rb
UTF-8
1,744
2.65625
3
[]
no_license
class Person < ActiveRecord::Base attr_accessible :birthday, :body_temperature, :can_send_email, :country, :description, :email, :favorite_time, :graduation_year, :name, :price, :photo after_save :store_photo validates_presence_of :name, :message => "must be provided. I won't tell anyone else." validates_lengt...
true
416666e37636f4ffc40b210eff3220d900bdbb98
Ruby
anclist/ruby_fundamentals2
/second-assigment/exercise_01.rb
UTF-8
174
3.671875
4
[]
no_license
def double(my_number) my_number * 2 end puts "Enter any number and I'll double it" user_number = gets.chomp.to_i puts "Your number times two is #{double(user_number)}"
true
53857a6b057ca10679cb06dec50fe70bf123d728
Ruby
justinshaber/intro-to-ruby
/exercises/ex13.rb
UTF-8
413
3.609375
4
[]
no_license
#use delete_if and start_with to delete words that start with 's' arr = ['snow', 'winter', 'ice', 'slippery', 'salted roads', 'white trees'] p arr arr.delete_if { |item| item.start_with?(/s/) } p arr #now recreate arr and delete words that start with s or w arr << ['snow', 'slippery', 'salted roads'] arr.flatten! ar...
true
b4d72c284d7c070e93602e507105d3775a4a3e63
Ruby
JuanRaba/S6E2
/1 metodos/ejercicio2.rb
UTF-8
279
4
4
[]
no_license
# El siguiente programa deberia mostrar si o no, sin embargo muestrar error # Se pide identificar el error y corregirlo. def random [true, false].sample end random_num = random if random_num == true puts 'sí' elsif random_num == false puts 'no' else puts 'error' end
true
b54515735cbb5792e07b86ee295396ca0c8b5bcf
Ruby
colorbox/AtCoderLog
/abc/128/a.rb
UTF-8
61
2.5625
3
[]
no_license
a, p = gets.strip.split.map(&:to_i) puts ((a*3 + p)/2).to_i
true