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
fa16ab7d6bca2256ef6460e12bdbb13cf6755f22
Ruby
NiushaH/collections_practice-v-000
/collections_practice.rb
UTF-8
725
3.78125
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require "pry" def sort_array_asc(num) num.sort end def sort_array_desc(num) num.sort do |a, b| b <=> a end end def sort_array_char_count(word) word.sort { |a, b| a.length <=> b.length } end def swap_elements(array) array[0], array[1], array[2] = array[0], array[2], array[1] end def reverse_array(nu...
true
4ad6c9aaf6a02278ffcfbac7da3c34b07026a9b0
Ruby
EliseP08/ruby
/exo_04.rb
UTF-8
176
3.046875
3
[]
no_license
#Lance le programme. Que se passe-t-il ? Pourquoi ? : erreur unterminated string meets end of file car il manque les guillemets à la fin de la phrase puts "Salut, ça farte ?
true
19cd6a3ebb554f968a56d384ea66a71b92d39f3a
Ruby
JackWCollins/seven_hills
/spec/models/opening_spec.rb
UTF-8
1,180
2.71875
3
[]
no_license
require 'spec_helper' describe Opening do it { should validate_presence_of(:date)} it { should validate_presence_of(:time)} it { should validate_presence_of(:instruction)} describe "#search_by_date" do it "returns an empty array if there are no matches" do expect(Opening.search_by_date("03/20/2015")).to eq([...
true
dd2cbd37f0240bd9699d05e634abae7c072902b1
Ruby
hchood/hello
/hello.rb
UTF-8
228
2.9375
3
[]
no_license
<<<<<<< HEAD #Default is "World" More CHANGES. ======= #Defaul is "World" >>>>>>> parent of 8e59076... change spelling error name = ARGV.first || "World" puts "Hello, #{name}!" # This is a comment. #Quick Change from Kelly Savietta
true
c9778385515977669781d8856f7e2ea54523a5a7
Ruby
senmei-club/club
/app/helpers/users_helper.rb
UTF-8
599
2.59375
3
[]
no_license
#encoding: utf-8 module UsersHelper @@auth_level_map = {0=> "一般使用者", 1=> "會計師" , 2=> "管理員" } @@user_type_map = { 0=>"系統帳號" ,1 => "女性員工", 2 => "男性員工" , 3 => "打掃人員", 4 => "經理" } def auth_level_to_string(auth_level) @@auth_level_map.has_key?(auth_level) ? @@auth_level_map[auth_level] : "" end def user_typ...
true
e6e756044947ff4819b03c0be9f38cbbf59d1473
Ruby
alextmk/Project-Odin-Ruby-Programming
/Algorithm/Node.rb
UTF-8
120
3.25
3
[]
no_license
class Node attr_accessor :next, :value def initialize(value,next_value=nil) @next=next_value @value=value end end
true
1f93dee692e048ccad3500741704b2e74bfad820
Ruby
department-of-veterans-affairs/caseflow
/app/services/external_api/va_notify_service/response.rb
UTF-8
1,420
2.671875
3
[ "CC0-1.0", "LicenseRef-scancode-public-domain" ]
permissive
# frozen_string_literal: true class ExternalApi::VANotifyService::Response attr_reader :resp, :code def initialize(resp) @resp = resp @code = @resp.code end def data; end # Wrapper method to check for errors def error check_for_error end # Checks if there is no error def success? ...
true
34253bce45d45ee74ebd3a15174f74938cae7e9c
Ruby
collabnix/dockerlabs
/vendor/bundle/ruby/2.6.0/gems/rubocop-0.93.1/lib/rubocop/cop/naming/predicate_name.rb
UTF-8
2,645
2.640625
3
[ "Apache-2.0", "CC-BY-NC-4.0", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
# frozen_string_literal: true module RuboCop module Cop module Naming # This cop makes sure that predicates are named properly. # # @example # # bad # def is_even(value) # end # # def is_even?(value) # end # # # good # def even...
true
3a6ae9d27a874f6f00a67abc8bb9c77ab069404a
Ruby
DataBranner/Ruby_CommandLine_To-DoList
/source/readable_writeable.rb
UTF-8
838
3.03125
3
[]
no_license
require 'CSV' module ReadableWriteable def read_csv(filename='todo.csv') filename = safejoin(filename) if !File.exist?(filename) return nil else content = [] # CSV does not have a `map` method CSV.foreach(filename) do |line| content.push(line) end end con...
true
b7328a9e4c1bdc95e84f1c145d13ed680f6f71bc
Ruby
louisgaeta1/vg-backlog
/app/helpers/authentication.rb
UTF-8
171
2.5625
3
[]
no_license
def logged_in? session.has_key?(:user_id) end def current_user User.find_by_id(session[:user_id]) end def authorized?(user) logged_in? && current_user == user end
true
dfa4230fc54f087f70cfd192008add2484ff04b5
Ruby
kirillrdy/kitaman-old
/lib/kitaman/graph.rb
UTF-8
683
3.03125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module Kitaman # Class to handle GraphvizGraph dependency output # # Usage: # g = GraphvizGraph.new # g.add("parent","child") # g.to_dot => will return dot in graphviz format class Graph def initialize @header = '/* Generated by Kitaman. */ digraph kita_linux { size="600,600"; node [co...
true
c76298cd817dea21d50137d50685506b6dbe2e69
Ruby
W00t3k/DoubleTap
/modules/office365.rb
UTF-8
1,289
2.5625
3
[ "MIT" ]
permissive
require_relative '../lib/core' COMPANY = "jet" class Office365 < DoubleTap def initialize super @url = "http://autodiscover.#{COMPANY}.com" @jitter = { min: 1, max: 3 } @fault_sleep = 300 end def login_flow(user:, pass:) visit_site fill_in(form_field_name: 'loginfmt', value: user) ...
true
deb5d473000b56bce4a981d471f907aee921ce7c
Ruby
h3rald/glyph
/lib/glyph/document.rb
UTF-8
7,283
3.046875
3
[ "MIT" ]
permissive
# encoding: utf-8 module Glyph # The Glyph::Document class stores information about a document or a chunk of text # currently being interpreted. # # It is responsible of analyzing (evaluating) the syntax tree and return the corresponding output # as well as replacing placeholders. class Document # A Regexp...
true
f1b78cabdf0fec8eb44879ac5ccdd24ae9667873
Ruby
Achrafeu/projet
/app/models/city.rb
UTF-8
1,124
2.65625
3
[ "MIT" ]
permissive
class City < ActiveRecord::Base before_validation :geocode def getTemperature forecast = ForecastIO.forecast(self.latitude, self.longtitude) temperatureOk = false if forecast todayForecast = forecast.currently if todayForecast if todayForecast.temperature ret...
true
94ad9394e18ecc6b4c7a38c4fda01725068c88c6
Ruby
indirect/adventofcode
/2018/11-chronal-charge/02.rb
UTF-8
948
3.453125
3
[]
no_license
#!/usr/bin/ruby require "matrix" input = 7165 class Grid def initialize(id, debug = false) @id = id @debug = debug @cells = Matrix.build(300, 300){|x, y| power(x, y) } end def power(x, y) rack_id = x + 10 power = rack_id * y power += @id power *= rack_id power = (power % 1000) /...
true
15b72fc6741116384d92ff3f5316a7ae54662175
Ruby
mkrisher/riskio
/lib/riskio/base.rb
UTF-8
994
2.8125
3
[ "MIT" ]
permissive
module Riskio class Base def initialize(uri, header) @uri, @header = uri, header end def show(id) response = request(:get, @uri + "/#{id}") end def list(page=1) response = request(:get, @uri + "/?page=#{page}") end def create(data) response = request(:post, @...
true
dee8b45f51808d56a01b3661a46ff889946e8ab1
Ruby
ameet01/Algorithm-Prep
/EPI/CH13 - Sorting/13.1.rb
UTF-8
481
3.765625
4
[]
no_license
#intersection of two arrays def intersection(array1, array2) i = 0 j = 0 result = [] while i < array1.length && j < array2.length if array1[i] == array2[j] if i != 0 && array1[i] != array1[i-1] result.push(array1[i]) end i += 1 j += 1 elsif array1[i] < array2[j] ...
true
55e964c0c5b2cc8541246e06a9a1ec1de06f9752
Ruby
ryanfb/scholrax
/lib/scholrax/importer/metadata_file_reader.rb
UTF-8
1,253
2.5625
3
[]
no_license
module Scholrax::Importer class MetadataFileReader DEFAULT_METADATA_MAPPING_FILE = File.join(Rails.root, 'config', 'metadata_mapping.yml') attr_reader :metadata_doc, :metadata_mapping_file attr_accessor :metadata def initialize(metadata_file_path, metadata_mapping_file = DEFAULT_METADATA_MAPPING_FI...
true
8877e2feac77c2fb9c8eb7fe26da31d57d34d033
Ruby
Nornec/MoMove--Mouse-Mover
/momove.rb
UTF-8
431
3.171875
3
[ "MIT" ]
permissive
require 'rumouse' mouse = RuMouse.new exit = false mouse.move(rand(20),rand(20)) loop do 10.times do #Move your mouse outside of the top left corner of the screen to exit cleanly if mouse.position[:x] > 20 || mouse.position[:y] > 20 puts "Exiting." exit = true break end mouse.move(r...
true
ddd761b957c3c70b0314ffe5633f8292b9656f74
Ruby
koic/ghq_transfer
/lib/ghq_transfer.rb
UTF-8
1,643
2.921875
3
[ "MIT" ]
permissive
require 'fileutils' require 'pathname' require 'uri' module GhqTransfer class Core def initialize(options) @options = options end def run puts valth? ? '*** VALTH!! ***' : '*** dry run ***' ghq_root = Pathname(`ghq root`.chomp) Dir.glob(ghq_root.join('*')).each do |src| ...
true
70cd47ac22222d1792149c9d9fab8504dd298c3e
Ruby
katsuma/keynote-client
/lib/keynote/theme.rb
UTF-8
1,197
2.703125
3
[ "MIT" ]
permissive
require 'keynote/util' module Keynote class Theme extend Keynote::Util attr_reader :id, :name def initialize(id: nil, name: nil) @id = id @name = name end def self.default self.all.first end def self.all self.find_with_conditions end def self.find_by(a...
true
d8a4b5aceac52448c86f48840628e4db76d50d39
Ruby
jukinner/Coding-Practice-Codewars-Codility-Hackerrank-etc.-
/Heredoc_Heading_parser.rb
UTF-8
685
3.5
4
[]
no_license
# February 20 - Markdown Heading Parser in Ruby with Heredocs require 'rspec' def markdown_heading_parser content content.gsub(/^.*#.*/) { |heading | "<h1>#{heading[2..-1]}</h1>"} end # (/^.*#.*/) is looking for all of the lines where the hashtag is used. # when passing a block to gsub, it allows you to wrap all ...
true
f9ef5d2f820803dd7bcba2a2dbc111e2d284903c
Ruby
KitaenSilva/OSFOP-Project-Repo
/Scripts/misc/meta_input_hot-wired.rb
UTF-8
5,157
2.53125
3
[]
no_license
# THIS CODE ONLY WORKS IN WINDOWS AND IS NOT INTENDED FOR CROSS-PLATFORM USE (yet) if Win32API != nil SWPO = Win32API.new "user32", "SetWindowPos", ["l", "i", "i", "i", "i", "i", "p"], "i" WINX = Win32API.new "user32", "FindWindowEx", ["l", "l", "p", "p"], "i" SMET = Win32API.new "user32", "GetSystemMetrics", ["...
true
b7c4edc9c4bfdd3a0f57abb5ed010c37dc132b66
Ruby
Jackyrie2/ics_bc_w18
/week3/ch09/old_roman_numerals.rb
UTF-8
702
3.6875
4
[]
no_license
def romanize_old number roman = '' if number <= 0 || number > 3000 return end if number / 1000 != 0 roman += 'M' * (number / 1000) number = number % 1000 end if number / 500 != 0 roman += 'D' * (number / 500) number = number % 500 end if number / 100 != 0 roman += 'C' * (num...
true
0dad51419d54e248a96f313c29b76caec760a2e2
Ruby
j-sto/car_salesman
/spec/car_store_spec.rb
UTF-8
1,930
3.078125
3
[ "MIT" ]
permissive
require 'rspec' require 'car_store' require 'car_options' describe Vehicle do before do Vehicle.clear end it 'initializes a Vehicle class with its properties' do test_vehicle = Vehicle.new("Toyota","Prius","2014","23999") test_vehicle.should be_an_instance_of Vehicle end it 'will provide proper...
true
752bed352c36df5e5a9e4a4e36017b2f59129ffa
Ruby
kadzer/w4_ruby_project
/controllers/members_ctrl.rb
UTF-8
624
2.515625
3
[]
no_license
require('sinatra') require('sinatra/contrib/all') require_relative('../models/member.rb') get '/members' do @members = Member.all() erb(:"members/index") end get '/members/:id' do @member = Member.find_by_id(params['id'].to_i) erb(:"members/view") end get '/new/member' do erb(:"members/new") end post '/ne...
true
9e12a97b506097d5c4ab22aac1ba1b2b76e6c377
Ruby
VinceCarollo/ruby-exercises
/mythical-creatures/lib/ogre.rb
UTF-8
828
3.59375
4
[]
no_license
class Ogre attr_accessor :name, :home, :swings, :encounter_counter def initialize(n, h = 'Swamp') self.name = n self.home = h self.swings = 0 self.encounter_counter = 0 end def encounter(human) human.encounter_counter += 1 self.encounter_counter += 1 self.swing_at(human) if human.en...
true
ea44703d1b3378f05551e019ffd9910a09c270aa
Ruby
marginalian/reading
/models/mixins/type_bucketable.rb
UTF-8
559
2.734375
3
[]
no_license
module TypeBucketable def type_percentages entries .map { _1["type"] } .group_by(&:itself) .transform_keys! { _1.gsub("_", "\s") } .transform_values!(&:size) .transform_values!(&calc_pct) .sort_by { _2 } .reverse end def calc_pct -> (i) { ((i.to_f / entries.lengt...
true
e65b0fdfe35b1cfaaa0049a8b1f2860394a0aab5
Ruby
csexton/twitter_archive
/lib/twitter_archive/backends/yaml_archive.rb
UTF-8
839
2.640625
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
module TwitterArchive module Backends class YamlArchive # Archive the twitter results in a yaml file. # This requires opts to have 'yaml_file' set to the location to write the archive. def archive(results, opts=nil) opts['yaml_file'] ||= File.dirname(__FILE__) + '/../../../tmp/test_yam...
true
5bbb1987779378423c7e27128085dcab7bc0fb63
Ruby
david8zhang/rails_decal
/hw2/app/controllers/concerns/foobar.rb
UTF-8
135
2.765625
3
[]
no_license
class Foobar def initialize(baz) @baz = baz end def bar(a, optional={}) return "#{a}#{@baz}#{optional[:sat]}" end end
true
ff2ff1255698c8ac493965423dbe6eba2fbc02f9
Ruby
brickstar/enigma
/lib/cipher_module.rb
UTF-8
299
3.390625
3
[]
no_license
module Cipher def cipher(rotation) characters = (' '..'z').to_a rotated_characters = characters.rotate(rotation) new_hash = Hash[characters.zip(rotated_characters)] end def split_message(my_message) message = my_message.chars.each_slice(4) message.map(&:join) end end
true
3259c68ad879c6a3c75df9a69283f8a81e043608
Ruby
eka249/SentimentalTweet-backend
/app/controllers/celebs_controller.rb
UTF-8
4,061
2.5625
3
[]
no_license
class CelebsController < ApplicationController require 'net/https' require 'uri' require 'json' require 'twitter' def index puts "hit get_celeb" celebs = Celeb.all render json: celebs end def show @celeb = Celeb.find(params[:id]) render json: cel...
true
70d4667b4fda9098c7414967aad404d74237f013
Ruby
kyle-baker/tealeaf_course1_week2
/oo_ruby/classes_objects_part1/exercise2.rb
UTF-8
729
4.0625
4
[]
no_license
# exercise2.rb class MyCar attr_accessor :color attr_reader :year def initialize(year, model, color) @year = year @model = model @color = color @current_speed = 0 end def speed_up(number) @current_speed += number puts "You push the gas and accelerate #{number} mph."...
true
985b83f50ea6b1cdbc261610fab49887fed04adc
Ruby
rickytux/phase_0_unit_3
/week_8_and_9/4_Ruby/reverse_words/my_solution.rb
UTF-8
605
4.375
4
[]
no_license
# U3.W8-9: Reverse Words # I worked on this challenge by myself. # 2. Pseudocode # 4. Refactored Solution def reverse(words) new = words.split.map {|word| word.reverse} new.join(' ') end # 1. DRIVER TESTS/ASSERT STATEMENTS GO BELOW THIS LINE p reverse("This is reversed") == "sihT si desrever" p reverse("...
true
19cd3d812ec800cfa511298ecc4c163fc28ea241
Ruby
alessio-palumbo/smartgoals
/task.rb
UTF-8
3,725
3.125
3
[]
no_license
# Purpose: To contain the attributes of the tasks # Usage: # t = SmartGoals::Task.new # t.frequency = :every_minute # t.description = 'Learn Ruby' # t.target_time = Time.parse('2017/08/11 16:20:00 +10:00') # t.create_reminder_notification # t.create_failed_notification] module SmartGoals class Task #...
true
ae7d8ddfef76e9ed40e3aa92e822385cb4f0eaa4
Ruby
FGA1992/rubyrepo
/hh.school/spiral.rb
UTF-8
924
3.234375
3
[]
no_license
#Рассмотрим спираль, в котрой, начиная с 1 в центре, последовательно расставим числа по часовой стрелке, # пока не получится спираль 5 на 5 # 21 22 23 24 25 # 20 7 8 9 10 # 19 6 1 2 11 # 18 5 4 3 12 # 17 16 15 14 13 #Можно проверить, что сумма всех чисел на диагоналях равна 101. #Чему...
true
86da4cef02688599cc38b72927a9d9042c542716
Ruby
jrpolidario/var_block
/lib/var_block/globals.rb
UTF-8
1,884
2.734375
3
[ "MIT" ]
permissive
require 'var_block/getvar_handlers' module VarBlock module Globals def self.included(base) # fail if there is already same-name methods to prevent breaking dependencies # thanks to Jack, https://stackoverflow.com/questions/44156150/how-to-raise-error-when-including-a-module-that-already-has-same-name...
true
07c24075d938a87e4a876af68c0e359a52b256f1
Ruby
ashchu/KWK_Labs
/2017_SF/conditional-diet-lab-master/spec/diet_spec.rb
UTF-8
1,407
3.359375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require_relative "./spec_helper" describe "HOMER DIET" do describe "#no_donuts" do it "tells Homer good job if he stays on his diet" do expect(no_donuts(0)).to eq('Good job, Homer!') end it "tells Homer to get back on his diet if he eats any donuts" do expect(no_donuts(3)).to eq('Get back on...
true
605e83c1d76be26b262b526ca9509e577a2e8a2e
Ruby
wayjwilliams/d5v2
/ruby/day7/hw_inherit.rb
UTF-8
505
3.46875
3
[]
no_license
class Log @@Log = [] def self.log_event(event) @@Log << event end def self.all_events @@Log end end class Animals < Log def eat puts "#{@animal} ate fish!" Log.log_event "#{@animal} ate fish!" end end class Shark < Animals initialize(shark) @animal = shark end clas...
true
b4ec482cd6b6bd21433ef3aaedf69a3a7c2072cc
Ruby
antelio/simply_agile
/spec/models/burndown_spec.rb
UTF-8
4,562
2.703125
3
[ "BSD-2-Clause" ]
permissive
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe Burndown do before :each do @iteration = Iteration.new @burndown = Burndown.new(@iteration) end describe "new" do it "should store the iteration" do burndown = Burndown.new(@iteration, {}) burndown.instance_var...
true
554e6f271ef358375ed2e2f1acf5f2badb926e14
Ruby
felipeprintes/projetos-ruby
/Jogo da Forca/ui.rb
UTF-8
1,379
3.78125
4
[]
no_license
def pontos_agora(pontos_ate_agora) puts "Você tem #{pontos_ate_agora} pontos" end def avisa_errou_palavra puts "Que pena, errou... :(" end def avisa_acertou_palavra puts "Parabéns, você acertou!" end def avisa_letra_econtrada (tota_encontrado) puts "Letra encontrada #{total_encontrado} vezes." end def avisa_le...
true
93766e17e5f83fb720d36041b5a367496bfe42e3
Ruby
pombreda/path-to
/lib/path-to/path.rb
UTF-8
2,472
2.5625
3
[ "MIT" ]
permissive
require "path-to/with_params" module PathTo # # Builds on the chaining and param collection of WithParams to provide chainable references to URIs. Delegates the modelling of the # web application to a parent (or ancestor) application object, so that this configuration is in one place (and perhaps the result of ...
true
1c0bacb1e330ae5508a0b5c07c650e443aa30220
Ruby
garciajordy/sales_tax_kata_advanced
/app/models/basket.rb
UTF-8
352
2.65625
3
[]
no_license
class Basket < ApplicationRecord include TaxCalculatorHelper validates :name, presence: true belongs_to :user has_many :line_items, dependent: :destroy def output line_items.map(&:output) << "Sales tax: #{total_sales_tax}" << "Total: #{total}" end def total (line_items.sum(&:price) + total_sal...
true
7a76d11477d68b724737628925466eb8846c0ae9
Ruby
elanjones/ruby-practice
/cup.rb
UTF-8
481
3.484375
3
[]
no_license
class Cup #Classes use Title Case def initialize puts "I'm alive! *SPARKLE*" @drink_amount = 0 end def fill puts "I'm filled up!" @drink_amount = 100 end def empty puts "All gone!" @drink_amount = 0 end def sip(amount=5) puts "Just took a sip" if amount < 0 puts "EWWWWWWWW, don't backwash!" ...
true
8527ac1e9893621cdf61e17b01bbf1b968b39499
Ruby
bnjmnhndrsn/course_work
/hangman/lib/executioner.rb
UTF-8
437
3.328125
3
[]
no_license
require_relative './player' class Executioner < Player attr_accessor :word def choose_word @word = @dictionary.sample @word.length end def evaluate_guess(guess) return {} unless @word.include?(guess) hash = Hash.new([]) guess.split("").uniq.each do |letter| @word.split("...
true
69e30448c633740cdb4b538ee895ddd18f53e1e2
Ruby
shipp11/isbn
/isbn_test.rb
UTF-8
2,135
3.421875
3
[]
no_license
require "minitest/autorun" require_relative "isbn.rb" class TestISBN< Minitest::Test def test_assert_that_1_is_1 assert_equal(1, 1) end def test_assert_that_my_number_is_integer my_number = 7894561237 assert_equal("valid", isbn(my_number)) end def test_assert_that_strings_are_not_integers my_number = "hi" asser...
true
4afae65da187172ba45fd53a282c29c2b834f5f5
Ruby
sorphin/facebook-cli
/lib/fbcli/auth.rb
UTF-8
2,683
2.78125
3
[ "ISC" ]
permissive
require 'net/http' require 'uri' require 'webrick' require 'webrick/https' require 'json' module FBCLI API_VERSION = "3.1" def self.login(app_id, app_secret, local_host, local_port) redirect_uri = "https://#{local_host}:#{local_port}/" uri = "https://www.facebook.com/dialog/oauth?client_id=#{app_id}" + ...
true
9e8b4988c673f66e93d3a05550223fcd50aa7fc7
Ruby
dmcclory/py_repl
/redis_repl.rb
UTF-8
867
2.953125
3
[]
no_license
require 'socket' require 'readline' class RedisInterface def initialize @socket = TCPSocket.new 'localhost', 6379 end def to_resp(command) terms = command.split(" ") length_marker = "*#{terms.length}\r\n" length_marker + terms.map { |term| ["$#{term.length}", term] }.flatten.join("\r\n") + "\r\n...
true
629b6d8eb0cd2d88c09c13a8b94f6bc9f5f719a0
Ruby
pjc0247/chocopie_plus_plus
/src/script/engine/GameObject/AnimatedObject.rb
UTF-8
330
2.78125
3
[]
no_license
import 'engine/gameobject/gameobject.rb' class AnimatedObject < GameObject def initialize(x,y,sprite, interval=30) super(x,y,sprite) @animation_interval = interval @tAnimate = Timer.new(@animation_interval) @tAnimate.start end def update super @tAnimate.on do # @sprite.doStep if @sprite != nil en...
true
2e3a4a0e07ba0be5f7bce7899cde1a05494b39d3
Ruby
josh-works/tiny-projects
/jumpstartlab/student.rb
UTF-8
389
3.875
4
[]
no_license
# student.rb class Student # attr_accessor :name, :grade def initialize(n, g) @name = n @grade = g end def compare(student1) puts student1 end def better_grade_than?(student) puts "well done. #{@name} () outscored #{student}" if self.grade_getter < student.grade_getter end def grade...
true
942963bdf96554772e25ab805877124fe3d6906b
Ruby
priyapower/denver_public_library_2006
/lib/book.rb
UTF-8
630
2.96875
3
[]
no_license
class Book attr_reader :title, :author, :publication def initialize(book_details) @title = book_details[:title] @author = "#{book_details[:author_first_name]} #{book_details[:author_last_name]}" @publication = book_details[:publication_date] end def publication_year if @publication.split[2] ==...
true
f39553ac3934022201cfcb24f7d7fe7229916ef7
Ruby
JoeyP0ckets/ruby-oo-practice-relationships-silicon-valley-exercise-atlanta-web-021720
/app/models/startup.rb
UTF-8
532
3.015625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Startup attr_accessor :name attr_reader :founder, :domain attr_writer @@all = [] @@alldomains = [] def initialize(founder) @founder = founder @@all << self end def pivot(domain, name) @domain = domain @name = name @@alldomains << domain end def self.all ...
true
b987f8f3a94da686cf1c317803ebbe5aadea20d3
Ruby
BobRazoswki/TakeAway-Challenge
/spec/engine_spec.rb
UTF-8
459
2.765625
3
[]
no_license
require 'engine' describe 'Engine' do let(:e) { Engine.new } it 'take the input name of the user' do allow(e.ask_name).to receive(:gets).and_return("bob") expect(e).to receive(:puts).with("your name") e.ask_name end it 'take the input phone of the user' do allow(e.ask_phone).to receive(:gets) end it...
true
eb5e5d689b17fffd29d0f95a03ab865c522ce832
Ruby
cmartyn/moo_moo
/lib/moo_moo/response.rb
UTF-8
799
3.03125
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
module MooMoo class Response # Constructor # # ==== Required # * <tt>:hash</tt> - hash of the response # # ==== Optional # * <tt>:key</tt> - primary key to use when indexing the hash def initialize(hash, key = nil) @hash = hash @key = key end # Returns whether or...
true
410a34473ce4685f0b1f76e17bf5e6f80704de70
Ruby
reganperkins/Pop-Depot
/return_repl.rb
UTF-8
370
2.875
3
[]
no_license
require_relative 'bottle_depot' ## require_relative 'calculate' def amount puts '"How much would you like to spend on bottles today? e.g. 20 for $20"' @investment = gets.to_i end def start_trade depot = BottleDepot.new(amount) depot.buy_pop loop do depot.trade break if depot.trading_in? end d...
true
73c863d447a1aa6ab93572e559cffd681f1c77b7
Ruby
BenDunjay/Recipes_backend
/lib/generate_token.rb
UTF-8
376
2.65625
3
[]
no_license
require "securerandom" module GenerateToken extend ActiveSupport::Concern def generate_token(type = :base64) loop do token = new_token(type) break token unless self.class.exists?(token: token) end end private def new_token(type) case type.to_sym when :base64 SecureRandom....
true
27b128fc6ad08cd0f427f65060f260c763e25fbb
Ruby
UTDoi/ruby-design-pattern
/builder/markdown_builder.rb
UTF-8
521
3.171875
3
[]
no_license
require_relative 'builder' class MarkdownBuilder < Builder attr_reader :result def initialize @result = '' @writer = nil end def make_title(title) filename = "#{title}.md" @writer = File.open(filename, 'w') @writer.puts "# #{title}" end def make_string(str) @writer.puts "## #{str...
true
2434599de81a74b77dabeeb5920615a6a16109c3
Ruby
JeremyVe/project_cli_mastermind
/board.rb
UTF-8
869
3.078125
3
[]
no_license
require_relative "logic" class Board include Logic attr_accessor :code, :close_or_exact def initialize @board_game = {} @code = {} @close_or_exact = {} create_board end def create_board (1..12).each { |row| @board_game[row] = {1 => 0, 2 => 0, 3 => 0, 4 => 0} } end def render_boar...
true
0e6e7ac0743f4892216a9721fab0371d97f5e2db
Ruby
maxolee23/programming-univbasics-4-square-array-prework
/lib/square_array.rb
UTF-8
113
3.125
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def square_array(array) new_array = [] end array.each do |i| new_array << i**2 end return new_array end
true
b376b34178531c340be540ab8678c6c88822ec63
Ruby
kelleysislander/victoria_test_deploy
/lib/validations.rb
UTF-8
777
2.84375
3
[]
no_license
def validates_positive_or_zero(*attr_names) configuration = { :message_neg => "cannot be negative", :message_nil => "cannot be blank" } configuration.update(attr_names.pop) if attr_names.last.is_a?(Hash) validates_each attr_names do |m, a, v| if v.nil? m.errors.add(a, configuration[:message_nil]) e...
true
5b13c0c16910d78c57baa4e73e913b1707da1989
Ruby
misogi/sandbox_ruby
/effective_ruby/8_initialize.rb
UTF-8
172
2.609375
3
[]
no_license
class Parent attr_accessor :name def initialize @name = "howard" end end class Child < Parent attr_accessor :grade def initialize @grade = 8 end end
true
023029bab55fb44fff8df4be7c75c98166a902bb
Ruby
tim-millar/request-headers
/app/models/request_headers.rb
UTF-8
641
2.6875
3
[]
no_license
class RequestHeaders attr_reader :request def initialize(request) @request = request end def as_json(options={}) { ipaddress: ip_address, language: language, software: software, } end private def ip_address request.ip end def language accept_language && accep...
true
3e3204557166a10fea00d0478cb6b0052030f203
Ruby
marciojg/my-notes
/ruby/pluck&tap&map.rb
UTF-8
406
3.0625
3
[ "Apache-2.0" ]
permissive
https://videosdeti.com.br/conhecendo-os-metodos-map-collect-e-pluck/ #pluck https://apidock.com/rails/ActiveRecord/Calculations/pluck # Este método tem uso como select no activerecord array = ['bla1', 'bla2', 'bla3'] Classe.ransack({}).result.pluck('bla1', 'bla2', 'bla3') = Classe.ransack({}).result.pluck(*array) #t...
true
811adf3ce870c3dc75a6d3b551a87e46049b6c8f
Ruby
hongtran/CoderTicket
/spec/models/ticket_type_spec.rb
UTF-8
1,210
2.59375
3
[ "Apache-2.0" ]
permissive
require 'rails_helper' RSpec.describe TicketType, type: :model do describe "multiple tickets with different price" do it "handle one ticket type case" do end it "handle duplicates" do event = Event.new(name: "blala") event.save validate: false type1 = event.ticket_types.create! price: 1.00 ...
true
65f4d55e915622939462c59beb7ace79c5b89682
Ruby
cheljoh/ruby_practice
/bottle_song.rb
UTF-8
556
4
4
[]
no_license
bottles = 99 (bottles + 1).times do if bottles > 1 puts " #{bottles} of beer on the wall, #{bottles} of beer.\nTake one down, pass it around #{bottles - 1} bottles of beer on the wall" bottles -= 1 elsif bottles == 1 puts " #{bottles} bottle of beer on the wall, #{bottles} of beer.\nTake one down, pas...
true
bf153ccfdd5a8e4823c71a6ad0f0bf00e9ee5838
Ruby
BenRKarl/WDI_work
/w06/d02/Aziz_Hasanov/persons_age/age.rb
UTF-8
246
3.75
4
[]
no_license
class Person attr_accessor :age def initialize @age = 25 end end person = Person.new show = Proc.new { |person| puts person.age } def increment(person, callback) person.age += 1 callback.call(person) end increment(person, show)
true
0edece8591a68cc3088c8ebe62b929e5e0bc172f
Ruby
CleanSolLLC/ruby-enumerables-reverse-each-word-lab-online-web-prework
/reverse_each_word.rb
UTF-8
294
3.5
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'byebug' # def reverse_each_word(string) # new_array = [] # array = string.split # array.each do |a| # new_array << a.reverse # end # new_array.join(" ") # end def reverse_each_word(string) array = string.split array.collect {|a| a.reverse}.join(" ") end
true
7f5fba1c65d8578cf4d559970eb3262be269ba59
Ruby
marekjelen/geonames
/parse-languages.rb
UTF-8
404
2.9375
3
[]
no_license
#!/usr/bin/env ruby require 'yajl' data = File.open('iso-languagecodes.txt') def hasher(array) { :iso_639_3 => array[0], :iso_639_2 => array[1], :iso_639_1 => array[2], :name => array[3], } end data.readline until data.eof? line = data.readline tmp = hasher(line.strip.split("\t")) unl...
true
4b744205b4261d5a75fef7e3c58799fe372211a5
Ruby
jilliangberger/homework_assignments
/methods_and_recursion/bottle_of_beer.rb
UTF-8
954
3.765625
4
[]
no_license
#!/usr/bin/env ruby bottles = 99 while bottles != 0 puts bottles.to_s + 'bottles of beer on the wall, ' + bottles.to_s + 'bottles of beer.' bottles = bottles - 1 puts 'Take one down and pass it around,' + bottles.to_s + 'bottles of beer on the wall.' if bottles == 2 puts bottles.to_s + 'bottles of bee...
true
9b7138eec89d3ca79f14ab79bde4c32331f7fa05
Ruby
cokuyan/knight-travails
/knight_travails.rb
UTF-8
1,246
3.296875
3
[]
no_license
require_relative '00_tree_node' class KnightPathFinder attr_reader :visited_positions, :starting_pos, :root_node CALC_POS = [ [ 2, 1], [ 1, 2], [-2, -1], [-1, -2], [ 2, -1], [-2, 1], [ 1, -2], [-1, 2] ] def self.valid_moves(pos) positions = [] CALC_POS.each do |c...
true
3811fc406575c0b9c8ad319c8f9d2f8a828a3b7e
Ruby
elizabethhyer/sinatra-mvc-lab-onl01-seng-ft-070620
/models/piglatinizer.rb
UTF-8
476
3.65625
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class PigLatinizer def piglatinize(user_input) array = user_input.split(" ") array.collect do |w| if w[0].match(/[aeouiAEIOU]/) "#{w}" + "way" else vowel_index = w.index(/[aeouiAEIOU]/) consonants = w[0..vowel_index-1] ...
true
289e3b1e3b3ff69c93b91ef03e21faf24de8e92e
Ruby
bburnett86/normalizer
/runner.rb
UTF-8
1,170
3.078125
3
[ "MIT" ]
permissive
# ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin16] require_relative 'car' # Return normalized data using the car class. def normalize_data(input) c = Car.new(input[:year], input[:make], input[:model], input[:trim]) c.normalize_data end examples = [ [{ :year => '2018', :make => 'fo', :model => 'focus'...
true
918a0b76051008c5f43a90f825eb4b930ac7782a
Ruby
kristo75/Week2_Day3_Pub_Lab
/customer.rb
UTF-8
776
3.5625
4
[]
no_license
class Customer attr_reader :name, :wallet, :age def initialize(name, wallet, age) @name = name @wallet = wallet @age = age end def can_afford?(drink) # Check if customer's wallet is greater than or equal # to the drink price # @wallet >= drink.price return true if @wallet >= drink...
true
c19ac92c1a88a993140df6a1f77dbe1a88bd22a4
Ruby
hospital-systems/fhir
/lib/fhir/models/substance.rb
UTF-8
1,606
2.8125
3
[ "MIT" ]
permissive
# A homogeneous material with a definite composition used in # healthcare. class Fhir::Substance < Fhir::Resource invariants do validates_presence_of :type end # Extensions that cannot be ignored attribute :modifier_extension, Array[Fhir::Extension] # Text summary of the resource, for human interpretati...
true
ba24070faabe92396869f547ae1c8c3fc1fe7649
Ruby
carlosarias1992/chess
/spec/queen_spec.rb
UTF-8
1,355
3.140625
3
[]
no_license
require 'rspec' require 'pieces/queen' describe Queen do subject(:queen) { board[[0,3]] } let(:board) { Board.new } context '#initialize' do it 'sets an instance variable of position' do expect(queen.pos).to eq([0,3]) end it 'sets an instance variable of color' do ...
true
9c315c7702f6c85409cc98864de061c203e5e635
Ruby
robb-broome/programming-fun
/funs/fibonacci/fib_spec.rb
UTF-8
3,072
3.8125
4
[]
no_license
require 'pry' require 'benchmark' require 'securerandom' class Ans MEMO = {} end class Fib NUM = [0,1,1,2,3,5,8,13,21,34] IDX = [0,1,2,3,4,5,6, 7, 8, 9] class << self def index num memo = Ans::MEMO[num] return memo if memo if num < 2 Ans::MEMO[num] = num else Ans::MEM...
true
0f1983eb6b5304be802aa6489d4ca4e9cdb787ef
Ruby
yihangho/FlashCards
/lib/dictionaries/cambridge.rb
UTF-8
2,562
2.59375
3
[]
no_license
module Dictionaries class Cambridge API_KEY = ENV["CAMBRIDGE_API_KEY"] def initialize(word) @word = word if Redis.current.connected? entryId = Redis.current.get("dictionary.cambridge.#{@word}.entryid") return @entryId = entryId unless entryId.nil? end http_response =...
true
149df263642d9747d0c3f0f46b5e02f518f63393
Ruby
kuba108/slevomat_api
/lib/slevomat_api/response.rb
UTF-8
684
2.9375
3
[ "MIT" ]
permissive
require 'json' module SlevomatApi class Response attr_reader :http_status, :body def initialize(http_status, body = nil) @http_status = http_status # Tries to parse body, which should be JSON # when http status is 2xx or 4xx kind and not 404 - page not found. if (200..299) === @http...
true
da6883a64bd1d5172f3f1e6735eacf8e3c5f9301
Ruby
jeffreyducharme/playlist_downloader
/lib/random_scripts/tracks_from_youtube.rb
UTF-8
624
2.984375
3
[ "MIT" ]
permissive
class TracksFromYoutube attr_accessors :file def initialize(file) @file = file end def get_track_list_from_youtube_mix file = File.open(file) hash = {} track_num = 1 file.each_line do |line| line = line.gsub("\n","") artist, track = line.split(' - ') artist = artist.gsub(/[0-9]+. /,'') pattern1 = / [0-9]+....
true
679e405885c668bdf726864b46a3eb0034590ebb
Ruby
Dujota/oop3
/reinforcement-exercise.rb
UTF-8
410
3.484375
3
[]
no_license
# require 'activesupport' # Exercise 1 require 'pry' list = (1..25).to_a #setup the list def add_odd(list) sum = 0 list.each { |num| if num % 2 == 0 sum += num end } sum end puts add_odd(list) # ALT WAY OF DOING IT # # def sum_oods(numbers) # total = 0 # numbers.each do |number|...
true
334d55108d9bced81a0924d1341a176c02d8b807
Ruby
dpressey/LRTHW
/ex13_extra_credit.rb
UTF-8
318
3.359375
3
[]
no_license
first_name, middle_name, last_name, continent, country, city = ARGV puts "\t\tFirst variable is: #{first_name}" puts "\tSecond variable is: #{middle_name}" puts "\t\tThird variable is: #{last_name}" puts "\tFourth variable is: #{continent}" puts "\t\tFifth variable is: #{country}" puts "\tSixth variable is #{city}"
true
d120d0c87a364cb875e8dfc80613706424a331bd
Ruby
daryllxd/hotels
/lib/importers/hotels/columns/match_finder.rb
UTF-8
2,178
3.484375
3
[]
no_license
# frozen_string_literal: true require 'levenshtein' # MatchFinder - Given a set of possible values and potential # values for a column, figure out which of them can be inserted in via Levenshtein # If potential_values are an array, then iterate over the array and look for matches # If hash, then look in the hash_key_...
true
cc5de6d7e2966f5f7bd94bdd2a1fad355ec2ed7b
Ruby
bkr/easy_monads
/lib/easy_monads/monadic.rb
UTF-8
922
3.140625
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
module EasyMonads class Monadic include Enumerable include Comparable class << self def unit(*args) new(*args) end end def unit(to_wrap) self.class.unit(to_wrap) end def bind(&func) result = func.call(data) if defined? @data raise RuntimeError.new("...
true
0606585ed9cc2cbb61cf463b8ac76de86a96d8a2
Ruby
hopsoft/hustle
/test/hustle_test.rb
UTF-8
1,714
2.78125
3
[ "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
permissive
require "micro_test" require "pry" require_relative "../lib/hustle" class HustleTest < MicroTest::Test test "multiple processes spawned" do 4.times do Hustle.go { sleep 1 } end assert Hustle::Hustler.instance.active_runners.size == 4 Hustle.wait end test "callback value" do asserts =...
true
5097b6b758bfbe8d5b43372737d6d7981e2ba570
Ruby
leoschuman/ga-exercises
/L05_custom_modules_solution.rb
UTF-8
1,137
3.890625
4
[]
no_license
# 1. In the /lib directory, create a module named AppUtilities and save it as app_utilities.rb. # In your module, define two constants named HOME_IP and APP_NAME. Then define a utility method # named sentence_cleaner for removing a specified word from a sentence. Write this method however # you wish, or copy this sim...
true
2597daf2618b57fc1a709553114a9b96f880eaf6
Ruby
codanko/learn_ruby
/01_temperature/temperature.rb
UTF-8
118
3.171875
3
[]
no_license
#write your code here def ftoc fars cels = (fars - 32)*(5.0/9.0) end def ctof cels far = cels*(9.0/5.0) + 32 end
true
9c4b7f3d1a0d24f56801888343863c41b6473237
Ruby
kwliou/re.factored
/app/models/rating.rb
UTF-8
1,905
2.84375
3
[]
no_license
class Rating < ActiveRecord::Base belongs_to :user belongs_to :course validates_uniqueness_of :user_id, :scope=>:course_id validates_presence_of :user_id validates_presence_of :course_id validates_presence_of :easiness validates_presence_of :interest validates_presence_of :work_load def Rating.total_e(course) course...
true
af51add882c32f6046023f12ac86ccf8d5fb3145
Ruby
unmanbearpig/imdb
/lib/imdb/movie_list.rb
UTF-8
1,677
2.71875
3
[ "MIT" ]
permissive
module Imdb class MovieList attr_accessor :client def initialize(options = {}) @client = options[:client] || Imdb::Client.new end def movies @movies ||= parse_movies end private def find_poster(element) poster_css = 'td.primary_photo a img' poster_element = el...
true
ce0bd48444fbf2536cd1dc0551918f7889c90017
Ruby
fpolanco/programming-univbasics-4-basic-hashes-lab-nyc04-seng-ft-041920
/lib/intro_to_ruby_hashes_lab.rb
UTF-8
230
2.671875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def new_hash Hash.new end def my_hash {:name => "Franchell"} end def pioneer {name: "Grace Hopper"}# return a hash with a key of :name and a corresponding value of 'Grace Hopper' end def id_hash_generator(number) { id:number} end
true
b01b586f1b53bb947dc77eb15becc2d74f06a6c7
Ruby
KalindiFonda/giorgio-bikes
/Boris/Spec/docking_station_spec.rb
UTF-8
815
2.625
3
[]
no_license
require 'docking_station' RSpec.describe DockingStation do describe "#release_bike" do it "Releases a bike" do expect{subject.release_bike}.to raise_error("No bikes available") # giorgio_bike = Bike.new # subject.dock_bike(giorgio_bike) # expect(subject.release_bike).to be_instance_of Bik...
true
7454a49031d35ca5efb2a70d069e9a9488d16b33
Ruby
skkmania/ctree
/pat2form.rb
UTF-8
1,032
2.5625
3
[]
no_license
#!/usr/bin/env ruby # -*- coding:utf-8 -*- # pat2form.rb # Usage: pat2form.rb pattern_string # given a pattern string( e.g. 101001000 ), returns formula # require 'net/ssh' require 'net/scp' class Register def initialize end def run_maxima pattern cmd = %|(cd workspace/ctree;sage -maxima -q --bat...
true
72509b838cdb282d761d8497a0436a79101595a4
Ruby
h4ck3rm1k3/reek
/lib/reek/smells/long_method.rb
UTF-8
1,617
2.796875
3
[ "MIT" ]
permissive
require File.join( File.dirname( File.expand_path(__FILE__)), 'smell_detector') require File.join(File.dirname(File.dirname(File.expand_path(__FILE__))), 'smell_warning') module Reek module Smells # # A Long Method is any method that has a large number of lines. # # Currently +LongMethod+ reports an...
true
f059e20b669fa7882aba40030279abb1a23abb8c
Ruby
LAD3D/om2eq
/lib/om2eq/constructions/midpoint.rb
UTF-8
338
2.96875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class Midpoint < SymbolicPoint def initialize(*args) @first_point, @second_point = retrieve_arguments(args) end def x @x ||= "((#{@first_point.x}-#{@second_point.x})/2)" end def y @y ||= "((#{@first_point.y}-#{@second_point.y})/2)" end def z @z ||= "((#{@first_point.z}-#{@second_point....
true
27f40f272a27e30214028277f7f904a284777703
Ruby
liugf/ERP
/app/helpers/print_helper.rb
UTF-8
2,393
2.90625
3
[]
no_license
# -*- encoding : utf-8 -*- module PrintHelper def dict_name(klass, code) dict = klass.find_by_code(code) "#{dict.name}" if dict end def dict_name_and_code(klass, code) dict = klass.find_by_code(code) "#{dict.name}(#{dict.code})" if dict end def dict_attr(klass, code, attr) dict = klass.f...
true
8723dea4ed95ec93ac600041eae25b15ebd8c28d
Ruby
innervisions/small-problems
/09_easy_8/05.rb
UTF-8
901
3.875
4
[]
no_license
# 05 - Palindromic Substrings def leading_substrings(str) str.chars.map.with_index { |_, idx| str[0..idx] } end def substrings(str) str.chars.map.with_index do |_, idx| leading_substrings(str[idx..-1]) end.flatten end def palindrome?(str) # str = str.downcase.gsub(/[^a-z0-9]/, '') # FE: Uncomment above ...
true
5be7a3f3cdb591a98efd32a09ea161a2edbf01ed
Ruby
jaydipvalu/ruby
/a_common.rb
UTF-8
173
3.515625
4
[]
no_license
def a_common(x,y) x & y end print "Enter your value" x = gets.chomp.split(',') print "Enter your value" y = gets.chomp.split(',') puts "Output:" puts "#{a_common(x,y)}"
true
ce9a5ebd9ae450a4ee7dbde47634ff4d5c227236
Ruby
vgvinay2/ruby_programme
/other/inject.rb
UTF-8
3,164
3.90625
4
[]
no_license
############################################### ############################################### hash = [[:first_name, 'Shane'], [:last_name, 'Harvie']].inject([]) do |result, element| p "===#{result}=========#{element}" result << [element.first, element.last] p "===#{result}=========#{element}" result end p ha...
true
81ec0d80fa73d8ef2ee1155932ef3f32aaf4eea4
Ruby
okitsutakatomo/parking
/parking.rb
UTF-8
1,553
3.140625
3
[]
no_license
require 'open-uri' require 'nokogiri' @reserve_days = [28, 29, 30] def reserved_dai2ordai3?(doc, parking_num, day) index = 0 if parking_num == 2 index = 1 #td index elsif parking_num == 3 index = 3 #td index end doc.css("#guide_01 table tr")[2].css("td")[index].css(".calday").each...
true
9cfd84e822d49434ad54720f1d771485ecfc2e5d
Ruby
lbvf50mobile/til
/20210916_Thursday/20210916.rb
UTF-8
1,199
3.28125
3
[]
no_license
# Leetcode: 54. Spiral Matrix. # https://leetcode.com/problems/spiral-matrix/ # = = = = = = = # Accepted. # Thanks God! # = = = = = = = # https://leetcode.com/explore/challenge/card/september-leetcoding-challenge-2021/638/week-3-september-15th-september-21st/3977/ # @param {Integer[][]} matrix # @return {Integer[]} def...
true
3ce976630128bc4be7630c78c6f322a91351d8e8
Ruby
sbeaulie/vmstatus
/lib/vmstatus/results.rb
UTF-8
1,090
2.5625
3
[]
no_license
class Vmstatus::Results attr_reader :state def initialize(vms) @state = { :ready => [], :queued => [], :ok => [], :missing => [], :disabled => [], :passed => [], :zombie => [], :failed => [], :unknown_running => [], :unknown_dead => [], } vms...
true