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
45bfdd4c9b1b694ff8e20ccfb939698c95e7ffbf
Ruby
TheWrongAlice/adventofcode-2018
/Day 2/part2.rb
UTF-8
1,320
3.765625
4
[]
no_license
#!/usr/bin/env ruby # --- Part Two --- # Confident that your list of box IDs is complete, you're ready to find the boxes full of prototype fabric. # # The boxes will have IDs which differ by exactly one character at the same position in both strings. For example, given the following box IDs: # # abcde # fghij # klmno ...
true
69c39deeacec14bc36c951a6a7fca089c0a136f9
Ruby
r26D/numbered_list
/lib/numbered_list.rb
UTF-8
2,668
2.875
3
[ "MIT" ]
permissive
require "rubygems" require "active_record" require "values" require 'numbered_list/item_value' require 'numbered_list/marshall_base' module NumberedList class List attr_reader :item delegate :formatted, :name, :description, :order_value, :to_item_description, to: :item class BadType < StandardError ...
true
6562712f07132dddb1b2cd7b460ee3a5677034fb
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/bob/1942fb58f5e140be92e7680e2564c3a9.rb
UTF-8
523
3.640625
4
[]
no_license
class Bob def hey phrase parser = ConversationParser.new phrase if parser.silence? 'Fine. Be that way!' elsif parser.forceful? 'Woah, chill out!' elsif parser.question? 'Sure.' else 'Whatever.' end end class ConversationParser def initialize phrase @phra...
true
2231718348bbe54447bbb7a23b75201a97056309
Ruby
Kaneofthrones/spartaClasswork
/classwork/w04d02/oo-basics/code/starter-code/square.rb
UTF-8
757
3.875
4
[]
no_license
class Square attr_accessor :side_length def initialize(side_length) self.side_length = side_length end def calculate_area self.side_length ** 2 end def calculate_perimeter self.side_length * 4 end def scaled_length(factor) self.side_length += factor end # def scale_square # # puts "please...
true
84fc4f8a4ab4d4b3a02b7fddd64de2ed47abf47f
Ruby
whymirror/why-archive
/hacketyhack/h-ety-h/sequel/schema.rb
UTF-8
4,648
2.59375
3
[ "Ruby" ]
permissive
module HH::Sequel class Schema COMMA_SEPARATOR = ', '.freeze COLUMN_DEF = '%s %s'.freeze UNIQUE = ' UNIQUE'.freeze NOT_NULL = ' NOT NULL'.freeze DEFAULT = ' DEFAULT %s'.freeze PRIMARY_KEY = ' PRIMARY KEY'.freeze REFERENCES = ' REFERENCES %s'.freeze ON_DELETE = ' ON DELETE %s...
true
3892b48e0c2780559f765d4d3e9805a9d3063307
Ruby
nehanakrani/intercom-problem
/spec/lib/distance_calculator_spec.rb
UTF-8
688
2.640625
3
[]
no_license
require 'spec_helper' describe DistanceCalculator do let(:office_coordinates) { [53.339428, -6.257664] } let(:customer) {{"latitude" => 53.2451022, "user_id" => 4, "name" => "Ian Kehoe", "longitude" => -6.238335}} let(:customer_coordinates) { [customer['latitude'], customer['longitude']]} context 'maximum dis...
true
184210c6f910fc3e2ee689dbd7279b35d746ab0e
Ruby
yusukemihara/samples
/ruby/lock.rb
UTF-8
327
2.921875
3
[]
no_license
def lock path = ".lock" lock_file = open(path,File::RDWR|File::CREAT) begin yield if lock_file.flock(File::LOCK_EX) ensure lock_file.close end end lock{ puts "---- A start" puts Time.now sleep 10 puts Time.now puts "---- A end" } lock { puts "---- B start" puts Time.now puts "---- B ...
true
4f4f186fdf5566375ced1ca91a82f54e51136918
Ruby
DannyBen/rigit
/lib/rigit/rig.rb
UTF-8
3,378
2.875
3
[ "MIT" ]
permissive
module Rigit # Handles "rigging" (scaffolding) of new projects from template rigs. class Rig attr_reader :name # Returns the root path for all rigs. By default, it will be +~/.rigs+ # unless the +RIG_HOME+ environment variable is set. def self.home ENV['RIG_HOME'] ||= File.expand_path('.rigs'...
true
d18b0677812cb69e2537a5824e361179198d960b
Ruby
codyalvarez/us_aircraft
/lib/us_aircraft/aircraft.rb
UTF-8
349
2.59375
3
[ "MIT" ]
permissive
class UsAircraft::Aircraft @@all = [] attr_accessor :path, :name, :contractor, :service, :armament, :power_plant, :speed, :range def initialize(name, path) @name = name @path = path save end def self.all UsAircraft::Scraper.scrape_aircraft if @@all.empty? @@all end def save ...
true
70c4e7222df48d97219dc01d9e09ce47db8b065a
Ruby
felipemfp/programacao-de-computadores
/aulas/aula-07/revisao/exercicio-10.rb
UTF-8
595
3.484375
3
[]
no_license
# encoding: UTF-8 require 'date' pessoas = [] for x in 1..2 print "Informe o nome da #{x}º pessoa: " nome = gets.chomp print "Informe o data de nascimento da #{x}º pessoa: " dt_nasc = Date.strptime(gets.chomp, '%d/%m/%Y') pessoas << {nome: nome, nasc: dt_nasc} end if pessoas[0][:nasc] > pessoas[1][:nasc] puts...
true
27a392a4f1b271155116b5f118b6bac46f858c2b
Ruby
davemcg3/design_patterns
/pure/memento/ruby/generic_example.rb
UTF-8
832
3.4375
3
[]
no_license
class Originator def initialize @state = "initialized" end def update state puts "Originator state updated to #{state}\n" @state = state end def show puts "Originator state is currently #{@state}\n" end def setMemento m puts "Originator restoring state from memento to #{m.getState}"...
true
889b7bebeea3f822f3fd87a07520aee7a4ea2a5b
Ruby
Rainiugnas/password_manager
/lib/cli.rb
UTF-8
4,990
3.078125
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'password_manager' require 'cli/input' require 'cli/option' require 'cli/storage' # Handle actions related to the cli interface. module Cli # Raise a password manager exception with the given message # @param message [String] Error message # @raise [PasswordManager::Passwo...
true
ef03ecdad3b2ba11ea8ecccd9b9c25cbdd917d50
Ruby
RottenRoost3r/BATTLESHIP
/board.rb
UTF-8
3,779
3.640625
4
[]
no_license
require_relative "cells.rb" class Grid def initialize(size=12) @size = size @grid = Array.new(size) {Array.new(size) {Cell.new()}} @end_point = size - 1 end def error() return "invalid placement" end def place_ship(ship, row, col, orientation) ship.len...
true
76587294ac088636c716e2480da56f7e9840fd90
Ruby
domanhtien2011/Sudoku-Solver
/sudoku_solver.rb
UTF-8
6,291
3.21875
3
[]
no_license
# For this problem, I use a simple backtracking algorithm because I think it is simple and in the time constraint of the problem. class Sudoku attr_reader :board def initialize @@number_of_solutions = 0 @board = Array.new(9){Array.new(9)} @board[0][0] = 0 @board[0][1] = 3 @board[0][2] = 0 @...
true
fc7c11607ddcea40340ef06f3712c2a017043b34
Ruby
NMinster/yags
/spec/models/random_bit_generator_spec.rb
UTF-8
2,122
2.859375
3
[]
no_license
require File.dirname(__FILE__) + '/../spec_helper' class RandomBitGeneratorTest < ActiveSupport::TestCase def test_random_bit counts = generate_random_bits(5000) # these tests should fail with probability less than 4 * 10^-5 assert_greater_than counts[0], 2500 - 4 * standard_error_for_count(5000,0.5) ...
true
7d7c3c29d56bbea7f6dc0536c26a6d5bafca8290
Ruby
alexeylightit/gift_system
/app/services/loyalty_service.rb
UTF-8
1,090
2.515625
3
[]
no_license
# frozen_string_literal: true class LoyaltyService < ApplicationService delegate :points, to: :user # Used only to upgrade user's loyalty # can't be downgraded def upgrade! return unless next_rank? next_type = next_loyalty[:type] RewardService.new(user: user).run_scenario!(:loyalty) if update_loyal...
true
86cfcacdc775276e4777fad931c947d4386c55d2
Ruby
cooljasonmelton/ruby-oo-relationships-practice-gym-membership-exercise-chicago-web-021720
/lib/lifter.rb
UTF-8
1,168
3.296875
3
[]
no_license
require_relative 'membership.rb' class Lifter attr_reader :name, :lift_total @@all = [] def initialize(name, lift_total) @name = name @lift_total = lift_total @@all << self end def self.all @@all end def self.lifters @@all end def memberships # Get a list of all the me...
true
96a5942f9e2c0dfe3826747ca239c628214a81d1
Ruby
joshuabrainjaffe/jc_murals_app
/JCMuralsApp/db/seeds.rb
UTF-8
1,687
2.578125
3
[]
no_license
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
true
c3e5e70e34a21859956ddf78aec724262dd9677c
Ruby
SergeyLyoshin/black_jack_thinknetica
/game_menu.rb
UTF-8
994
3.0625
3
[]
no_license
require_relative 'menu' # Game menu class GameMenu < Menu FIRST_TURN_STRUCTURE = { '1' => { name: 'Hit', action: :handle_hit }, '2' => { name: 'Stand', action: :handle_stand }, '3' => { name: 'Showdown', action: :open_cards }, '0' => { name: 'Quit...
true
d0c968086043afe28f07d31208b1018d42f1f2d3
Ruby
tylerflint/caterer
/lib/caterer/communication/rsync.rb
UTF-8
1,403
2.5625
3
[ "MIT" ]
permissive
require 'pty' module Caterer module Communication class Rsync attr_reader :server class << self def available? `command -v rsync &>/dev/null` $?.exitstatus == 0 ? true : false end end def initialize(server) @server = server ...
true
aec9c8d10471ccd3e4be7b05106305b96832ef56
Ruby
tjwallace/fit
/spec/fit/file/type_spec.rb
UTF-8
2,774
2.5625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# frozen_string_literal: true require 'spec_helper' describe Fit::File::Type do before :all do @types = Fit::File::Types.class_variable_get :@@types Fit::File::Types.add_type(:int_type, :sint8) Fit::File::Types.add_type(:int_type_with_val, :uint8, values: { 1 => 'one', 2 => 'two', 3 => 'three' }) end ...
true
4bfde5a9a77215e74ebd094734eb631908f8912e
Ruby
rallySally/ruby-learning
/about/arrays.rb
UTF-8
475
3.203125
3
[]
no_license
require 'minitest/autorun' class ArrayPlayground < Minitest::Test def test_access_element a = [1,2,3] assert_equal 2, a[1] end def test_each_on_array a = [1,2,3,4] sum = 0 # not ruby like, use inject # see https://ruby-doc.org/core-2.3.1/Enumerable.html#method-i-inject a.each do | n...
true
34ffee38d353a522739f11d0973d86d180cac3c2
Ruby
nicholasmbogo/battle_ship
/test/board_test.rb
UTF-8
3,369
3.203125
3
[]
no_license
require 'minitest' require 'minitest/pride' require 'minitest/autorun' require_relative '../lib/board' class BoardTest < MiniTest::Test def test_board_initializes board = Board.new assert_instance_of Board, board assert_equal [["", "", "", ""], ["", "", "", ""], ["", "", "", ""], ...
true
c0c42647cced106b3b625a396410133a8dbbb5d6
Ruby
chrisroos/chrisroos-googlecode
/scratch/rails_timestamps_test/setup_rails_project.rb
UTF-8
3,965
2.59375
3
[]
no_license
# To replicate, you need to create a mysql database called rails_timestamps_test (or change the details in assets/database.yml) # CREATE DATABASE rails_timestamps_test; # The database must contain a table called people which can be created with this sql # CREATE TABLE people (id INTEGER AUTO_INCREMENT, created_on DATE,...
true
734907853cee25037a16345c23c408540f724659
Ruby
tganzarolli/breaking-names-badly
/models/renderer.rb
UTF-8
2,987
2.640625
3
[]
no_license
require 'rvg/rvg' require 'open-uri' Magick::RVG::dpi = 72 class Renderer attr_accessor :element, :square_x, :square_y, :square_size, :sufix, :prefix SQUARE_TEXT_COLOR = 'white' DESTINATION_PATH = (ENV['RACK_ENV']=='production' ? "#{settings.root}/tmp" : "tmp") BACKGROUND_PATH = 'public/images/backgrounds/'...
true
75ef1e6a36767f001922a07e098876a137e7d77f
Ruby
bliuredhat/second_pdc
/errata-rails/docker/build
UTF-8
2,679
2.734375
3
[]
no_license
#!/usr/bin/env ruby require 'fileutils' require 'getoptlong' PREFIX = 'docker-registry.usersys.redhat.com/errata_tool/' def help puts <<-"eos" Usage: build [options] [pattern] Build/rebuild docker images for Errata, in sequence. Options: pattern Only build images matching the given regex. --from <numbe...
true
b36d83cc651cad6933f8256eafca6eca3d6c6534
Ruby
AlexRaubach/ListFortress
/lib/tasks/generate_season_seven_matches.rake
UTF-8
1,459
2.515625
3
[ "MIT" ]
permissive
desc 'Creates S7 and all the divisions and matches' task generate_season_seven_matches: :environment do DIVISION_NAMES = [ ['Coruscant'], ['Alderaan', 'Corellia', 'Kuat'], ['Chardaan', 'Kashyyyk', 'Myrkr', 'Nal Hutta', 'Manaan'], ['Bespin', 'Dagobah', 'Tatooine', 'Endor', 'Dantooine', 'Hoth', ...
true
9f5a41b10990fff7ccb7a2ed7b5608469738a2aa
Ruby
tk0358/design_patterns_in_ruby
/chapter12_singleton/12_05.rb
UTF-8
172
3.03125
3
[]
no_license
# クラスメソッドその2 class SomeClass def SomeClass.class_level_method puts('hello from the class method') end end SomeClass.class_level_method
true
b8a18f75f9882f170fc1ceabbc77170789347857
Ruby
TikiTDO/sereth_rtm
/lib/sereth_rtm/template_manager/core_parser_plugin.rb
UTF-8
1,979
2.59375
3
[ "MIT" ]
permissive
# Implements the core operations for the parser class Sereth::TemplateManager class CoreParserPlugin < ParserPlugin ## Parsing Instructions # Navigates down the preamble, and entres active parsing mode on_parse do down_preamble if is_preamble? state :active end # Goes through each exp...
true
29c5d978cb7a4616431d634cd5052940bb5bd444
Ruby
jenngeorge/aa_questions
/question_like.rb
UTF-8
2,303
3.03125
3
[]
no_license
require_relative 'questiondatabase.rb' require_relative 'users' class QuestionLike attr_accessor :title, :body, :user_id attr_reader :id def initialize(options) @id = options['id'] @question_id = options['question_id'] @user_id = options['user_id'] end def self.all questions = QuestionsDat...
true
ac7a245ee79ec0816da6f0c8223393dd44796fbd
Ruby
aviflombaum/activerecord-cli-example
/app/lib/song_importer.rb
UTF-8
338
2.890625
3
[]
no_license
class SongImporter def initialize(path) @path = path end def import! Dir.glob("#{@path}/**/**/*.mp3").each do |filename| song_filename = filename.split("/").last s = Song.create(:name => song_filename, :mp3_path => filename) puts "Successfully imported #{song_filename} (#{s.id})..." ...
true
f879cfa33bbd4356b97deba070a5de1228d18231
Ruby
amckemie/Walking-With-The-Dead-Dungeon-Game
/lib/wwtd/database/methods/room_item_db.rb
UTF-8
1,594
2.75
3
[]
no_license
module WWTD class ActiveRecordDatabase def create_room_item(attrs) RoomItem.create!(attrs) end def create_item_objects(room_item_arr) room_item_arr.map {|item| item = Item.find(item.item_id) build_item(item) } end def get_player_room_items(player_id, room_id) ...
true
d1deb9ecdd5b065d4f4a639e694f0df86b0c4f8f
Ruby
mikezaby/adventofcode
/2015/13/13.rb
UTF-8
947
3.5625
4
[]
no_license
require '../file_helper.rb' class TableHappiness attr_reader :file, :karmas def initialize(file_path) @file = FileHelper.new(file_path) @karmas = {} end def fetch_karma file.each { |line| karma(line.chomp[0...-1]) } end def persons karmas.keys.flatten.uniq end def best_seats all...
true
ee0014c5f586600368fb38b1c0d047d0cbe016d1
Ruby
OwlinOhana/rubyRuby
/lib/output_value.rb
UTF-8
416
2.734375
3
[]
no_license
require './lib/comput_temper' require './lib/user_start' class OutputValue def run temper = UserStart.new.arg_temp_date_num source_scale = UserStart.new.put_scale_in target_scale = UserStart.new.put_scale_om puts "#{temper}, #{source_scale}, #{target_scale}" temper = ComputTemper.new(temper, sour...
true
1796b2b904f386a7f68556855e2822038b46b96c
Ruby
rase-/syksy2012
/infotheory/week3/shannon-fano.rb
UTF-8
1,292
3.25
3
[]
no_license
#!/usr/bin/env ruby require 'pp' def shannon_fano_code(symbols) sorted_symbols = [] sorted_probabilities = [] sorted = symbols.sort_by {|symbol, prob| prob} codes = {} symbols.each {|symbol, prob| codes[symbol] = ""} end def split_to_sets(sorted_symbols, codes) return codes if sorted_symbols.length == 1 ...
true
620c02668cd1e173b494b460003ec10b2182c465
Ruby
ashhcashh1120/cartoon-collections-dumbo-web-career-021819
/cartoon_collections.rb
UTF-8
616
3.3125
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def roll_call_dwarves(dwarves)# code an argument here # Your code here dwarves.each_with_index {|name, i| puts (i + 1).to_s + ".*#{name}"} end def summon_captain_planet(produce)# code an argument here # Your code here produce.collect {|name| name.capitalize + "!"} end def long_planeteer_calls(call)# code an ...
true
d52d80d5b1f1fc1eef8439b7cb1cccd7fffd8d52
Ruby
GabrielH9981/Curso-de-Ruby
/1º Módulo/Aula 18 - Heranças/PessoaFisica.rb
UTF-8
404
3.09375
3
[]
no_license
#fazer o import da classe pessoa require_relative "Pessoa.rb" #o simbolo de < representa que a classe PessoaJuridica herda da classe Pessoa class PessoaFisica < Pessoa attr_accessor :cpf attr_accessor :dataNascimento def initialize(nome, endereco, cpf, dataNascimento) @nome = nome @enderec...
true
2a91fe9885db6daa2e2a804910dcde265549037a
Ruby
margueriteblair/Ruby-on-Rails-mini-Projects
/oop_projects/student.rb
UTF-8
910
3.90625
4
[]
no_license
require_relative 'crud' class Student include Crud attr_accessor :first_name, :last_name, :email, :username, :password #attr_reader will act as only getter methods @first_name @last_name @email @username @password #the @ symbol represents the instance variable, as opposed to a norm...
true
655a72b24292d359300827df8fb5841e76d9d0a4
Ruby
waffle-iron/reckoning
/app/validators/uuid_validator.rb
UTF-8
514
2.5625
3
[ "MIT" ]
permissive
class UuidValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) return if nil?(value) || blank?(value) || valid?(value) record.errors[attribute] << (options[:message] || "not a valid uuid") end private def blank?(value) value.blank? && options[:allow_blank] end priva...
true
3e247b450a4c6eb7fe064f5e05e0d1b88bf97212
Ruby
tiy-durham-2014-09/scratch
/pig_latin.rb
UTF-8
2,211
4.09375
4
[ "MIT" ]
permissive
# Pig Latin is a constructed language game in which words in English are altered # according to a simple set of rules. Pig Latin takes the first consonant (or # consonant cluster) of an English word, moves it to the end of the word and # suffixes an -ay (for example, "pig" yields "igpay", "banana" yields "ananabay", # ...
true
5b6d45293ca66d36d5690247a062c568bccc9540
Ruby
denniskuczynski/cap_deploy_rightscale
/lib/cap_deploy_rightscale/credentials.rb
UTF-8
841
2.578125
3
[ "MIT" ]
permissive
module CapDeployRightscale class Credentials CREDENTIALS_FILE_PATH = './.cap_deploy_rightscale_credentials.json' def initialize() if File.exist?(CREDENTIALS_FILE_PATH) @credential_hash = JSON.parse(File.open(CREDENTIALS_FILE_PATH, "r").read) else @credential_hash = {} e...
true
74818fa78016bc8e05f69e832ebd3ee990e2d150
Ruby
GiaGenae/ruby-metaprogramming-triangle-classification-lab
/lib/triangle.rb
UTF-8
471
3.4375
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class Triangle attr_accessor :sides @sides = [] def initialize (side1, side2, side3) @sides = [side1, side2, side3] @sides.sort! end def kind if @sides.any?{|side| side <= 0} || ((@sides[0] + @sides[1]) <= @sides[2]) raise TriangleError elsif @sides.uniq.length == 1 :equil...
true
6481df616f65ba7ce7c3f05d10a61dd9e39d22ae
Ruby
zblanco/building-blocks
/substrings/subtrings.rb
UTF-8
389
3.5
4
[]
no_license
def substrings word, dictionary result = Hash.new(0) word.split.each do |s| dictionary.each do |d| if s =~ /#{d}/ result[d] += 1 end end end p result end dictionary = ["below","down","go","going","horn","how","howdy", "it","i","low","own","part","partner","sit"] substrings("below", dictionar...
true
5abd6465aac48ae4c9b9c3675bf943023e514788
Ruby
richardforth/ruby-tidbits
/ruby2_3_3/course_files/UDEMY_Learn_to_Code_with_Ruby/Section_03_Numbers_and_booleans/upto_and_downto_methods.rb
UTF-8
182
3.671875
4
[ "Unlicense" ]
permissive
# downto 5.downto(1) { |i| puts "Countdown: #{i}" } # 5,4,3,2,1 puts 5.downto(0) do |i| puts "Countdown:" puts i end puts "LIFTOFF!" puts # upto 1.upto(10) do |i| puts i end
true
bc8391e114e55b36e4df6f76a7dbc09db6232a40
Ruby
gustavoallfadir/ruby
/backend/app.rb
UTF-8
1,284
2.859375
3
[]
no_license
require 'socket' app = Proc.new do [ '200', {'Content-Type' => 'text/html'}, [ '<head> <title>Welcome</title> <meta charset="UTF-8"> </head>', "<h1>Hello world! The time is #{Time.now.strftime("%d/%b/%Y, %I:%M %p")}</h1>", "<h3>Bienvenido a este sitio de prueba, sólo es un backend sencillo con Ruby...
true
cf3faac5906dad756bc5fa435c57cf406bfcc249
Ruby
musialik/nonsensor
/lib/nonsensor/series.rb
UTF-8
325
2.953125
3
[ "MIT" ]
permissive
module Nonsensor::Series def next! raise '#next! must be implemented for Nonsensor::Series' end def to_enum Enumerator.new do |yielder| loop do yielder << self.next! end end.lazy end def take(*args) to_enum.take(*args) end def take!(*args) take(*args).force end...
true
2c7c263b16dbf0f5392aeb9ffa1b7046a5022baa
Ruby
platanus/lita-lunch-reminder
/lib/lita/services/spreadsheet_manager.rb
UTF-8
1,706
2.53125
3
[]
no_license
require "google_drive" require "base64" module Lita module Services class SpreadsheetManager def initialize(spreadsheet_key, ws_title) @session = GoogleDrive::Session.from_service_account_key(credentials_io) @spreadsheet = @session.spreadsheet_by_key(spreadsheet_key) @ws = load_works...
true
4e0341b07d511ed17ce530fc565d126a131661ad
Ruby
prometheus/client_ruby
/spec/benchmarks/labels.rb
UTF-8
5,577
3.046875
3
[ "Apache-2.0" ]
permissive
require 'benchmark/ips' require 'prometheus/client' require 'prometheus/client/counter' require 'prometheus/client/data_stores/single_threaded' # Compare the time it takes to observe metrics that have labels (disregarding the actual # data store) # # This benchmark compares 3 different metrics, with 0, 2 and 100 label...
true
988d20433a2a171648fde68f562ee8097821f415
Ruby
LouisKottmann/metaprogramming-ruby
/eigen_of_eigenclass.rb
UTF-8
190
2.921875
3
[]
no_license
class Object def eigenclass class << self self end end end puts Object.new.eigenclass puts Object.new.eigenclass.eigenclass puts Object.new.eigenclass.eigenclass.superclass.inspect
true
48f80850fdf2e60dab01163225294f00482070a8
Ruby
eliotst/waffle
/lib/study_import/definitions/block.rb
UTF-8
915
2.6875
3
[]
no_license
class StudyImport::Definitions::Block attr_accessor(:label) attr_accessor(:questions) def initialize @questions = [] end def to_dictionary { label: @label } end def create(client) url = Rails.application.routes.url_helpers.blocks_path result = client.post url, block: to_dictio...
true
817da29a0e533e0e291680ba9e69f4e09f87e3a0
Ruby
soel/code_pa
/unagi-seikai.rb
UTF-8
595
3.171875
3
[]
no_license
#!/usr/bin/env ruby # -*- encoding: utf-8 -*- a = [] b = [] h = [] first_line = gets array1 = first_line.chomp.split a = array1.map(&:to_i) a[1].times{ input_lines = gets array2 = input_lines.chomp.split b = array2.map(&:to_i) for j in b[1]...b[1]+b[0] if j > a[0] j = j - a[0] end ...
true
13592d9b40539f364b9c118cabae85d7e8998d67
Ruby
princelab/mspire-molecular_formula
/spec/mspire/molecular_formula/isotope_distribution_spec.rb
UTF-8
3,944
2.796875
3
[ "MIT" ]
permissive
require 'spec_helper' # in this case we need to pull in mol...form... first or we'll get it behaving # like a proper hash with ::[] since ::[] hasn't been overridden! require 'mspire/molecular_formula' describe 'Mspire::Isotope::Distribution class methods' do def similar_distributions(a_dist, b_dist) b_dist.zi...
true
55cf7296913d6843ced7e4bee73d9b9408f74740
Ruby
gramos/docrails
/actionpack/lib/action_controller/routing/recognition_optimisation.rb
UTF-8
5,881
2.671875
3
[ "MIT" ]
permissive
module ActionController module Routing # BEFORE: 0.191446860631307 ms/url # AFTER: 0.029847304022858 ms/url # Speed up: 6.4 times # # Route recognition is slow due to one-by-one iterating over # a whole routeset (each map.resources generates at least 14 routes) # and matching weird re...
true
d00b0704a0bf556375ecd782f8312e09f6441e26
Ruby
DarktuxKnight/Ruby
/MiscProject/Arrays.rb
UTF-8
491
3.546875
4
[]
no_license
x = 4 data_set = [] data_set = ['a','b','c'] data_set[0] data_set[0] = "d" data_set[1] = nil data_set.clear array1 = [1,2,3,4,5] array2 = [1,"2",3.0,["a","b"],"dog"] puts array1.inspect puts array2.inspect array2.join array2.join(',') array2.join(',').split(",") array1 << 0 # appending array1.sort ar...
true
56a296836b97eaaa0fd399626d4a5fa7b5da38a4
Ruby
mikekarnes123/Enigma
/lib/modules/shifts_mod.rb
UTF-8
2,241
3.0625
3
[]
no_license
module ShiftsMod def a_shift(char, date_shift, direction) return "" if char == nil key_shift = "#{key[0]}#{key[1]}" date_shift = "#{date_shift[-4]}" total_shift = (key_shift.to_i + date_shift.to_i) % 27 whole_range = ("a".."z").to_a << " " case when direction == "forward" index = who...
true
49c85637386b2ee43e38834c723b03f6a0761eed
Ruby
Dianamal242/StudentDashboard
/server/spec/test_WAPI_result_wrapper.rb
UTF-8
4,553
2.71875
3
[ "ECL-2.0", "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
permissive
require 'minitest' require 'minitest/autorun' require 'minitest/unit' require_relative '../WAPI_result_wrapper' require 'logger' require_relative '../Logging' require_relative 'test_helper' class TestWAPIResultWrapper < Minitest::Test # Called before every test method runs. Can be used # to set up fixture inform...
true
6cf12151c000f3552ac61f0d6e46909573e3a720
Ruby
Christgopher/address_book
/lib/address.rb
UTF-8
308
2.625
3
[]
no_license
class Address attr_reader(:address, :city, :state, :zip, :type) define_method(:initialize) do |attributes| @address = attributes.fetch(:address) @city = attributes.fetch(:city) @state = attributes.fetch(:state) @zip = attributes.fetch(:zip) @type = attributes.fetch(:type) end end
true
c01312b1205f5d070c780a55164fed481bb62c45
Ruby
ManpreetSRajpal/rubyAutomationBoilerPlate
/utils/OktaCredentialsProvider.rb
UTF-8
403
2.5625
3
[]
no_license
require 'yaml' class OktaCredentialsProvider attr_reader :credentials def initialize cwd = File.dirname(__dir__) okta_credentials_file = File.join(cwd, '/constants/okta_credentials.yml') @credentials = YAML.load_file(okta_credentials_file) end def get_username(role) @credentials[role]['usern...
true
4d982f53cf030e2ae90a036a82385cd61c990df3
Ruby
sciencehistory/scihist_digicoll
/lib/scihist_digicoll/task_helpers/subject_creator_adjuster.rb
UTF-8
2,100
2.8125
3
[ "Apache-2.0" ]
permissive
module ScihistDigicoll module TaskHelpers # This is meant to be called by the rake task scihist:data_fixes:adjust_subjects_and_creators # which instantiates this lass *once*, then calls process_work(work) on each work in the collection. # process_work just updates the subjects and authors of a work accor...
true
a4b30c4cbab43dae9758d4ece3376c6a3beecd4b
Ruby
hannahbishop/pokerscore
/tests/test_card.rb
UTF-8
1,909
3.328125
3
[]
no_license
require 'minitest/autorun' require 'minitest/color' require 'lib/pokerscore/card.rb' require 'const/card_constants.rb' class TestCard < Minitest::Test def test_can_create_card_object card = Card.new(3, :heart) assert_equal card.class, Card end def test_card_object_has_suit_and_value card = Card.new(...
true
8b9232f3a458a5b6893cafbcf089a8d1d5f23488
Ruby
lucasrcdias/controle-pontos
/app/models/period.rb
UTF-8
684
2.640625
3
[ "MIT" ]
permissive
class Period < ActiveRecord::Base validates :start_at, :finish_at, :interval_start, :interval_finish, presence: true validates_with PeriodUniquenessValidator belongs_to :company def workload to_hour(finish_at - start_at) - interval_duration end def interval_duration to_hour(interval_finish - inte...
true
d2267c11bbd47ade34b6642c5fcd162fadeb6ff6
Ruby
glinraen/CallGirl
/CallGirl/v0.2.0/fullbodied-callgirl/vendor/ruby/2.2.0/gems/rye-0.9.13/lib/rye/dsl.rb
UTF-8
2,361
2.515625
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
require 'docile' module Rye class Set def run cmd instance_eval &@@command[cmd] end end end @hosts, @hostsets, @contexts = {}, {}, {} @parallel = nil @@colors = false || ENV['COLORS'] || ENV['TERM'].match(/.*color.*/) @@command = {} def parallel state; @parallel = state; end def colors state; @@...
true
2f50a6d695a05591bd13fa030c175c72ece9d4d1
Ruby
alexm/refactoring-book
/ruby/page_039/movie.rb
UTF-8
848
3.265625
3
[]
no_license
class Movie REGULAR = 0 NEW_RELEASE = 1 CHILDRENS = 2 attr_reader :title attr_reader :price_code def price_code=(value) @price_code = value end def initialize(title, the_price_code) @title, self.price_code = title, the_price_code end def charge(days_rented) result = 0 case p...
true
ef9b51f725847d58d1a8fcc320e8b76207e66fb6
Ruby
Annedj/parsing-demo
/json_demo.rb
UTF-8
709
3.109375
3
[]
no_license
require 'json' # TODO - let's read/write data from beers.json filepath = 'data/beers.json' serialized_beers = File.read(filepath) beers_hash = JSON.parse(serialized_beers) beers_hash["beers"].each do |beer| # p beer["name"] end # Get the appearance of the third beer # puts beers_hash["beers"][2]["appearance"]...
true
902facd8672f8a1dec27ce63e8b980470c5aaa11
Ruby
pegasusy/todo
/hello.rb
UTF-8
498
3.9375
4
[]
no_license
puts 'hello' string_array = ["aa","bb","cc"] puts string_array[1] two_d_array = [0,1,2,3],[4,5,6,7],[8,9,10,11] print two_d_array[1][3] two_d_array.each {|x| puts "#{x}"} friends = ["Jake", "Ken", "Nelson"] family = { "Homer"=>"dad", "Marge"=> "mon", "Lisa"=>"sister"} friends.each{|item| puts "#{item}"} family.eac...
true
544b1dc249a4b395a1d79a06e7a0a882728ebef4
Ruby
nitschmann/rails-settings-manager
/spec/settings-manager/base_spec.rb
UTF-8
5,774
2.515625
3
[ "MIT" ]
permissive
require "spec_helper" describe SettingsManager::Base do before(:all) do DefaultSetting = Class.new(Setting) LimitedKeySetting = Class.new(Setting) do allowed_settings_keys [ :page_title, :page_description ] end end after(:each) { Setting.all.each { |setting| setting.dest...
true
e95f5364018bc9b878e2213b35ad67a922804746
Ruby
VorontsovIE/scihub_analysis
/convert_to_local_time_2.rb
UTF-8
1,761
2.671875
3
[]
no_license
require 'tzinfo' year = 2017 tz = Hash.new{|h,k| h[k] = TZInfo::Timezone.get(k) } tz_server = tz['Europe/Moscow'] File.open('scihub_local_time.tsv'){|f| f.readline # drop header # puts ['timezone', 'latDerived', 'lngDerived', *header].join("\t") header = [ 'timezone', 'country', 'city', 'year', 'mon...
true
3c97424f6ae1ada6cc54fcc889768de792368942
Ruby
richardforth/ruby-tidbits
/ruby2_3_3/course_files/UDEMY_Learn_to_Code_with_Ruby/Section_13_Hashes_II/select_reject_on_hash.rb
UTF-8
228
2.828125
3
[ "Unlicense" ]
permissive
receipe_tspns = { sugar: 5, flour: 10, salt: 2, pepper: 4 } high = receipe_tspns.select { |ingredient,teaspoons| teaspoons >=5} p high puts low = receipe_tspns.reject { |ingredient,teaspoons| teaspoons >=5} p low puts
true
ffdb1fcf733c364227e14e397d4d90d109664459
Ruby
ButenkoT/WDI11_Homework
/donald_wade/week_04/monday/calculator2.rb
UTF-8
934
4.03125
4
[]
no_license
hash_of_symbols = Hash[ "*", "multiplication", "/", "division", "+", "addition", "-", "subtraction", "**", "exponent", "sq", "square root", ] def doSum(num1, operation, num2) result = num1.send(operation, num2) puts result end loop do puts 'Which function would you like to perform today?' puts "En...
true
eb72cc9413cf3a1d6b57daae6401cbca5427e9dc
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/grade-school/3ae271f0cd3540ceb5da2ecd9f897ed9.rb
UTF-8
340
3.4375
3
[]
no_license
class School def initialize @roster = Hash.new{|hash, key| hash[key] = []} end def db @roster end def add student, grade @roster[grade] = @roster[grade] << student end def grade number @roster[number] end def sort Hash[Hash[ @roster.map{|grade,students| [grade, students.sort] ...
true
ccd88f3007f50cab174744c5e42251e3e04d6cc2
Ruby
aribray/heaps
/lib/min_heap.rb
UTF-8
2,461
4.25
4
[]
no_license
require 'pry' class HeapNode attr_reader :key, :value def initialize(key, value) @key = key @value = value end end class MinHeap def initialize @store = [] end # This method adds a HeapNode instance to the heap # Time Complexity: O(log n) # Space Complexity: O(n) def add(key, value = ...
true
842b2427f551ed20d3a6a6380a008ab8bce1b653
Ruby
GSA/search-gov
/lib/importers/youtube_profile_data.rb
UTF-8
1,757
2.78125
3
[]
no_license
module YoutubeProfileData def self.import_profile(url) url_type, resource_id = detect_url url case url_type when :channel import_profile_by_channel_id resource_id when :user import_profile_by_username resource_id.downcase else nil end end def self.detect_url(url) ur...
true
30700e80a30cfd7212909f598d92cfd5c5afd733
Ruby
dduqueti/study
/algorithms/merge_sort.rb
UTF-8
1,197
4.21875
4
[]
no_license
# Approach: recursion on merge_sort def merge_sort(list) length = list.length return list if length <= 1 middle = length / 2 left = list.take(middle) # list.slice(0, middle) right = list.drop(middle) # list.slice(middle, length) # Recursion on each side of the list merge(merge_sort(left), merge_sort(ri...
true
35e6fb064239f29c3c437c08dac4985a5dd95796
Ruby
Danrod16/lectures
/cookbook_1/todo-manager-prep/task.rb
UTF-8
222
2.9375
3
[]
no_license
class Task def initialize(title) @title = title @completed = false end def title return @title end def mark_as_completed @completed = true end def completed? return @completed end end
true
457c2b4cd4e313498af44c28c975f488789098df
Ruby
eallsopp/second-ruby-intro-reading
/Hashes/iterating_over_hashes.rb
UTF-8
147
3.59375
4
[]
no_license
person = {name: "Elijah", height: "4 ft 9 inches", weight: "120 lbs", age: 9} person.each do |key, value| puts "Elijah's #{key} is #{value}" end
true
f166b243c6f07302104cc5ec714b95f97f2df447
Ruby
saramannseichner/sprout
/app/models/order.rb
UTF-8
966
2.75
3
[]
no_license
class Order < ApplicationRecord belongs_to :user has_many :order_items has_many :plants, through: :order_items has_one :address, through: :user before_create :set_order_status before_save :update_subtotal # validates :address, presence: true # monetize :amoun def num_of_items order_items.collec...
true
3464572a1676827058a550c6e85cf6f4078e5b37
Ruby
jamesnovakowski/Twilio-Messenger-simple
/app/services/twilio_message_sender.rb
UTF-8
1,067
3.046875
3
[]
no_license
module TwilioMessageSender def self.check_number(number) number = number.strip #remove non-numeric characters number = number.gsub(/\D/,'') #check length puts "Modified Number: #{number}" puts number.length if number.length == 11 number = number puts "11 digit check go" ...
true
57c3b239950263190ac8d188603c6d1b9ac5465b
Ruby
bravolima/bravo_presenter
/lib/bravo_presenter/base.rb
UTF-8
903
2.65625
3
[ "MIT" ]
permissive
# Based on this gist by Joshua Clayton: # https://gist.github.com/1522839/ class BravoPresenter::Base < BasicObject include ::BravoPresenter::Filters include ::BravoPresenter::Helpers attr_accessor :object, :template undef_method :== def initialize(object, template) @object = object @template = te...
true
381697a706c25b6dc190b745264fea7977b16377
Ruby
BerilBBJ/scraperwiki-scraper-vault
/Users/P/paulaguisado/boe_subvenciones1.rb
UTF-8
2,650
2.734375
3
[]
no_license
##encoding:utf-8 #Este programa tiene por objetivo obtener los enlaces a #las disposiciones del BOE que tratan de subvenciones a partidos políticos #LIBRERIAS require 'mechanize' #CONSTANTES BASE_URL = "http://www.boe.es/buscar/boe.php?campo%5B1%5D=DOC&dato%5B1%5D=Ley+Org%E1nica+8%2F2007"\ "&operador%5B1%5D=and&campo%...
true
4695f4704a740af4fde717cd0d16d2b633216452
Ruby
vmfrcosta/mid-batch-party
/08-spin-words/lib/spin_words.rb
UTF-8
193
3.3125
3
[]
no_license
def spinWords(words) # Code me here! array = words.split(" ") array.each_with_index { |el, index| if el.length > 5 array[index] = el.reverse end } return array.join(" ") end
true
3bc2b570bb16243148a193fc1b5b5fd8edda8c44
Ruby
kthatoto/termworld-ruby
/lib/termworld/commands/user_action.rb
UTF-8
2,066
3.078125
3
[ "MIT" ]
permissive
require "termworld/game/controller" module Termworld module Commands class UserAction def initialize(name) @name = name end COMMANDS = [ { label: "wakeup", description: "Wakeup user" }, { label: "sleep", description: "Sleep user" }, { label:...
true
64a63397e7cdfe315f90e8608610dfd322965440
Ruby
Jun-Ota/phase-0-tracks
/ruby/4.option.robot.rb
UTF-8
1,549
4.71875
5
[]
no_license
# Robot Translator # If a letter is capitalized and it's in the first half of the alphabet, it becomes "bloop" # Otherwise if a letter is capitalized or it's the letter "e", it becomes "buzz" # If it is not a letter at all, it becomes "boing". # Otherwise, it becomes "beep" # "Happy Halloween!" # Business logic def tr...
true
e04da0e7637713cd2941bd9b360175243c549d1b
Ruby
fauxparse/fourk
/app/concepts/board/triangle.rb
UTF-8
204
2.9375
3
[]
no_license
class Board::Triangle def initialize(size) @size = size end def hexes (0...@size).flat_map do |row| (0...(@size - row)).map { |column| Hex.from_axial(row, column) } end end end
true
ca71ddf064629498d5873c96a1796a49e9c49e25
Ruby
tiffany-simionescu/ruby-course
/modules.rb
UTF-8
224
3.515625
4
[]
no_license
# modules are groups of related methods module Tools def sayhi(name) puts ("Hello, #{name}") end def saybye(name) puts ("Bye, #{name}") end end include Tools Tools.sayhi("Tiffany") Tools.saybye("Tiffany")
true
915cae76eae204af219f1891ae68e4e2e25fe689
Ruby
empressofedenia/Learn-Code
/execise7.rb
UTF-8
665
3.21875
3
[]
no_license
z = [] 500.times do z<<rand(10) end zeros= ones= twos= threes= fours= fives= sixes= sevens= eights= nines = 0 z.each do |i| if i == 0 zeros = zeros + 1 elsif i == 1 ones = ones + 1 elsif i == 2 twos = twos + 1 elsif i == 3 threes = threes + 1 elsif i == 4 fours = fours + 1 elsif i == 5 fives = five...
true
96bda640bc3fce79b1d6503d3a208335c6035767
Ruby
bonar/file-visitor
/lib/file/visitor/filter/mtime.rb
UTF-8
1,319
3.109375
3
[ "MIT" ]
permissive
require 'file/visitor/filter' require 'file/visitor/time_utils' class File::Visitor::Filter::Mtime include File::Visitor::TimeUtils PASSED_COMPARATOR = { :passed => :is_older_than, :passed= => :is_older_than=, } # Two ways to initialize filter: # 1) File::Visitor::Filter::Mtime.new( # ...
true
a60476951ed5419c37fbf17012f2631c961cedc0
Ruby
anaerobeth/Bravo-exercises
/anagrams/anagram_generator.rb
UTF-8
572
3.859375
4
[]
no_license
class AnagramGenerator attr_accessor :word def initialize(word) @word = word.downcase end def generate anagram_array = [] factorial = word.length.downto(1).inject(:*) while anagram_array.length != factorial anagram = word.split('').shuffle.join if anagram_array.include?(anagram) ==...
true
6e02b93e8c76eba381193044ab014d2c1ead8268
Ruby
scalaview/selectable_column_sample
/app/services/selectable_column/test.rb
UTF-8
4,853
2.625
3
[]
no_license
module SelectableColumn class Test class << self def user_selectable puts " This is a example for selectable columns, you can see the selectable columns in SQL, if the development mode on. the preload associations are [{:organizations=> [:products, :user]}, :introduction, {:wif...
true
a70230b4b987ac2281e61a3eb16915b4c7e6fdb7
Ruby
StuartPearlman/RightOnTracker
/app/helpers/day_converter.rb
UTF-8
345
3.53125
4
[ "MIT" ]
permissive
helpers do def day_converter(days_scheduled_string) days = {} days["1"] = "Mon" days["2"] = "Tues" days["3"] = "Wed" days["4"] = "Thur" days["5"] = "Fri" days["6"] = "Sat" days["0"] = "Sun" nice_string = '' days_scheduled_string.each_char do |c| nice_string += days[c] + " " end ret...
true
a81dc76f0da3fe51291192958250abd2d35fbbb5
Ruby
joe-hamilton/RB_101
/rb_small_problems/easy_5/2.rb
UTF-8
2,166
4.46875
4
[]
no_license
# After Midnight Part 1 =begin (Understand the Problem) Problem: Write a method that takes a time using this minute-based format and returns the time of day in 24 hour format (hh:mm) Inputs: Integer (time in day) Outputs: String ('hh:mm') Questions: 1. Explicit Rules: 1. You may not ...
true
11d81c01492a0a4524ff8dc9075943ff18610b17
Ruby
robo-monk/mastermind_sinatra
/game/game_objects/player.rb
UTF-8
2,503
3.171875
3
[]
no_license
require_relative '../modules/screen.rb' require_relative '../modules/pawn_settings.rb' class Player include PawnSettings attr_accessor :name, :automated, :games_memory, :game_memory, :data, :run, :last_move def initialize name, automated=false @name = name @automated = automated @game_memory = Array.n...
true
4f3b2d14e6816eec434f76b82e620058a941b0f3
Ruby
julyytran/black_thursday
/lib/item_repository.rb
UTF-8
1,119
3.171875
3
[]
no_license
require 'csv' require 'bigdecimal' require_relative 'item' class ItemRepository attr_reader :all def inspect "#<#{self.class} #{@merchants.size} rows>" end def initialize(file = nil) content ||= CSV.open "#{file}", headers: true, header_converters: :symbol @all ||= content.to_a.map { |row| Item.n...
true
b0726b6a3de1b8ad75518a1d8a516b222100e0ef
Ruby
bmeneses/vinq
/app/services/wine_list.rb
UTF-8
1,112
2.625
3
[]
no_license
require File.dirname(__FILE__) + "/../../lib/ruby_extensions" class WineList attr_accessor :list, :attributes ::WINE_FILTER_TYPES = [:region, :appellation, :varietal, :product_attributes] def get(params = {}) #if params != {}; binding.pry; end; @list = get_list(params) @attributes = get_attributes(params) ...
true
25474a6f22bb049aeaccd128da7df3191b61c1af
Ruby
creep1g/ruby_programming
/bubble_sort/bubble_sort.rb
UTF-8
575
3.5
4
[]
no_license
def bubble_sort array n = array.length loop do swapped = false (n-1).times do |i| if array[i] > array[i + 1] array[i], array[i + 1] = array[i + 1], array[i] swapped = true end end break if swapped == false end array end def bubble_sort_by array n = ...
true
cb8c73df96e4ba6d2bef5d61ebf714ecc57cd8fd
Ruby
danabest2/week1weekend_homeworkv2
/pet_shop.rb
UTF-8
2,588
3.3125
3
[]
no_license
def pet_shop_name(pet_shop) return pet_shop[:name] end # def total_cash(pet_shop) return pet_shop[:admin][:total_cash] end def add_or_remove_cash (pet_shop, extra_cash) return pet_shop[:admin][:total_cash] += extra_cash end def pets_sold(pet_shop) return pet_shop[:admin][:pets_sold] end ###I need to double ch...
true
7e056bcf7582264ae5a16fb9eabc888675f8e3c5
Ruby
peteyluu/ruby-poker-tdd
/spec/hand_spec.rb
UTF-8
16,078
3.0625
3
[]
no_license
require 'rspec' require 'spec_helper' require 'hand' require 'card' describe Hand do describe '#initialize' do let(:cards) {[ Card.new(:spades, :ace), Card.new(:hearts, :ace), Card.new(:clubs, :ace), Card.new(:diamonds, :ace), Card.new(:spades, :ten) ]} let(:hand) { Hand.new...
true
b139b1fe6e02814b3f5d4f6e9bea909392aa6706
Ruby
tulibraries/dplah
/lib/encodings/constants.rb
UTF-8
963
2.53125
3
[ "Apache-2.0" ]
permissive
module Encodings class Constants LANG_ABBR = { 'Afr' => 'Afrikaans', 'Amh' => 'Amharic', 'Grc' => 'Ancient Greek', 'Chi' => 'Chinese', 'Zho' => 'Chinese', 'Cze' => 'Czech', 'Ces' => 'Czech', 'Dan' => 'Danish', 'Dut' => 'Dutch', 'Eng' ...
true
2dc6fad605b77ba39280e6f589d5ad71a0eea708
Ruby
AlmazKo/battleship
/spec/battle-ship/client/key_map_spec.rb
UTF-8
1,382
2.546875
3
[]
no_license
# coding: utf-8 require "battle-ship/client/key_map" include BattleShip::Client describe BattleShip::Client::KeyMap do before(:all) do Thread.abort_on_exception = true @stream = FakeBlockingStream.new @key_map = KeyMap.new(@stream) end it "Array of Bindings's mustn't be empty after running" do ...
true
5a1fe91af0f4117d1084273c8279b7a890c55ba2
Ruby
iamabhishekt/leetcode-ruby-1
/1027.longest-arithmetic-sequence.rb
UTF-8
2,460
3.515625
4
[]
no_license
# -*- coding: utf-8 -*- # # @lc app=leetcode id=1027 lang=ruby # # [1027] Longest Arithmetic Sequence # # https://leetcode.com/problems/longest-arithmetic-sequence/description/ # # Given an array A of integers, return the length of the longest # arithmetic subsequence in A. # # Recall that a subsequence of A is a list ...
true
bcb7f52d8d3dd60e347d54be02ba574e0d5c4d8e
Ruby
aman199002/Data-Structures-and-Algorithms-in-Ruby
/tree/least_common_ancestor.rb
UTF-8
861
3.6875
4
[]
no_license
class Node attr_accessor :left,:right,:val def initialize(val) @val = val end end def lca(node,n1,n2) if node == nil return end # If either n1 or n2 matches with node value, return node. if node.val == n1 || node.val == n2 return node end l_lca = lca(node.left,n1,n2) r_lca = lca(node.right,n1,n2) #...
true