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
eaacba9be4e2c744c1d7106f1e37ea6731f7db23
Ruby
eguitarz/macaron
/lib/macaron/page.rb
UTF-8
1,216
2.78125
3
[ "MIT" ]
permissive
require 'open-uri' require 'nokogiri' module Macaron class Page def initialize(url, bot=nil) @url = url @bot = bot end def fetch document base(@url) self end def inner_links anchors = links.select {|link| URI.parse(link).host == @base.host }.c...
true
d031e2ba99ae380ba1144712f16de1d60ccf7edb
Ruby
e-eq-mc2/usb-raid
/src/usb/tree/base.rb
UTF-8
1,725
2.65625
3
[]
no_license
module Usb::Tree::Base module ClassMethods def write(key, str) Usb::Tree.storage[key] = str end def read(key) Usb::Tree.storage[key] end def load(meta) type = meta.fetch(:type ) digest = meta.fetch(:digest ) case type when Usb::Tree::Commit.type then Usb...
true
6c62112809be8a5960888c1557c10a57d6179b35
Ruby
touyou/CalcProgramming
/prac3.rb
UTF-8
912
2.828125
3
[]
no_license
# prac3 load "word.rb" def search(w) word.index(w) end def find(t, s) i = 0; j = t.length-1 while i<=j k=(i+j)/2 if t[k]==s return k elsif t[k] < s i = k+1 else j = k-1 end end return nil end def search2(w) find(word, ...
true
00902659afc204a00835e32805aa536056ebe76b
Ruby
kakulo83/LittleOrganisms
/src/simulation.rb
UTF-8
7,360
2.875
3
[]
no_license
# Life-Simulation # # Copyright (c) 2012 Robert Carter # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation the rights to use, copy, mod...
true
98b66d91c397b06408b978e31019e663fb9d7940
Ruby
Hallm13/ideamapr
/lib/cookie_jar.rb
UTF-8
1,129
2.546875
3
[ "Apache-2.0" ]
permissive
module CookieJar class CookieKey attr_reader :key attr_accessor :respondent_id def initialize(key:, new:, respondent_id:) @new = new @key = key @respondent_id = respondent_id end def new? @new end end def find_or_create_cookie(old_key = nil) # If a cookie...
true
778c0b96465b11c2fc94ecb5e0b859cbdcd45c75
Ruby
ajgosling/App_Academy_Review
/Alpha_Curriculum/algorithmic_strategies_exercise/05_compress_str.rb
UTF-8
959
4.15625
4
[]
no_license
# Write a method, compress_str(str), that accepts a string as an arg. # The method should return a new str where streaks of consecutive characters are compressed. # For example "aaabbc" is compressed to "3a2bc". def compress_str(str) # loop until done with string # take current (first char) # inside loop u...
true
99d7e3ece3465c9106b42955529ba6d6cd468e2b
Ruby
jonathandwang/mini_capstone
/app/models/product.rb
UTF-8
460
2.734375
3
[]
no_license
class Product < ApplicationRecord validates :name, presence: true validates :price, presence: true validates :price, numericality: { greather_than: 0 } validates :description, length: { in: 2..500 } def friendly_updated_at created_at.strftime("%B%e, %Y") end def is_discounted? if price <= 20...
true
e098b64649de7d29b781bdeda22f1b2b81103a48
Ruby
mhero/ruby-rails-api
/app/services/response_handler.rb
UTF-8
1,072
2.96875
3
[]
no_license
class ResponseHandler include CustomLogger NOT_FOUND = 404 SERVER_ERROR = 500 SUCCESS = 200 REQUEST_ERROR = (400..499).freeze def initialize(response) @response = response @status = response&.status @body = parse_body end def bad_request? REQUEST_ERROR.include? @status end def su...
true
b9e30c86c0f80cb1ee4d3e2c060dbda77def75ae
Ruby
modeset/bitbot-responders
/responders/misc/cah_responder.rb
UTF-8
1,354
2.75
3
[ "MIT" ]
permissive
class CardsAgainstHumanityResponder < Bitbot::Responder include Bitbot::Responder::Wit category "Cards Against Humanity" help "misc:cards", description: "Provides a random question and answer card.", examples: ["cards against humanity.", "give me some cards."] intent "cah_cards", :cards rout...
true
b8e2dc74e9367eb175711d0ce11792a0b7ebd780
Ruby
vjoel/cgen
/examples/matrix.rb
UTF-8
2,290
2.875
3
[ "Ruby" ]
permissive
require 'cgen/cshadow' class MyMatrix include CShadow shadow_attr_reader :rows => "int rows", :cols => "int cols" shadow_attr :matrix => "double *matrix" define_c_method(:initialize) { c_array_args { required :rows, :cols typecheck :rows => Fixnum, :cols => Fixnum } declare :size => "...
true
f2e3aaec79c874b4572e879f15b806a153d7de1b
Ruby
qwertale/C
/Ruby/Prog_giris1_odev1.rb
UTF-8
1,368
2.921875
3
[]
no_license
notlar = [["ahmet",50.0,60.0], ["mehmet",60.0,90.0], ["temel",70.0,20.0], ["dursun",0.0,100.0], ["fadime",100.0,100.0], ["zeynep", 30.0,30.0]] not_ort = [] not_ort = notlar.select do |ogrenci, vize, final| ogrenci && not_ort << vize * 0.4 + final * 0.6 end puts "Not Ortalamaları = #{not_ort}" genel_ort =...
true
728193fad00a34c99b849b729d18666b1ce40093
Ruby
eipipuz/euler_project
/problem1.rb
UTF-8
306
3.90625
4
[]
no_license
#!/usr/bin/env ruby def sum_of_n(n) n * (n + 1) / 2 end def sum_of_multiples(limit = 1000, prime1 = 3, prime2 = 5) multiples_for_prime1 = limit / prime1 multiples_for_prime2 = limit / prime2 prime1 * sum_of_n(multiples_for_prime1) + prime2 * sum_of_n(multiples_for_prime2) end puts sum_of_multiples
true
6afb19e991585993a6f155cc792c1ca4619739d0
Ruby
madcalf/tealeaf_c1_prework
/hashes/exercise5.rb
UTF-8
398
4.09375
4
[]
no_license
# Hashes Exercise 5 # What method could you use to find out if a Hash contains a specific # value in it? Write a program to demonstrate this use. puts "-- Exercise 5" people = {Elrond: "Elf/Man", Gimli: "Dwarf", Bilbo: "Hobbit", Fili: "Dwarf", Aragorn: "Man", Gandalf: "Wizard", Eomer: "Man"} people.has_va...
true
3804a541a0fab7362b4892736f251d90cd16e988
Ruby
Gerula/interviews
/LeetCode/maximal_square.rb
UTF-8
659
3.890625
4
[ "MIT" ]
permissive
# Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area. # # For example, given the following matrix: # # 1 0 1 0 0 # 1 0 1 1 1 # 1 1 1 1 1 # 1 0 0 1 0 # # Return 4. # board = [[1, 0, 1, 0, 0], [1, 0, 1, 1, 1], [1, 1, 1, 1, 1], ...
true
c7ec592f9281c7318d902d90cda872cf6e0ea437
Ruby
tysonvanburen/tictactoe
/tictactoe2.rb
UTF-8
1,136
3.859375
4
[]
no_license
puts "Welcome to Tic Tac Toe!" tic_tac_toe = [ ["", "", ""], ["", "", ""], ["", "", ""] ] turn = 1 while turn <= 9 if turn.odd? player = "X" puts "Player 1's turn" else player = "O" puts "Player 2's turn" end puts "Choose a row! (1-3)" row = gets.chomp.to_i - 1 puts "Choose a column! (1-3...
true
cba9f545f9f577e400d460d36be3dc8ec82b5e6c
Ruby
NicoleReyeso/introduccion_ruby2
/ejercicio3_hash/usuarios.rb
UTF-8
888
3.34375
3
[]
no_license
require 'securerandom' #ciclos de la logica comando = "" #dato de lista, lista usuarios lista_usuarios = [] puts "Ingrese los nombres de los trabajadores para generar contraseña: " puts "Si desea salir escriba salir" while comando != "salir" #datos de entrada puts "Ingrese el nombre del trabajador: " ...
true
be0249095e3a7ed8899109e8faa5c54ece58f0c4
Ruby
minsiw/looping-while-until-v-000
/lib/while.rb
UTF-8
131
2.828125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
#your code here def using_while levitation_force=6 while levitation_force < 10 levitation_force += 1 puts "Wingardium Leviosa" end end
true
e96c79879fb555d09f2ed54f4815075846e528d0
Ruby
happyhappyhappyhappy/rubycode
/atcoderruby/begineersSelection/chap1/PASTFILES/ABC082A_2.rb
UTF-8
173
3.359375
3
[]
no_license
# Problem https://atcoder.jp/contests/abc082/tasks/abc082_a # Ruby 2nd Try a,b = gets.chomp('\n').split(' ').map(&:to_i) group = 2 answer = (a+b+group-1)/group puts(answer)
true
23a404940d7e1aa76aa1feae6edb78c7aaff29b3
Ruby
winnie-ho/161124_week4_ruby_project
/controllers/restaurants_controller.rb
UTF-8
1,268
2.78125
3
[]
no_license
require( 'sinatra' ) require( 'sinatra/contrib/all' ) require_relative ('../models/burger.rb') require_relative ('../models/day.rb') require_relative ('../models/restaurant.rb') # show all restaurants get '/restaurants' do @restaurants = Restaurant.all() @days = Day.all() erb(:"restaurants/index") end # form t...
true
7b7878ca406c0716a41a35578ba0432a467e31d9
Ruby
mperez623/oo-counting-sentences-onl01-seng-pt-030220
/lib/count_sentences.rb
UTF-8
321
3.578125
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' class String def sentence? self.end_with?(".") end def question? self.end_with?("?") end def exclamation? self.end_with?("!") end def count_sentences arr = self.split(/[!.?]/) short_array = arr.select do |x| x != "" end short_array.length end end ...
true
a75f791d15bf124ce59e211e63acff836cfc76ab
Ruby
AAMani5/student-directory
/chap08/ex7.rb
UTF-8
1,866
4.4375
4
[]
no_license
# get cohort as input & convert to symbol. added a nw method cohort_check # default to :novenber # random month assigned if the user makes a typo def input_students puts "Please enter the names of the student" # get the first name name = gets.chomp puts "Please enter the cohort of the student" #get the cohor...
true
211e449ad8a67a706206f3855624bcaecdbe17dd
Ruby
kawano-t/kanakomi
/log_monitor.rb
UTF-8
3,165
2.828125
3
[]
no_license
#!/usr/bin/ruby ###########################3 ## 20140820 made ## 20140826 sendmail機能追加 ###### ## 使用例 ## ##### require 'mail' require 'openssl' ##日付 datetime = `date` datetime.chomp! ##ログファイルオープン begin log_filename = "/var/log/log_aleart.log" log_file = File.open(log_filename, "a") rescue =...
true
b32e418a86c612b0cc6f8add4cf88a27908f4853
Ruby
hipstar-08/HelloWorld
/Python27/APIXPortal/Samples/Ruby Scripts/Anagram.rb
UTF-8
615
3.859375
4
[]
no_license
class Anagram #--Anagram string def search(b,n,l1) p=0 for j in 0...l1 if n==b[j] p=1 end end if p==1 return 1 else return 0 end end a=String.new b=String.new print "Please provide First string:" a=gets.chomp l=a.length count =0 print "Please provide Second string...
true
f87700b955d3857f9d2f13230b999ab0fc424365
Ruby
Woumpousse/KHL
/bop/java/week2-poolpuzzle/doc/Generate.rb
UTF-8
4,117
3.671875
4
[]
no_license
require './Questions.rb' require './Java.rb' $data = Hash.new def add(label, exercise) abort "Duplicate label #{label}" if $data.has_key? label $data[label] = exercise end def get(label) abort "Undefined label #{label}" unless $data.has_key? label $data[label] end def labels $data.keys end # Vul de typ...
true
0c84097c0e61378eac23936117ea00c0fd929210
Ruby
Jackwhitener/CloseButNoCigar
/closebutnocigar1.rb
UTF-8
858
3.578125
4
[]
no_license
def offbyonenumber(my_number, bash_numbers) counter = 0 x = 0 my_number.length.times do # puts "#{my_number} is my number" # puts "#{bash_numbers} is the winning number" if bash_numbers[x] == my_number[x] counter += 1 # puts "count: #{counter}" end x += 1 end counter == my_number.length - 1 end # ...
true
97c297c15c935b7255c41d92c12f2603eaa2c17b
Ruby
liahnee/programming-univbasics-4-array-simple-array-manipulations-seattle-web-080519
/lib/intro_to_simple_array_manipulations.rb
UTF-8
631
3.390625
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def using_push(array, string) array.push(string) end def using_unshift(array, string) array.unshift(string) end def using_pop(array) array.pop end def pop_with_args(array) array.pop(2) end def using_shift(array) array.shift end def shift_with_args(array) array.shift(2) end def using_concat(array, ar...
true
b14852fb5d7dfc7d9ce27bcb8bcfc8c9f83eb5b7
Ruby
sealink/un_numbers
/lib/un_numbers/loader.rb
UTF-8
535
2.53125
3
[ "MIT" ]
permissive
module UnNumbers class Loader attr_reader :un_codes def load lines = file.lines headers = lines.shift @un_codes = lines.map do |line| columns = line.strip.split('|') UnNumber.new( number: columns[0], variant: columns[1], name: co...
true
355b11f0a02f34ed7c3857bf3748364ce725e378
Ruby
jlgasparrini/zebra-zpl
/lib/zebra/zpl/barcode.rb
UTF-8
1,659
2.984375
3
[ "MIT" ]
permissive
require "zebra/zpl/printable" module Zebra module Zpl class Barcode include Printable class InvalidNarrowBarWidthError < StandardError; end class InvalidWideBarWidthError < StandardError; end attr_accessor :height attr_reader :type, :narrow_bar_width, :wide_bar_width, :width ...
true
5409c826a33c90116777fefc50b8e082ff7a6230
Ruby
albertog2man/wyncode
/random/random.rb
UTF-8
663
3.265625
3
[]
no_license
class Quadrilateral end class Rectangle < Quadrilateral end class Trapezoid < Quadrilateral end class Square < Rectangle end class Rhombus < Trapezoid end def test squa = Square.new puts squa.is_a? Rectangle puts squa.is_a? Quadrilateral rect = Rectangle.new puts rect.is_a? Quadrilateral puts not(rect.is_a...
true
f3edefb0f6f1d32ee1d2df39bbd9e10e348c24b0
Ruby
jjjreisss/w2d1
/game.rb
UTF-8
1,146
3.515625
4
[]
no_license
require_relative 'display' require_relative 'cursor_module' require_relative 'errors' class Game attr_reader :display, :start_pos, :end_pos, :board def initialize(display, board) @display = display @board = board end def get_move start_pos = nil end_pos = nil # all Display#move_cursor ...
true
a7c758ce66da5388b9a68f0a99c89bd1a34de676
Ruby
dano/vertx-lang-ruby
/src/main/resources/vertx/datagram_socket.rb
UTF-8
13,539
2.65625
3
[]
no_license
require 'vertx/packet_writestream' require 'vertx/buffer' require 'vertx/datagram_packet' require 'vertx/measured' require 'vertx/read_stream' require 'vertx/socket_address' require 'vertx/util/utils.rb' # Generated from io.vertx.core.datagram.DatagramSocket module Vertx # A datagram socket can be used to send {::Ve...
true
1e6e4c0587255ebd0f2fe8af7f5ffefaf01d9a9d
Ruby
FrankSerra/PaulyPCharacterGenerator
/app/controllers/home_controller.rb
UTF-8
625
2.578125
3
[]
no_license
class HomeController < ApplicationController def index end def generate count = 1 if params[:count] count = params[:count] end @characters = [] count.to_i.times do @characters.append(Character.new) end respond_to do |format| format.html { render "generate", charac...
true
e980375c86d00b522ac3ef694c98aa937a04f23f
Ruby
pullmonkey/EulerProblems
/problem5.rb
UTF-8
259
3.171875
3
[]
no_license
numbers = (1..20).to_a i = numbers.last def evenly_divisible?(i, numbers) numbers.reverse.each do |num| return false if i % num != 0 end return true end until evenly_divisible?(i, numbers) do i+=numbers.last # inc by largest number end puts i
true
023d607e51fddd908336c1b393c003f676b557a6
Ruby
Shelvak/nebula-game
/server/lib/app/models/construction_queue_entry.rb
UTF-8
4,779
2.5625
3
[ "LicenseRef-scancode-other-permissive" ]
permissive
# Actual database entries for ConstructionQueue. # # Do not use this class directly from the constructors. Instead use # ConstructionQueue class that will manage these objects. # class ConstructionQueueEntry < ActiveRecord::Base include Parts::WithLocking default_scope order(:position) belongs_to :constructor, :c...
true
d7a3fa78518c809b0fd49ec90b625227a340bacd
Ruby
lDesa/telegram_bot
/lib/weather_condition.rb
UTF-8
1,181
2.96875
3
[]
no_license
require 'weather-api' module WeatherBot class WeatherCondition attr_writer :city, :country,:unit def initialize(unit = 'c',hash) # @city = "SaintPetersburg" @city = hash[:city].lstrip! @country = hash[:country] @unit = unit end def get_weather_today woeid = ...
true
1eae63edae95b3733ba7e99b91d5519bb29f9443
Ruby
tsonntag/expression_problem
/ruby/shape.rb
UTF-8
348
3.40625
3
[]
no_license
class Shape end class Square < Shape attr_reader :side def initialize side @side = side end def area @side * @side end end class Circle < Shape attr_reader :radius def initialize radius @radius = radius end def area @radius * @radius * 3.14 end end #puts Circle.new(2).area #pu...
true
bb3f7c17822c159e1f2f6fdf99adb4cc491c0998
Ruby
agross/nhibernate-init
/tools/Rake/string.rb
UTF-8
416
2.96875
3
[]
no_license
class String def escape "\"#{self.to_s}\"" end def in(dir) File.join(dir, self) end def name() File.basename(self) end def dirname() File.dirname(self) end def to_absolute() File.expand_path(self) end def exist? if File.exist?(self) self end end def pa...
true
c87aa223ee0641d0358697137f8f2762cfeb7d9e
Ruby
adrian-lara/job-tracker-base
/spec/models/tag_spec.rb
UTF-8
1,611
2.6875
3
[]
no_license
require 'rails_helper' describe Tag do describe "Instance Methods" do before(:each) do @company = Company.create!(name: "ESPN") @job_1 = @company.jobs.create!(title: "Developer", level_of_interest: 70, city: "Denver") @tag_1 = @job_1.tags.create(name: "Sports") @tag_2 = @job_1.tags.crea...
true
a1d42e10cd17ec19a55d4660423380221545b66c
Ruby
mckenziefiege/OO-mini-project-dumbo-web-082718
/app/models/User.rb
UTF-8
1,081
3.125
3
[]
no_license
class User @@all = [] attr_reader :name def initialize(name) @name = name @@all << self end def self.all @@all end def get_recipe_card RecipeCard.all.select do |recipe_card| recipe_card.user == self end end def recipes get_recipe_card.map do |recipe_card| recip...
true
58de1d06ca50cbc80dd78803f46896f2cdfa2267
Ruby
kylekrawl/launch_school_intro_to_programming
/09_more_stuff/exercise_1.rb
UTF-8
438
3.921875
4
[]
no_license
# 1. Write a program that checks if the sequence of # characters "lab" exists in the following strings. If it # does exist, print out the word. # "laboratory" # "experiment" # "Pans Labyrinth" # "elaborate" # "polar bear" def has_lab?(string) puts string =~ /lab/ ? string : "Substring not found." end h...
true
295a32b44db25d2352e4149073f2e650c92c9800
Ruby
Xlaudius/Desafio_Latam_RoR
/Week_6/E6CP2A1/1 metodos/ejercicio5.rb
UTF-8
308
4.25
4
[]
no_license
# Crear un método que reciba como parámetro dos números enteros positivos # e imprima los números pares que existen entre esos dos números. def even_between_2_numbers(num1, num2) num1.upto(num2) { |i| puts i if i.even? } num2.upto(num1) { |i| puts i if i.even? } end even_between_2_numbers(17, 2)
true
53a1cad6630cf4d040b53a345d2e9be4b0f1c943
Ruby
MiyamotoAkira/CommandLineGames
/lib/game_IO.rb
UTF-8
1,069
3.390625
3
[]
no_license
class GameIO def get_input gets.chomp end def get_input_as_int gets.chomp.to_i end def player_won player_number puts "Player #{player_number} has won!" end def end_of_game puts "Game over" puts "Press a key" gets end def welcome puts "Welcome to my Tic Tac Toe game" ...
true
cf4fc75374cff1c7f7ba6775a8d1dc76d7926874
Ruby
iamabhishekt/leetcode-ruby-1
/1.two-sum.rb
UTF-8
702
3.84375
4
[]
no_license
# -*- coding: utf-8 -*- # # @lc app=leetcode id=1 lang=ruby # # [1] Two Sum # # https://leetcode.com/problems/two-sum/description/ # # Given an array of integers, return indices of the two numbers such # that they add up to a specific target. # # You may assume that each input would have exactly one solution, and # you...
true
e48adc0cac6462af548f8d2aace8ce745c4dd4c0
Ruby
Merseyside/ruby
/task1/disc.rb
UTF-8
302
3.3125
3
[]
no_license
puts "Input A" a = gets.chomp.to_i puts "Input B" b = gets.chomp.to_i puts "Input C" c = gets.chomp.to_i d = b**2 - 4*a*c puts "#{d}" if d < 0 puts ("d < 0 => no roots") elsif d == 0 puts "x1 = #{-b / 2*a}" else puts "x1 = #{(-b + Math.sqrt(d)) / 2*a} x2 = #{(-b - Math.sqrt(d)) / 2*a}" end
true
a8fc2a23b70820072e22fcab7ab7bf2637160929
Ruby
sassygrody/methods
/fib.rb
UTF-8
341
3.890625
4
[]
no_license
def recursive_fib(x) return x if x < 3 fib(x - 1) + fib(x - 2) end p recursive_fib(5) def loop_fib(x) return x if x < 3 starting = 0 following = 1 ending = starting + following x.times do puts ending starting = following following = ending ending = starting + following end end p loop...
true
3b39238919520c5c4bd9a55fa943a5baac37296b
Ruby
AnanthSrinivasan/Projects
/SideProjects/RubyApplication1/RubyApplication1/Ruby1.rb
UTF-8
676
3.734375
4
[]
no_license
#def romanize num # roman = '' #easy way of saying string # roman = roman + 'M' * (num / 1000) # roman = roman + 'D' * (num % 1000/ 500) # roman = roman + 'C' * (num % 500/ 100) # roman = roman + 'L' * (num % 100/ 50) # roman = roman + 'X' * (num % 50/ 10) # roman = roman + 'V' * (num % 10/ 5) # ro...
true
32ef00b4d55e92d37694114d15fef95ea87200c0
Ruby
mcwaller422/Intro_to_Ruby
/LoopsIterators/doubler.rb
UTF-8
99
2.953125
3
[]
no_license
def doubler(start) puts start if start <10 doubler(start*2) end end doubler(2)
true
703d9fee9084769fb837a4cf1a696b481c0155e7
Ruby
appliedcode/omniconfig
/lib/omniconfig/config.rb
UTF-8
4,626
3.3125
3
[ "MIT" ]
permissive
module OmniConfig # Represents a root configuration structure along with a set of loaders, # and is used to load the final result object. # # **Note:** While you may instantiate this class directly, {OmniConfig.new} # is a shortcut for creating this class, since `OmniConfig::Config` is a bit # redundant. ...
true
3708d6d7211e750c7e132d783efd6b77576d45ea
Ruby
nofxsnap/open-api-search
/app/models/movie_search.rb
UTF-8
593
2.65625
3
[]
no_license
class MovieSearch < ActiveRecord::Base validates :search_term, presence: true, length: { maximum: 250 } def self.add_or_increment(search_term) movie_search = MovieSearch.where(search_term: search_term).first if movie_search.present? # Just increment it movie_search.count += 1 movie_searc...
true
357ba38ab760de90aef3e579ad96847b6029aed1
Ruby
DanylNysom/project_euler
/021.rb
UTF-8
844
3.734375
4
[]
no_license
#!/usr/bin/ruby # Finds the sum of all amicable numbers under 10000 require 'set' def find_divisors(number) divisors = [1] (2..Math.sqrt(number)).each do|possible_divisor| if number % possible_divisor == 0 divisors << possible_divisor if possible_divisor != Math.sqrt(number) ...
true
e11ec82d139db8347ffc5c95352399556d18492b
Ruby
Aaron1515/phase-0
/week-6/pad-array-refactor/my_solution.rb
UTF-8
2,301
4.15625
4
[ "MIT" ]
permissive
# Review and Refactor: Pad an Array # I worked on this challenge [Myself ]. # First Person's solution I liked # What I learned from this solution # Copy solution here: # def pad!(array, min_size, value = nil) #destructive # if min_size <= array.length # return array # else # difference = min_size -...
true
68d9349888a1575cb3db9ac49fb5599d5e327601
Ruby
Yashwanth-nr/E-commerce
/app/models/order.rb
UTF-8
1,603
2.71875
3
[]
no_license
class Order < ActiveRecord::Base belongs_to :user has_many :order_line_items before_save :update_total_for_order # is a callback which invokes method before object is saved after_save :copy_cart_line_items after_save :clear_user_cart after_save :send_order_confirmation_notification =begin after_save :updat...
true
90afb1bece45d77c37c8c00a853906c9617593e8
Ruby
tied/DevArtifacts
/master/fresh-samples-master/fresh-samples-master/Ruby_api_samples/notes_with_attachments.rb
UTF-8
1,109
2.75
3
[ "MIT" ]
permissive
#Create a private note with attachments. I had my attachments in the current directory. #You can use body or body_html to set the note content. #You can also pass the user_id if you want to add the note by that particular user. require 'rubygems' require "rest_client" require 'json' #Specify your [ticket_id] in the be...
true
1b00c2b17e61ae77850d94e872b61a60b9b06208
Ruby
kanghua1981/Cello
/benchmarks/Map/map_ruby.rb
UTF-8
164
3.203125
3
[ "BSD-2-Clause-Views" ]
permissive
require 'rbtree' h, max = RBTree[], 0 STDIN.each do |l| if h[l] == nil h[l] = 1 else h[l] = h[l] + 1 end max = h[l] if max < h[l] end # puts h.length, max
true
575a586aa3002928951ae3b3b7326bf7a2a2576d
Ruby
griffifam/ride-share
/worksheet.rb
UTF-8
676
3.1875
3
[]
no_license
######################################################## # Step 1: Establish the layers # Write a list of the layers here ######################################################## # Step 2: Assign a data structure to each layer # Copy your list from above, and write what data structure each layer should have ###...
true
acb896616981164b634da4d5370d24cb0dbc0cb0
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/phone-number/e84438c05fa0405a88ed2dbad9ec053b.rb
UTF-8
681
3.21875
3
[]
no_license
class PhoneNumber attr_accessor :number def initialize(phone_number) @number = sanitize_number(phone_number) end def sanitize_number(phone_number) if !!phone_number.match(/[a-zA-Z]/) return "0000000000" else phone_number = phone_number.gsub(/\D/, '') end if phone_number.length < 10 return "00...
true
befebe399da74d65f10864209cede31db0c9f1b3
Ruby
dblooman/dockerfiles
/chartbeat/chartbeat.rb
UTF-8
2,258
2.859375
3
[ "Apache-2.0" ]
permissive
require "time" require "faraday" require "json" require "simple-graphite" class Chartbeat API_KEY = ENV["APIKEY"] def self.data(query, version, options) Faraday.get("http://api.chartbeat.com" + "/" + query.to_s + "/#{version}/" + API_KEY + options) rescue Faraday::Error::ConnectionFailed => e puts "Erro...
true
166e913877c968e62e07c3c6d3c381a60597a182
Ruby
xjasminelu/hackduke2016
/jumpingem/game.rb
UTF-8
2,221
3.234375
3
[]
no_license
#!/usr/bin/env ruby -w require 'rubygems' require 'gosu' include Gosu class Floor attr_accessor :x, :y, :width, :height, :color def initialize(window, x, y, width, height, color) @x = x @y = y @width = width @height = height @color = color @window = window end def dra...
true
6b82f768e11fb64736a2740475c78f45a40b3808
Ruby
Nicolasheckmann/my_tictactoe
/lib/board.rb
UTF-8
350
3.6875
4
[]
no_license
class Board attr_accessor :moves_hash def initialize self.moves_hash = {A1: " ", B1: " ", C1: " ",A2: " ", B2: " ", C2: " ", A3: " ", B3: " ", C3: " "} end def is_full? #retourne true lorsque le board est plein moves_hash.select{ |key, value| value == "X" || value == "O" }.length =...
true
65f9b6353b3c2d8483610cdaf7cdad2a5fcd8dd2
Ruby
piotrm/Longest-repeated-substring
/substring.rb
UTF-8
3,510
3.796875
4
[]
no_license
#==Longest Repeated Substring # #==Klasa Substring #Klasa ta realizuje wyszukiwanie najdłuższego powtarzającego się podciągu. Wydaje mi się, że bardziej intuicyjnym rozwiązaniem byłoby napisanie rozszerzenia dla klasy String: # # class String # def longest_repeated_substring(text) # ... # end # # def extract_sub...
true
dc6197a8bacb0296ca8a9c7936603b67f9a346c9
Ruby
jag918/ruby-class-variables-and-class-methods-lab-dumbo-web-051418
/lib/song.rb
UTF-8
933
3.546875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Song attr_accessor :name, :artist, :genre @@count=0 #keeps track of num of songs @@genres=[] @@artists=[] def initialize(name,artist,genre) @name=name @artist=artist @genre=genre @@count+=1 @@genres << @genre @@artists << @artist end def self.count @@count end d...
true
8250aa3bce5fab37afcb73324f4f01f46a986b56
Ruby
johnsir/hei-connect-web
/app/models/update.rb
UTF-8
2,076
2.65625
3
[]
no_license
# encoding: utf-8 # == Schema Information # # Table name: updates # # id :integer not null, primary key # object :string(255) # state :string(255) # rev :integer default(0) # user_id :integer # created_at :datetime not null # updated_at :datetime not ...
true
c994bec2e02c9234647db88310551cb0f441b1a8
Ruby
s-taylor/wdi_class_projects
/ruby/anagram.rb
UTF-8
267
2.890625
3
[]
no_license
require 'pry' class Anagram def self.listen(word,anagrams) target = word.split('').sort anagrams.each do |word| return word if word.split('').sort == target end end end Anagram.listen('listen',%w(enlists google inlets banana)) binding.pry
true
ca9c92e1d5cf924083c272d9862b23139ec69c09
Ruby
RJForgie/Project-Moneycashboard
/models/tag.rb
UTF-8
1,439
3.046875
3
[]
no_license
require('pg') require_relative('../db/sqlrunner.rb') class Tag attr_accessor(:name) attr_reader(:id) def initialize(details) @id = details['id'].to_i() @name = details['name'] end def save() sql = ' INSERT INTO tags (name) VALUES ($1) RETURNING *;' values = [@name] ...
true
eacdbb31f296b64930ff94975c39dd58575f4ef2
Ruby
khaivubui/w2d3_classwork
/Poker/spec/deck_spec.rb
UTF-8
682
2.9375
3
[]
no_license
require 'deck' describe Deck do subject(:deck) {Deck.new} describe '#initialize' do it 'creates 52 cards' do expect(deck.cards).to be_a(Array) expect(deck.cards.length).to eq(0) end end describe '#populate' do before(:each) do deck.populate end it 'Populates the deck with...
true
84c81f07a378dcb6ff1cca19b1f7aeb655b39456
Ruby
ministryofjustice/defence-request-service-rota
/spec/lib/rota_generation/parser_spec.rb
UTF-8
1,611
2.78125
3
[ "MIT" ]
permissive
require "spec_helper" require "active_support/core_ext/string/strip" require_relative "../../../lib/rota_generation/parser" require_relative "../../../lib/rota_generation/unsatisfiable" require_relative "../../../lib/rota_generation/solution" RSpec.describe RotaGeneration::Parser do describe "#parse!" do context...
true
d5bf8a3df49cda8bf06168a55ba4288f2c7dccd7
Ruby
mklagassey/Launch-School
/RB101d/quiz1.rb
UTF-8
748
3.859375
4
[]
no_license
# trying this out # def string_lengths(sentence) # words = sentence.split # word_lengths = [] # counter = 0 # # while counter < words.size do # word_lengths << words[counter].length # counter += 1 # end # # word_lengths # end # # p string_lengths("what is this") # # def string_lengths(sentence) # ...
true
a0e8e82bbba25f232d678c9619efa9324c033581
Ruby
arnau/ISO8601
/spec/iso8601/date_spec.rb
UTF-8
3,975
2.546875
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'spec_helper' describe ISO8601::Date do it "should raise an error for any unknown pattern" do expect { ISO8601::Date.new('') }.to raise_error(ISO8601::Errors::UnknownPattern) expect { ISO8601::Date.new('2') }.to raise_error(ISO8601::Errors::UnknownPattern) expect { ...
true
859e14d68367855fcc61f04a74f90547aa3e122a
Ruby
github/codeql
/ruby/ql/test/query-tests/experimental/manually-check-http-verb/ManuallyCheckHttpVerb.rb
UTF-8
2,359
2.609375
3
[ "MIT" ]
permissive
class ExampleController < ActionController::Base # Should find def example_action if request.get? Resource.find(id: params[:example_id]) end end # Should find def other_action method = request.env['REQUEST_METHOD'] if method == "GET" Resource.find(id: params[:id]) end end ...
true
3cade4feddd05b31daddb937eab41d0f2497cab5
Ruby
robrieba/hayfork
/lib/hayfork/binding.rb
UTF-8
2,099
2.703125
3
[ "MIT" ]
permissive
module Hayfork class Binding < Struct.new(:statement, :column, :raw_value) def to_sql "#{quoted_value} \"#{column.name}\"" end alias to_s to_sql def column_name column.name end alias key column_name def quoted_value case raw_value when Arel::Attributes::Attribute...
true
da43c112211d082de7d773c7ee1ca672c9a1ece2
Ruby
codemilan/old_stuff
/sbs1/bag_rails/models/list.rb
UTF-8
499
2.515625
3
[]
no_license
class List < Item contains :items add_order_support_for :items validates_presence_of :name def item_updated item super move_finished_item_to_bottom item if item.finished? and item.state_changed? end protected # moves finished task before first non-finished from bottom def mo...
true
7d093dd0739931a7d34274142e4ff64c3b623825
Ruby
davidlaprade/Match-Optimization
/quick_spec.rb
UTF-8
3,935
2.96875
3
[]
no_license
$LOAD_PATH << '.' require 'testing' #//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// # METHODS THAT DO NOT DEPEND ON OTHER METHODS I HAVE WRITTEN SHOULD BE TESTED FIRST, SO THAT IF THERE IS A PROBLEM WITH THEM, THE PROBLEM # IS DI...
true
6cb9520e839c031bd9d05c8465a7156979c2909d
Ruby
francescoFH/oystercard
/lib/oystercard.rb
UTF-8
1,232
3.4375
3
[]
no_license
class Oystercard MAXIMUM_BALANCE = 90 MINIMUM_BALANCE = 1 FARE = 1 attr_reader :balance, :enter_station, :journey_history def initialize(balance = 0) @balance = balance @enter_station = nil @journey_history = [] end def top_up(money) fail "Maximum balance if £#{MAXIMUM_BALANCE} exceeded...
true
3ed706e0ba679c29759b0b1d1d3a0e1c9b00996a
Ruby
abehrooz/pivotal-time-tracker
/app/models/time_chart_presenter.rb
UTF-8
14,810
2.796875
3
[]
no_license
require 'time_diff' class TimeChartWrapper attr_accessor :description attr_accessor :title attr_reader :chart def initialize(chart, description, title) self.description = description self.title = title @chart = chart end def method_missing(m, *args, &block) @chart.send m, *a...
true
d23ed2a48517c43a11bbb6445e2261f9020541fd
Ruby
Archyfly/less3
/cl_station.rb
UTF-8
1,093
3.65625
4
[]
no_license
require "./cl_train.rb" class Station def initialize(name) @name = name puts "New station created. Name of station: #{name}" @train_on_station = [] end def display_trains_on_station puts "Train on station now is: #{@train_on_station}" end def train_arrived(number) puts "Train a...
true
4a527f726897ffe06352094e9d1e237e84d9452c
Ruby
jeanpaulsio/notes
/ruby/design_patterns_in_ruby/08_proxy/lib/3_virtualproxy.rb
UTF-8
727
3.65625
4
[]
no_license
# Keeps track of bank account class BankAccount attr_reader :balance def initialize(starting_balance) @balance = starting_balance end def deposit(amount) @balance += amount end def withdraw(amount) @balance -= amount end end # Virtual proxy for laziness class VirtualAccountProxy def init...
true
7fca03eb341ac84998ba12357b67d0a8e7eb82a8
Ruby
tbem/MapKitWrapper
/lib/map-kit-wrapper/map_type.rb
UTF-8
1,102
3.03125
3
[ "MIT" ]
permissive
## # Wrappers for MapKit # module MapKit ## # Class for dealing with MKMapView map type constants # class MapType ## # Convert from MKMapView to MapView # # * *Args* : # - +map_type+ -> Map type as MKMapView constant # # * *Returns* : # - map type as symbol # def...
true
e8c7dbe834c44220a1d08a9cafc209865af922bb
Ruby
jguaschi/comb
/helpers/data_presentation_helpers.rb
UTF-8
431
2.578125
3
[]
no_license
# encoding: UTF-8 (magic comment) class CTT2013 module DataPresentationHelpers module_function def text_from_boolean(bool, options = {}) bool ? "✓#{ t(:yes, options) }" : t(:no, options) end def capitalize_first_letter_of(str) unless str.empty? str = ActiveSupport::M...
true
8c4c27a1a3082e37394ee18d04285fad8f5b6537
Ruby
dkremez/concurrency_models
/examples/threads.rb
UTF-8
219
3.234375
3
[]
no_license
range1 = 0...5_000_000 range2 = 5_000_000...10_000_000 number = 8_888_888 t1 = Thread.new { puts "Thread1: #{range1.to_a.index(number)}" } t2 = Thread.new { puts "Thread2: #{range2.to_a.index(number)}" } t1.join t2.join
true
4505f4d664516860cfea96392b2615ea01d68ba5
Ruby
CarlosAndres22/wynwork
/cheetah.rb
UTF-8
483
2.9375
3
[]
no_license
CHEETAH_GIRLS = [ "Raven-Symone", "Adrienne Bailon", "Sabrina Bryan", "Kiely Williams" ] auditions = [ "Raven-Symone", "Usher", "Wiz Khalifa", "Adrienne Bailon", "Hulk Hogan", "Sabrina Bryan", "Diego Lugo", "Kiely Williams", "Justin Timberlake" ] panel = [] def check(auditions, panel) au...
true
36f6d3ba92edff3890f309bbe38113d594a57cf5
Ruby
nnattawat/basic-ruby
/class/module.rb
UTF-8
1,066
4.15625
4
[]
no_license
## module is (1) used for namespacing module ANamespace class AClass def initialize puts "Another A, coming right up!" end end class BClass def initialize puts "Another B, coming right up!" end end end ANamespace::AClass.new # Another A, coming right up! ANamespace::BClass.new # An...
true
969af0cf2e7d1e7d62a5b13a194e141e7cc0d4c1
Ruby
Larrypg31/launch_school
/exercises/101_109_small/advanced/matrix.rb
UTF-8
537
3.640625
4
[]
no_license
def transpose(matrix) matrix.map.with_index do |sub_a, idx| sub_a.map.with_index do |_, idx2| matrix[idx2][idx] end end end def transpose!(matrix) end matrix = [ [1, 5, 8], [4, 7, 2], [3, 9, 6] ] new_matrix = transpose(matrix) p new_matrix == [[1, 4, 3], [5, 7, 9], [8, 2, 6]] p matrix == [...
true
9e3173f3c3da08d9e6b205c6b03cffc2a73452bd
Ruby
emeanor-cdp/blog
/config/routes.rb
UTF-8
993
2.59375
3
[]
no_license
Rails.application.routes.draw do # This route declares that GET / requests are mapped to the index action of # ArticleController. root 'articles#index' # Creates all the routes needed for a basic CRUD object, so we don't have to # do it manually. resources :articles do # This creates comments as a nest...
true
674fdf30b67eb63ddf77af4e8b9636288c0094c8
Ruby
09croberts/CosmicCrew
/app/policies/comment_policy.rb
UTF-8
295
2.578125
3
[]
no_license
class CommentPolicy attr_reader :current_user, :model def initialize(current_user, model) @current_user = current_user @comment = model end def create? @current_user.member? or @current_user.admin? end def destroy? @current_user == @comment.user or @current_user.admin? end end
true
ec171f5a4c094d04f896802e68040f6b5d07bdff
Ruby
cenwright/lab_6_exercise
/person.rb
UTF-8
471
3.5625
4
[]
no_license
class Person attr_reader :first_name, :last_name, :gender def initialize(first_name, last_name, gender) @first_name = first_name @last_name = last_name @gender = gender end def fullname puts "#{@first_name} #{@last_name}" end def doctor "Dr. " + fullname end def lawyer ...
true
aaad1d155ec9b42cc21af8745220151380db0964
Ruby
itsacezon/toy-robot-simulator
/lib/entity.rb
UTF-8
373
3.421875
3
[ "MIT" ]
permissive
class Entity attr_accessor :x, :y, :direction def initialize(direction: Direction.new, x: 0, y: 0) @x = x @y = y @direction = direction end def move(surface) raise NotImplementedError, "You must implement the move method" end def rotate(surface, directions, to) raise NotImplementedErr...
true
878664e70e0489c7a91fb7ad6b34bafd0bd61b90
Ruby
danimaleski/Ruby
/loops.rb
UTF-8
548
4.125
4
[]
no_license
# 10.times do # puts "Repetindo a mensagem" #imprime a x quantidade de vezes a mensagem. # end # 5.times do |i| #int # puts "Repetindo a mensagem " + i.to_s + "vez(es)." #concatenar as strings # end # init = 0 # while init <= 10 # puts "Repetindo a mensagem " + init.to_s + "vez(es)." # init += 1 #...
true
f2f2b390e66e3639121c43c80278a9e3a9fbe573
Ruby
rmnckv/wikipedia
/ruby/example/retriever/retriever.rb
UTF-8
2,636
2.859375
3
[ "Apache-2.0" ]
permissive
require 'retriever' require 'stopwatch' require 'text' wikipedia_file = ARGV[0] || '../data/sample_dewiki-latest-pages-articles.xml' dbpedia_file = ARGV[1] || '../data/sample_long_abstracts_de.ttl' query = ARGV[2] || 'smithee' persistor = Retriever::Persistors::ElasticsearchPersistor.new persistor.create_...
true
f90db587df69144e1cfffa5739352cdfb7f5afd5
Ruby
ivanvanderbyl/cloudist
/lib/cloudist/request.rb
UTF-8
1,369
2.59375
3
[ "MIT" ]
permissive
module Cloudist class Request include Cloudist::Encoding attr_reader :queue_header, :qobj, :payload, :start, :headers, :body def initialize(queue, encoded_body, queue_header) @qobj, @queue_header = queue, queue_header @body = decode(encoded_body) @headers = parse_custom_headers(queue_...
true
06f298e3ba54ff10eb4fc877b2cf2ce642ac8b8a
Ruby
thisisDom/phase-0-tracks
/ruby/problem_solving_methods.rb
UTF-8
1,208
4.5
4
[]
no_license
# Release 0 def search_array(arr, int) position = 0 index = nil arr.each do |comparison| if comparison == int index = position else position += 1 end end return index end arr = [42, 89, 23, 1] p search_array(arr, 13) # Release 1 def fib(terms) fibonacci = [] ind...
true
f4ca53e959ef6120cd68a9707850fcc50ec9bf01
Ruby
hari31582/jv
/spec/value_meal_spec.rb
UTF-8
497
2.765625
3
[]
no_license
# Test ValueMeal class # Author: Haribhau Ingale # Date: 30 April 2012 require File.dirname(__FILE__)+'/../lib/value_meal' describe ValueMeal do def new_value_meal(labels,price) @value_meal = ValueMeal.new(labels,price) end it "should return price as set" do new_value_meal([],13.5) @value_meal.p...
true
3f4317114e1dfafe34b112393a54c07ea8e81f26
Ruby
Neethusajeevan/rgsoc-teams
/app/models/application_draft.rb
UTF-8
1,161
2.609375
3
[ "MIT" ]
permissive
class ApplicationDraft < ActiveRecord::Base include HasSeason belongs_to :team validates :team, presence: true before_validation :set_current_season attr_accessor :current_user Role::TEAM_ROLES.each do |role| define_method "as_#{role}?" do # def as_student? team.send(ro...
true
f8d748a0963450b348d098e16c9ca12b27db047b
Ruby
Mifistoff/buy_bus_ticket
/app/models/bus.rb
UTF-8
476
2.515625
3
[]
no_license
class Bus < ApplicationRecord has_many :bus_stops has_many :tickets attr_reader :name has_many :orders def name #name of bus from start and final stations departure + ' - ' + destination end def available_tickets #how many tickets not purchased Ticket.where(bus_id: id, availability: 0).size en...
true
d13bf7b402fb81303e638e9badc80d4ef4abcede
Ruby
DanBlakeman/rps-challenge
/spec/feature/game_play_spec.rb
UTF-8
1,466
3.15625
3
[]
no_license
require 'capybara/rspec' require 'game' require 'ai_computer' require 'player' feature "A human can play against an AI and hear who has won" do scenario 'Human can win a game' do player = Player.new("Dan") ai = AI.new game = Game.new(player, ai) allow(ai).to receive(:choice).and_return('rock') p...
true
585c1990431830a1d6b8d0fc4cfa53f0fad2bee4
Ruby
armhold/data-engineering
/app/models/merchant.rb
UTF-8
268
2.625
3
[]
no_license
# represents a merchant # # For lack of anything better, we use 'name' as a business key for lookups. # A merchant may have multiple addresses. # class Merchant < ActiveRecord::Base attr_accessible :name has_many :addresses validates :name, presence: true end
true
d78daf8f60146a3b92fcf6d3061115655495f9f2
Ruby
PetyaDjanovska/key-for-min-value-v-000
/key_for_min.rb
UTF-8
297
3.484375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# prereqs: iterators, hashes, conditional logic # Given a hash with numeric values, return the key for the smallest value def key_for_min_value(name_hash) value_array=[] name_hash.collect do |name, value| value_array << value end min_value = value_array.min name_hash.key(min_value) end
true
6875d63ef4b277a39e83f79ee42a45fab655692f
Ruby
ebinmore/swirl
/lib/swirl/parser.rb
UTF-8
1,387
3.28125
3
[ "MIT" ]
permissive
module Swirl class NoAffiliateDatabaseError < StandardError; end class Parser def initialize @html = nil @cash_words = nil end def add_html(html) @html = html end def use_affiliate_database(cash_words) @cash_words = cash_words end def money_making_html ...
true
ceee8aad77e744a65cb3d49e9a446dee0accff6f
Ruby
adamgriffis/SprintEmailGenerator
/generate.rb
UTF-8
15,041
2.875
3
[]
no_license
require 'clubhouse2' require 'YAML' require "csv" class Generator API_KEY = 'API_KEY' YEAR = '2020' PLANNED_ROADMAP_LABEL_NAME = "planned" UNPLANNED_ROADMAP_LABEL_NAME = "unplanned" TECHNICAL_DEBT_LABEL_NAME = "Tech Debt" REACT_REFACTOR_LABEL_NAME = "React Refactor" LABEL_MAJOR_NAME = "major" LABEL_CR...
true
8babcbbd71056c8c93d1a119d0fcae10b3da9f51
Ruby
archit1jain/RubyPractice
/scope_block.rb
UTF-8
543
3.515625
4
[]
no_license
class BankAccount attr_accessor :id,:amount def initialize(id,amount) @id = id @amount = amount end end acc1 = BankAccount.new(123,200) acc2 = BankAccount.new(212,100) accs = [acc1,acc2] total_sum =0 accs.each do |account| total_sum+=account.amount end puts total_sum arr = [5,4,1] curr_number = 10 arr.each d...
true
33deea4478aaef2ba178441cc405110b2d34597d
Ruby
vladveterok/ruby
/learning/DeafGrandmaProgram.rb
UTF-8
897
3.40625
3
[]
no_license
command = '' #check = 'BYE' exitCondition = 0 while exitCondition != 3 command = gets.chomp if command == 'BYE' exitCondition += 1 #puts exitCondition puts 'HUH?! SPEAK UP, SONNY!' else exitCondition = 0 #puts exitCondition if (command != command.upcase || command == '') puts 'HUH?! SPEAK UP, ...
true