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
c5d8081fda3cfcc9c6cc89ac9c0dba7b1f0aa2b5
Ruby
astera/tecc
/citizen428/04/euler4.rb
UTF-8
342
3.703125
4
[]
no_license
def is_palindrome?(num) num = num.to_s num == num.reverse end largest_palindrome = 0 (100..999).each do |i| (100..999).each do |j| product = i * j largest_palindrome = product if is_palindrome?(product) && product > largest_palindrome end end puts "Largest palindrome made from two 3-digit numbers: #{...
true
7719b8fad3347b9a60c1148c93b6f1ec8eb395af
Ruby
markryall/cardigan
/lib/cardigan/command/edit_value.rb
UTF-8
455
2.625
3
[ "MIT" ]
permissive
require 'cardigan/commands' require 'splat' require 'cardigan/card_editor' class Cardigan::Command::EditValue attr_reader :usage, :help def initialize entry, io @entry, @io = entry, io @usage = '<key>' @help = 'Launch default editor to specify a new value to associate with the specified key' end ...
true
cff5991e0c659d09cf6783feae13a6400e48706d
Ruby
cbellavia/Learn-to-program
/Copy of chapter8.rb
UTF-8
172
3.703125
4
[]
no_license
puts "Hi, enter as many words as you want" myArray = [] while true value = gets.chomp if value == '' break else myArray.push value end end puts myArray.sort
true
49a5da3c137d509d4c8cfc58e8caf1a5df24bc44
Ruby
learn-co-students/atl-web-082619
/03-one-to-many/run.rb
UTF-8
499
3
3
[]
no_license
require 'pry' require_relative 'user' require_relative 'tweet' brit = User.new("king_cons") princeton = User.new("princey") t1 = Tweet.new(brit, "i am not really awake yet but it is fine") t1.username brit.post_tweet("i'm waking up now. ruby is pretty cool") princeton.post_tweet("man, whatever. when do we get to SQL...
true
05840d4308fc765fb2610e178404d6d37ccad6b8
Ruby
jwperry/recursive_target_sum
/lib/target_sum.rb
UTF-8
872
3.46875
3
[]
no_license
# frozen_string_literal: true # This class will allow you to calculate all possible combinations of candidate # numbers in an array that add up to a target number, uniquely. # Ex: candiates: [1, 2, 4], target: 4 # => [[1, 1, 1, 1], [1, 1, 2], [2, 2], [4]] class TargetSum def solve(candidates, target) result = tr...
true
de3a32f3c210f945a623e4b415e8235d6f8efd03
Ruby
mcfiredrill/tweet_wall
/tweet_wall.rb
UTF-8
1,848
2.75
3
[]
no_license
require 'rubygems' require 'ruby-processing' require 'net/http' require 'oauth' require 'json' require 'thread' $mutex = Mutex.new class TweetWall < Processing::App CONSUMER_KEY = 'xxxxxxxxx' CONSUMER_SECRET = 'xxxxxxxxx' OAUTH_TOKEN = 'xxxxxxxxx' OAUTH_SECRET = 'xxxxxxxxx' def setup @bg_x = -200 ...
true
239119e1bec1a8b77195f7482ee966dd6e09979e
Ruby
takagotch/ruby
/perfect_auth/sample_files/part2/05/list5.3.rb
UTF-8
267
3.203125
3
[]
no_license
for item in %w(foo bar baz) Thread.fork do sleep 1 # 確実にforループが終わるのを待つ puts item # すべてのスレッドで"baz"と表示される end end (Thread.list - [Thread.current]).each &:join # 子スレッドの終了を待つ
true
255b3ef2d70d49e2101483f5d042eb922e001d02
Ruby
randyL78/design_patterns
/ruby/strategy_pattern/quack_behavior.rb
UTF-8
328
2.796875
3
[]
no_license
# frozen_string_literal: true module QuackBehavior # Implements different versions of the quack method class Quack def self.quack puts 'Quack quack!' end end class Squeak def self.quack puts 'Squeak!' end end class MuteQuack def self.quack puts '<< Silence >>' end ...
true
22636e3f4738a6b6919d5b529f4ff042633d8180
Ruby
Thibault-collard/mini_jeu_poo
/mini_jeu_POO/app2.rb
UTF-8
2,156
3.453125
3
[]
no_license
require 'bundler' Bundler.require require_relative 'lib/game' require_relative 'lib/player' class App def starting_game puts "-------------------------------------------------" puts "|Bienvenue sur 'ILS VEULENT TOUS MA POO' ! |" puts "|Le but du jeu est d'être le dernier survivant !|" puts "-----------...
true
e5e9c694a62205755defff65f4f3cbf33bb3ed6e
Ruby
natigajardo/Proyecto-final-DL
/app/models/order_item.rb
UTF-8
548
2.640625
3
[]
no_license
class OrderItem < ApplicationRecord belongs_to :order belongs_to :product before_save :set_unit_price before_save :set_subtotal #Si la orden mantiene su estado de "creado" por más de 20 minutos, se elimina. #Precios de los productos def unit_price if persisted? self [:unit_price] else ...
true
352fcd66585511c936ae6bd60ad728d1c151582c
Ruby
robhanlon22/autopluck
/lib/autopluck.rb
UTF-8
1,291
2.609375
3
[ "MIT" ]
permissive
require_relative 'autopluck/version' module Autopluck class << self attr_reader :deactivated alias :deactivated? :deactivated def activate! unless defined? @deactivated require 'active_record' ActiveRecord::Relation.send(:include, self) end @deactivated = false end ...
true
34ba9ed126110b126933d319606ccaf59e7f5646
Ruby
zackmdavis/App_Academy_Exercises
/Week_1/array_exercises4.rb
UTF-8
375
3.671875
4
[]
no_license
def stock_picker(prices) maximum = 0 days = [0,0] (0...prices.length).each do |buy_day| (buy_day...prices.length).each do |sell_day| if prices[sell_day] - prices[buy_day] > maximum maximum = prices[sell_day] - prices[buy_day] days = [buy_day, sell_day] end end end days end ...
true
ae06fd34ea802a54447c2d80b5c05a4613912677
Ruby
bryspy/RubyTestProject
/Scratch/array_delete_if.rb
UTF-8
69
3.21875
3
[]
no_license
arr = [1,2,3,4,5,6,7,8,9,10] arr.delete_if {|item| item < 4} p arr
true
c94e9122a5f1dcfbc46bce829c58a99cf0396424
Ruby
roginn/gathering_dsl
/card_collection/halimar_excavator.rb
UTF-8
394
2.71875
3
[ "MIT" ]
permissive
class HalimarExcavator < Card name 'Halimar Excavator' creature :human, :wizard, :ally mana_cost 1, :U pt 1 / 3 text 'Whenever Halimar Excavator or another Ally enters the battlefield ' + 'under your control, target player puts the top X cards of his or her ' + 'library into his or her ...
true
b5fa6210663ba5d7d2ed0004e24872287a0c6c00
Ruby
tastycode/bridge-rvm-parser-b
/url_parser.rb
UTF-8
270
3.0625
3
[]
no_license
class URLParser def initialize(input) @raw = input end def self.parse(url:) new(url) end def scheme parsed[:scheme] end def host parsed[:host] end def parsed @raw.match(%r{^((?<scheme>[\w]+)://)?(?<host>[\w\-\.]+)?}) end end
true
67edb3b43ac86e79463b9fe85c8ce054fc5d57d2
Ruby
hzbadr/ruby-meta
/define_method.rb
UTF-8
1,577
3.71875
4
[]
no_license
## define a method for object # class A # end # a = A.new # b = A.new # a.define_singleton_method(:greet) do # puts "Hello" # end # a.greet # begin # b.greet # rescue Exception => e # puts e # end # A.define_singleton_method(:greet) do # puts "Hello '#{self.name}'" # end # A.greet # begin # b.greet # r...
true
e6e96fb06dc4523e69340aff983aa92d76105483
Ruby
edwin-lai/w2d5
/lib/p04_linked_list.rb
UTF-8
1,643
3.46875
3
[]
no_license
class Link attr_accessor :key, :val, :next, :prev def initialize(key = nil, val = nil) @key = key @val = val @next = nil @prev = nil end def to_s "#{@key}: #{@val}" end end class LinkedList include Enumerable def initialize @head = nil @tail = nil end def [](i) eac...
true
f63e76a24f414d070767f5221f775333c59209dc
Ruby
IscencoAl/toy_robot
/spec/position_spec.rb
UTF-8
582
2.65625
3
[ "MIT" ]
permissive
require 'spec_helper' require 'position' describe Position do describe '#new' do subject { described_class.new(1, 2, 'NORTH') } it { is_expected.to be_a(Position) } end let(:position) { described_class.new(0, 0, 'WEST') } describe '#update_direction' do it 'updates direction' do position.upd...
true
7dd8b7a566c931974c58e8be4e92a1e8b75d1518
Ruby
charlesbjohnson/super_happy_interview_time
/rb/lib/epi/epi_c10_p1.rb
UTF-8
447
2.765625
3
[ "MIT" ]
permissive
# frozen_string_literal: true require("ctci/ctci_c4_p1") module EPI module C10 module P1 # Write a function that takes as input the root of a binary tree # and returns true or false depending on whether the tree is balanced. # Use O(h) additional storage, where h is the height of the tree. ...
true
d9be74d49e4c9ca5b415431be67eb61760b283b2
Ruby
joostcalis/store
/mijnsupermarkt.rb
UTF-8
2,372
3.40625
3
[]
no_license
total = 0 cart = [] apple = Foods.new apple.name = "apple" apple.price = 2 apple.stock = 10 pear = Foods.new pear.name = "pear" pear.price = 1 pear.stock = 15 cola = Drinks.new cola.name = "cola" cola.price = 2 cola.stock = 20 fanta = Drinks.new fanta.name = "fanta" fanta.price = 3 fanta.stock = 15 beer = Adult...
true
9282abf168cd6b8dddd60a98b00c14c054d34763
Ruby
VikingR/sample_app
/spec/requests/static_pages_spec.rb
UTF-8
1,690
2.78125
3
[]
no_license
require 'spec_helper' describe "Static pages" do # let variables for refactoring let(:base_title) { "Sample App" } # static_pages#home # describe block, the string can be anything you want describe "Home page" do # first example marked by it ... do; the string is irrelevant and should be descripti...
true
4b92b487c9c3c92eecd65e9a62bbc7e7fd99276b
Ruby
adrienpoly/click-n-co
/app/services/open_hour_sort.rb
UTF-8
1,091
3.0625
3
[]
no_license
class OpenHourSort def initialize(open_hours) @open_hours = open_hours end def call # def_hrs = ["12h - 12h30", "15h - 15h30", "16h - 16h30", "17h - 17h30", "18h - 18h30"] def_hrs = ["9h", "10h", "11h", "12h", "12h", "13h", "15h", "16h", "17h", "18h"] my_day = Date.today date_now = @open_hour...
true
1592ec56d49541c643c05ab61558d7d7b043c2f4
Ruby
turingschool-examples/set-list-1911
/db/seeds.rb
UTF-8
1,409
2.625
3
[]
no_license
PlaylistSong.destroy_all Playlist.destroy_all Song.destroy_all Artist.destroy_all carly_rae = Artist.create(name: "Carly Rae") spears = Artist.create(name: "Brittney Spears") journey = Artist.create(name: "Journey") billie = Artist.create(name: "Billie Eilish") like_you = Song.create(title: "I Really Like You", leng...
true
63c2b1fc8d8f9e5852775fa4eb8072531e0b7893
Ruby
learn-co-students/chicago-web-080320
/03-one-to-many/models/tweet.rb
UTF-8
371
3.203125
3
[]
no_license
class Tweet attr_reader :message, :user, :timestamp @@all = [] def initialize(message, user) @message = message @user = user # by saving a user instance here, we say: this tweet belongs to this user @timestamp = Time.now @@all << self end def username self.user.username end def ...
true
e9b1360b2700303a31e8ac14ced5b56e1a60e465
Ruby
gkunwar/ShareNews
/lib/result_formatter.rb
UTF-8
699
2.796875
3
[]
no_license
require 'open-uri' class ResultFormatter attr_accessor :title, :post_type, :text, :url def initialize(content, title_selector = "h2 a", url_selector = "h2 a", text_selector = "div.thing div.entry div.expando div.md p") @content = content @title_selector = title_selector @url_selector = url_selector @text_se...
true
8509ba865a2180b8ae495096e81c77081694d4a0
Ruby
azmiimza/pokemon_rainbow
/test/models/pokemon_skill_test.rb
UTF-8
2,769
2.59375
3
[]
no_license
require 'test_helper' class PokemonSkillTest < ActiveSupport::TestCase def setup @pokedex = Pokedex.create(name: "pokedex", base_health_point: 20, base_attack:20, base_defence:30, base_speed:30, image_url:"aaaa", element_type:"fire") id = @pokedex.id @pokemon = Pokemon.create(name: "pokemon", pokedex_id:...
true
1783b91986fa807f3718a9a5606d5f884a0d344e
Ruby
pmichaeljones/learn-ruby-hard-way
/ex33.rb
UTF-8
196
3.734375
4
[]
no_license
def prompt() print "What's your name?" puts ">> " return gets.chomp end while true name = prompt() if name == "Patrick" puts "You got it!" Process.exit() else puts "Wrong!" end end
true
bffbbaafa8df2a090a6bc40f08ece9028ebe8ae1
Ruby
ethueter/array-CRUD-lab-atlanta-web-career-031119
/lib/array_crud.rb
UTF-8
605
3.9375
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def create_an_empty_array empty_array = [] end def create_an_array kids = ["stella", "lewis", "kate", "keebler"] end def add_element_to_end_of_array(array, element) array << element end def add_element_to_start_of_array(array, element) array.unshift("wow") end def remove_element_from_end_of_array(array) ...
true
8026fada62cca07277c027d3f65cd5bddf7be6e4
Ruby
saintmedusa/hotel
/test/block_test.rb
UTF-8
3,853
2.84375
3
[]
no_license
require_relative "test_helper" describe Hotel::Block do before do @fd = Hotel::FrontDesk.new @rooms = @fd.rooms.slice(0,5) @start = Date.new(2020, 01, 01) @end = Date.new(2020, 01, 07) @rate = 153 end describe "constructor" do describe "has all the expected state" do it "rooms" do ...
true
1815b50a234d97ee85857636c2f26288e2220b71
Ruby
ossforumjp-app-IoT/rubyiot_mobile
/app/models/Controller.rb
UTF-8
894
2.546875
3
[ "Apache-2.0" ]
permissive
class Controller HTTP = 'http://' CONTROLLER_URL = '/api/controller?gateway_id=' # retriving data via api def self.retrieve_data(gateway_id, block) @gateway_id = gateway_id @block = block url = HTTP + $settings.server_address + CONTROLLER_URL + @gateway_id.to_s BW::HTTP.get(url, {cookie: $lo...
true
3dd7103639283761d6b8a0000c679d5eb401f3fd
Ruby
hyperoslo/grumbles-the-lame-wizard
/app/models/item/floppy.rb
UTF-8
319
2.609375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class Item::Floppy < Item def describe <<-HTML Contains my game state. <strong>DELETE</strong> the <strong>floppy</strong> to reset the game. HTML end def drop game.reset <<-HTML Goodbye cruel world! Hello World! I’m back at the <strong>inn</strong>. HTML end end
true
4680a15366da68a85197891548d33ccdeed4a2b0
Ruby
eliias/git
/lib/git/commit.rb
UTF-8
430
2.71875
3
[ "MIT" ]
permissive
# frozen_string_literal: true module Git class Commit attr_accessor :oid def initialize(tree, author, message) @tree = tree @author = author @message = message end def type "commit" end def to_s lines = [ "tree #{@tree}", "author #{@author}", ...
true
aa202a0d4dae26bb96415b95409daa25aed2b3c1
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/raindrops/378d6223b71342b1839f1e3e71cde8bf.rb
UTF-8
365
3.390625
3
[]
no_license
require 'prime' class Raindrops PRIME_TO_SOUND = { 3 => "Pling", 5 => "Plang", 7 => "Plong" } def self.convert number sounds = "" factors = Prime.prime_division(number).map(&:first) PRIME_TO_SOUND.each_pair do |prime, sound| sounds << sound if factors.include? prime end sounds << number...
true
8aad26392eaf4b92483b1026819e8567fc6d12d4
Ruby
ryooochin776/furima-31143
/spec/models/product_spec.rb
UTF-8
2,972
2.578125
3
[]
no_license
require 'rails_helper' RSpec.describe Product, type: :model do before do @product = FactoryBot.build(:product) end describe '商品の出品' do context '商品が出品できる場合' do it '情報を全て入力すれば保存できる' do expect(@product).to be_valid end end context '商品が出品できない場合' do it '画像が空だと出品できないこと' do ...
true
1b7fa4b2ae8796ad1f1615aabdcd9a7989787db1
Ruby
dubey98/learn_ruby
/02_calculator/calculator.rb
UTF-8
612
3.65625
4
[]
no_license
#write your code here def add(num1,num2) return num1 + num2 end def subtract(num1,num2) return num1 - num2 end def sum(array) result =0 index =0 while index<array.length result += array[index] index+=1 end return result end def multiply(array) result = 1 for numb...
true
47afcaaf343e46aeda5e4d39eaca266f15f39205
Ruby
oneKelvinSmith/coin
/lib/coin.rb
UTF-8
791
2.859375
3
[ "MIT" ]
permissive
require 'coin/version' require 'openssl' require 'base64' module Coin CYPHER = 'aes-256-gcm'.freeze AUTH_DATA = ''.freeze def self.new_cipher OpenSSL::Cipher.new(CYPHER) end def self.encrypt(plaintext:) cipher = new_cipher.encrypt key = cipher.random_key iv = cipher.random_iv cipher....
true
e6d0f42680f74555987079597cef8cd87e86c3cf
Ruby
TaishiTakano/stone_ruby
/lexer_test.rb
UTF-8
311
3.15625
3
[]
no_license
require './lib/line_number_reader' require './lib/lexer' require './lib/token' text = "13 + x * 2" reader = Stone::LineNumberReader.new(text) lexer = Stone::Lexer.new(reader) token = true i = 0 while token != Stone::Token.EOF token = lexer.read print "token[#{i}] => " p token.get_text i += 1 end
true
eb6bbe2103e50e1cb33e3f5df0e0e6d68fb1b06a
Ruby
delightio/nowbox.web
/models/mention.rb
UTF-8
2,019
2.609375
3
[]
no_license
module Aji # Mention Schema # - id: Integer # - author_id: Integer (Foreign Key: Account) # - body: Text # - external_id: Integer? # - unparsed_data: Text # - published_at: DateTime # - links: Text (serialized to array of Link models) class Mention < ActiveRecord::Base belongs_to :author, :class_n...
true
611ba43cf1ac9d0cf9d5d412b9f5443987e6fa03
Ruby
thomasballinger/botherbother
/botherbother.rb
UTF-8
3,614
3.015625
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby # Credits: # Many tips from: # https://www.shell-tips.com/sheets/bash_help_sheet.jpg # http://www.howtoforge.com/useful_linux_commands # Name from Megan Baker # I encourage you to look up each of these commands online (Google...
true
bc0f3e2330509146d0a3e3b0a0adc4df2a707689
Ruby
markrebec/trailguide
/spec/lib/trail_guide/calculators/score_spec.rb
UTF-8
6,949
2.546875
3
[ "MIT" ]
permissive
require 'rails_helper' RSpec.describe TrailGuide::Calculators::Score do subject { described_class.new(experiment, probability, base: base).calculate! } let(:probability) { TrailGuide::Calculators::DEFAULT_PROBABILITY } let(:base) { :default } context 'with multiple variants' do experiment { variant ...
true
908e312522c83ca1017eca3e8beb819dfb546978
Ruby
macduff/macduff.github.com
/Rakefile
UTF-8
693
2.625
3
[ "MIT" ]
permissive
require 'rubygems' require 'rake' require 'fileutils' desc "Draft a new post" task :new do puts "What should we call this post for now?" name = STDIN.gets.chomp FileUtils.touch("drafts/#{name}.md") open("drafts/#{name}.md", 'a') do |f| f.puts "---" f.puts "comments: true" f.puts "date: 0000-00-00 ...
true
8d544df9a7831f39b205aa5a6341d640c25770e2
Ruby
JustinLupica/sinatra-mvc-lab-onl01-seng-pt-070620
/models/piglatinizer.rb
UTF-8
1,859
3.671875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class PigLatinizer def piglatinize(word_or_phrase) vowels = ["a", "e", "i", "o", "u"] piglatinized_words = [] word_or_phrase.split(" ").each do |letter| # if first letter is a vowel.. if vowels.include?(letter.downcase.split("").first) le...
true
705b59faae3209e4fcfef4d0517253c4a1684d0a
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/anagram/2a018b9bba5e4710bf696a6da5aaf15c.rb
UTF-8
268
3.5
4
[]
no_license
class Anagram def initialize(str) str = str.downcase @str = str @sorted_str = str.chars.sort.join end def match(words) words.select do |word| word = word.downcase @str != word && @sorted_str == word.chars.sort.join end end end
true
7468d75bce1f0a9de94416863e3968ec9747dfc0
Ruby
hurhurhurt/rottenpotatoes-rails-intro
/app/models/movie.rb
UTF-8
293
2.828125
3
[]
no_license
class Movie < ActiveRecord::Base def self.all_ratings #return ['G','PG','PG-13','R'] %w(G PG PG-13 R) # Same as above, this is more Ruby idiomatic end def self.filter_and_sort(selected_ratings, sorting) Movie.where(rating: selected_ratings).order(sorting) end end
true
d1af37041c6d80e5860a6c00ac3ad369d66c82aa
Ruby
ceciliarivero/teamballots
/filters/password_recovery.rb
UTF-8
241
2.515625
3
[ "BSD-3-Clause" ]
permissive
class PasswordRecovery < Scrivener attr_accessor :password, :password_confirmation def validate assert password.length > 5, [:password, :too_small] assert password == password_confirmation, [:password, :not_confirmed] end end
true
fde917d18233dd356d6fc918963e0d08de289adc
Ruby
steveholm/fish_report
/app/models/current_weather.rb
UTF-8
1,065
2.625
3
[]
no_license
class CurrentWeather < ActiveRecord::Base # This model will just pull a forecast. I may actually hook the data up to a database later. attr_accessible :temperature, :wind_speed, :humidity, :condition, :wind_direction, :city, :state, :json_data require 'open-uri' require 'json' attr_accessor :forecast_js...
true
3c2d9fd9e27ada93e885f1de10ff8de0af73e38c
Ruby
jclem/castle
/spec/castle/position_spec.rb
UTF-8
695
2.515625
3
[]
no_license
require 'spec_helper' describe Castle::Position do let(:position) { Castle::Position.new } describe "#initialize" do context "when given a FEN" do let(:fen) { 'rnbqkbnr/pppppppp/8/8/8/4P3/PPPP1PPP/RNBQKBNR w KQkq - 0 1'} let(:position) { Castle::Position.new(fen) } it "sets that as its FEN"...
true
cd3e067c49b1f137146945ce4dd9e7013614b6e6
Ruby
pwentz/poker-hands
/lib/rank.rb
UTF-8
114
3.1875
3
[]
no_license
class Rank attr_reader :name, :high def initialize(name:, high:) @name = name @high = high end end
true
1f4143a237c81b26bb01c2733ea21c8c95c72d0a
Ruby
lanimacedo/ruby_puro
/metodos_gems/method.rb
UTF-8
197
2.890625
3
[]
no_license
def talk(first_name, last_name) puts "Olá #{first_name} #{last_name}, como você está?" end first_name = "Teste" last_name = 're' talk('lasksad', 'dasdasdasd') talk(first_name, last_name)
true
bc3efd41e79f9da2459ca67010cb8fff8f4159c5
Ruby
musicmills1990/ruby-objects-has-many-lab-v-000
/lib/author.rb
UTF-8
334
3.125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' class Author attr_accessor :name def initialize(name) @name = name @posts = [] end def add_post(post) @posts << post post.author = self end def posts @posts end def add_post_by_title(title) post = Post.new(title) @posts << post post.author = self end def self.post_count Post.all.si...
true
417f5151cab9e1b74c55503a94750764b952bf17
Ruby
mh-mobile/RubyCherryBook
/2/2.5.3.rb
UTF-8
747
3.703125
4
[]
no_license
#!~/.rbenv/shims/ruby n = 11 if n > 10 puts "10よりおおきい" else puts "10以下" end country = "italy" if country == "japan" puts "こんにちわ" elsif country == "us" puts "Hello" elsif country == "italy" puts "ciao" else puts "???" end greenting = if country == "japan" "こんにちわ" elsif country == "us" "...
true
5589a8f5a8e4670049beba6a3be8e3137293e15d
Ruby
Eden-Eltume/101
/Lesson_4_Ruby_Collections/Exercises_Nested_Collection_and_Working_with_Blocks.rb/ex6.rb
UTF-8
194
3.0625
3
[]
no_license
arr = [{a: 1}, {b: 2, c: 3}, {d: 4, e: 5, f: 6}] arr.map do |sub_hash| incremented_hash = {} sub_hash.map do |key, value| incremented_hash[key] = value + 1 end incremented_hash end
true
f723b3b6e19ba339eebcc737913d7fac6809a677
Ruby
riddopic/croesus
/lib/croesus/validators/base.rb
UTF-8
1,228
2.734375
3
[]
no_license
# encoding: UTF-8 # # Author: Stefano Harding <riddopic@gmail.com> # # Copyright (C) 2014 Stefano Harding # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/license...
true
f22f3ee80408c0d131e9ad7a002f733bd9be7354
Ruby
ssandaya/autodata
/lib/trash/song_list_test.rb
UTF-8
477
2.9375
3
[]
no_license
# To change this license header, choose License Headers in Project Properties. # To change this template file, choose Tools | Templates # and open the template in the editor. require "./trash/song_list" require "./trash/song" song1 = Song.new("Bicylops", "Fleck", 260) p SongList.isTooLong(song1) #→ false song2 = Song....
true
a728fa1ab122e265639556a142beac97c024714d
Ruby
copypastel/print_stuff_mail
/lib/psm.rb
UTF-8
2,385
2.875
3
[]
no_license
require 'net/http' require 'base64' require 'json' require 'addressable/uri' require 'psm/session' module PrintStuffMail class Letter attr_reader :address, :return_address, :message, :state def initialize(params = {}) @message = params['message'] @address = params['address'] @re...
true
4f932f8918825a77af864a3f636764b51a7a585c
Ruby
jclif/ruby-primitives
/enumerables/concat_strings.rb
UTF-8
113
3.3125
3
[]
no_license
def concatenate(array) array.inject('') do |accum, x| accum + x end end p concatenate(["a","b","c","d"])
true
14c415edbbaa14325fc22afc8138ecdcf900de1f
Ruby
yunix/bucnewswidget
/app/models/bucnews.rb
UTF-8
780
2.828125
3
[]
no_license
require 'htmlentities' class BUCNEWS attr_accessor :title, :description, :thumbimg, :url FEED = "http://adventist.org.uk/news/news.rss".freeze #FEED = "http://adventist.org.uk/news/news.rss".freeze def initialize(params) @title = params[:title] @description = params[:description] @thumbimg =...
true
909fc022b3a06270362eb85afbc7d9cf81d239d4
Ruby
Hwesta/project-euler
/euler_001_sum_of_multiples.rb
UTF-8
335
3.078125
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require 'set' # Done 2015-04-22 def first_try(max) multiple_3 = Set.new 0.step(max-1, 3).to_a multiple_5 = Set.new 0.step(max-1, 5).to_a multiples = multiple_3 | multiple_5 sum = multiples.reduce(:+) end if __FILE__ == $0 max = ARGV[0].to_i puts "max is #{max}" puts fi...
true
cb31a761b32e46d2cb5b7240087a7f2678ca6919
Ruby
dyoder/hive
/test/basic.rb
UTF-8
593
2.96875
3
[]
no_license
require 'rubygems' require 'logger' require 'lib/hive/worker' require 'lib/hive/scheduler' class MyScheduler < Hive::Scheduler def start_tasks schedule( :my_task, :minute => Time.now.min + 1 ) schedule( :another_task, :interval => 10.seconds ) schedule( :odd_tasks, :minute => (0..59).select{ |x| x.odd...
true
25432806ed4f5d5b1df3961a29d3701e23c5e27b
Ruby
Nanamiiiii/TweetOnDisco
/main.rb
UTF-8
730
2.625
3
[]
no_license
require 'discordrb' require 'twitter' require 'dotenv' Dotenv.load def twitter_init() @client = Twitter::REST::Client.new do |config| config.consumer_key = ENV["TWITTER_CS_KEY"] config.consumer_secret = ENV["TWITTER_CS_SEC"] config.access_token = ENV["TWITTER_ACCESS_TOKEN"] config.access_token_secre...
true
13660f81f23c9b196bce09d7721d47bc34435ef8
Ruby
gazayas/asagao
/test/controllers/members_controller_test.rb
UTF-8
1,558
2.515625
3
[]
no_license
require 'test_helper' class MembersControllerTest < ActionController::TestCase def setup login_as("taro") end test "the truth" do a = 1 # もし「a」が1でない場合は、次の行はターミナルの中でエラーメッセージを表示する assert a == 1, "\naは1ではありません" end # テストの名前なんですけど、これは自分が test "矛盾" do # 1 != 2 なのでこれは成功する # assert_equ...
true
245c609381a1d9f5e8be6ad2d0c73c64fc40303c
Ruby
stevepm/euler
/2/ruby/2.rb
UTF-8
469
3.9375
4
[]
no_license
class Two def initialize(number_cap) @number_cap = number_cap end def even_numbers first = 0 n = 1 even_numbers = [] @number_cap.times do if n.even? even_numbers << n end first, n = n, first + n end even_numbers end def sum_of_evens first, second, su...
true
aa34191cbdaaaa196a28983800af043cf0fd4c4a
Ruby
freakinhuge/ruby_koans_rspec
/spec/about_true_and_false_spec.rb
UTF-8
736
3.3125
3
[]
no_license
require 'spec_helper' describe "True and False" do def truth_value(condition) if condition :true_stuff else :false_stuff end end it "should demonstrate true_is_treated_as_true" do truth_value(true).should eql __ end it "should demonstrate false_is_treated_as_false" do truth...
true
eb2c8e9273822a41908f25eee5f3422ad3f0d6e0
Ruby
ToniRib/turing-warmups
/12-17-2015/word_frequency.rb
UTF-8
532
3.421875
3
[]
no_license
class WordFrequency def list_frequencies(words) freq = Hash.new(0) words.each { |word| freq[word] += 1 } sorted = sort_by_descending_value(freq) top_5(sorted) end def sort_by_descending_value(frequencies) frequencies.sort_by { |word, count| [-count, word] } end def top_5(frequencies) ...
true
dd6ee5d287bd842dae6aa5a113d60677308b752c
Ruby
fkurusu/bookery
/db/migrate/20170705174542_create_books.rb
UTF-8
799
2.609375
3
[]
no_license
class CreateBooks < ActiveRecord::Migration def change create_table :books do |t| t.string :name, :isbn t.string :tags, array: true t.integer :author_id, :user_id, :category_id, :rating t.string :filename, :content_type t.binary :file_contents t.timestamps end a...
true
e553316c799fd9bc14905265612ae64e2667dfce
Ruby
vitivey/intro-to-tdd-rspec-and-learn-v-000
/current_age_for_birth_year.rb
UTF-8
70
2.65625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def current_age_for_birth_year(year) age_of_person= 2003 - year end
true
a076cbc44417f8593fc4023b21655bd5dc5bb448
Ruby
alphabrian/RubyPython
/test.rb
UTF-8
849
3.625
4
[]
no_license
first_name = 'Brian' last_name = 'Harrison' age = 35 # not a lie in 2009 height = 6 # feet weight = 180 # lbs eye_colour = 'blue' tooth_colour = 'white' hair_colour = 'brown' height_conv = height*30.48 #formula for height in cms weight_conv = weight*0.454 #formula for weight in kgs year_born = 2016-age puts "How's i...
true
c13e92c1f6b64062ddaffa7cbc83c97cadb8ac2b
Ruby
eamontaaffe/group19
/app/helpers/interpolator.rb
UTF-8
2,747
3.359375
3
[]
no_license
require 'nokogiri' require 'json' require 'open-uri' # require 'pry' include Math module Interpolator def interpolate(loc,time) @@ATTRIBUTES = [:rainValue, :rainProb, :tempValue, :tempProb, :windSpeedValue, :windSpeedProb, :windDirValue, :windDirProb] #there are more to be...
true
fef10810c967b710b59a413307a0dab0d82aae0b
Ruby
CodesAFK/deli-counter-v-000
/deli_counter.rb
UTF-8
672
3.78125
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# ~~~HAVICK WAS HERE~~~ katz_deli = [] def line(katz_deli) newline = [] if !(katz_deli.empty?) katz_deli.each.with_index(1) {|name, index| newline << name} puts "The line is currently: 1. #{newline[0]} 2. #{newline[1]} 3. #{newline[2]}" else puts "The line is currently empty." end end def...
true
b838751b20392f8a9a23317612b7625df105443c
Ruby
Jirles/ttt-game-status-v-000
/lib/game_status.rb
UTF-8
842
3.796875
4
[]
no_license
# Helper Method def position_taken?(board, index) !(board[index].nil? || board[index] == " ") end # Define your WIN_COMBINATIONS constant WIN_COMBINATIONS = [ [0,1,2], #top row [3,4,5], #mid row [6,7,8], #bot row [0,3,6], #left col [1,4,7], #mid col [2,5,8], #right col [0,4,8], #l>r diag [2,4,6]...
true
018c09ef658770582817c2089bb18827ccbfd954
Ruby
sachinkaria/learn_to_program
/ch10-nothing-new/dictionary_sort.rb
UTF-8
61
2.546875
3
[]
no_license
def dictionary_sort arr arr.sort_by{|w| [w.downcase, w]} end
true
4f2c37934459f410e966eb07b7fad98ca0f24d09
Ruby
buzzamus/baseball-gem
/lib/baseball/player.rb
UTF-8
3,929
2.796875
3
[ "MIT" ]
permissive
module Player require 'baseball/player_helper' class Player include PlayerHelper STATS = %i[ at_bats hits walks hbp sac_flies singles doubles triples hr put_outs assists errors er ip so stolen_bases caught_stealing ] attr_accessor(*STATS) def initialize(hash) STATS.each...
true
125665526e367250b7cdc410f7afdc362a47ff14
Ruby
tamouse/ruby-examples
/preset_with_script/ruby_script
UTF-8
350
2.515625
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby IO.popen('csh -ic "source setup_env.csh && setenv"') do |io| io.each_line do |line| if %r{^([[:alnum:]_]+)\s*=\s*(.*)}m =~ line k = $1 v = $2 ENV[k] ||= v else STDERR.puts "Did not parse line #{line}" end end end puts "ENV_VAR_A: #{ENV["ENV_VAR_A"]}" puts "EN...
true
5b0c582d27b43089f53324c706ac60cdb3a0b8fe
Ruby
vineshpersaud/learn_rpsec
/lib/do_math.rb
UTF-8
80
3.03125
3
[ "MIT" ]
permissive
def add_five(num) return num + 5 end def sub_five(num) return num - 5 end
true
2c4deafa2c127920706d8a7dd7db5c697ff668d5
Ruby
colstrom/stamina
/lib/stamina-core/stamina/utils/decorate.rb
UTF-8
6,237
3.390625
3
[ "MIT" ]
permissive
module Stamina module Utils # # Decorates states of an automaton by applying a propagation rule until a fix point is # reached. # class Decorate # Creates a decoration algorithm instance def initialize(output = :invariant) @output = Decorate.state_output(output) if output ...
true
a7fe44bb2d62a992d02c2312561136bdb728cb8b
Ruby
qq431169079/yyrp
/lib/yyrp/utils/download_progress.rb
UTF-8
607
2.921875
3
[ "MIT" ]
permissive
require 'ruby-progressbar' require 'net/http' require 'uri' def down(url, save_file_path) uri = URI.parse(url) @counter = 0 @pbar = nil Net::HTTP.start(uri.host, uri.port) do |http| response = http.request_head(uri.path) file_size = response['content-length'].to_i @pbar = ProgressBar.create(format...
true
87d7ae9999dd472180bc2908c949015a6c01349e
Ruby
pelensky/ttt_core
/lib/board.rb
UTF-8
1,781
3.828125
4
[ "MIT" ]
permissive
class Board attr_reader :winner, :number_of_rows, :spaces def initialize(spaces) @spaces = spaces @number_of_rows = Math.sqrt(spaces.count) end def place_marker(space) spaces = @spaces.dup spaces[space] = current_player_marker if space_available?(space) Board.new(spaces) end def chec...
true
d8caaa788a979782a7af5c517153b9dbd38e0530
Ruby
luca-baldelli/tictactoe
/move.rb
UTF-8
611
3.171875
3
[]
no_license
require 'matrix' class Move attr_accessor :config def self.[] *config new(Matrix[*config]) end def initialize config self.config = config end def rotate self.class.new(self.config.transpose * Matrix[[0, 0, 1], [0, 1, 0], ...
true
408f4714ee7a32eb83c7b70caef15ae5de720acf
Ruby
jiangming1/rblog2
/app/models/document.rb
UTF-8
535
2.53125
3
[]
no_license
class Document < ActiveRecord::Base def initialize(params = {}) file = params.delete(:file) super if file self.filename = sanitize_filename(file.original_filename) self.content_type = file.content_type self.file_contents = file.read end end private def sanitize_filename(filename) return File...
true
f77d04d86c0be225e90bb4b730da730037c5a19d
Ruby
julieharrow/ruby-practice
/methods_exercises.rb
UTF-8
433
4.46875
4
[]
no_license
def conv_lbs_to_kilos(pounds) kilos = pounds/2.2 kilos.round(2) end def length_of_string() word = gets.chomp length = word.length end def reverse_string() word = gets.chomp reverse = word.reverse end puts "130 pounds is equivalent to #{conv_lbs_to_kilos(130)} kilos" puts "Gimme a word:" puts "The lengt...
true
5e99d3e91749d0b1f44948cd9edfaa19fa0ac898
Ruby
MalikG15/process_artist
/process_artist.rb
UTF-8
1,773
3.234375
3
[]
no_license
require 'ruby-processing' class ProcessArtist < Processing::App #This is my first ruby processing project and I love it! def setup background(255, 0, 0) @size = 10 @queue = " " end def draw end def key_pressed warn "A key was pressed! #{key.inspect}" if @queue.nil? @queue = "" ...
true
f3bc9e0b0625c5218573a88781f8c281d1104ff7
Ruby
gonzofish/ws-chat-server
/chat-socket.rb
UTF-8
951
2.9375
3
[]
no_license
require 'em-websocket' require 'json' require_relative 'json-handler' class ChatSocket < Struct.new(:socket) Channel = EM::Channel.new Handler = JH.new def initialize(socket) self.socket = socket @username = "" socket.onclose { self.on_close } socket.onmessage { |message| ...
true
e96e9e4c0b2c4c2e27b1c69f78824e69dec364a9
Ruby
spraguesy/module-one-final-project-guidelines-houston-web-082718
/lib/playlist.rb
UTF-8
804
2.703125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Playlist < ActiveRecord::Base has_many :playlist_songs has_many :songs, through: :playlist_songs belongs_to :user has_many :follows has_many :followers has_many :users, :as => :followers, through: :follows alias_attribute :followers, :users def add_song_to_playlist(song) ...
true
8204801d713aae2ed1ee1809d9db517724d678e7
Ruby
poliver24/Battle
/spec/player_spec.rb
UTF-8
550
2.75
3
[]
no_license
require 'player' describe Player do subject(:patrick) { Player.new('Patrick') } subject(:computer) { Player.new('Computer') } describe '#name' do it 'returns the name' do expect(patrick.name).to eq 'Patrick' end end describe '#hit_points' do it 'returns the hit points' do expect(pat...
true
74f213f03d4cd8ca6882751bb92152b64e6338ae
Ruby
selinafeng/codenow
/new/cyoa.rb
UTF-8
3,652
3.625
4
[]
no_license
puts "Once upon a time another Cinderella was born. She had four evil stepbrothers who bullied her a lot. One day she decided to get back at them. What does she do? a. She decides to prank them. b. She plots to murder them. c. She does nothing and cries." input = gets.chomp if input == "a" puts "She hides dead fi...
true
68db87a90cf44482f3dda1c6477f30b2098f9eb7
Ruby
luqyluqe/Rubisc
/lib/fileutil.rb
UTF-8
1,606
2.859375
3
[ "MIT" ]
permissive
#!/usr/bin/ruby module Rubisc module FileUtil def self.process_file file_path,write return true unless block_given? if !File.file? file_path puts "Not a file: "+file_path return false end file=File.new file_path,"r" if !file puts "Failed to read file "+file_path return false end ...
true
85fa72aae2f342f3e4109abd24ecb1f2c893f369
Ruby
wardymate/codewars-kata
/character_concatenation/lib/catter.rb
UTF-8
269
3.4375
3
[]
no_license
class Catter def char_concat(input) numb = (input.length/2) a = input[0..(numb-1)] b = input[numb..-1].chars.reverse.join output = '' i = 0 numb.times do |i| output << a[i] + b[i] + (i+1).to_s i += 1 end output end end
true
9fcd7d835a50b8aa784f5700d926f6c43f173073
Ruby
jdkaplan/advent-of-code
/2019/day03/part1.rb
UTF-8
1,549
3.765625
4
[]
no_license
# frozen_string_literal: true require 'pp' input = File.read(File.join(__dir__, 'input')) def wires(input) input.lines.map do |line| wire_points(line.strip.split(',')) end end class Point attr_reader :x, :y def initialize(x, y) @x = x @y = y end def inspect "Point(#{x}, #{y})" end ...
true
c23a1a5092a64b293c9a759bb632ebf1c1a6fa19
Ruby
screenxtv/screenxtv-news
/screenxtv_news.rb
UTF-8
1,438
2.84375
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby # -*- coding: utf-8 -*- require 'json' require 'twitter' # load config.json open('config.json') {|f| @config = JSON.parse f.read } # Load OAuth Settings Twitter.configure do |config| config.consumer_key = @config['consumer_key'] config.consumer_secret = @config['consumer_secret'] config.o...
true
868e50ca3f0dcab14ebe0751a313550eed67ac2d
Ruby
juliengrimault/portfolio-unicorn
/spec/support/shared_examples/shared_example_case_insensitive_unique_field.rb
UTF-8
704
2.546875
3
[]
no_license
shared_examples "a case insensitive unique attribute" do |klass, attribute| it "is invalid without a #{attribute}" do expect(FactoryGirl.build(klass.name.underscore.to_sym, attribute => nil)).not_to be_valid end it "is invalid with a non unique #{attribute} (case insensitive)" do field = 'QwRtYuY' ...
true
62aa9f202cd30f1603679a0ac940bf344b1c6161
Ruby
jeanleopoldo/chess_ruby
/game.rb
UTF-8
721
4
4
[]
no_license
class Game require_relative 'table.rb' def initialize @table = Table.new(ROW_SIZE, COL_SIZE) @round = 0 @mate = false end def make_move(from, to) _piece = from.get_piece if is_turn(_piece) if @table.move(from, to) add_round else puts "Something went wrong" end else puts "Not#{_pi...
true
fddd7f5982163a8664475afa169fd35685443ce6
Ruby
sarahpai/tweet-shortener-nyc-web-100818
/tweet_shortener.rb
UTF-8
2,102
4.4375
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' def dictionary dictionary = { "hello" => 'hi', "to" => '2', "two" => '2', "too" => '2', "for" => '4', "four" => '4', 'be' => 'b', 'you' => 'u', "at" => "@", "and" => "&" } end #Write a method, word_substituter that takes in a string of a tweet as an argument a...
true
564b8c1e11813b1bdce3c40190c0a19389abd12b
Ruby
enkessler/cuke_linter
/lib/cuke_linter/linters/background_does_more_than_setup_linter.rb
UTF-8
911
2.8125
3
[ "MIT" ]
permissive
module CukeLinter # A linter that detects backgrounds that have non-setup steps class BackgroundDoesMoreThanSetupLinter < Linter # Changes the linting settings on the linter using the provided configuration def configure(options) @when_keywords = options['When'] @then_keywords = options['Then'...
true
f5f22e5aa635d38c0a820a605771262b86047f67
Ruby
UMNLibraries/umbra.search
/app/services/aws_api.rb
UTF-8
663
2.640625
3
[]
no_license
class AwsApi attr_reader :uri, :api_key, :http_klass, :post_klass def initialize(url: :missing_url, api_key: :missing_api_key, http_klass: Net::HTTP, post_klass: Net::HTTP::Post) @uri = URI(url) @api_key = api_key @http_klass = http_klass ...
true
799aaad55ac5796f636a5bbcb524b8bd294a5a83
Ruby
phil/nyx
/lib/nyx/message.rb
UTF-8
503
2.609375
3
[]
no_license
class Nyx::Message attr_reader :created_at attr_reader :from attr_reader :body attr_reader :type def type @type ||= "AnyMessage" end def initialize attrs = Hash.new @created_at = Time.now @type = attrs[:type] if attrs.key?(:type) @body = attrs[:body] if attrs.key?(:body) @fro...
true
b21cbec58a040e930b1c6fe166c1b543303f03da
Ruby
erikiva/advent-of-code
/2017-ruby/day01/problem_test.rb
UTF-8
2,107
3.375
3
[]
no_license
require 'rspec' require_relative './problem' describe 'Day1 Part1' do it '#get test answer 1' do # 1122 produces a sum of 3 (1 + 2) because the first digit (1) matches the second digit and the third digit (2) matches the fourth digit. day1 = Day1.new().calculateCaptcha('1122') expect(day1).to eq(3) end...
true
b0b4107f686362f9b4ed08bc63ef0cc92126d12d
Ruby
ryohashimoto/lightrails
/actioninteractor/test/composite_test.rb
UTF-8
3,050
2.890625
3
[ "MIT" ]
permissive
require "test/unit" require_relative "../lib/actioninteractor" class ChiefInteractor < ActionInteractor::Composite end class CookInteractor < ActionInteractor::Base def execute results.add(:steak, "Juicy beaf steak") successful! end end class ArrangeInteractor < ActionInteractor::Base attr_reader :brok...
true
103e4a151893d386b112f85e3df7d2e84e9bb0a9
Ruby
HeiaHeia/heiaheia.rb
/lib/heia_heia/default.rb
UTF-8
2,524
2.53125
3
[ "MIT" ]
permissive
require 'heia_heia/response/raise_error' require 'heia_heia/version' module HeiaHeia # Default configuration options for {Client} module Default # Default API endpoint API_ENDPOINT = "https://api.heiaheia.com".freeze # Default User Agent header string USER_AGENT = "HeiaHeia Ruby Gem #{HeiaHeia...
true
2db8ef6f32e4d884f02b5f2b5dd915ace7ed0f44
Ruby
frcharry/Ruby-exercicesI
/leefile.rb
UTF-8
140
2.640625
3
[]
no_license
def read(file) if File.exists?(file) f=File.open(file,"r") print f.readline f.close else nil end end read("test.txt")
true
4bb76dc1da15270bef3767e7a097d25c3698f350
Ruby
brunohq/exercism
/ruby/transpose/transpose.rb
UTF-8
403
3.3125
3
[]
no_license
class Transpose def self.transpose(matrix) rows = matrix.lines.map(&:rstrip).map(&:chars) columns = Array.new( rows.map{ |row| row.size }.max || 0 ) { Array.new(rows.size) } rows.each_with_index do |row, r| row.each_with_index do |char, c| columns[c][r] = char (0...r).each { |i| colu...
true