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
2f53b1385cd23608777d573934539b6d9c1921a2
Ruby
Osvimil/RubyCourse
/entradasalida.rb
UTF-8
86
2.796875
3
[]
no_license
File.open("texto.txt") do |file| while lineas = file.gets puts lineas end end
true
52c3a149060c4deb14fa76493bf41b798eb02dd0
Ruby
falonofthetower/tealeaf
/basics/solution_1.rb
UTF-8
57
2.984375
3
[]
no_license
fname = "Peter" lname = "Karth" puts "#{fname} #{lname}"
true
1342a8808dd3f871bd3f39dbc2f60b734efee778
Ruby
weirdpercent/lyracyst
/lib/lyracyst/wordnik/example.rb
UTF-8
1,530
2.59375
3
[ "MIT" ]
permissive
# coding: utf-8 %w{httpi multi_json multi_xml rainbow}.map { |lib| require lib } module Lyracyst class Wordnik # Fetches examples from Wordnik. class Example # @param search [String] The word or phrase to search for. # @param params [Hash] The search parameters to use. def get_ex(search, pa...
true
78ffd1a890aeb1577a90a0e1de38cc0ea3418f03
Ruby
jmojennifer/FarMar
/specs/farmar_sale_spec.rb
UTF-8
2,943
2.90625
3
[]
no_license
# Talked to TA Friday afternoon re: spec tests not so helpful--could have included sub data (such as a custom csv file just for testing purposes) to create spec tests to target certain numbers of data (such as all expected items in a collection making it into the collection.) require_relative 'spec_helper' describe F...
true
b597d4fdcbfed41e2bf0124d7e6fd9df9f32793f
Ruby
ahlfors/raspberry_picrowave
/microwave_daemon/lib/serial_microwave.rb
UTF-8
2,982
2.953125
3
[]
no_license
require 'serialport' class SerialMicrowave PORT_STR = "/dev/ttyACM0" CMD_CLOCK = 0 CMD_MODE = 1 CMD_TIME = 5 CMD_POWER = 4 POWER_LEVELS = { 'high' => 10, 'medium' => 7, 'low' => 5, 'defrost' => 3 } WEB_BUTTON_MAPPINGS = { "Quickstart Medium 2m" => [['time', 120], ['power', '...
true
d2104e9921640e151c197aca4631ede36e616b2b
Ruby
estebanmjm/EjerciciosRuby
/invert_num.rb
UTF-8
332
3.75
4
[]
no_license
puts "ingrese numero a invertir" numero = gets.chomp.to_i residuo = 0 numero_inv = 0 while numero > 0 #si fuera >= 0, el algoritmo entra en un loop infinito residuo = numero%10 numero = numero/10 - (residuo/10) numero_inv = numero_inv*10+residuo residuo = 0 end puts "El número invertido es: #{numer...
true
a879f6e4457fc01b0cbf4c5bd53e32d2f55ab8dc
Ruby
IceDragon200/vx_to_ace
/lib/vx_to_ace/rgss3-lib/color.rb
UTF-8
773
3.328125
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
class Color attr_reader :red, :green, :blue, :alpha def red=(n) @red = n < 0 ? 0 : n > 255 ? 255 : n end def green=(n) @green = n < 0 ? 0 : n > 255 ? 255 : n end def blue=(n) @blue = n < 0 ? 0 : n > 255 ? 255 : n end def alpha=(n) @alpha = n < 0 ? 0 : n > 255 ? 255 : n end def ...
true
2f86bff75e2a2b8efb2276972b1f303d39a093d4
Ruby
remiodufuye/ruby-enumerables-introduction-to-map-and-reduce-lab-dc-web-102819
/lib/my_code.rb
UTF-8
1,594
3.890625
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# My Code here.... #Remember, all map methods return a new Array. def map_to_negativize(source_array) new_array = [] negativize = 0 i = 0 while i < source_array.length do negativize = source_array[i] * - 1 new_array.push(negativize) i += 1 end return new_array end def...
true
70e6cecde4312ad1af6d2e316d4ffd5905d5fa89
Ruby
cechareb/fundamentos-programacion
/ruby/estructuras-secuenciales/propuestos-actividades/EstructurasSecuenciales_UC.rb
UTF-8
422
3.125
3
[]
no_license
cp1 = 15 puts "Nota CP1: #{cp1}" cp2 = 17 puts "Nota CP2: #{cp2}" cp3 = 18 puts "Nota CP3: #{cp3}" ef = 16 puts "Nota Examen Final: #{ef}" tf = 13 puts "Nota Trabajo Final: #{tf}" promedioParciales = (cp1 + cp2 + cp3)/3 notaParciales = promedioParciales * 0.55 notaExamenFinal = ef * 0.30 notaTrabajoFinal = tf * 0.15 ...
true
482e131bda2697d8f326283762c3540be5d1e8a2
Ruby
karayusuf/esri_shapefile
/lib/esri_shapefile/models/shapes/poly_line_z.rb
UTF-8
3,074
2.90625
3
[ "MIT" ]
permissive
require 'esri_shapefile/byte_model' module EsriShapefile module Shapes # # A PolyLineZ consists of one or more parts. A part is a connected sequence # of two or more points. Parts may or may not be connected to one another. # Parts may or may not intersect one another. # class PolyLineZ ...
true
aba09efea0d383ed3407fbae33f6188eaf9ec381
Ruby
thorncp/fsck
/spec/fsck/fsck_spec.rb
UTF-8
2,343
2.953125
3
[ "MIT" ]
permissive
require "spec_helper" describe Fsck do subject { Class.new { include Fsck }.new } describe "method is called" do it "should match method with fluff at the beginning" do subject.should_receive(:the_method) subject.call_the_method end it "should match method with fluff at the end" do ...
true
93b652f8df61c3b9f50305fe2a84ba8d653ef01a
Ruby
apinrdw/naivechain.rb
/client.rb
UTF-8
273
2.78125
3
[]
no_license
require 'restclient' puts "Blockchain client" print("Specify the port: ") port = gets.chomp loop do begin print "#{port}> " msg = gets.chomp x = RestClient.post "http://localhost:#{port}/chain/add", msg puts x rescue => e puts e.message end end
true
ccebedb9a4a945957ef681dc423ae626cafe155f
Ruby
Hacker0x01/arel_toolkit
/lib/arel/extensions/overlaps.rb
UTF-8
1,154
2.53125
3
[ "MIT" ]
permissive
# rubocop:disable Naming/MethodName # rubocop:disable Naming/UncommunicativeMethodParamName module Arel module Nodes # https://www.postgresql.org/docs/10/functions-string.html class Overlaps < Arel::Nodes::Node attr_reader :start1 attr_reader :end1 attr_reader :start2 attr_reader :end...
true
bb42b24fa16896e16fc84c313ee962b1aa152672
Ruby
rhardih/aoc
/2022/23p1.rb
UTF-8
11,812
3.734375
4
[]
no_license
=begin --- Day 23: Unstable Diffusion --- You enter a large crater of gray dirt where the grove is supposed to be. All around you, plants you imagine were expected to be full of fruit are instead withered and broken. A large group of Elves has formed in the middle of the grove. "...but this volcano has been dormant ...
true
b1a4c9d45304ddd5f831397d12dd8d2bbe5c151e
Ruby
jkpj/elk_sports
/spec/helpers/application_helper_spec.rb
UTF-8
20,065
2.546875
3
[]
no_license
require 'spec_helper' describe ApplicationHelper do describe "#points_print" do it "should print no result reason if it is defined" do competitor = mock_model(Competitor, :no_result_reason => Competitor::DNS, :points => 145) helper.points_print(competitor).should == "<span class='expl...
true
0658e3ddc26a745a4f3d55899543666124502b69
Ruby
jdizon71/phase-0-tracks
/ruby/santa.rb
UTF-8
4,536
3.03125
3
[]
no_license
class Santa attr_reader :gender, :ethnicity, :orientation, :religion, :favorite_cookie, :milk_type attr_accessor :age def initialize(gender, ethnicity, orientation, religion, favorite_cookie, milk_type) @gender = gender @ethnicity = ethnicity @orientation = orientation @religion = religion @...
true
3575868577c05a8488f450b25311fbe25b3653c3
Ruby
ACBullen/algorithms_pratice
/array_solution/well_formed_string.rb
UTF-8
457
4.0625
4
[]
no_license
# A string with the characters [,], {,},(,) is said to be well formed if the different types of brackets # match in the correct order. # for example, ([]){()} is well formed, but [(]{)} is not def well_formed?(str) return false if str.length % 2 != 0 left_char = [] lookup ={ '('=> ')', '['=>']', '{' => '}' } st...
true
d70826df68bc57fd4813705776fa590bcdece177
Ruby
rmosolgo/graphql-ruby
/spec/graphql/schema/object_spec.rb
UTF-8
15,081
2.53125
3
[ "MIT" ]
permissive
# frozen_string_literal: true require "spec_helper" describe GraphQL::Schema::Object do describe "class attributes" do let(:object_class) { Jazz::Ensemble } it "tells type data" do assert_equal "Ensemble", object_class.graphql_name assert_equal "A group of musicians playing together", object_clas...
true
1f6b8edd345741c5455d3ac9666b8573b3d0f77d
Ruby
mcharnay/ruby_base
/matrices.rb
UTF-8
92
2.890625
3
[]
no_license
require 'matrix' matriz = Matrix[[1,8,5],[5,2,2]] # # # matriz.each do |i| puts i end
true
ef4e148ba5f7eba7808a765a9d092282b7d8c3b2
Ruby
topofocus/standard_deviation
/benchmark/types.rb
UTF-8
423
2.890625
3
[ "MIT" ]
permissive
require "standard_deviation" require "bigdecimal" require "benchmark" n = 100 range = (1..10_000) integers = range.to_a floats = range.map(&:to_f) decimals = range.map { |value| BigDecimal.new [value, (rand * 10000000000).to_i].join(".") } Benchmark.bm do |b| b.report do n.times { integers.stdev } end ...
true
37dc10d836f8d4c138a4031dab2bb33376a4e9f5
Ruby
mikeyhogarth/duckpond
/spec/inspection_spec.rb
UTF-8
888
2.734375
3
[ "MIT" ]
permissive
require 'ostruct' module DuckPond describe Inspection do describe '#initialize' do it 'is constructed using any ruby object' do obj = Object.new analysis = Inspection.new(obj) expect(analysis.subject).to be obj end end describe '#fulfilled_by?' do context 'when ...
true
591af1724563b155efa937dacca156a07d8c5859
Ruby
Tasoxanadu/Ruby_test
/Work/7_class3.rb
UTF-8
915
3.125
3
[]
no_license
# 実行してもエラーになるメソッドを定義 def hello File.open( "/hello/file" ) end begin # エラーを起こす可能性のあるコード hello rescue # ローカル変数ではなく特殊変数を使った例 puts $! puts $@ end # 出力結果 # TASO:furiRuby tanakasogo$ ruby RiaseTech/6_class2.rb # あなたは? 1:太郎 2:次郎 3:三郎 # 1 # 仕事お疲れ様 # TASO:furiRuby tanakasogo$ ruby RiaseTech/6_class2.rb # あなたは? 1...
true
043b431f5a5518a2cea495ddf5d154d35a727050
Ruby
macbury/detox
/app/services/urls/expand_absolute.rb
UTF-8
774
2.53125
3
[]
no_license
module Urls # Expand urls from relative one to absolute one in html elements like a, img, video, audio, iframe class ExpandAbsolute < Service use Normalize, as: :normalize_url def initialize(doc, base_url = nil) @doc = doc.is_a?(String) ? Nokogiri::HTML.fragment(doc) : doc @base_url = base_url ...
true
1ee89f8b4732979c9f4dc5dd64dd69d94821ff7a
Ruby
dilipcode/ruby
/rubyExercises/ex9.rb
UTF-8
417
4.0625
4
[]
no_license
# Guessing the number require 'pry' def prompt(message) puts "=> #{message}" end number = Kernel.rand(1..10) total_guess = 0 loop do prompt('Guess a number between 1 to 10') guess = gets.chomp.to_i total_guess += 1 if guess == number prompt("you guessed it right in #{total_guess} attempts") exit el...
true
dace0ad50e096325ae8273a0feacaed54caf0958
Ruby
njaffer/sufia_6
/sufia_app/vendor/bundle/ruby/2.2.0/gems/active-triples-0.7.1/lib/active_triples/configurable.rb
UTF-8
2,164
2.546875
3
[ "Apache-2.0" ]
permissive
require 'deprecation' module ActiveTriples ## # Module to include configurable class-wide properties common to # Resource and RDFDatastream. It does its work at the class level, # and is meant to be extended. # # Define properties at the class level with: # # configure base_uri: "http://oregondigita...
true
6a4a88e6d66e58b9f58b9ae5c6621676d91d3b96
Ruby
nakajima/poundie-weather
/lib/poundie-weather.rb
UTF-8
1,181
2.71875
3
[]
no_license
require "nokogiri" class PoundieWeather < Poundie::Plugin register :poundie_weather match do |message| message.body =~ /^poundie weather / end action do |message| begin place = message.body.gsub(/^poundie weather /, "").strip woeid = get_woeid(place) doc = Nokogiri(get("http://weath...
true
51431f91c506b81635402d36ae8448c4a893a4cd
Ruby
pollygee/homework_5
/deck.rb
UTF-8
466
3.34375
3
[]
no_license
class Deck attr_reader :SUITS, :RANKS, :VALUES, :drawn, :deck def initialize @SUITS = [:C, :S, :H, :D] @RANKS = [:A, 2, 3, 4, 5, 6, 7, 8, 9, 10, :J, :Q, :K] @deck = [] @drawn = [] @SUITS.each do |suit| @RANKS.each do |rank| c = Card.new(rank,suit) @deck << c end ...
true
a34dfd1598c8f38c9cddd43d16d83f584cbb3278
Ruby
RubyCamp/rc2011s_g1
/dice_game/player.rb
UTF-8
1,701
3.484375
3
[]
no_license
# Playerクラスの定義 class Player attr_accessor :x, :y, :image, :is_go_north attr_reader :mas # 初期化処理 def initialize(x = 45 , y = 100, image_file = "Player_images/player1.png") @x, @y = x, y @mas = 0 @image_file = image_file @image = Image.load(image_file) @position = Position.new ...
true
77d02e7cdddcc91edf777fb01811c3b9ecab51bd
Ruby
hanezu/hanezu.github.io
/scripts/post.rb
UTF-8
2,531
3.078125
3
[ "MIT" ]
permissive
require 'fileutils' require 'date' require_relative 'error' module PostModule class Post ENGLISH_DIR = 'posts/' CHINESE_DIR = 'cn/' JAPANESE_DIR = 'ja/' POSTS_FOLDER = '_posts' DRAFT_DIR = '_drafts' class << self def title_of(path) File.open(path).each do |line| if ...
true
01e03d0a3706343eb814bb44eb1b9136bffeb33f
Ruby
lauraadalmolin/projeto_ds2
/models.rb
UTF-8
2,643
2.609375
3
[ "MIT" ]
permissive
require "data_mapper" require "dm-migrations" #para o código funcionar é necessário fazer o seguinte insert : "INSERT INTO usuarios VALUES (DEFAULT, 'administrador', 'admin', '1234')" DataMapper.setup(:default, 'postgres://postgres:postgres@localhost/hogwarts') class Wand include DataMapper::Resource property :id...
true
86a4cd286550ba26c115a94340cc448141980bf2
Ruby
tiagodavi/small-twitter-microblog
/app/models/user_session.rb
UTF-8
611
2.8125
3
[]
no_license
class UserSession include ActiveModel::Model attr_accessor :login, :password validates_presence_of :login, :password def initialize(session, attributes={}) @session = session @login = attributes[:login] @password = attributes[:password] end def authenticate! user = User.authenticate(@login, @password...
true
9c72d39fc2311bc2e9c1998ffbe5472b8dc2717a
Ruby
soronda/ekatarina
/config/upitnik.rb
UTF-8
101
3.046875
3
[]
no_license
puts "koji broj cipela nosis?" a1=gets.chomp if a1>40 puts "imas velike noge" else puts "lepo"
true
e3eb907dde9dea70e592ca0a8428d3f9dd7dd998
Ruby
bdimcheff/sandbox
/lib/sandbox.rb
UTF-8
1,252
3.0625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'tmpdir' require 'digest/sha1' # Represents a temporary sandbox for testing that relies on the # filesystem. class Sandbox attr_accessor :path # Executes the block and yields the path to the sandbox directory. # Cleans up the sandbox after the block is complete. # == Options # [+:path+] the path to ...
true
cb67b05c52b834125f2fb82db6536eb394c99cdc
Ruby
Srossmanreich/phase-0
/week-5/nums-commas/my_solution.rb
UTF-8
4,056
4.5625
5
[ "MIT" ]
permissive
# Numbers to Commas Solo Challenge # I spent [] hours on this challenge. # Complete each step below according to the challenge directions and # include it in this file. Also make sure everything that isn't code # is commented in the file. # 0. Pseudocode # What is the input? a number without commas # What is the ou...
true
3d6fafe7f4367587d3e90b6423aa4734969382c3
Ruby
caward12/black_thursday
/lib/invoice.rb
UTF-8
1,543
2.859375
3
[]
no_license
require 'date' class Invoice attr_reader :id, :customer_id, :merchant_id, :status, :created_at, :updated_at, :invoice_repository def initialize(info = {}, invoice_repository = "") @id = info[:id].to_i @cust...
true
54aeafd6634c1dc70188cba2c4657baf9773b5f7
Ruby
muhd-ali/ProblemSolving
/CodeJam/2016/ROUND 1/A/prob_1 Last_Word/main_cmd.rb
UTF-8
159
3.03125
3
[]
no_license
require_relative 'sol' while true print 'Input String => ' input = gets.chomp print "last word: #{last_word input}" puts ' ' puts ' ' end
true
63909de6771668739c6403c4ef094d1f1a727cd2
Ruby
zph/dude
/lib/dude.rb
UTF-8
517
3.078125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class Exception attr_reader :initial_message def initialize(message) @initial_message = message end def to_s # "#{self.inspect}, hello" require'pry';binding.pry case self when LoadError when ArgumentError "Yo, there's nothing here in ArgErr" when NoMethodError "#{@initi...
true
1841287ea4138c9c9ef11289bbb7c28b5f3be412
Ruby
duncandevs/my-select-web-031317
/lib/my_select.rb
UTF-8
200
3.34375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def my_select(collection) # your code here! result = [] i = 0 while i < collection.length y = yield collection[i] if y == true result << collection[i] end i += 1 end result end
true
a2b35f02d03785895af5f739306ec5b45b5780d7
Ruby
smosab/weekly_challenges
/pascals_triangle/pascals_triangle.rb
UTF-8
1,133
3.9375
4
[]
no_license
require 'pry' class Triangle attr_accessor :row, :tri_array, :num_operations, :tmp_arr def initialize(row) @row = row @tri_array = [[1]] @num_operations = row + 1 @tmp_arr = tri_array.last end def triangle_array binding.pry if row == 0 return tri_array else # if tri_...
true
2190abad5fc453fabbceb7d04d3450a5d3eec21c
Ruby
Raf-Batista/tic-tac-toe-rb-online-web-sp-000
/lib/tic_tac_toe.rb
UTF-8
3,059
3.875
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#rspec spec/01_tic_tac_toe_spec.rb WIN_COMBINATIONS = [ [0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6] ] def display_board(board) puts " #{board[0]} | #{board[1]} | #{board[2]} " puts "-----------" puts " #{board[3]} | #{board[4]} | #{board[5]} " puts "----------...
true
eb63e1e96e21b95d35faa95fef093b0db5c584e4
Ruby
Zapata/rockstails
/model/activerecord/active_record_db.rb
UTF-8
2,021
2.75
3
[]
no_license
require 'active_record' require_relative 'cocktail' require_relative 'recipe_step' require_relative 'ingredient' require_relative 'bar' require_relative '../ingredient_manager' class ActiveRecordDB def search(keywords, bar) query = build_criteria_query(keywords) query = append_bar_filter(query, bar) ret...
true
ea0d0cd46b720fe0aa2ba30e9c988a97c87486dc
Ruby
cha63506/marlowe
/lib/marlowe/class.rb
UTF-8
1,426
2.953125
3
[]
no_license
require 'marlowe/type' require 'marlowe/method' module Marlowe class MObject def initialize(cls) @klass = cls end attr_reader :klass end class Class < Type def initialize(name, instance_class=MObject) super name @instance_class = instance_class @methods = [] @singl...
true
ba92fd83c32cef7fe39a7cd737a08fb6077edfc3
Ruby
m-chrzan/aoc2020
/14/b.rb
UTF-8
1,060
3.3125
3
[]
no_license
def mask_address address, mask address.chars.zip(mask.chars).map do |bit, mask_bit| case mask_bit when '0' bit when '1' '1' when 'X' 'X' end end.join '' end lines = File.readlines('input.txt') mask = '' code = [] lines.each do |line| if line.slice(0, 4) == 'mask' mask...
true
8db09e443c558e8b83976b2ab4a8f241d8c356ac
Ruby
mchail/piratescrabble
/src/make_from.rb
UTF-8
268
2.890625
3
[]
no_license
# Get suggestions to steal a word class MakeFrom def initialize(word) @word = Word.new(word) end def suggestions Dictionary.words.find_all do |word| word.contains?(@word) end.map do |word| Match.new(@word, word) end.find_all(&:valid?).sort end end
true
a9fd9a73bab8ae95be360bbe971dbdb365ee6e67
Ruby
heffay/app
/git_utils.rb
UTF-8
961
3.40625
3
[]
no_license
def exit_if_on_the_master_branch exit_if_on_branch('master') end def exit_if_on_branch(branch) status = `git branch` if (%r/\* #{branch}/ =~ status) puts "You cant run this command on the branch #{branch}" exit end end def run_git_command(command,capture_ouptut = false) full_command = "git #{comm...
true
fa7a97a64f32291b1ad171587fb20846bf2061e9
Ruby
langalex/realtimebattle_rb
/spec/realtimebattle/arena_spec.rb
UTF-8
3,352
2.84375
3
[]
no_license
require 'spec/spec_helper' describe Arena do describe '#step' do describe "sensors" do before(:each) do @bot = TestBot.new @arena = Arena.new [@bot], 20, 20 @bot_info = @arena.info_for(@bot) end it "should tell a bot about the upper wall" do @b...
true
27710504e6a124c40294fd6934ff3941ad2fbbef
Ruby
She-Codes/pragmatic_studio_ruby
/game/studio_game_oop.rb
UTF-8
463
3
3
[]
no_license
require_relative 'game' game1 = Game.new('Super Smurfs') game1.load_players(ARGV.shift || 'players.csv') loop do puts "\nHow many game rounds? ('quit' to exit)" answer = gets.chomp.downcase case answer when /^\d+$/ game1.play(answer.to_i) do game1.total_points >= 2000 end when 'quit', 'exit'...
true
6f84507e58a3051323c22855f9cf28b71402101e
Ruby
hsk/lit-x86
/examples/fizzbuzz.rb
UTF-8
154
3.21875
3
[ "BSD-3-Clause" ]
permissive
for i = 1, i < 30, i = i + 1 if i % 15 == 0 puts "fizzbuzz" elsif i % 5 == 0 puts "buzz" elsif i % 3 == 0 puts "fizz" else puts i end end
true
ce612e734b5b471881a33e9a9490219e0d96264f
Ruby
itsgermanphil/pingpong2
/app/models/round.rb
UTF-8
3,755
2.71875
3
[]
no_license
# Rounds are the top-level unit of game time # Each round is a mini-tournament, sub-divided into "tiers" # A round is over when each player has played every other player in their tier # When one round starts, the next one automatically beings the next time a # player makes a request for the "current "round. class Round...
true
63c05f1cca7ed214ba3bf00ceae7f25bb5d103b9
Ruby
GenyPivo/CI_report
/app/services/chart_builder_service.rb
UTF-8
1,566
3.1875
3
[]
no_license
require 'csv' class ChartBuilderService FAILED_LABEL = 'Failed builds'.freeze PASSED_LABEL = 'Passed builds'.freeze DURATION_LABEL = 'Duration, s'.freeze def initialize(file) @csv = CSV.parse(File.read(file)) @headers = @csv.shift end def builds_series marked = mark_abnormal [ { nam...
true
ede5b0da97c5ba5b5003bfd7257df62f9ac4595e
Ruby
mayday77-77/rbnd-toycity-part3
/lib/product.rb
UTF-8
1,809
3.8125
4
[ "MIT" ]
permissive
class Product attr_reader :title, :price, :stock @@products = [] def initialize(options = {}) @title = options[:title] @price = options[:price] @stock = options[:stock] add_to_product end def in_stock? # need to reverse the boolean because if zero? is true, it means we have no stock, thus the need to...
true
e9af008ce9dd52e2ad786075c96eccda1d58f401
Ruby
stp-che/timus
/lib/1033.rb
UTF-8
1,644
3.796875
4
[]
no_license
class Labyrinth EMPTY_CELL = '.' BLOCK = '#' CELL_SIZE = 3 CELL_HEIGHT = 3 def initialize(size, configuration) @size = size @configuration = configuration end def visible_walls_square visible_walls_count*CELL_SIZE*CELL_HEIGHT end def visible_walls_count @visible_walls_count ||= begi...
true
5bc1ed564b89d89322ecaae3ad18cf357ac961e5
Ruby
packethost/healthcheck-rb
/lib/healthcheck/checks/abstract_check.rb
UTF-8
1,177
2.5625
3
[]
no_license
require 'healthcheck' require 'active_support/inflector' require 'active_support/core_ext/module/delegation' module Healthcheck module Checks class AbstractCheck attr_writer :logger attr_accessor :paused delegate :slug, to: :class def ok? [true, :paused].include?(result) e...
true
b49fc932e49aca2e52ace22deb9b89f5be4a6916
Ruby
tommirintala/redmine_doc_pu
/lib/latex_doc.rb
UTF-8
4,467
2.53125
3
[ "WTFPL" ]
permissive
require 'latex_build' require 'latex_template' module ModuleLatexDoc include ModuleLatexBuild attr_accessor :wiki_pages attr_accessor :latex_template attr_accessor :makeindex_bin def version_makeindex() old_work_dir = Dir.pwd # Change to working directory Dir.chdir(self.work_dir) begin ...
true
f87ba104e89a99556a7501eb2e08f0adfd13ab92
Ruby
SDouglas92/MoneyCashBoard
/models/account.rb
UTF-8
693
3.078125
3
[]
no_license
require_relative('../db/SqlRunner.rb') class Account def self.all sql = "SELECT * FROM accounts;" accounts = SqlRunner.run(sql) return result = accounts.map {|account| Account.new(account)} end def self.update(options) sql = "UPDATE accounts SET balance = #{options['balance']} WHERE id = 1;" ...
true
82f8864c6720682ed10742edd8f8a038bcbf3c18
Ruby
rails/rails
/activemodel/lib/active_model/validations/comparison.rb
UTF-8
3,927
2.90625
3
[ "MIT", "Ruby" ]
permissive
# frozen_string_literal: true require "active_model/validations/comparability" require "active_model/validations/resolve_value" module ActiveModel module Validations class ComparisonValidator < EachValidator # :nodoc: include Comparability include ResolveValue def check_validity! unle...
true
134e04b19adead88c575916dd380cd5cd0ca4327
Ruby
IljaBekirov/Lessons
/Lesson_2/1_month.rb
UTF-8
203
3.078125
3
[]
no_license
months = { jan: 31, feb: 28, mar: 31, apr: 30, may: 31, june: 30, july: 31, aug: 31, sept: 30, oct: 31, nov: 30, dec: 31 } months.each { |month, days| puts month if days == 30 }
true
15e36ce87ddd0367f326de3a6ef0dea9e797c741
Ruby
kjkkuk/homeworks
/HW_05/Yan_Tsapik/notification.rb
UTF-8
353
3.125
3
[]
no_license
# discribes Notification class Notification attr_accessor :whom, :from_whom, :content, :status def initialize(whom, from_whom, content) @whom = whom @from_whom = from_whom @content = content @status = false end def to_s "To: #{@whom.name},from: #{@from_whom.name}, Contents: #{@content...
true
0181765660762309fda2ef337dfa365b5e636786
Ruby
RocketScienceProjects/Store_stock_tracker
/store.rb
UTF-8
1,375
3.203125
3
[]
no_license
require './inventory' module Okram class Shirt include Inventory # extend Inventory::ClassMethods attr_accessor :attributes def initialize(attributes) @attributes = attributes end end class Pant include Inventory attr_accessor :attributes def initialize(attributes) ...
true
f22b93cb3a9407738604be2b58ed3b76bffb54df
Ruby
Carpe-Omnia/oo-email-parser-cb-000
/lib/email_parser.rb
UTF-8
528
3.59375
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Build a class EmailParser that accepts a string of unformatted # emails. The parse method on the class should separate them into # unique email addresses. The delimiters to support are commas (',') # or whitespace (' '). class EmailParser attr_accessor :emails def initialize(data) @emails = data end def ...
true
6c3bb93ab3ecf0ab7071aae15f9b18dc1522668c
Ruby
khuuwinnie/fsf-ruby
/test.rb
UTF-8
1,458
3.609375
4
[]
no_license
class Image attr_accessor :image def initialize (image) @image = image end def transform(number) n = number.to_i n.times do b = Marshal.load ( Marshal.dump(@image) ) #creates new unique copy each time @image.each_with_index do |row, row_id| r...
true
8cc4845ac97cdc864d2eed2397ea082b97ec6e2f
Ruby
dendomenko/tb
/part_5/carriage.rb
UTF-8
177
3.234375
3
[]
no_license
class Carriage include Manufacturer attr_reader :number def initialize(number) @number = number end def printer print "Carriage number: #{number}" end end
true
10fce5d3a19140356bafa66cf32c732e80212d93
Ruby
marisayou/flight-booker
/bin/api_info.rb
UTF-8
2,252
2.828125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain", "MIT" ]
permissive
require 'uri' require 'net/http' require 'openssl' require 'json' require_relative '../config/environment' # Access data from Skyscanner API def access_api(url) http = Net::HTTP.new(url.host, url.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE file = File.open('bin/key.rb') ...
true
ca2cd107a26e26cf4b26438e983e0f57377fd451
Ruby
SixiS/fixture_to_factory
/lib/fixture_to_factory/factory_writer.rb
UTF-8
1,856
2.953125
3
[ "MIT" ]
permissive
module FixtureToFactory class FactoryWriter def self.write_files(folder, file_hashes) file_hashes.each do |fixture_path, fixtures| write_fixtures_to_file(folder, fixture_path, fixtures) end end private class << self def write_fixtures_to_file(folder, fixture_path, fixtures)...
true
42a467a22f8632970078abe3c07f9a39be3eeaf6
Ruby
glebm/to_spreadsheet
/lib/to_spreadsheet/context/pairing.rb
UTF-8
696
2.546875
3
[ "MIT" ]
permissive
module ToSpreadsheet class Context # Axlsx classes <-> Nokogiri table nodes round-tripping module Pairing def assoc!(entity, node) @entity_to_node ||= {} @node_to_entity ||= {} @entity_to_node[entity] = node @node_to_entity[node] = entity end ...
true
6db8a2bd680d5a7193c48471ce90992388700749
Ruby
kowacmp/ss_kanri
/app/helpers/d_price_check_reports_helper.rb
UTF-8
1,925
3.015625
3
[]
no_license
module DPriceCheckReportsHelper def price_888_print(value) #表示価格が888の場合表示しない if value.to_i == 888 return "" else return value end end # 税抜金額取得(レギュラー、ハイオク) def get_zeinuki_print(tanka) # 指定された単価が無い場合空白を返す if tanka.to_f == 0 then return "" end # 消費税率を...
true
8f461c3d4c285718142c371b526214118ab03a71
Ruby
AmaljithCf/pixel
/pixelart-characters/lib/pixelart/characters.rb
UTF-8
5,776
3.1875
3
[ "CC0-1.0", "LicenseRef-scancode-public-domain" ]
permissive
require 'pixelart/base' ## our own code require 'pixelart/characters/version' # note: let version always go first module Pixelart class Character ## todo/check: rename to Generator or Artist or such? why? why not? def self.build( chars, format=nil ) ## try to unify characters format ## format 1 - "...
true
2af128e7880f57b7e7fff195fda672c2ddf9fde3
Ruby
rokumatsumoto/boyutluseyler
/lib/boyutluseyler/array_helper.rb
UTF-8
538
2.84375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# frozen_string_literal: true module Boyutluseyler module ArrayHelper def array_changed?(existing_array, new_array) return false if array_empty?(new_array) return false if array_equal?(existing_array, new_array) true end def array_match?(my_array, other_array) return true if my...
true
d83c8c21a3e0b3fdcba68704b436a01b734ed65a
Ruby
Inkdit/inkdit.rb
/lib/inkdit/entity.rb
UTF-8
1,039
2.75
3
[]
no_license
module Inkdit # Represents an {https://developer.inkdit.com/docs/read/Entity_Description Inkdit Entity}. class Entity < Resource # this entity's type. +'individual'+ or +'organization'+. def type @params['type'] end # this entity's human-readable name. def label @params['label'] ...
true
a33459dbebbfb800ab7f011157bb939f50b970d2
Ruby
jaz303/rif
/rif/lib/runners/console_runner.rb
UTF-8
866
2.890625
3
[]
no_license
require 'readline' module Rif module Runners class ConsoleRunner include Readline def initialize(game) @game = game end def run present while cmd = readline('> ') break if cmd == 'quit' response = @game.handle_input(cmd) unless respo...
true
21bce08763011c178b4519e21d7b4b10f6e96fe7
Ruby
albiurs/edu_codecademy_learn-ruby
/src/01_introduction_to_ruby/04_everything_in_ruby_is_an_object.rb
UTF-8
646
4.1875
4
[]
no_license
# Everything in Ruby is an Object # # Because everything in Ruby is an object (more on this later), everything in Ruby has certain built-in abilities called # methods. You can think of methods as “skills” that certain objects have. For instance, strings (words or phrases) have # built-in methods that can tell you the l...
true
1ea88d0784c19f7b9a2e3709b3f0ce506c2c7ea1
Ruby
ReneNyffenegger/vorax
/vorax/ruby-helper/lib/vorax/sqlhtml/table_tag_handler.rb
UTF-8
3,312
2.90625
3
[]
no_license
module Vorax # Table handler class TableTagHandler < AbstractTagHandler def initialize(colsep = ' ', underline = '-', recsep = false, recsepchar = '', vertical = false) # column separator @colsep = colsep # the char used to underline @underline = underline # should records be sep...
true
ebf3e0ef2a1c117dd3171ae46e7be636001ae038
Ruby
RecursiveAwesome/recursiveawesome.github.io
/vendor/bundle/ruby/2.6.0/gems/json-minify-0.0.3/lib/json/minify.rb
UTF-8
1,242
2.8125
3
[ "MIT" ]
permissive
require 'strscan' require 'json' require 'json/minify/version' module JSON module Minify def self.included(mod) mod.send(:extend, self) end def minify(str) ss = StringScanner.new(str) buf = '' until ss.eos? # Remove whitespace if s = ss.scan(/\s+/) # Sca...
true
82a3f4829d6e0429dbb5d14df53294cec41f1e1a
Ruby
akimichi/skkserv-benchmark.scala
/client.rb
UTF-8
377
2.703125
3
[ "MIT" ]
permissive
#!/usr/bin/ruby # -*- coding: utf-8 -*- require "socket" # 127.0.0.1(localhost)の1178番へ接続 sock = TCPSocket.open("pinel.local", 1178) begin # サーバに文字列を送付 sock.write("1a // ") # 相手からの文字列を出力 p sock.gets ensure # 例外が発生しても実行 # 送信が終わったらソケットを閉じる sock.close end
true
fcc093041b88cd31c25fb25eaaed210c08392b2d
Ruby
Freddy-Harimanana/ruby-master
/lib/05_timer.rb
UTF-8
283
3.15625
3
[]
no_license
def time_string(temps) h = temps/3600.to_i m = temps/60.to_i-h*60 s = temps - h*3600 - m*60 h=pres(h) m=pres(m) s=pres(s) return [h,m,s].join(":") end def pres(i) if i<10 return i = "0" + i.to_s else return i = i.to_s end end
true
4c981fb1fb9db1521c92cdf4e2b766b485480234
Ruby
tutysara/saas
/hw0/testcases/part3_test.rb
UTF-8
90
2.75
3
[ "MIT" ]
permissive
load 'part3.rb' b = BookInStock.new('12',20.9824) puts(b.price_as_string=='$20.98')
true
252ef4c8f2e75b7bd9e446328b34742f936b567d
Ruby
travis-ci/travis-cookbooks
/community-cookbooks/compat_resource/files/lib/chef_compat/resource/lwrp_base.rb
UTF-8
1,354
2.546875
3
[ "Apache-2.0", "MIT" ]
permissive
require 'chef_compat/resource' require 'chef_compat/copied_from_chef/chef/resource' require 'chef/mixin/convert_to_class_name' require 'chef/mixin/from_file' module ChefCompat class Resource < ChefCompat::CopiedFromChef::Chef::Resource class LWRPBase < ChefCompat::Resource class<<self include Chef...
true
801b01ee985e6d17a0fafc9c57ecf5a244d42302
Ruby
adcpe/c2-module2
/week-1/day-1/hiring.rb
UTF-8
293
2.609375
3
[]
no_license
def hiring (years_of_experience, github_points, languages_worked_with, applied_recently, age) if ( languages_worked_with.include?('Ruby') && (years_of_experience >= 2 || github_points >= 500) && !(applied_recently || age < 15) ) "Hired!" else "Not hired." end end
true
8ece5e4068466e7f5cd7bda0023ea6f592319322
Ruby
ryleebooroff/finstagram
/yellowpager.rb
UTF-8
830
3.703125
4
[]
no_license
puts "Phone Numbers!" #write a method that converts letters to numbers with: def convert_to_numbers(input_text) # A,B,C = 2 # D,E,F = 3 # G,H,I = 4 # J,K,L = 5 # M,N,O = 6 # P,Q,R,S = 7 # T,U,V = 8 # W,X,Y,Z = 9 def convert_to_numbers(input_text) result= "" input_t...
true
ed20dc0918f54fcee87573d335ac018cf6cdcfac
Ruby
blueyed/vimrunner
/lib/vimrunner/platform.rb
UTF-8
1,781
2.640625
3
[ "MIT" ]
permissive
require "rbconfig" require "vimrunner/errors" module Vimrunner # Public: The Platform module contains logic for finding a Vim executable # that supports the clientserver functionality on the current system. Its # methods can be used to fetch a Vim path for initializing a Server. # # Examples # # Vimr...
true
9e13ffc7c6d66da14a2d55cd13229c5dcad1b1b5
Ruby
warmfusion/piframe
/guage.rb
UTF-8
1,166
2.90625
3
[]
no_license
require 'ws2801' WS2801.generate # generate empty strip (Would happen from alone if you just start setting colors) WS2801.length 12 # default WS2801.device "/dev/spidev0.0" # default WS2801.strip [] WS2801.autowrite true # default #4.times do |i| # WS2801.set :pixel => i*3, :r...
true
e4527aa8aa9dbabb7a0e6e7194823bf8e0ac2d6c
Ruby
jrobertson/shutter3_morsecode
/lib/shutter3_morsecode.rb
UTF-8
1,292
2.765625
3
[]
no_license
#!/usr/bin/env ruby # file: shutter3_morsecode.rb require 'morsecode' require 'shutter3_sps' class Shutter3MorseCode < Shutter3Sps def initialize(bdid, topic: 'shutter3', sps_address: nil, sps_port: 59000, debug: false) super(bdid, sps_address: sps_address, sps_port: sps_port) @mc = '' @t =...
true
a99c142780b1e1abe9492d9c83d756de41564125
Ruby
Kashiwara0205/ruby-tic-tac-toe
/ch3/code/test/tic_tac_toe_test.rb
UTF-8
5,274
3.625
4
[]
no_license
require "minitest/autorun" require "../tic_tac_toe/tic_tac_toe" class TicTacToeTest < Minitest::Test # 概要: コマの配置メソッドを担保する # 期待値: 入力した値に応じてコマが配置されること def test_place_piece board = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] place_piece(board, 1, 0, 0) assert_equal 1, board[0][0] board = [[0, 0, 0], [0, 0,...
true
95954beacb99b911e1289400c8627e039759bedd
Ruby
RobotDisco/ykwya-roguelike
/spec/item_spec.rb
UTF-8
583
2.515625
3
[]
no_license
require 'spec_helper' describe 'PotionFactory' do def self.potion?(name, magnitude, attribute) it 'creates #{magnitude} #{attribute} potion with #{name} function.' do potion = PotionFactory.send(name.to_underscore) expect(potion.magnitude).to be magnitude expect(potion.attribute).to be attribut...
true
868cba9062d72c8b6f7ebaf3cbef72323f9018a2
Ruby
Stevenpaulino1/collections_practice_vol_2-dumbo-web-082718
/collections_practice.rb
UTF-8
1,186
3.515625
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def begins_with_r(arr) output = true arr.each do | element | result = element.start_with? 'r' if result == false return false end end output end def contain_a(array) array.select {|element| element.include? 'a'} end def first_wa(words) words.find { |word| word.to_s.start_with?(...
true
3a48db8ce8bba3e794f9729efc01c016654c8718
Ruby
lisenenkov-sl24/blackjack
/model/card.rb
UTF-8
352
3.296875
3
[]
no_license
class Card RANKS = { "A": 1, "2": 2, "3": 3, "4": 4, "5": 5, "6": 6, "7": 7, "8": 8, "9": 9, "T": 10, "J": 10, "Q": 10, "K": 10 }.freeze SUITS = %i[♣ ♦ ♥ ♠].freeze def initialize(rank, suit) @rank = rank @suit = suit end def to_s "#{@rank}#{@suit}" end def points @points ||=...
true
f52135d01b386f6bb0f44f9aa25e7278e3dac4ed
Ruby
kimpeter/p2p_book_sharing
/lib/crawling_book.rb
UTF-8
11,588
2.578125
3
[ "MIT" ]
permissive
# coding : utf-8 #How to run: just type in console, 'CrawlingBook.start' # 희귀사례 테스트용 url # http://book.daum.net/detail/book.do?bookid=BOK00009259809YO # 책 크기 정보 없음. 책 소개 없음. # http://book.daum.net/detail/book.do?bookid=BOK00008912179BA # isbn, 책 크기 정보 없음. # http://book.daum.net/detail/book.do?bookid=KOR2005723000625...
true
cf1eb3ce0634f66d4ab53a2545ec82850b9de07f
Ruby
mpolec/sudoku
/main.rb
UTF-8
2,808
3.640625
4
[]
no_license
class Board attr_reader :raw_board def initialize(raw_board) @raw_board = raw_board end def row(number) raw_board[number] end def column(number) raw_board.map { |row| row[number] } end def square(row, column) starting_x = row / 3 * 3 starting_y = column / 3 * 3 numbers_in_sq...
true
0da8e20dfa78e4c0ee0fb45f66b1132c6bdddc0b
Ruby
shwoodard/sprites
/lib/sprites/sprite.rb
UTF-8
3,338
2.546875
3
[ "MIT" ]
permissive
require 'fileutils' require 'active_support/core_ext' require 'sprites/sprite_pieces' require 'sprites/sprite_piece' require 'forwardable' class Sprites class Sprite class InvalidOrientation < StandardError; end module Orientations VERTICAL = 1 HORIZONTAL = 2 end SUPPORTED_OPTIONS = %w{...
true
4e2d79db5da0b48659c4e7f5e3685e0a77221d66
Ruby
ljwoodward/codeclan_cinema
/db/seed.rb
UTF-8
906
2.78125
3
[]
no_license
require_relative( '../models/customer.rb' ) require_relative( '../models/film.rb' ) require_relative( '../models/ticket.rb' ) require( 'pry' ) Ticket.delete_all() Film.delete_all() Customer.delete_all() customer1 = Customer.new({ 'name' => 'Boris Johnson', 'funds' => 250 }) customer1.save() customer2 = Customer.new(...
true
6d5ceee48401e40f6602b5c2c05ee60a21e19b5f
Ruby
Shendidy/bank
/lib/bank.rb
UTF-8
693
3.453125
3
[]
no_license
# Class to handle main bank accound methods class Bank attr_accessor :balance, :transactions, :statement def initialize @balance = 0 @transactions = [] @statement = "date || credit || debit || balance\n" end def deposit(ammount = 0, date = '01/01/1900') @balance += ammount @transactions.pu...
true
2dcc2cf67802b8137cac43690848a4f0e2d1dcfc
Ruby
Ger-onimo/week_02_day_2_multiple_classes_lab
/bus.rb
UTF-8
486
3.609375
4
[]
no_license
class Bus attr_reader :route_number, :destination def initialize(route_number, destination) @route_number = route_number @destination = destination @passengers = [ ] end # def route_number() # return @route_number # end # def destination() # return @destination # end def driv...
true
a6ae84c54580a003512229ba7db1494cc8bc8418
Ruby
ArthurKVasque07/cucumber_rspec_QAN
/features/step_definitions/movie_steps.rb
UTF-8
1,414
2.578125
3
[]
no_license
Given('que {string} é um novo filme') do |movie_code| file = YAML.load_file(File.join(Dir.pwd, 'features/support/fixtures/movies.yaml')) @movie = file[movie_code] Database.new.delete_movie(@movie["title"]) end Given('este filme já existe no catálogo') do Database.new.insert_movie(@movie) end When(...
true
8ccef09b13c2f73d4b1c2854906c824f79ff6574
Ruby
mcavallo/alfred-color-name-ruby
/lib/name_that_color/match.rb
UTF-8
305
2.59375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# encoding: utf-8 # frozen_string_literal: true module NameThatColor class Match def initialize(hex_query) @query = hex_query @is_exact_match = false end def queried_hex '#' + @query end def valid? end def exact? @is_exact_match end end end
true
50fb6c33615301a634fe4b31820a894a4a73fe02
Ruby
akmassey/nanoc
/lib/nanoc/cli/command_runner.rb
UTF-8
1,881
2.765625
3
[ "MIT" ]
permissive
# encoding: utf-8 module Nanoc::CLI # A command runner subclass for nanoc commands that adds nanoc-specific # convenience methods and error handling. class CommandRunner < ::Cri::CommandRunner # @see http://rubydoc.info/gems/cri/Cri/CommandRunner#call-instance_method # # @return [void] def call...
true
575481e3ed5f967d3b3ce7f826a333db9fca5087
Ruby
martinemde/active_collection
/spec/member_class_spec.rb
UTF-8
2,465
2.640625
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') class Model def self.human_name(*args) "Model" end def self.table_name "models" end end class ModelCollection < ActiveCollection::Base end class SpecialModel def self.human_name(*args) "Special Model" end def self.table_nam...
true
fab8b5ff50ad8fabb10b7f7fb5a529e147d2d286
Ruby
mersonff/myrecipes
/test/models/ingredient_test.rb
UTF-8
634
2.671875
3
[]
no_license
require 'test_helper' class IngredientTest < ActiveSupport::TestCase def setup @ingredient = Ingredient.create!(name: "chicken") @ingredient2 = Ingredient.create!(name: "egg") end test "ingredient should be valid" do assert @ingredient.valid? end test "ingredient name should be unique" do @ingre...
true
03ff65c371ac3ddc11e049e7e67e4be4960be031
Ruby
pelluch/code-based-testing-part-2
/app/services/contest_simulator.rb
UTF-8
2,004
3.796875
4
[]
no_license
class ContestSimulator def self.test(contender1, contender2) synchronous_test contender1, contender2 get_result contender1, contender2 end def self.test_multiple(team1, team2) while team1.length > 0 and team2.length > 0 contender1 = team1.first con...
true
45dd6dd3a07df17cf43cd0e5620ae542a5d90992
Ruby
razanjoshi/cc_validity
/app/models/credit_card.rb
UTF-8
882
3.25
3
[]
no_license
class CreditCard < ActiveRecord::Base validates :number, presence:true, length: { maximum: 16} #Methods for luhn validation #First checking the type of card def self.find_type(credit_card) # Making sure that the card number is passed as a string credit_card = credit_card.to_s # Set of st...
true
2417b6220d26c6054823d88948292736b0011066
Ruby
igravious/CorpusBuilder
/lib/tasks/dict_clean.rake
UTF-8
2,744
2.84375
3
[]
no_license
# # useful methods for cleaning the _ dictionary terms # namespace :dictionary do namespace :clean do def argf_file begin STDERR.puts "Found file - #{ARGF.filename}" rescue STDERR.puts $! end end def skip argf_file ARGF.skip # skip clean:proper param argf_file end desc "John Smi...
true