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
99725fbd59009a3cea247ee999249f2f20d47d91
Ruby
ivanvanderbyl/skittles
/lib/skittles/configuration.rb
UTF-8
2,081
2.78125
3
[ "MIT" ]
permissive
# Adapted from the Ruby Twitter gem. # @see https://github.com/jnunemaker/twitter module Skittles # Defines constants and methods related to configuration. module Configuration # An array of valid keys in the options hash when configuring a {Flixated::API}. VALID_OPTIONS_KEYS = [ :access_token, :authorizati...
true
6f2f80459ab875edcf5679bbe709e436be372014
Ruby
RadiusNetworks/radius-spec
/benchmarks/case_equality_vs_class_check.rb
UTF-8
1,802
2.59375
3
[ "Apache-2.0" ]
permissive
# frozen_string_literal: true # Run from the command line: bundle exec ruby benchmarks/case_equality_vs_class_check.rb require_relative 'bm_setup' display_benchmark_header section "Class match" do |bench| x = "Any String" bench.report("===") do String === x # rubocop:disable Style/CaseEquality end benc...
true
c6a2d0f4c26acff139cfb079bbc1da2378f06d1a
Ruby
jergason/decision_tree
/lib/decision_tree/splitter.rb
UTF-8
3,383
3.1875
3
[]
no_license
module DecisionTree class Splitter # Return an array of new ArffFile objects # split on the given attribute # @pre-condition: attribute is a valid attribute name. # @param: attribute - String or Symbol - name of the attribute def self.split_on_attribute(dataset, attribute) index = find_inde...
true
4cbb8ba0cb312245c4a32e02bb88bc3f172c98c3
Ruby
sharang-d/ruby_programs
/4wk/4e_swap_contents.rb
UTF-8
276
2.875
3
[]
no_license
require 'fileutils' require 'tempfile' def swap a, b a, b = File.absolute_path(a), File.absolute_path(b) temp = Tempfile.new(File.basename(a)) temp.close temp = temp.path FileUtils.mv(b, temp) FileUtils.mv(a, b) FileUtils.mv(temp, a) end a, b = ARGV swap a, b
true
98df90719d27dce638730da5627d2fb7cabec17a
Ruby
PraneethChandraThota/socketlabs-ruby
/examples/bulk/bulk_send_from_data_source_with_merge_data.rb
UTF-8
2,113
2.890625
3
[ "MIT" ]
permissive
require_relative "../../lib/socketlabs-injectionapi.rb" require "json" class Customer attr_accessor :first_name, :last_name, :email_address, :favorite_color def initialize( first, last, email, color ) @first_name = first @last_name = last @email_address = email @favorite_...
true
cea208409443357cd301eb0d924569cc9a108a5d
Ruby
Cstein94/chana_practice
/sort.rb
UTF-8
148
3.578125
4
[]
no_license
array = [1, 5, 2, 4, 7, 6, 8] swap_number = 0 array.each do |number| if number > swap_number new_array << number end end puts new_array
true
65524eba1c06fa122c5cf0ae8bc5ad4a7333c26e
Ruby
aastronautss/emittance-resque
/lib/emittance/resque/event_fanout_job.rb
UTF-8
1,196
2.546875
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'emittance/resque/process_event_job' module Emittance module Resque ## # A job that fans out events to their proper listeners. # class EventFanoutJob PROCESS_EVENT_JOB = Emittance::Resque::ProcessEventJob @queue = :default class << self ...
true
70357cd96e7bc721873243ccc61a131c7886e0b9
Ruby
TommyTeaVee/pet-finder
/app/services/sms.rb
UTF-8
428
2.5625
3
[]
no_license
class SMS def initialize(number, msg) @plivo = Plivo::RestAPI.new Figaro.env.plivo_auth_id, Figaro.env.plivo_auth_token @number = number.to_s # ensure we have a fully qualified number @number = "1#{@number}" if @number.length == 10 @message = msg end def self.send(number, msg) self.new(number, msg).sen...
true
863661a11366e2756068c0425be44d3986657905
Ruby
wfth/collector
/download.rb
UTF-8
13,137
2.53125
3
[]
no_license
$LOAD_PATH.unshift(".") require 'pp' require 'mechanize' require 'pg' require 'json' require 'aws-sdk' require 'fileutils' require 'beachball' require 'securerandom' def main setup_aws puts "Loading messages - #{current_time}" puts "\n\n" messages_page = agent.get("http://www.wisdomonline.org/media/messages"...
true
23693184e112f926dca30aaf2b7a21b3bfff23c2
Ruby
glenc/rpoint
/lib/rpoint/contexts/context_factory.rb
UTF-8
876
2.703125
3
[]
no_license
module RPoint module Contexts ## # Valid context factories CONTEXT_FACTORIES = [WebContext, ListContext, SiteContext, WebApplicationContext] class ContextFactory ## # Create a new context based on the arguments provided. Then evaluate # the block within the scope of that context def self...
true
55b23f96be3113688d44e295950d476706ee5889
Ruby
uncageddesign/CodeclanCinema
/models/film.rb
UTF-8
1,277
3.09375
3
[]
no_license
require_relative("../db/sql_runner") require_relative('customer.rb') require_relative('ticket.rb') require_relative('screening.rb') class Film attr_reader :id attr_accessor :title, :price def initialize(options) @id = options['id'].to_i if options['id'] @title = options['title'] @price = options['...
true
092585960e53acd65a79be3343649d0d34e1b850
Ruby
brad72287/ttt-with-ai-project-v-000
/lib/player.rb
UTF-8
512
3.46875
3
[]
no_license
class Player attr_reader :token def initialize(token) @token = token end end class Player::Human < Player def move(board) input = 0 puts "where would you like to go?" until input.to_i < 10 && input.to_i > 0 input = gets end #board.update(2, "X") input end end class Play...
true
901b476d39c1143257fb6c07012180f665efe7af
Ruby
gchan/advent-of-code-ruby
/2017/day-24/day-24-part-1.rb
UTF-8
787
3.109375
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby file_path = File.expand_path("../day-24-input.txt", __FILE__) input = File.read(file_path) comps = input.split("\n") .map { |comp| comp.split('/').map(&:to_i) } max = 0 queue = comps.select { |comp| comp.include?(0) } .map { |comp| remaining = comps.reject { |c| c == comp } target = ...
true
95935de022b4960748263161843e6c11f11bf328
Ruby
alyon4a/ruby-oo-advanced-class-methods-lab-nyc-web-120919
/lib/song.rb
UTF-8
1,174
3.34375
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'pry' class Song attr_accessor :name, :artist_name @@all = [] def self.all @@all end def save self.class.all << self end def self.create song = Song.new song.save song end def self.new_by_name (name) song = Song.new song.name = name song end def self.c...
true
6fdd928842181632c45798e4fe2bd6c7bc65d28a
Ruby
peresvetjke/na_igru
/app/services/notification_sender.rb
UTF-8
361
2.90625
3
[]
no_license
class NotificationSender def initialize(game, players_to, message) @game = game @players_to = players_to @message = message end def call Array[@players_to].each { |player| inform_player(player) } end def inform_player(player) player.notifications.create!(body: message, game: @game) e...
true
2171f37b9d0e292368e16b491bc9c9ef2dace1fe
Ruby
doches/GraphConnectivity
/lib/Wordmap.rb
UTF-8
795
3.296875
3
[]
no_license
class Wordmap def initialize(path_to_wordmap) @wordmap = {} @revmap = {} IO.foreach(path_to_wordmap) do |line| if line.strip.size > 0 word,index = *(line.strip.split(/\s+/)) word = word.split("_")[0] if word.include?("_") @wordmap[index.to_i] = word.to_sym @revmap[wor...
true
ec7625428c33a4da9c76d217b759e1bd4a8cf691
Ruby
hubertlepicki/Swing-JRuby-Twitter-client-example
/main.rb
UTF-8
1,362
2.8125
3
[]
no_license
require 'net/http' require 'uri' include Java class QuickTweetWindow < javax.swing.JFrame import javax.swing include java.awt.event.ActionListener def initialize super self.getContentPane.setLayout BoxLayout.new(self.getContentPane, BoxLayout::Y_AXIS) [ JLabel.new("Twitter login:"), @login = ...
true
c8d98d6a6d533858c531d641b05cfa5bcddc67a0
Ruby
supertylerc/rinfo
/rinfo.rb
UTF-8
727
2.65625
3
[ "BSD-2-Clause" ]
permissive
#!/usr/bin/env ruby # encoding: UTF-8 require_relative 'lib/rinfo' require 'trollop' opts = Trollop.options do opt :type, '`ip` or `asn`.', type: :string opt :query, 'IP address or AS number.', type: :string end abort 'Must specify type. Type must be `ip` or `asn`.' unless opts[:type] abort 'Query is required. ...
true
aa7e46652cc604292fe8790629ec1f295110760d
Ruby
colbySherwood/Boolean-Gurus
/Project5/app/controllers/matching_controller.rb
UTF-8
7,048
2.875
3
[]
no_license
class MatchingController < ApplicationController skip_before_action :verify_authenticity_token def index end # parses a nn:nn-nn:nn formatted time interval to a more convenient (start,end) form where start, end are integers representing number of minutes passed from 00:00 (point in time as interval from a fixed po...
true
b93c577d34e40ed974ff5830c8905db50cf363cd
Ruby
lonelyelk/advent-of-code
/2020/15/lib.rb
UTF-8
412
3.15625
3
[]
no_license
def memory_game(starting_numbers, end_turn) mem = starting_numbers.each_with_object({}).with_index do |(num, m), index| m[num] = [index + 1] end prev = starting_numbers.last ((starting_numbers.length+1)..end_turn).each do |turn| num = if mem[prev].length > 1 mem[prev][-1] - mem[prev][-2] else ...
true
ef7a0fc08ddd93dffae717e38e21e7cf37b1d29b
Ruby
cgrandi1/school-domain-online-web-pt-021119
/lib/school.rb
UTF-8
538
3.453125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class School attr_reader :school_name, :roster def initialize(school_name) @school_name = school_name @roster = {} end def add_student (student, grade) if @roster.key?(grade) @roster[grade] << student else @roster[grade] = [student] e...
true
ac65a31a237088555191a90f439e93a173d88dc7
Ruby
Julioliveira/Ruby
/Exercises/hour24.rb
UTF-8
446
4.0625
4
[]
no_license
# Convert an hour in 24-hour notation to 12-hour notation hour24 = 0 # the input is a number hour12 = "" # the output is a string print "Enter an hour from 0-23: " hour24 = gets.to_i if hour24 == 0 then hour12 = "midnight" elsif hour24 < 0 hour12 = "" elsif hour24 <= 11 then hour12 = "#{hour24} a.m." elsif ho...
true
a0ea0c750d5b2166077bfe6e71fadc3b1f566922
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/word-count/41b1cc0d2fd2400ea9de8ab61a077e22.rb
UTF-8
448
3.546875
4
[]
no_license
class Phrase def initialize(phrase) @phrase = phrase end def word_count make_counted_hash(words) end private def words make_list(strip_non_alpha(@phrase)) end def strip_non_alpha(string) string.gsub(/[^0-9a-z ]/i, '') end def make_list(string) string.downcase! string.sp...
true
6cfeeba1d86e88b2bf9062b4ee24138a78e2503f
Ruby
MSproston23/cr-crime-map
/get_plog.rb
UTF-8
2,353
2.796875
3
[]
no_license
require 'rubygems' require 'time' require 'restclient' require 'nokogiri' require 'american_date' require 'geokit' #require 'kml' REQUEST_URL = "http://apps.cedar-rapids.org/policelogs/calls_list.asp" name_terms = [ "stonybrook", "idlebrook", "waterbrook", "driftwood", "boxwood", "mosswood", ...
true
450c25886618260d885f1a0a05a264ff3544a8fa
Ruby
NicoleHall/Tweet-My-Rep
/test/services/twitter_service_test.rb
UTF-8
2,318
2.6875
3
[]
no_license
require './test/test_helper' class TwitterServiceTest < ActiveSupport::TestCase attr_reader :service def setup @service = TwitterService.new(user_with_credentials( oauth_token: "public token", oauth_token_secret: "secret token", )) end test '#compose_tweet composes a tweet' do stub_r...
true
5b1520132a2fbd7a4d6dec87ffcba3ef1ca2188a
Ruby
jbreeden/mruby-libuv
/examples/check_handle.rb
UTF-8
664
3.3125
3
[ "MIT" ]
permissive
def start_check_handle puts "Starting check. Stop at 5 hits." check = UV::Check.new UV.check_init(UV.default_loop, check) count = 1 UV.check_start(check) do puts "Check hit: ##{count}" if count == 5 UV.stop(UV.default_loop) end count += 1 end end def start_idle_handle puts "Starting...
true
b5638cdd3da4decb46e56f397a22fae141e105bc
Ruby
charlesbjohnson/super_happy_interview_time
/rb/lib/leetcode/lc_448.rb
UTF-8
1,255
3.375
3
[ "MIT" ]
permissive
# frozen_string_literal: true module LeetCode # 448. Find All Numbers Disappeared in an Array module LC448 # Description: # Given an array nums of n integers where nums[i] is in the range [1, n], # return an array of all the integers in the range [1, n] that do not appear in nums. # # Follow up...
true
4b158744df03d81b911ee1489ece5ab161a57f2c
Ruby
AskarZinurov/pioneer600
/lib/pioneer600/bmp180.rb
UTF-8
3,358
2.765625
3
[ "MIT" ]
permissive
module Pioneer600 class Bmp180 < I2cDevice attr_reader :calibration attr_accessor :mode # BMP085 default address. def address 0x77 end # Operating Modes ULTRALOWPOWER = 0 STANDARD = 1 HIGHRES = 2 ULTRAHIGHRES = 3 # BMP085 Registers C...
true
17acaf0ccc45e4a2857db2e1bef9a3ca36ecdc79
Ruby
breaknenter/thinknetica
/lesson_7/station.rb
UTF-8
988
3.40625
3
[]
no_license
require_relative "instance_counter" class Station include InstanceCounter NAME_EXP = / ^[А-ЯЁ][а-яё]{2,15}$ # Название населённого пункта с заглавной буквы (3..16 букв) /x attr_reader :name @@stations = [] def self.all @@stations end def self.find(name:) @@stations.find { |station| nam...
true
1e1769140978945b1b061d13b9d9dda86ff3a363
Ruby
fictionalparakeets/rb101
/lesson_6/twenty.rb
UTF-8
6,166
3.6875
4
[]
no_license
# Lesson 6 Assignment: Twenty-One require 'pry' player1_hand = {} dealers_hand = {} SUITS = [:hearts, :diamonds, :spades, :clubs] game_over = false hidden_dealer_card = {} play_again = '' def prompt(msg) # TESTED AND WORKS puts "==> #{msg}" end def clear_display # TESTED AND WORKS system("clear") end def initi...
true
a7eff4939511622bc1673e160f8c68fbf71fabda
Ruby
robfors/fiber_recycling
/lib/fiber_recycling/recycled_fiber.rb
UTF-8
1,588
2.796875
3
[ "MIT" ]
permissive
module FiberRecycling class RecycledFiber def self.yield(*args) ::Fiber.yield(*args) end def initialize @native_fiber = ::Fiber.new { execution_loop } @state = :initialized start end def close raise 'can not close, currently running a block' unless @state...
true
1b14a24e5a97cf6dce010718fc7b785c86977c4c
Ruby
kevinclark/Lesson-Plans
/shoes/memory-2-final.rb
UTF-8
1,338
2.90625
3
[]
no_license
Shoes.app :width => 800, :height => 600 do blue = rgb(100, 100, 100) @cards = [] @colors = [] @picked = [] @done = [] 3.times do |row| 4.times do |column| r = rect 200 * column + 50, 200 * row + 50, 100, 100, :fill => blue @cards << r end end 6.times { @colors << rgb(ra...
true
f33d141721d858a1ba1108b33859f163dcf82b93
Ruby
endymion/mashup-exercise
/event.rb
UTF-8
1,043
2.921875
3
[]
no_license
require 'nokogiri' require 'open-uri' require 'net/http' class Event attr_accessor :date attr_accessor :city attr_accessor :state attr_accessor :conditions attr_accessor :temperature def initialize(params) self.date = params[:date] self.city = params[:city] self.state = params[:state] end ...
true
84276e16f35879ef8df23a89de36338e00d36a8f
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/anagram/78b9420865454ba5b98c9bc328a0c1c0.rb
UTF-8
1,295
3.671875
4
[]
no_license
class Anagram def initialize( word ) @base_word = word @sorted_base_word = word.downcase.chars.sort.join end def match( word_list ) return word_list.match_words( @base_word ).match_cases( @base_word ) end class ::Array def match_words( base_word ) anagram_list = [] self.each do...
true
e2815862ae69d9cbf323d9e94ec1be6ae8025a20
Ruby
nscarlyon/sinatra-art-life-list
/db/seeds.rb
UTF-8
515
2.8125
3
[ "MIT" ]
permissive
artists_list = { "Klimt" => { }, "Rodin" => { }, "Edvard Munch" => { }, "Raphael" => { } } artists_list.each do |name, figure_hash| p = Artist.new p.name = name p.save end movements_list = { "Symbolism" => { }, "Abstract" => { }, "Expressionism" => { },...
true
3f7fc8f5694459461bcb4d5a6d171d616dbbf78a
Ruby
gbergy/rails-object
/railsObject.rb
UTF-8
282
3.15625
3
[]
no_license
class All @@podcast = 0 def initialize @@podcast += 1 puts "You have downloaded #{@@podcast} podcasts in total, this one being #{self.class}" end end class Politcal < All end class Comedy < All end political1 = Politcal.new comedy1 = Comedy.new comedy2 = Comedy.new
true
bfa67b6d552c52874a6e7c31bc8fa5522f1d91a2
Ruby
russellkt/britecore_printer
/lib/britecore_printer/britecore_doc.rb
UTF-8
1,100
3.046875
3
[ "MIT" ]
permissive
class BritecoreDoc attr_accessor :print_date, :policy_number, :name, :path, :fullpath def initialize(policy_number,path,fullpath) @policy_number = policy_number name_from_path(path) print_date_from_path(path) @fullpath = fullpath end def name_from_path(path) path_split = path.split(" -...
true
330b56a832a69c6569b483a92c8f26da152c7f11
Ruby
chrislomaxjones/Ruby-programs
/euler_39/source.rb
UTF-8
264
3.015625
3
[]
no_license
def find_b(p,a) ((p**2) - (2*p*a))/(2*(p-a)) end p = 1 while p <= 1000 puts p solutions = 0 a = 1 while a < p # Find a p b = find_b(p,a) break if b % 1 != 0 c = Math.sqrt(a**2 + b**2) a+=1 end end
true
43ccf0ef47423b1c9b9609eea971d9d28cbbf949
Ruby
karabijavad/cadet
/spec/unit/cadet_spec.rb
UTF-8
7,750
2.65625
3
[]
no_license
require 'spec_helper' require 'tmpdir' describe Cadet do it "should create an instance of cadet session, for normal sessions" do Cadet::Session.open(Dir.mktmpdir).class.should == Cadet::Session end it "should create an instance of cadet session, for test sessions" do Cadet::Session.open.class.should ==...
true
f15dacd744ecaf26da89949bb1de1facd9af5a0b
Ruby
joshspringer/object_oriented_ruby
/assembler.rb
UTF-8
339
2.546875
3
[]
no_license
require_relative 'movementmodule' require_relative 'bike' require_relative 'car' car1 = Actualize::Car.new(speed: 0, direction: "north", fuel: "unleaded", make:"Honda", model: "Accord") bike1 = Actualize::Bike.new(speed: 10, direction: "east", gears: 18, type: "road bike", weight: 12) # p car1 # p bike1 bike1.ring_b...
true
b4e3d7fef5820ef9f2f43efcf778203ed0286dba
Ruby
goatpmrf/rubyforpro
/Section4/rgb.rb
UTF-8
836
3.859375
4
[]
no_license
# RGB def to_hex(r, g, b) # '#' + # r.to_s(16).rjust(2, '0') + # g.to_s(16).rjust(2, '0') + # b.to_s(16).rjust(2, '0') # 繰り返しを避ける # hex = '#' # [r, g, b].each do |n| # hex += n.to_s(16).rjust(2, '0') # end # hex # injectを使用する [r, g, b].inject('#') do |hex, n| hex + n.to_s(16).rjust(2, '...
true
701f4096e8586eeda1eecb3d8cf00711d099d34b
Ruby
sohmama/furima-30978
/spec/models/user_spec.rb
UTF-8
5,602
2.6875
3
[]
no_license
require 'rails_helper' RSpec.describe User, type: :model do before do @user = FactoryBot.build(:user) end describe 'ユーザー登録' do context 'ユーザー登録ができる場合' do it 'nickname, email, password, password_confirmation, last_name, first_name, first_name_furigana, last_name_furigana, date_of_birthがあればユーザー登録できるこ...
true
cc7a8564bf841a9ff5399c9bcf7c6b7e58e8b458
Ruby
GregoryJFischer/night_writer
/spec/bra_to_let_spec.rb
UTF-8
679
3.015625
3
[]
no_license
require 'rspec' require './lib/bra_to_let' describe BraToLet do before :each do @b = BraToLet.new end it 'is an instance of BraToLet' do expect(@b).to be_a BraToLet end it '#n_by_b' do expect(@b.n_by_b[['0.','..','..']]).to eq 'a' expect(@b.n_by_b[['00','00','0.']]).to eq 'q' expect(@b....
true
6ecd925a6dc4ca38dec34e53227ca945fa6b63c4
Ruby
clarehsu390/LeetCode
/Ruby/search_for_range.rb
UTF-8
1,007
3.765625
4
[]
no_license
#O(n) def search_range(nums, target) start = 0 finish = 0 hash = {} nums.each_with_index do |el, i| if hash[el] && el == target finish = i elsif !hash[el] && el == target start = i hash[el] = true end end return [-1, -1] if !hash[target...
true
f9f98e5c52fcc1628410c9698365ed5efdac0ca5
Ruby
KimWren2009/launch-school
/RB100/10-final_exercises/user-input/08.rb
UTF-8
582
4.625
5
[]
no_license
def valid_number?(number_string) number_string.to_i.to_s == number_string end x = nil y = nil loop do puts "What is the first number?" x = gets.chomp if valid_number?(x) == false puts "That's not a valid number! Integers only." else break end end loop do puts "What is the second number?" y =...
true
6924494c270d3426827e8635e0f98a95a2b17b3b
Ruby
pashagray/scholar
/app/helpers/text_helper.rb
UTF-8
141
2.625
3
[]
no_license
module TextHelper def text_to_html(text) text .split(/\r\n/) .map { |p| "<p>#{p}</p>" } .join('').html_safe end end
true
60bb06e32e62d5d288c549ac91a1b3b2afbd2eff
Ruby
tsetsova/bank-tech-test
/spec/unit/account_spec.rb
UTF-8
839
3.1875
3
[]
no_license
require 'account.rb' describe Account do let(:statement) {double:statement, add_transaction: nil, print: nil} let(:statement_class) {double(:statement, new: statement)} subject(:account) {described_class.new(statement: statement_class)} it "starts with a balance of 0" do expect(account.balance).to eq 0 ...
true
18c202ff34c89aea6bf0f2291dc6d22a5ccc06fe
Ruby
CruGlobal/staff-conf-onsite
/app/models/user_variable.rb
UTF-8
3,005
2.890625
3
[]
no_license
class UserVariable < ApplicationRecord enum value_type: %i[string money date number html list] validates :code, :short_name, :value_type, presence: true validates :code, :short_name, uniqueness: true after_commit { Rails.cache.clear } class << self def get(short_name) Rails.cache.fetch("user_vari...
true
f9035d30ccd4d989342c1678b4d7ac918e11dd52
Ruby
pi-track/craigslist_scrape
/lib/craigslist_scrape/cli.rb
UTF-8
1,373
3.3125
3
[ "MIT" ]
permissive
class CraigslistScrape::CLI attr_accessor :search def call welcome new_search menu goodbye end def welcome puts "Hello - welcome to the craigslist scraper" end def menu input = nil while input != 'exit' puts "Enter the number of the item you'd like to see more info on or...
true
d19bbdfc7ab927706e8201c42add7201a3d2436e
Ruby
mcpenchel/batch-686
/food-delivery-day-1-reboot/app/controllers/customers_controller.rb
UTF-8
470
2.703125
3
[]
no_license
require_relative '../views/customers_view' class CustomersController def initialize(customer_repository) @customer_repository = customer_repository @view = CustomersView.new end def add name = @view.ask_for_name address = @view.ask_for_address customer = Customer.new(address: address, nam...
true
4675cf282b0eed082c8b4655b943aaa2b235e5ba
Ruby
iresine/shrimp
/spec/services/trivia_service_spec.rb
UTF-8
2,546
2.515625
3
[]
no_license
require 'rails_helper' RSpec.describe TriviaService do API_URL = TriviaService::API_URL API_CATEGORIES_URL = TriviaService::API_CATEGORIES_URL HTTP_NOT_FOUND = 404 VALID_API_CODE = 0 INVALID_API_CODE = 1 describe '#call' do context 'when external api is available' do let(:category) { 'Science: C...
true
6fd46bc1343f1fe530f05ec9f7b84d6a3a5364c3
Ruby
sbcn7/atcoder-by-ruby
/abc016/C.rb
UTF-8
596
3.265625
3
[]
no_license
# http://abc016.contest.atcoder.jp/tasks/abc016_3 M, N = gets.split.map(&:to_i) rels = Array.new(N) { gets.split.map(&:to_i) } def get_friend_list(rels, person) friend_list =[] rels.each do |person_a, person_b| friend_list << person_a if person == person_b friend_list << person_b if person == person_a ...
true
e35be3ceab4c6ecbf29c4f979617463879ff98b1
Ruby
valendea/quiz-master
/quiz-master-rails/db/seeds.rb
UTF-8
745
2.765625
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 rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Ch...
true
3acce87135aedd47ebb2b8b07ae2eb6686deeef7
Ruby
husseinfahmy/CS3342-Organization-of-Programming-Languages-Practice-Tasks
/webber/material4final/obsolete/170408/makeExam.rb
UTF-8
5,986
3.171875
3
[]
no_license
require 'json' # https://hackhands.com/ruby-read-json-file-hash/ # note: if you don't have json, you need to do: gem install json # however, since json is part of stdlib, you really should have it already # http://ruby-doc.org/stdlib-2.4.0/libdoc/json/rdoc/JSON.html class ExamDatabase attr_reader :items def initia...
true
0a66cad96e3bb4254155b469d46dbf8002ad4f6d
Ruby
tonytonyjan/treerful_scanner
/test/test_parser.rb
UTF-8
2,081
2.5625
3
[]
no_license
# frozen_string_literal: true require 'minitest/autorun' require 'treerful_scanner' require 'json' module TreerfulScanner class TestParser < Minitest::Test PLACE_HTML = IO.read("#{__dir__}/fixtures/place.html") PLACES_HTML = IO.read("#{__dir__}/fixtures/places.html") TIME_BAR_JSON = IO.read("#{__dir__}/...
true
80ace0a30e32c256eb98d31c3d31d08208256379
Ruby
avdi/seeing_is_believing
/lib/seeing_is_believing/evaluate_by_moving_files.rb
UTF-8
6,557
2.859375
3
[ "WTFPL" ]
permissive
# Not sure what the best way to evaluate these is # This approach will move the old file out of the way, # write the program in its place, invoke it, and move it back. # # Another option is to replace __FILE__ macros ourselves # and then write to a temp file but evaluate in the context # of the expected directory. Some...
true
b1c07175be39bedd7e8d1c3dd2b107d249db9bfd
Ruby
andersonvom/misc
/game_of_life/ruby/lib/cell.rb
UTF-8
1,021
3.59375
4
[]
no_license
class Cell DEAD = "-" ALIVE = "*" attr_accessor :current_status, :next_status def initialize(status = nil) @next_status = nil init_status = ( rand * 1000 ).to_i % 2 @current_status = status || ((init_status==1) ? ALIVE : DEAD) end def alive? current_status == ALIVE end def tick(nei...
true
88b0c4d3c7d97eb3fb11478991ece3fc92bc29ef
Ruby
jwang9392/W6D1
/byo_active_record_pt_1/lib/01_sql_object.rb
UTF-8
2,097
2.984375
3
[]
no_license
require_relative 'db_connection' require 'active_support/inflector' # NB: the attr_accessor we wrote in phase 0 is NOT used in the rest # of this project. It was only a warm up. class SQLObject def self.columns return @columns if @columns columns = DBConnection.execute2(<<-SQL) SELECT * ...
true
83853c78bafa4553102a9473ada03522e5dc954e
Ruby
Kimberly-Fasbender/matrix_convert_to_zero
/lib/matrix_convert_to_zero.rb
UTF-8
964
4
4
[]
no_license
# Updates the input matrix based on the following rules: # Assumption/ Given: All numbers in the matrix are 0s or 1s # If any number is found to be 0, the method updates all the numbers in the # corresponding row as well as the corresponding column to be 0. # Time complexity: O(n^3) - n * n * m, where n is the length ...
true
a6472c0955bfdf17bbf1bb938c6cb93126e31322
Ruby
jayseo5953/math_game
/game.rb
UTF-8
1,507
3.515625
4
[]
no_license
require './player' require './question' class Game attr_accessor :player1, :player2, :current_player, :waiting_player, :questions def initialize(questions_db) @questions = questions_db end def register print "Player 1 Name: " name1 = gets.chomp @player1 = Player.new(name1) print "Player...
true
1f6b15e85473ac88c1305a14d5d8dab9533db05b
Ruby
RayHightower/mathstuff
/loopsample.rb
UTF-8
46
2.578125
3
[]
no_license
(1..100).each do |counter| puts counter end
true
a0a5eca27d54300f15dde97cd220738ad188dad2
Ruby
stamppot/cbcl4
/lib/restore_logins.rb
UTF-8
6,884
2.5625
3
[]
no_license
require 'rubygems' require 'csv' class RestoreLogins def restore_entries(file = "journal_entries_backup.csv", change_data = false) i = 0 entries = [] not_created = [] obsolete_lusers = [] output_file = "" CSV.foreach(file, :headers => true, :col_sep => ";", :row_sep => :auto) do |row| i += 1 nex...
true
8272d2f28332c982c453b44827286c990fa3584d
Ruby
OpenRubyRMK/game-engine
/data/scripts/2.0/charge_skill.rb
UTF-8
1,539
2.6875
3
[]
no_license
require_relative "battler_equip" require_relative "battler_skill" module RPG module EquippableItem attr_reader :charge_skills chain "ChargeSkillInfluence" do def _init_equippable super @charge_skills = {} end def _parse_xml_equippable(item) super end d...
true
8a9e2a4441a016e7d8c82000a3858620f2b9b414
Ruby
craigw/local_authority
/lib/local_authority.rb
UTF-8
1,043
2.734375
3
[ "MIT" ]
permissive
require "local_authority/version" require "my_society/map_it" require "csv" module LocalAuthority class LocalAuthority DB_FILE = File.join File.dirname(__FILE__), '..', 'db', 'local_authorities.csv' DB = CSV.new File.read(DB_FILE), :headers => :first_row def self.all @all ||= DB.map { |row| new ro...
true
44e45a377e3bb0e11430a86a4231902e0ba97b34
Ruby
sriharikapu/MusicWithCode
/sonic-sample.rb
UTF-8
6,409
2.578125
3
[ "Unlicense", "CC0-1.0" ]
permissive
# Coded by Sam Aaron use_debug false live_loop :synths, delay: 6 do puts "how does it feel?" use_synth :mod_saw use_synth_defaults amp: 0.5, attack: 0, sustain: 1, release: 0.25, mod_range: 12, mod_phase: 0.5, mod_invert_wave: 1 notes = (ring :F, :C, :D, :D, :G, :C, :D, :D) notes.each do |n| tick p...
true
ad7dcfe016aa6375d626475a5d4025889736d785
Ruby
isuPatches/maia
/lib/maia/message.rb
UTF-8
2,140
2.515625
3
[ "MIT" ]
permissive
module Maia class Message MAX_TOKENS_AT_ONCE = 999 def send_to(pushable, job_options = {}) devices = Device.owned_by pushable worker = Maia::Messenger.set job_options enqueue worker, devices.android, to_h(notify: notify?(:android)) enqueue worker, devices.ios, to_h(notify: notify?(:i...
true
9a4524ea0259f5b847f934cb6534659b41ff3e1f
Ruby
frescoraja/ruby_road
/appacademy/w1d4/makechange.rb
UTF-8
419
3.1875
3
[]
no_license
def makechange(value, coins) return [value] if coins.include?(value) possible_coins = [] coins.each do |coin| next if coin > value new_value = value - coin remaining_coins = makechange(new_value, coins) next if remaining_coins.nil? remaining_coins.unshift(coin) possible_coins << remaining...
true
33db02230c7337d8e8a3261d28dfa8ee0c0ac610
Ruby
jin501/looping-while-until-wdf-000
/lib/while.rb
UTF-8
124
2.734375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def using_while levitation_force = 6 while levitation_force < 10 levitation_force += 1 puts charm = "Wingardium Leviosa" end end
true
b00ab0114504ca45c2897bc4d06d9f37d2850bb5
Ruby
aerohit/learningtocode
/ruby/wellgrounded/ch03/reopening_classes.rb
UTF-8
201
3.140625
3
[]
no_license
class C def x end def m puts "This is the first definition" end end class C def y end # Overriding methods def m puts "This would override the previous definition" end end
true
f41eb8b1bf2ec4f15d9a047862391788199f713a
Ruby
seanbjornsson/connect_four_challenge
/easy_player.rb
UTF-8
442
3.40625
3
[]
no_license
require_relative 'Player' class EasyPlayer < Player attr_accessor :color, :opponent def init @color = 'navy' end # make a random move from the columns available def play_round(grid) return 3 if grid.open_space?(3) grid.available_columns.each do | col | if grid.is_winning_move_for?(@colo...
true
0b41fc59ad5f84d324e97030aadb48cbe25e6b0b
Ruby
generalzhou/movie_recommender
/db/movielens.rb
UTF-8
813
2.96875
3
[]
no_license
def load_titles(file_path) movies = {} File.open(file_path, :encoding => 'ISO-8859-1').each_line do |line| line_data = line.split("|") id = line_data[0] title = line_data[1].gsub(/ \(\d+\)/, '') # removes the year (YYYY) movies[id] = title end movies end def load_ratings(file_path, titles) ra...
true
969653490eba45e121e650be1282aa8ed54d2398
Ruby
kentan88/merlion
/lib/merlion/extensions/object.rb
UTF-8
274
2.515625
3
[]
no_license
class Object def self.const_missing(name) $AUTOLOAD_PATH.each do |load_path| Dir[load_path + "/**/*.rb"].each do |file| puts "Looking for #{name} in #{file}..." end end Object.const_set(name.to_s.capitalize, Module.new) end end
true
28ae7e8835e8e6503d33d1bb09fcc5f521fe19e4
Ruby
Takhir78/FizzBuzz
/test_FizzBuzz.rb
UTF-8
703
3.46875
3
[]
no_license
require "minitest/autorun" require_relative "FizzBuzz.rb" class Test < Minitest::Test def test_fizzbuzz_simple assert_equal [1], fizzbuzz(1), "fizzbuzz(1) should return [1]" end def test_fizzbuzz result = fizzbuzz(15) assert result.kind_of?(Array), "Function should return an array" expected = [ 1, ...
true
1dbf2ac05ba7c7a39e90ff369572ae333b877c9d
Ruby
arcterex/Referee-Management
/app/helpers/assignors_helper.rb
UTF-8
218
2.546875
3
[]
no_license
module AssignorsHelper def pretty_game(game) if game.nil? then "Error, Nil Game!" else "#{game.home} vs #{game.away} at " + pretty_time(game.gametime) + " on #{game.field.name}" end end end
true
c4f4671871a8907e98104c0d40c3876fa0e8b027
Ruby
ASCAP-INTERNATIONAL/tunecoreSearch
/db/seeds.rb
UTF-8
1,722
2.84375
3
[]
no_license
require "net/http" require 'json' require "uri" def callApi(thing) uri = URI(thing) get = Net::HTTP.get(uri) JSON.parse(get) end def get_track_names(j) totalTracks = j["tracks"]["total"].to_i for i in 0...totalTracks Song.create!(title: j["tracks"]["items"][i]["name"], album: j["name"], ...
true
d8fe10f894bd926d38aace87f07505e79a2295a9
Ruby
Andrewglass1/boggle
/app/models/board.rb
UTF-8
918
3
3
[]
no_license
class Board < ActiveRecord::Base attr_accessible :size, :content has_many :locations, :dependent => :destroy serialize :content after_create :make_board after_create :seed_locations LETTERS = ('a'..'z').to_a def all_words @locations.collect{|location|location.all_words}.flatten.sort_by{|w|-w.le...
true
b4515501879bf2f31de67e0c25c974d48f62b985
Ruby
jmac522/blackjack_trainer
/house.rb
UTF-8
266
3.09375
3
[]
no_license
require_relative 'bust_helper' class House include BustHelper attr_accessor :hand, :no_of_cards, :hand_value, :bust def initialize(bust = false) @hand = [] @hand_value = 0 @no_of_cards = 0 @bust = bust end def show hand[1] end end
true
9ac2e6971bb145fb9f924f5f32db13341a23a947
Ruby
selfup/dev.random
/spikes/router.rb
UTF-8
1,395
2.765625
3
[ "MIT" ]
permissive
# https://gist.github.com/selfup/badadac1553575f9775202d4cf1c12d3 require 'json' non_rejected = [] rejected = [] macs = [] results = { :rejected_login_count => 0, :rejected_mac_addrs => [], :common_dates => [], :attempted_dates => [], } File.read("tmp/router.log").each_line do |line| is_rejected = line.in...
true
4506eb50f3e5e3bdb64e50e05e85a64fd08dd87e
Ruby
UCalgaryZEUS/ZEUS_Logging_Scripts
/logging_scripts/cleanCapturePaired.rb
UTF-8
383
2.546875
3
[]
no_license
#!/usr/bin/env ruby =begin This Ruby script will be used to clean the raw data files. It outputs a single file, containing velocity and position pairs. =end dirtyFile = ARGV[0] dirtyData = File.read(dirtyFile) cleanPairData = dirtyData.scan(/(^.*#BESTVELA.*SOL_COMPUTED.*$)|(^.*#BESTPOSA.*SOL_COMPUTED.*$)/) File.open(...
true
d0c1ab22b8bb71c27740851a7d71eee0f5e82307
Ruby
taillet/ruby-boating-school-dc-web-career-010719
/app/models/student.rb
UTF-8
711
3.28125
3
[]
no_license
require 'pry' class Student attr_accessor :name @@all = [] def initialize(first_name) @name = first_name @@all << self end def self.all @@all end def add_boating_test(test, status, instructor) BoatingTest.new(self, test, status, instructor) end def self.find_student(first_name) ...
true
78d3cdd951098034243507de6c5afb52e1adc972
Ruby
daphneaugier/comp348_a3
/Q4Q5.rb
UTF-8
2,489
3.75
4
[]
no_license
class Shape def initialize @status = nil end def print if @status.nil? p = perimeter().nil? ? "undefined" : perimeter().to_s a = area().nil? ? "undefined" : area().to_s puts "#{self.class}, Perimeter: " + p + ", area: " + a else puts...
true
c57f54d4b66deb78e33f7f11647b4093d481c126
Ruby
karthik-mallavarapu/Concordance-part1
/concordance.rb
UTF-8
2,766
3.671875
4
[]
no_license
class Concordance # Regular expression constants SENTENCE_DELIMITER = /\. [A-Z]/ WORD_SANITIZE = /\A[-,:;*^()\/&%{}$!@#=\"'?\”\“]+|[-,:;*^()\/&%{}$!@#=\"'?\”\“]+\z/ DOT_SANITIZE = /\A[\.]+|[\.]+\z/ # Constructor accepts text as a parameter and prints the result according to the given format. def initial...
true
9ce6df61b90283249794c79f52de19a875966c6c
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/cs169/800/spectral_cluster/cluster9/23350.rb
UTF-8
462
3.515625
4
[]
no_license
def combine_anagrams(words) output = nil hash = Hash.new words.each do |word| charsSorted = word.downcase.chars.sort.join if( hash.has_key?(charsSorted) ) hash[charsSorted] = hash.fetch(charsSorted) << word else hash[charsSorted] = [word] end end hash.keys.each do |key|...
true
a3d5439ba13d162bdf069d855970fcbb8a30785b
Ruby
rocketmade/katas
/poker_hands/ruby/poker_hands.rb
UTF-8
2,626
3.46875
3
[]
no_license
require 'pp' CARD_ORDER = %w(1 2 3 4 5 6 7 8 9 10 j q k a) HAND_ORDER = %i(high_card pair two_pair three_kind straight flush full_house four_kind straight_flush) class Card < Struct.new(:str, :suit, :value, :value_rank) def initialize card self.str = card self.value = card[0..-2] self.suit = card[-1] ...
true
ce427c951aba689418c0db93c8b38f40a0f4402b
Ruby
zhang4952/dspace2hydra
/mapping/degree.rb
UTF-8
1,166
3
3
[ "LicenseRef-scancode-public-domain", "CC0-1.0" ]
permissive
# frozen_string_literal: true module Mapping class Degree extend Extensions::BasicValueHandler ## # Split the Degree value and remap values to new field names, # for instance "Doctor of Philosophy (Ph. D.) in Animal Husbandry" would result # in the field_name's provided with a value of "Doctor of...
true
052c0cacf64459dc8b9bad8d398363db000f609a
Ruby
Estevenson1994/Clothes-Store
/spec/features/shopping_basket_spec.rb
UTF-8
2,248
2.703125
3
[]
no_license
require_relative "./web_helper" feature "Shopping Basket" do include Helpers scenario "user can add item to basket and see it in the cart" do enter_product_page add_first_item_to_basket expect(page).to have_content("Shopping Cart") expect(page.find(".shopping_cart")).to have_selector("li", count: 1...
true
48cc58addc0034616511d888920c201f31501955
Ruby
sgtFloyd/project-euler
/11-20/16.rb
UTF-8
259
3.375
3
[]
no_license
# 2^15 = 32768 and the sum of its digits is # 3 + 2 + 7 + 6 + 8 = 26. # # What is the sum of the digits of the number 2^1000? puts (2**1000).to_s.split('').inject(0){|sum, i| sum + i.to_i} # => 1366 # real 0m0.007s # user 0m0.004s # sys 0m0.002s
true
421a5b07804ea51cc07d7aba823244cd2f8d69e1
Ruby
dsulfaro/datastructures
/ruby/bst.rb
UTF-8
5,202
3
3
[]
no_license
class Node attr_accessor :left, :right, :val def initialize(left=nil, right=nil, val) @left = left @right = right @val = val end end class BST attr_accessor :root def initialize @root = nil end def insert(val) @root.nil? ? @root = Node.new(val) : __insert(val, @root) end def i...
true
90838231b60e7631c1c14d51336e3613cd371a58
Ruby
jaksonmoura/Ruby-Puzzles
/100 doors/doors.rb
UTF-8
491
3.578125
4
[]
no_license
class Door attr_reader :state def initialize @state = :closed end def close @state = :closed end def open @state = :open end def closed? @state == :closed end def toggle closed? ? open : close end def state @state.to_s end end doors = Array.new(100) { Door.new }...
true
074139090ce8dbf4acebe0711b64ba1d1baf9947
Ruby
DaryaAndreevna/marley_spoon_test
/app/entries/base_entry.rb
UTF-8
837
2.71875
3
[]
no_license
# frozen_string_literal: true ############## Usage ################# ###################################### # # class RecipeEntry < BaseEntry # fields :id, # :title, # :calories, # :description # # linked_entries :photo, :chef, :tags # end # ####################################### class...
true
38ad9c10894ed661b2ba43ecd615f3cdee1c9b67
Ruby
flatiron32/AvantSolutions
/factors_and_caching.rb
UTF-8
739
2.890625
3
[]
no_license
#!/usr/bin/env ruby require 'yaml' CACHE_FILE = "factor_cache.yml" REVERSE_CACHE_FILE = "reverse_factor_cache.yml" input = ARGV.map { |e| e.to_i } cache = YAML::load_file CACHE_FILE if File.exist? CACHE_FILE cache ||= {} reverse_cache = YAML::load_file CACHE_FILE if File.exist? CACHE_FILE reverse_cache ||= {} cach...
true
b6d5246e9d528df2e9d83fbe3bfe995eefbf7a97
Ruby
rgriffith/LogMaster5000
/config/initializers/regexp.rb
UTF-8
314
3.140625
3
[]
no_license
class Regexp def self.unescape(source) source = source.split('') escape_on = false unescaped_string = source.inject([]) {|r, char| if char == "\\" and escape_on == false escape_on = !escape_on else r << char escape_on = false end r }.join end end
true
e3818ca6515099f9a795b535bccd129176e9689a
Ruby
mynyml/nanotest
/examples.rb
UTF-8
429
2.796875
3
[ "MIT" ]
permissive
require 'nanotest' include Nanotest class Foo attr_accessor :bar end @foo = Foo.new assert { @foo.is_a?(Foo) } assert { @foo.respond_to?(:bar) } assert { @foo.bar.nil? } @foo.bar = 'a' @foo.bar << 'b' assert { @foo.bar == 'ab' } assert { not @foo.bar == 'xy' } @foo.bar = nil assert { @foo.bar == 'ab' } a...
true
0f83add325c91b12a897e30abf6114cf76e44046
Ruby
ChristieRenaud/launch-school-course-101
/small_problems/second_try/Easy7_7-2.rb
UTF-8
676
4.6875
5
[]
no_license
#Easy7_7-2.rb #input: Array of integers #output: Prints the result of multiplying all the numbers together, dividing by no. of entries, rounded to 3 decimal places #Approach: #Iterate through the array and multiply all integers together # Divide the result by the size of the array # Round to 3 decimal points # Print ...
true
3447cc2abe5c3f811eb7ef294382f72463839d22
Ruby
Bumsuk/MyRubyBase
/08-016-privlege.rb
UTF-8
492
2.5625
3
[]
no_license
class Yapoo # デフォルトではメソッドはpublicになる def public_method; end private # 以降に定義するメソッドは自動的にprivateになる def internal_use; end # 内部的な処理 def public_api return internal_use # inernal_useを使って何かを実装 end public :public_api # public_apiをpublicに設定する end yapoo = Yapoo.new yapoo.public_api ...
true
ff7c3e382d5f0ceadc4bc738c3278bfe2ded43a5
Ruby
JakubowskiA/OO-FlatironMifflin-nyc-web-060319
/lib/Manager.rb
UTF-8
900
3.546875
4
[]
no_license
class Manager attr_accessor :name, :age attr_reader :department @@all = [] def initialize(name, department, age) @name = name @department = department @age = age.to_i @@all << self end def self.department @department end def self.all @@...
true
f711f4a2850341da92a242a2226dc2e824a76f98
Ruby
evinsou/kottans-kharkiv-2016
/week2-task1/lib/capybara_animal.rb
UTF-8
1,034
3.265625
3
[ "MIT" ]
permissive
require 'byebug' class Capybara attr_accessor :fatigue, :hunger, :color ONE_YEAR = 365 * 24 * 60 * 60 def initialize(fatigue: 0, hunger: 0, color: 'brown') @fatigue = fatigue @hunger = hunger @color = color @born_at = Time.now @alive = true end def age (Time.now - @born_at).to_i ...
true
c9fbded93ab948bd6873374d9a3bd932da005911
Ruby
taylorbrooks/wp-scraper
/wp_scraper.rb
UTF-8
2,215
3.234375
3
[]
no_license
require 'rubygems' require 'nokogiri' require 'json' require 'net/http' require 'open-uri' require 'csv' # No trailing slash for site def scrape(site) base_url = "#{site}/page/" url_list = Array.new post_links = Array.new # Grabbing all the pages (1..14).each do |i| url_list << base_url + i.to_s pu...
true
be2fb2dd82d935dab4f39d314a6947f2e163dc53
Ruby
rhys117/LaunchSchoolCurriculum
/Backend/101/exercises/medium1/rotation_pt2.rb
UTF-8
806
4.1875
4
[]
no_license
require 'pry' def rotate_array(array) array << array.shift array end # ls def rotate_array(array) array[1..-1] + [array[0]] end def rotate_rightmost_digits(number, digit) num_array = number.to_s.split(//).map(&:to_i) something = num_array.length - digit num_array << num_array.delete_at(something) num_a...
true
f2fc893eddf424d0098d54a91c4a2b9e25467874
Ruby
tomo10/prime-ruby-london-web-career-021819
/prime.rb
UTF-8
257
3.21875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' def prime?(n) foundDivider = false if n <= 1 foundDivider = true else for d in 2..(n - 1) foundDivider = ((n % d) == 0) || foundDivider binding.pry end end not foundDivider end
true