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
8a62e80f04e5cbb2fb0f30e6ecb0b0259bf27e5e
Ruby
ronaldabreu-dev/ruby-oo-object-relationships-kickstarter-lab-nyc01-seng-ft-042020
/lib/project.rb
UTF-8
272
2.765625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Project attr_reader :title def initialize(title) @title = title end def add_backer(backer) @title = ProjectBacker.new(self, backer) end def backers ProjectBacker.all.collect{ |p| p.project == self ? p.backer : nil}.compact end end
true
4a9b0d5d84a24a3ba06911acc38210948e7aa7ed
Ruby
hunterae/cashstar-ruby
/lib/cashstar/configuration.rb
UTF-8
2,585
2.828125
3
[]
no_license
require 'cashstar/version' module Cashstar # Defines constants and methods related to configuration module Configuration # An array of valid keys in the options hash when configuring a {Cashstar::API} VALID_OPTIONS_KEYS = [ :username, :password, :endpoint, :return_card_numbers, ...
true
0dae41b96fb5b9445091d8b8b440e10f29fc5ba0
Ruby
alphagov/local-links-manager
/app/presenters/link_api_response_presenter.rb
UTF-8
699
2.53125
3
[ "MIT", "LicenseRef-scancode-proprietary-license" ]
permissive
class LinkApiResponsePresenter def initialize(given_authority, link) @given_authority = given_authority @link = link end def present local_authority_details.merge(link_details) end private attr_reader :given_authority, :link def authority link&.local_authority || given_authority end ...
true
018099c1cf89e962df8ecd2f1d05de11bf16221e
Ruby
jamiepg1/cma-crawlers
/lib/cma/crawler.rb
UTF-8
1,387
2.765625
3
[]
no_license
require 'anemone' require 'cma/case_store' module CMA class Crawler MAILTO_LINKS = %r{mailto:} IN_PAGE_ANCHORS = %r{/?#} NEWS_AND_UPDATES = %r{/news-and-updates} attr_reader :crawl def do_crawl(start_url, options = {}) Anemone.crawl(start_url, options) do |crawl| @crawl = cr...
true
ba2db174f18bf2d2e43a75b940323436eaf282ed
Ruby
spencerschack/shess
/piece.rb
UTF-8
409
3.6875
4
[]
no_license
class Piece class << self attr_accessor :ascii end attr_accessor :side, :board def initialize board, side @board, @side = board, side end def move from, to if board[to].nil? board[to] = self board[from] = nil true else false end end def to_s "\e[38;5;#{white? ? 231 : 16}m#{self.clas...
true
8f7b1e0a99ac09183893435cf757fe182da8af5d
Ruby
kbackowski/all_green
/lib/all_green/runner.rb
UTF-8
625
2.578125
3
[ "MIT" ]
permissive
require 'rspec' module AllGreen class Runner def initialize(options = {}) @options = options @options[:order] ||= [:rspec, :rails_tests, :cucumber, :spinach] @engines = [] load_engines sort_engines end def run @engines.map(&:run).all? end private def load_engines AllGreen::Engines...
true
83684124039ab18dbdbd367d4f7d3597e8edc669
Ruby
midi-visualizer/vissen-parameterized
/lib/vissen/parameterized/conditional.rb
UTF-8
2,006
3.40625
3
[ "MIT" ]
permissive
# frozen_string_literal: true module Vissen module Parameterized # The conditional is just a specialized form of a parameterized object. It # takes just one input and, through a given block, transforms it to a # boolean value. The aliased method `#met?` is nothing more than syntactic # suger for and ...
true
30cd0a8822fde98d61989025175ac274284949d6
Ruby
KevinBongart/mwhich
/lib/mwhich/itunes.rb
UTF-8
724
2.546875
3
[ "MIT" ]
permissive
module MWhich module Services class ITunes def initialize(options={}) @endpoint = "http://itunes.apple.com/search" end def search(title) data = request(title) results = data['results'].map do |r| { 'title' => r['trackName'], 'url' => r[...
true
b5fdb755d62c104e072aff2dcfbef9e647181fba
Ruby
avantmittal90/simple_sales_tax
/app/services/tax_calculator/invoice.rb
UTF-8
355
2.546875
3
[]
no_license
class TaxCalculator::Invoice attr_reader :calculator_service, :invoice def initialize(calculator_service) @calculator_service = calculator_service @invoice = calculator_service.taxable_resource end def calculate invoice.invoice_line_tems&.map do |li| TaxCalculator.call(li, calculator_service...
true
25657b592670af4802b13f1416267f2c1037d4dc
Ruby
eneagoe/hackerrank
/ruby/challenge/ruby-methods-keyword-arguments.rb
UTF-8
477
3.453125
3
[]
no_license
def convert_temp(n, input_scale:, output_scale: 'celsius') n = case input_scale when 'celsius' n + 273.15 when 'fahrenheit' 5/9r * (n - 32) + 273.15 else n end case output_scale when 'celsius' n - 273.15 when 'fahrenheit' (n - 273.15) * 1.8 + 32 else ...
true
257ce7177406c67843c19d237cb7ef18c9708f56
Ruby
hiro-su/polling
/test/test_engine.rb
UTF-8
3,691
2.625
3
[ "Apache-2.0" ]
permissive
require File.expand_path(File.dirname(__FILE__)) + "/helper.rb" class Polling::Engine::Test < Test::Unit::TestCase def setup @e = Polling::Engine.new end def test_engine_initialize assert_equal 0, @e.offset assert_equal 5, @e.target = 5 end def test_increment! @e.target = 0 assert_equal...
true
082290113524df2aac145cfc01089bf7fe36913b
Ruby
toothrot/riot
/test/core/runnable/teardown_test.rb
UTF-8
1,457
2.75
3
[ "MIT" ]
permissive
require 'teststrap' global_thang = Struct.new(:count).new(0) context "A context with a teardown" do setup do @a_context = Riot::Context.new("me") do setup { global_thang.count += 1 } asserts("teardown run") { global_thang.count }.equals(1) teardown { global_thang.count += 1 } end @a_co...
true
d5e54dc15480a259554a6ee9d764e4eb98fcd6eb
Ruby
boochtek/aatc2017
/bowling.rb
UTF-8
2,092
3.375
3
[]
no_license
class Game MAX_FRAMES=10 @pins=0 @totRolls=Array.new @score=0 def initialize @pins=0 @totRolls=Array.new(10,0) @score=0 end def roll(pins) @totRolls << pins #return pins end def score raise BowlingError, ("Pins are not in range of 0 to 10") if (@totRolls.any? { |e| e<0 || e>10 }...
true
b5c30a88d6a97238bed37043839ab74704d15503
Ruby
KatKmiotek/weekend_homework_week02
/specs/bar_specs.rb
UTF-8
642
2.640625
3
[]
no_license
require('minitest/autorun') require('minitest/reporters') require_relative('../bar') require_relative('../room') require_relative('../guest') Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new class TestBar < MiniTest::Test def setup() @room1 = Room.new("The best of Britney") @bar = Bar.new() en...
true
799ee0e6a6d1dcd1e73187f20846373e7f69d81e
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/bob/b9d5421550594b86a8fdfcc02e840fd6.rb
UTF-8
703
3.78125
4
[]
no_license
class Bob def hey(greeting) responses = [ {evaluation: ->(greeting) { _empty?(greeting) }, response: 'Fine. Be that way!'}, {evaluation: ->(greeting) { _shouting?(greeting) }, response: 'Woah, chill out!'}, {evaluation: ->(greeting) { _question?(greeting) }, response: 'Sure.'}, {evaluation...
true
ae0e495fb61d6671f6bae7d6d72fe6a290173085
Ruby
berkes/vim-presentatie
/res/bike.rb
UTF-8
189
2.953125
3
[]
no_license
class Bike def parts 2.times.map do part = Wheel.new part.in_use end end def price sum = 0 parts.each do |part| sum += part.price end end end
true
b9afba3eaff1dc507eba1e28dd1d4d6dd4ad8c28
Ruby
faraazahmad/shellrb
/spec/packages/ls_spec.rb
UTF-8
980
3
3
[ "MIT" ]
permissive
require "packages/ls" describe Ls do describe ".main" do context "given any parameter" do it "calls the right method" do # check whether main("") shows only non hidden files expect(Ls.main("")).to eql(Ls.show_non_hidden) # Merge hidden and non_hidden Sets and check for equality w...
true
ab07f733124d8685215d74aff34205df79b7f0c2
Ruby
scottyschup/dotfiles
/scripts/git_push_set_upstream
UTF-8
611
2.625
3
[]
no_license
#!/usr/bin/env ruby -w def usage $stdout.puts "Usage: `git_push_set_upstream [-h, --help] [[REMOTE] BRANCH]`" end if ARGV[0]&.include?("-h") usage exit end remote = branch = nil args = ARGV.select { |el| !el.start_with?('--') } flags = ARGV.select { |el| el.start_with?('--') }.join(' ') case args.length when ...
true
7cee157aeafebea201097787335d33b6e23a705c
Ruby
acolletti21/deliberate_practice
/math_quiz.rb
UTF-8
588
4.0625
4
[]
no_license
# random math problem, if user puts correct answer put correct etc. prob1 = {"problem" => "What is 2 + 2?", "answer" => 4} prob2 = {"problem" => "What is 6 * 10?", "answer" => 60} prob3 = {"problem" => "What is 9/3?", "answer" => 3} prob4 = {"problem" => "What is 10 - 5?", "answer" => 5} problems = [prob1, prob2, pr...
true
ac170b521e3748c80b289aa579401fc675cf6f90
Ruby
ssavard/fader
/app/datatables/markets_datatable.rb
UTF-8
1,178
2.578125
3
[]
no_license
class MarketsDatatable delegate :params, :h, :link_to, to: :@view def initialize(view) @view = view end def as_json(options = {}) { sEcho: params[:sEcho].to_i, iTotalRecords: Markets.count, iTotalDisplayRecords: markets.total_entries, aaData: data } end private def da...
true
1d99e3c905a1c3b18a597625c49f04a4f41a82a5
Ruby
oyvkva/HashnestBot
/app/workers/bot_worker.rb
UTF-8
8,702
2.9375
3
[]
no_license
class BotWorker include Sidekiq::Worker def perform market,hashLeft,btcLeft,tradingPrice startTrading(market,hashLeft,btcLeft,tradingPrice) end # Starts buying and selling def startTrading market,hashLeft,btcLeft,tradingPrice startID = Pricepoint.last.id #Set these: username = "whateverYou...
true
7f3c00a098d1ad97633a7d2adf5b6f592ac8870c
Ruby
binyamindavid/Sales-Tax
/lib/Calculator.rb
UTF-8
1,150
3.6875
4
[]
no_license
require_relative "./Tax" class Calculator attr_reader :line_items def initialize(line_items) @line_items = line_items @taxes = 0 @total_amount = 0 @listing = [] end def calculate_tax puts #@line_items get_tax_amounts print_totals return @listing end def get_tax_amounts ...
true
9d3b5813ab566dd14536345a9eda76fdf66b67c7
Ruby
diegofigueroa/sync
/lib/nospi/synchronizer.rb
UTF-8
1,133
2.78125
3
[]
no_license
class Synchronizer INTERVALS = Project::INTERVALS def self.perform interval if INTERVALS.include? interval projets = Project.where(interval: interval) projets.find_each do |project| self.sync project end else msg = "Invalid interval value provided." puts msg Ra...
true
9a43213d0f1298fc18183dc9424e8137c7d7efa2
Ruby
kostrom/encounter_simulator
/characters/character.rb
UTF-8
2,718
3.015625
3
[]
no_license
require_relative '../actions/weapon' class Character attr_reader :str, :dex, :con, :int, :wis, :cha attr_reader :name, :level, :ac, :hp, :proficiency_bonus, :metal_armor attr_reader :save_proficiencies, :weapons attr_accessor :actions, :bonus_actions, :allies, :foes, :engaged attr_accessor :initiative, :curr...
true
8619295820214445593c4ac00bc4eece7a0a539d
Ruby
vecnet/dl-discovery
/script/harvest-dl.rb
UTF-8
2,256
2.84375
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env ruby require 'json' require 'rsolr' require_relative '../lib/geonames' require_relative '../lib/enrich_solr' # This is getting to be kinda ugly. if ARGV.length < 2 || ARGV.length > 3 puts "USAGE:" puts "harvest-dl.rb [harvest url] [target solr url]" puts "harvest-dl.rb [harvest url] [target solr...
true
0de7ed5d16f9d3a6285ab0e45113d67f255fe0e2
Ruby
tylore/ruby_test
/block_practice.rb
UTF-8
2,035
3.828125
4
[]
no_license
#ENUMERABLE #**TODO ENTER CODE** # * Output all the methods of the Enumerable class to the console puts "#all? #any? #chunk #collect #collect_concat #count #cycle #detect #drop #drop_while #each_cons #each_entry #each_slice #each_with_index #each_with_object #entries #find #find_all #find_index #first #flat_map #gre...
true
381099d3fef6df1090848fbc95253db35d9888e4
Ruby
tiago972/git-thp
/D07/lib/03_Shakespeare.rb
UTF-8
223
3.1875
3
[]
no_license
def word_counter(word,dico) h={} word.downcase! dico.each do |d| i = 0 word.split.map do |w| if w.include?(d) i+=1 end end if i>0 h[d.to_sym] = i end end return h end
true
fa9b29ac05ea565053c6297f07f7f4ba9b6f980a
Ruby
jsl/georuby
/lib/geo_ruby/simple_features/geometry.rb
UTF-8
9,102
2.71875
3
[ "MIT" ]
permissive
module GeoRuby#:nodoc: module SimpleFeatures #arbitrary default SRID DEFAULT_SRID=-1 #Root of all geometric data classes. #Objects of class Geometry should not be instantiated. class Geometry #SRID of the geometry attr_reader :srid #writer defined below #Flag i...
true
92aa2fe7274f555324f4164e347cdd682b783934
Ruby
domchristie/sharedworkforce-demo-rails
/app/tasks/improve_description_of_cat_task.rb
UTF-8
573
2.75
3
[]
no_license
class ImproveDescriptionOfCatTask include SharedWorkforce::Task title "Describe a cat" instruction "Improve the descrption to make it more accurate, fix spelling mistakes, improve grammar and add some more descriptive language. (e.g. describe what it is doing)" answer_type :edit on_success :describe_cat def s...
true
d0b51faf61fa89d9a62fd53bf4999eb148940b02
Ruby
ISS-SOA/demo_ruby_basics
/iteration/for_loops.rb
UTF-8
518
2.890625
3
[]
no_license
# rubocop:disable all require 'open-uri' sites = %w{slack facebook github codecademy canvaslms} # PROCEDURAL FOR LOOPS titles = [] for site in sites html = URI.open("https://www.#{site}.com").read puts "#{site} scanned" capture = html.match(%r{<title>(?<title>.*)<\/title>}) titles << (capture ? capture[:title...
true
7ab22fb98c1a4a82e93f60179ad0caa5ca84ba47
Ruby
strange-wonders/learnruby
/practice/moarbeer.rb
UTF-8
798
3.546875
4
[]
no_license
#while beer > 1 puts "N bottles of beer on the wall, N bottles of beer, tale one down, pass it around N-1 bottles of beer on the wall!" n = 99 while n > 2 puts n.to_s + " bottles of beer on the wall, " + n.to_s + " bottles of beer, take one down, pass it around, " + (n-1).to_s + " bottles of beer on the wall!" n-=1 ...
true
51b504d7e0d92a074fb50286558be97d59dc5768
Ruby
chrismessina/skobee
/calendar/app/models/geocode_cache_entry.rb
UTF-8
9,620
3.171875
3
[ "MIT" ]
permissive
#MES- Create a GeocodeInfo struct, to hold info returned by geocoding services GeocodeInfo = Struct.new(:location, :address, :city, :state, :zip, :lat, :long) class GeocodeCacheEntry < ActiveRecord::Base #KS: not technically correct, but the range is from 68.71 through 69.40 so I #figure it's kind of insign...
true
efde7c4987c57400ac13f5dd7122eac1c5991260
Ruby
matinahat/merb
/merb-core/experimentation/experiments/erb-bench.rb
UTF-8
6,346
2.859375
3
[ "MIT" ]
permissive
require File.join(File.dirname(__FILE__), "..", "..", "lib", "merb-core") require "rubygems" require "rbench" class Array alias_method :concat, :<< end class Erubis::ArrayEruby < Erubis::BlockAwareEruby def add_preamble(src) src << "_old_buf, @_erb_buf = @_erb_buf, []; " src << "@_engine = 'erb'; " end ...
true
10c097418131e1aed6df26e4ee916337d9ac4413
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/word-count/8124b546bfc04cdd9f3eab042e6bb205.rb
UTF-8
487
3.59375
4
[]
no_license
class Phrase def initialize(phrase) # Since phrase is fixed, just generate the word count once. count_words(phrase) end def count_words(phrase) @counter = Hash.new(0) # Lowercase, strip punctuation (except for apostrophes), phrase = phrase.downcase.gsub(/[^\w']+/, ' ') # Split on white...
true
c4efdb1666d9c096444239103c22781001df7306
Ruby
PENGZhaoqing/CourseSelect
/app/helpers/sessions_helper.rb
UTF-8
1,713
2.59375
3
[ "MIT" ]
permissive
module SessionsHelper def log_in(user) session[:user_id] = user.id end def logged_in? !current_user.nil? end def student_logged_in? !current_user.nil? && !current_user.teacher && !current_user.admin end def teacher_logged_in? !current_user.nil? && current_user.teacher end def admi...
true
119eebb3883bce33ba8f0a81680eb2932f5980e1
Ruby
stci/db-factory
/lib/db_factory/helpers.rb
UTF-8
890
2.890625
3
[]
no_license
module PLSQL class Schema # Returns object ID of table object. Examples: # plsql.find_table('scott.my_table') # plsql.find_table('scott', 'my_table') def find_table(*args) if args.size == 1 table_owner = args[0].split('.')[0].upcase table_name = args[0].split('.')[1].upcase ...
true
24449b45183f878d26ce8ed740803f96730b2b94
Ruby
dgmstuart/sloc
/lib/sloc/cli.rb
UTF-8
1,169
2.609375
3
[ "MIT" ]
permissive
require 'slop' require 'sloc/runner' module Sloc class CLI def initialize @options = {} end def run(args = ARGV) setup(args) if help? puts help else puts @runner.run(@paths) end end def report(args = ARGV) setup(args) if help? he...
true
2530ca1469e6b1935bc8b91bc189f3fd93770dc4
Ruby
joeainsworth/programming_exercises
/Tealeaf Academy - Object Oriented Ruby Exercises Workbook/Intermediate/Quiz 1/exercise_2.rb
UTF-8
695
3.875
4
[]
no_license
# Alyssa created the following code to keep track of items for a shopping cart # application she's writing: class InvoiceEntry attr_accessor :quantity attr_reader :product_name def initialize(product_name, number_purchased) @quantity = number_purchased @product_name = product_name end def upd...
true
0b120b0f5f732ad7598b4f6eafa47b8e96383854
Ruby
krisleech/wisper-visualize
/lib/wisper/visualize/recording_broadcaster.rb
UTF-8
2,142
2.828125
3
[ "MIT" ]
permissive
module Wisper module Visualize class RecordingBroadcaster def initialize(broadcaster) @events = [] @broadcaster = broadcaster end def broadcast(subscriber, publisher, event, args) @broadcaster.broadcast(subscriber, publisher, event, args) @events.push(Event....
true
f6c5b7bd881cdcd228f961efa02efb251e9c37b8
Ruby
GerardOrtiz2017/ruby1
/first.rb
UTF-8
478
4.25
4
[]
no_license
print "Enter your name: " name = gets.chomp puts "Hello #{name}" print "Enter the number of cups: " cups = gets.chomp cups = cups.to_i ounces = cups * 8 puts "That is #{ounces}" print "Enter the temperature in Farenheit: " faren = gets.chomp.to_i cel = (faren - 32) * 5/9 puts "#{faren} degrees Farenheit in is about...
true
f068419506988a086cac1107d4e91042c17790b1
Ruby
dkStephanos/sinatra-mvc-lab-v-000
/models/piglatinizer.rb
UTF-8
1,219
3.796875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' class PigLatinizer attr_accessor :text, :converted_text def to_pig_latin(some_text) piglatinize(some_text) end def piglatinize(text_to_convert) vowels = "aeiouAEIOU".split("") @converted_text = "" if(text_to_convert.split(" ").count == 1) if(vowels.include?(text_to_conve...
true
efd43f3fa4030ba9cd371624aa70b591ab287c41
Ruby
Hiarpa/RubyPuroCourse
/Aula08-RubyAvançado/EXcapitalize.rb
UTF-8
207
3.484375
3
[]
no_license
def capitalize_name(capitalize_lambda) capitalize_lambda.call('adriano') capitalize_lambda.call('evandro') end capitalize_lambda = -> (name){puts name.capitalize} capitalize_name(capitalize_lambda)
true
45b0344dc195b8d842f29e8c900d871e59fed65c
Ruby
thegands/intro-to-tdd-rspec-and-learn-002
/current_age_for_birth_year.rb
UTF-8
61
2.75
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def current_age_for_birth_year(year) return 2015 - year end
true
6bdf3a2f7c2c580337840ba29953dac2be1124eb
Ruby
aliismayilov/poker-player-xiyar
/player.rb
UTF-8
2,546
2.953125
3
[]
no_license
require 'json' class Player VERSION = 'ali' attr_reader :game_state def initialize(game_state) @game_state = JSON.parse(game_state) end def bet_request return all_in_bet if flush? || three_of_a_rank? || double_pair? return minimum_bet + available_for_raise / rank_to_value[ranks(hole_cards).fi...
true
806ae2dfb1e804ee7b069b3b6abf53dd85f0f1d2
Ruby
hairendezi/classbench-ng
/classbench
UTF-8
1,378
2.65625
3
[]
no_license
#!/usr/bin/env ruby require_relative "lib/classbench" require "pp" require "docopt" doc = <<DOCOPT Classbench utility Firewall/openflow rule generator. Usage: #{__FILE__} analyse FILE #{__FILE__} generate v4 <seed> [--count=<n>] [--db-generator=<path>] #{__FILE__} generate v6 <seed> [--count=<n>] #{__FILE_...
true
7745c79494a35096ead7254c5cf281daa16f7077
Ruby
regexer/file_io_polyglot
/nonidiomatic.rb
UTF-8
232
2.765625
3
[]
no_license
# Find all telephone numbers as fast as possible # the non-idiomatic ruby approach i = 0 infile = File.new(ARGV[0], 'r') until infile.eof? do if /\(\d{3}\) \d{3}-\d{4}/ =~ infile.readline i += 1 end end infile.close puts i
true
77cf6235f932e1e7afabbee3ee2566576993f63d
Ruby
RebeccaHA/countdown-to-midnight-online-web-pt-120919
/countdown.rb
UTF-8
266
3.796875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def countdown(n) while n > 0 puts "#{n} SECOND(S)!" n -= 1 end return "HAPPY NEW YEAR!" end countdown(10) def countdown_with_sleep(n_times) while n_times > 0 puts "#{n_times} SECOND(S)!" n_times -= 1 sleep(5) end return "HAPPY NEW YEAR!" end
true
6b5ec95af2787c4304468f4561883f94684835af
Ruby
tekhuy/rock_paper_scissors
/lib/game.rb
UTF-8
1,001
3.515625
4
[]
no_license
class Game def initialize @player = nil @rps = [:rock, :paper, :scissors] @chosen = false @item = nil end attr_accessor :player, :rps, :item WIN = {:rock => :scissors, :paper => :rock, :scissors => :paper} def add_player(player) @player = player end def has_player? !@player.ni...
true
90bf2ef700149c2647f9e8c8cc8b23f9c7b5fbcb
Ruby
blink182seba/Actividad20
/ruby/ejercicios3/ejercicio2.rb
UTF-8
424
3.40625
3
[]
no_license
nombres = ["Violeta", "Andino", "Clemente", "Javiera", "Paula", "Pia", "Ray"] a = nombres.select do |nombre| nombre.length > 5 end b = nombres.map do |nombre| nombre.downcase end c = nombres.select do |nombre| nombre.start_with?("P") end d = nombres.map do |nombre| nombre.length end e = nombres.map do |nombre| ...
true
f278af69e0bd3ec19c8cb9546bda6d2ea21c08f2
Ruby
wzheng10/Aa
/wei_zheng_advanced_methods_exercise/01_coprime.rb
UTF-8
846
4.21875
4
[]
no_license
# Write a method, coprime?(num_1, num_2), that accepts two numbers as args. # The method should return true if the only common divisor between the two numbers is 1. # The method should return false otherwise. For example coprime?(25, 12) is true because #s 1 is the only number that divides both 25 and 12. #check if th...
true
79fe7aa590846ca0c12556e21b6bffe64e88c725
Ruby
hocus2pocus/study_projects
/ruby_module_2/weight.rb
UTF-8
314
3.28125
3
[]
no_license
puts "Укажите Ваше имя:" print "> " name = gets.chomp puts "Укажите Ваш рост:" print "> " height = gets.chomp.to_i weight = height - 110 if weight < 0 puts "#{name}, Ваш вес уже оптимален." else puts "#{name}, Ваш идеальный вес - #{weight}." end
true
4e4c59f4fd08a5f8dd6bfce0e644e67e89101fcd
Ruby
valmar1322/valmar_ruby
/first_lesson/perfect_weight.rb
UTF-8
284
3.328125
3
[]
no_license
print "Введите имя: " name = gets.chomp print "Рост: " growth = gets.to_i perfect_weight = growth - 110 print "#{name}, " if perfect_weight < 0 puts "ваш вес уже оптимальный" else puts "ваш идеальный вес #{perfect_weight}" end
true
b68fe2908c79ab040936361d0cb0b56f0f68af78
Ruby
nilclass/apotomo
/test/unit/test_event_system.rb
UTF-8
3,899
2.640625
3
[ "MIT" ]
permissive
require File.expand_path(File.dirname(__FILE__) + "/../test_helper") ### FIXME: clean me up, use respond_to_event and remove peek. class TestWidget < Apotomo::StatefulWidget def transition_map { :simple_state => [:following_state], } end def simple_state; "simple!"; end; def following_state; "followi...
true
8d20ceb78c89ad54ba72a194651e67f23c585abc
Ruby
jrochkind/rubyland
/app/updaters/body_scrubber.rb
UTF-8
6,205
2.78125
3
[]
no_license
# Want to do what rails does, but with some customizations. # Rails has a bunch of different objects involved, with kinda weird API. We try # to use them, but with an API simpler for our custom fit. # # BodyScrubber.new.sanitize(html_str) # # => returns nokogiri object, not string! Cause we might # # ...
true
3f8cd46dbea5d5628db79c2cea8a73146a174eda
Ruby
whatalnk/cpsubmissions
/atcoder/ruby/code-festival-2015-quala/codefestival_2015_qualA_a/509225.rb
UTF-8
386
2.984375
3
[]
no_license
# Contest ID: code-festival-2015-quala # Problem ID: codefestival_2015_qualA_a ( https://atcoder.jp/contests/code-festival-2015-quala/tasks/codefestival_2015_qualA_a ) # Title: A. CODE FESTIVAL 2015 # Language: Ruby (2.1.5p273) # Submitted: 2015-09-26 12:06:50 +0000 UTC ( https://atcoder.jp/contests/code-festival-2015-...
true
f895e6f2411c15ac2b22da1200b1c1068337ce53
Ruby
jbmeerkat/wild_wild_hash
/lib/wild_wild_hash/extensions/method_access.rb
UTF-8
945
2.828125
3
[ "MIT" ]
permissive
module WildWildHash module Extensions module MethodAccess def method_missing(method_name, *arguments, &block) key = method_name.to_s.chomp("=").chomp("?").intern define_getter key, key setter_name = "#{key.to_s}=".intern define_setter setter_name, key checker_name...
true
ed9cf7c84a7c59208a8892262216e65508634a91
Ruby
brianmario/escape_utils
/test/html_safety_test.rb
UTF-8
551
2.734375
3
[ "MIT" ]
permissive
require File.expand_path("../helper", __FILE__) class HtmlEscapeTest < Minitest::Test include EscapeUtils::HtmlSafety def test_marks_escaped_strings_safe escaped = _escape_html("<strong>unsafe</strong>") assert_equal "&lt;strong&gt;unsafe&lt;/strong&gt;", escaped assert escaped.html_safe? end def...
true
60f9318d17850bd9efc7bd6db550cc66b3f73476
Ruby
jbowkett/Area-Finder
/lib/area_summariser.rb
UTF-8
2,055
2.828125
3
[]
no_license
require_relative 'stats_calculator' class AreaSummariser def self.set_summary_for(area) shortest_journey = shortest_journey(area) area.set_summary(shortest_journey) end def self.shortest_journey(area) area.journeys.min_by{|journey|journey.duration} end def self.median_overall_inspection_grade_...
true
2033ecba4561e032b04e3e1c7e7adcbcb586fcd2
Ruby
catherinetcai/algorithms
/misc/bubble_sort/ruby/main.rb
UTF-8
2,136
4.875
5
[]
no_license
# Bubble Sort # Take an array of numbers and continually # swap two adjacent members until the array is fully sorted # Ex: [3,2,9,5] # 1: [2,3,9,5] - We compared 3 and 2 and swapped them # 2: [2,3,9,5] - We compared 3 and 9 and didn't swap # 3: [2,3,5,9] - We compared 9 and 5 and swapped them # 4: We actually have to l...
true
e338c8e8a3762f60ab4baee1b2fd92f0540056fb
Ruby
stephanierosep/oystercard
/lib/oystercard.rb
UTF-8
924
3.453125
3
[]
no_license
require './lib/journey' class Oystercard attr_reader :balance, :journey_history MAX_LIMIT = 90 MIN_BALANCE = 1 def initialize @balance = 0 @journey_history = [] end def top_up(amount) max_reached = @balance + amount > MAX_LIMIT error_message = "Error: card limit is #{MAX_LIMIT}" max_...
true
e3fdede3b40c1499b3fd615ed5536327e543bc93
Ruby
RoothB/blog
/DescendingExercise.rb
UTF-8
270
3.65625
4
[]
no_license
entered_values=[] (0..9).each do puts "Enter number" entered_value = gets.chomp.to_f entered_values.push(entered_value) end sort_entered_values = entered_values.sort.reverse puts "You entered:" sort_entered_values.each do |value| print value.to_s + ' ' end puts ""
true
11da8abfa40fbc712f58faed183a8f8c89c3aee5
Ruby
waleolakareem/phase-0-tracks
/ruby/gps2_2.rb
UTF-8
2,220
4.375
4
[]
no_license
# Method to create a list # input: string of items separated by spaces (example: "carrots apples cereal pizza") # steps: # [fill in any steps here] # set default quantity # print the list to the console [can you use one of your other methods here?] # output: [what data type goes here, array or hash?] # define ...
true
ab57ce3c4e8811f14c7655d724b16b2aa3945836
Ruby
maxjacobson/duchamp
/app/models/dog.rb
UTF-8
157
3.015625
3
[]
no_license
class Dog attr_reader :name def initialize(name) @name = name end def untested_method puts "this should lower the coverage, huh" end end
true
4175f441186e5ba003b2f7e838780c90841025e9
Ruby
ianballou/prprocessor
/redmine/project.rb
UTF-8
694
2.625
3
[]
no_license
require 'date' require File.join(File.dirname(__FILE__), 'redmine_resource') # Issue model on the client side class Project < RedmineResource def base_path '/projects' end def identifier @raw_data['project']['identifier'] end def name @raw_data['project']['name'] end def get_versions ...
true
01621519e4d7fa5d3ccb1721bb12959fa234d131
Ruby
PARAZIT007/gcj
/jam-Round1C-A.rb
UTF-8
1,381
3.484375
3
[]
no_license
# -*- coding: utf-8 -*- # Problem A. Diamond Inheritance # D < B, C # B < A # C < A # # Your task is to determine whether or not a given class diagram contains a diamond inheritance. require 'rgl/adjacency' INPUT = <<__EOL__ 3 3 1 2 1 3 0 5 2 2 3 1 4 1 5 1 5 0 3 2 2 3 1 3 0 __EOL__ # 3 # the number of classes in t...
true
ec18582e68c0d2025c6041a074c224a081523bd8
Ruby
generall/Distance-Measures
/lib/distance_measures.rb
UTF-8
1,288
3.078125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
$:.unshift(File.dirname(__FILE__) + '/../lib') require 'distance_measures/cosine_similarity' require 'distance_measures/euclidean_distance' require 'distance_measures/tanimoto_coefficient' require 'distance_measures/core' require 'distance_measures/jaccard' require 'distance_measures/haversine' require 'distance_measu...
true
83b855614d234454b9f338b21c0ca28368510756
Ruby
arkadoel/AprendiendoRuby
/dia2/uno.rb
UTF-8
1,278
4.0625
4
[]
no_license
#!/usr/bin/env ruby ''' tambien comentario de varias lineas ''' def imprimeMenu() print ("Menu") print ("\r\n\t1.- meter numeros") print ("\r\n\t2.- sumar") print ("\r\n\t9.- Salir") print("\r\nOpcion> ") opcion = gets return opcion.to_i end def sumarNumeros() resultado = $n1 + $n2 return resul...
true
c3a631191239c61d2e2c1393e8c26b265c94e994
Ruby
Hexopay/be_protected_client
/lib/be_protected/response/verification/white_black_list.rb
UTF-8
1,193
2.6875
3
[]
no_license
require "be_protected/response/attributes" module BeProtected module Response class Verification class WhiteBlackList extend ::BeProtected::Response::Attributes attr_reader :attributes key_reader :error, for: :attributes def initialize(attributes) @attributes = ...
true
8b69ce93615f2f334eb621729beaad99132c0e3c
Ruby
DevKRedd/programming-univbasics-nds-nested-arrays-iteration-lab-part-3-wdc01-seng-ft-011121
/lib/iteration_with_loops.rb
UTF-8
278
3.125
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def join_nested_strings(src) # src will be an Array of Arrays of Strings and Integers # Combine all Strings present in the AoA into a single value and return it join_strings = src.flat_map do |items| items.select { |item| item.is_a?(String) } end.join(" ") end
true
3704dbdb1579fd0aff8201ee47252611c18580c4
Ruby
ebradyjobory/foretoken
/app/models/future.rb
UTF-8
686
2.515625
3
[]
no_license
class Future < ActiveRecord::Base belongs_to :project validates :future_year, :presence => true, numericality: { only_integer: true } def last_entry_year_time project.forecasts.last.time end def first_future_year project.futures[0] end def last_entry_year_id last_entry = project.forecasts.la...
true
11f5c845c727de611ff4aa971f12401c7e1402fb
Ruby
bestwebua/codewars
/ruby/unique_in_order.rb
UTF-8
986
3.875
4
[]
no_license
=begin Unique In Order by Vladislav Trotsenko. Implement the function unique_in_order which takes as argument a sequence and returns a list of items without any elements with the same value next to each other and preserving the original order of elements. For example: unique_in_order('AAAABBBCCDAABBB') == ['A', 'B', ...
true
76dd7933a8f2a2a585690a83722afabd5cebcdd1
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/anagram/4bb94824740642869d59c5f3879f5a1f.rb
UTF-8
343
3.515625
4
[]
no_license
class Anagram def initialize(word) @sorted = sort_string(word) end def match(candidates) candidates.each_with_object([]) { |candidate, anagrams| if @sorted == sort_string(candidate) anagrams << candidate end } end private def sort_string(str) str.to_s.strip.downcase.cha...
true
ad2e95921a4fb56befea7d39c1ab25b6888e24f9
Ruby
matthijsgroen/game-of-geese
/lib/gosu-formatter/renderers/pawn_renderer.rb
UTF-8
1,883
2.953125
3
[ "MIT" ]
permissive
#:nodoc: class PawnRenderer def initialize(window) @pawns = {} initialize_pawn_images(window) end def update_game(game) pawns = game[:players].map { |p| p[:pawn] } if @pawns.size != pawns.size reset_pawns(pawns) else update_pawns(pawns) end end def transition @pawns.e...
true
6e07076c7290499ccbc883759782d7442cd9d043
Ruby
cobranet/tablic
/spec/models/game_spec.rb
UTF-8
2,932
3.171875
3
[]
no_license
require 'rails_helper' arr = [2, 41, 33, 19, 21, 47, 24, 36, 37, 27, 5, 0, 31, 1, 40, 8, 35, 10, 7, 25, 17, 51, 18, 48, 44, 42, 45, 4, 6, 32, 11, 15, 30, 20, 12, 14, 22, 34, 9, 49, 38, 23, 39, 13, 28, 50, 3, 43, 29, 46, 16, 26] # At move 1 # NORTH : ["2S", "2C", "7H", "6D", "8...
true
06936441ee9afd74894c49056abe50b76825107a
Ruby
klakegg/dockerfile-import
/lib/instruction/copy.rb
UTF-8
735
2.875
3
[ "MIT" ]
permissive
module DockerfileImport module Instruction # Reference: https://docs.docker.com/engine/reference/builder/#copy class Copy def self.parse(line) # Copy from image if line.include? '--from=' parts = line.split /\s+/, 3 self::new parts[1][7..], parts[2] # ...
true
50bc1f3796633d2399aa776fa47cfe030a2bba34
Ruby
aiming/sdo-reading-refactoring-ruby
/spec/6.7-split_temporary_variable_spec.rb
UTF-8
487
2.578125
3
[]
no_license
require 'spec_helper' describe SplitTemporaryVariable do describe '#distance_traveled' do instance = SplitTemporaryVariable.new(10, 10, 5, 5) context 'secondary_time <= 0' do it 'returns 12.5' do result = instance.distance_traveled(5) expect(result).to eq 12.5 end end co...
true
4a6f495800b030b5f99fc2940da22e28c368466f
Ruby
sonermezgitci/advanced-hashes-hashketball-dumbo-web-102819
/hashketball.rb
UTF-8
5,738
3.15625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' def game_hash { :home =>{ :team_name =>"Brooklyn Nets", :colors => ["Black", "White"], :players =>{ "Alan Anderson" =>{ number:0, shoe:16, points:22, rebounds:12, assists:12, steals:3, blocks:1, slam_dunks:1 }, "Reggie Evans" =>{ number:30, shoe:14, po...
true
9c64c98d97945d3e15fe3a1c901e2d131974b4e0
Ruby
ptomulik/puppet-portsutil
/lib/puppet/util/ptomulik/package/ports/execution.rb
UTF-8
2,087
2.734375
3
[ "Apache-2.0" ]
permissive
require 'puppet/util/ptomulik/package' begin # Puppet > 2.7 has Puppet::Util::Execution.execpipe Puppet::Util::Execution.method(:execpipe) rescue NameError # Puppet <= 2.7 has Puppet::Util.execpipe... begin Puppet::Util.method(:execpipe) rescue NameError module Puppet::Util # .. but it's usuall...
true
2830f974974900710d162ad76830e27a50c275a4
Ruby
ajshopov/WDI_14_HOMEWORK
/Alex/wk04/1-mon/loc.rb
UTF-8
187
3.125
3
[]
no_license
require 'pry' print "enter file name: " file_name = gets.chop number_of_lines = IO.readlines(file_name) puts("lines: #{number_of_lines.length}") # binding.pry # puts('end of program')
true
7c1a178ad742c891e0b43725dd00590474863c9b
Ruby
fingersi/Ruby_lessons
/ruby_lesson9_meta/accessors.rb
UTF-8
1,134
2.953125
3
[]
no_license
module Accessors def attr_accessor_with_history(*names) names.each do |name| var_name = "@#{name}".to_sym instance_variable_set(var_name, []) define_method(name) do instance_variable_get(var_name)&.last end define_setter(name, var_name) define_method("#{name}_history"...
true
68fdfbad8a49372b48f3f71338e3d8499324f461
Ruby
oleksa-dev/budget
/lib/tasks/properting/propering_properties.rake
UTF-8
4,405
2.765625
3
[]
no_license
namespace :properting_properties do desc 'Set start_date' task set_start_date: :environment do counter = 0 old_date_properties = Properting::Property.where(:property_date.exists => true, :property_date.ne => nil, :property_start_date.exists => false) puts "#{old_date_properties.count} properties selecte...
true
be26566bf92b9f11846776fce0b4892996c24be0
Ruby
bhbryant/iron_mq_ruby
/test/long_run_worker.rb
UTF-8
1,468
2.765625
3
[]
no_license
require 'iron_worker' class LongRunWorker < IronWorker::Base merge_gem 'concur' merge_gem 'iron_mq' attr_accessor :config, :num_to_add def run @client = IronMQ::Client.new(@config['iron_mq']) @client.queue_name = 'ironmq-gem-long' start = Time.now puts "Queuing #{@num_to_add} items at #{st...
true
bd4d712c3bff75dfa8d19f43e9556a7c779c8c31
Ruby
noniq/twtrtool
/bin/twtrtool
UTF-8
3,620
2.953125
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require "twtrtool" require "thor" module Twtrtool class CLI < Thor include Thor::Actions desc "auth", "Authenticate with Twitter API" long_desc %{ Authenticate with the Twitter API. Will ask for CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN and OAUTH_SECRET and store t...
true
0466c03763d757aa2d4282975ee2a1c193cd2f3a
Ruby
dtcoutu/2019-Advent-of-Code
/day-06/day-06_spec.rb
UTF-8
816
2.859375
3
[]
no_license
require_relative 'day-06' require 'minitest/autorun' class Day06Test < Minitest::Test def test_one_level input = 'COM)B' day = Day06.new(input) assert_equal 1, day.compute end def test_multiple_levels_single_line input = "COM)B\nB)C\nC)D" day = Day06.new(input) assert_equal 6, day.comput...
true
1ddb1c1e92fc4a44c1d614e523866fc491208786
Ruby
marinacor1/sorting_suite
/test/insertion_sort_test.rb
UTF-8
1,357
2.953125
3
[]
no_license
gem 'minitest', '~> 5.2' require './lib/insertion_sort' require 'minitest/autorun' require 'minitest/pride' require 'pry' class InsertionSortTest < Minitest::Test def test_insert_instance_created sorter = InsertionSort.new assert sorter.instance_of? InsertionSort end def test_insertion_sort_can_sort_emp...
true
061f672e8bf701bccf96079079d925262c02f028
Ruby
ljsc/vegas
/examples/current_timeline.rb
UTF-8
1,747
3.09375
3
[]
no_license
#!/usr/bin/env ruby # Here's a working example with pulling some data from twitter. To get this # running I did the following steps. # # 1. Downlaod MacFuse and Install # 2. Install Fusefs for OSX # $ gem install fusefs-osx # This only works with ruby 1.8 apparently. It will not compile correctly # with 1...
true
15ab9df04c3ee5d18e31dac44eea97fa2cd91cda
Ruby
rumman07/rubyonrails
/ruby_code_sample/string_join.rb
UTF-8
404
3.8125
4
[]
no_license
names = ["Joe", "Moe", "Bob"] p names.join p names.join("-") puts def custom_join(array, delimeter = "") string = "" last_index = array.length - 1 array.each_with_index do |elem, index| string << elem string << delimeter unless index == last_index end string end p custom_join(n...
true
c7e2400063a08da99a0d946160d896265c340f9d
Ruby
Veith3n/Bikeramp
/app/models/trip.rb
UTF-8
745
2.6875
3
[]
no_license
class Trip < ApplicationRecord validates_presence_of :start_address, :destination_address, :price after_validation :calculate_distance, :set_date scope :weekly, -> { where(date: Date.current.beginning_of_week..Date.current.end_of_week).order(:date) } scope :monthly, -> { where(date: Date.current.beginning_of_...
true
6693ddc8b84755a6bb7ce041bb2ca539f81fb856
Ruby
chef/chef
/lib/chef/attribute_blocklist.rb
UTF-8
2,229
3.109375
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require_relative "exceptions" class Chef class AttributeBlocklist # filter takes two arguments - the data you want to filter, and an array # of keys you want discarded. You can capture a subtree of the data to filter by # providing a "/"-delimited string of keys. If some key includes "/"-characters, ...
true
1135b8f9cb3cf1e7c44afc2c7d8a48742d93c52f
Ruby
ashikajith/online_education_system
/app/models/leader_board.rb
UTF-8
6,182
2.6875
3
[]
no_license
class LeaderBoard include Mongoid::Document include Mongoid::Timestamps include Mongoid::Paranoia #fields field :rank field :total_users_attended field :accuracy field :l1_attended field :l2_attended field :l3_attended field :exam_date, type:Date field :total_mark field :least_mark_ratio f...
true
d0c05421845c291a7f7e4612c2f3193865bd6a37
Ruby
LVillaflores/Ruby-Challenges
/max_char_service.rb
UTF-8
478
3.328125
3
[]
no_license
class MaxCharService def self.call(str) sentence = str.downcase.delete(' ') count = 0 max_count = 0 char = "" sentence.each_char do |ch| count = sentence.count(ch) if count > max_count max_count = count char = ch end end puts "Text: #{str}" return "#{...
true
fa83150b8086a884213c1915dc8a03af02fac3d0
Ruby
junwatanabe72/poker_rails
/app/models/result.rb
UTF-8
480
2.5625
3
[]
no_license
class Result < ApplicationRecord has_many :user_results has_many :users, through: :user_results def self.form_game_data(game) formed_game_data = {} victory = game.victory rank = game.user_rank hands = game.user_hands hands.each_with_index { |card, num| formed_game_data["card#{num + 1}"....
true
b1307f472eafeafe8bba91434cefff2669d2aed5
Ruby
shravnk/rack-responses-lab-v-000
/t.rb
UTF-8
88
2.59375
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'pry' require 'date' t = Time.new binding.pry if t.hour >= 23 puts "WOO" end
true
df04cc054275c060e52bf742ec3bfebed506e827
Ruby
vyklimavicius/square_array-dumbo-web-career-021819
/square_array.rb
UTF-8
110
2.984375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def square_array(array) new_array = [] array.each |num| do new_array << num * num end new_array end
true
ad8906d029d0e0fec140017c99722b51b69e93bd
Ruby
kaihoffman/Oyster-card
/spec/oystercard_spec.rb
UTF-8
2,645
2.921875
3
[]
no_license
require 'oystercard' describe Oystercard do describe '#balance' do before(:each) do basicoyster = subject.new fulloyster = subject.new.top_up(90) end end it 'returns the current balance' do expect(subject.balance).to eq (0) end describe 'Journeys' do it 'has an empty list of journ...
true
9a953a7fc7745f14509676dbafc4a13672176658
Ruby
Shadowsith/mumble-ruby-pluginbot-plugins
/plugins/picotts.rb
UTF-8
2,786
2.59375
3
[ "MIT" ]
permissive
# requires svox pico console program require "yaml" require "../helpers/tts.rb" require "../helpers/picottsh.rb" class PicoTTS < Plugin include ITextToSpeech public def init(init) super logger("INFO: INIT plugin #{self.class.name}.") @@bot[:pico] = self return @@bot end def name self.c...
true
39cf09c69bbed675174814fa581154b35b2223ba
Ruby
FelipeSoller/workout-plan
/spec/models/training_spec.rb
UTF-8
1,266
2.5625
3
[]
no_license
require 'rails_helper' describe Training, type: :model do context 'attributes' do it 'is not valid without title' do subject.title = nil subject.valid? expect(subject.errors[:title]).to include("can't be blank") end end context 'and :title' do it 'should be greather than 5 characte...
true
2a33a41041eb2ed32a3210344ec81d24ef91f916
Ruby
MrAlejandro/rby
/lesson_4/main.rb
UTF-8
6,893
3.5
4
[]
no_license
require_relative 'train' require_relative 'cargo_train' require_relative 'passenger_train' require_relative 'station' require_relative 'route' require_relative 'wagon' require_relative 'cargo_wagon' require_relative 'passenger_wagon' class RailWayControlPanel OPERATION_CODE_OK = 0 OPERATION_CODE_EXIT = -1 OPERAT...
true
952412151b8b8c41c50f7b215a552dc5d09130a6
Ruby
twingly/twingly-url
/profile/profile.rb
UTF-8
931
2.546875
3
[ "MIT" ]
permissive
# frozen_string_literal: true require "ruby-prof" require "memory_profiler" class Profile def self.measure(name, count, &block) RubyProf.start count.times do block.call end result = RubyProf.stop result_directory = "tmp" Dir.mkdir(result_directory) unless File.exists?(result_director...
true
be17d657e6b4d18ab5c99b25d52f08e8e3a89838
Ruby
smeyyeac/Ruby-basic-examples
/craps.rb
UTF-8
452
2.90625
3
[]
no_license
a=rand(1..6) b=rand(1..6) kosul=a+ b case kosul when 7 then puts "kazandınız" when 11 then puts "kazandınız" when 2 then puts "kaybettiniz" when 3 then puts "kaybettiniz" when 12 then puts "kaybettiniz" else puts "yeniden zar atacak oyuncu" if kosul2==kosul puts "yeniden z...
true