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
1f6e51a08f367abcbd72c6deb9a83b26e1be7595
Ruby
austccr/link_and_attachment_archiver
/lib/link_archiver.rb
UTF-8
670
2.8125
3
[]
no_license
require 'scraperwiki' require_relative 'link_archiver/parse_html.rb' require_relative 'link_archiver/archive_links.rb' class LinkArchiver attr_accessor :links attr_accessor :source_url def initialize(links: nil, source_url:) @links = links || [] @source_url = source_url end def parse_html_and_archi...
true
1f8a16d89f9c83676befc308e75b5dd73239ba10
Ruby
st1102/EventAPI
/event_api.rb
UTF-8
1,319
2.578125
3
[]
no_license
require 'sinatra' require 'json' require 'active_record' require 'mysql2' ActiveRecord::Base.configurations = YAML.load_file('database.yml') ActiveRecord::Base.establish_connection(:development) class Event < ActiveRecord::Base validates :start, presence: true, format: { with: /\d{4}-\d{2}-\d{2} \d{2}:\d{2}/ } va...
true
ce7628a436f8f2e60a1c1ba022624756824274f9
Ruby
jcpny1/elevator
/app/classes/person.rb
UTF-8
216
3.21875
3
[ "MIT" ]
permissive
# A Human Being. # For this app, a Person needs weight only. class Person attr_reader :id, :weight def initialize(id, weight) @id = id # Person Id. @weight = weight # Person Weight. end end
true
14fed614c8bb42e72e7d3ba465a6949f82f7ba3d
Ruby
nyc-salamanders-2016/akme-flash-cards
/model/flashcard.rb
UTF-8
161
2.59375
3
[]
no_license
class Flashcard attr_reader :question, :answer def initialize(args = {}) @question = args.fetch(:question) @answer = args.fetch(:answer) end end
true
af74234259bd40535ba3a068d8918c47ca389745
Ruby
caroo/validatable
/test/unit/translator_test.rb
UTF-8
1,735
2.609375
3
[ "Ruby" ]
permissive
require "test_helper" class Validatable::TranslatorTest < Test::Unit::TestCase include Validatable::Translator attr_reader :to_validate def setup I18n.load_path ||= [] file = File.expand_path(File.join(File.dirname(__FILE__), "../de.yml")) I18n.load_path << file unless I18n.load_path.include?(file) ...
true
43999385a481c6e704328553be7896463748d4fc
Ruby
yatish27/byebug
/lib/byebug/commands/method.rb
UTF-8
996
3
3
[ "BSD-2-Clause" ]
permissive
module Byebug # # Show methods of specific classes/modules/objects. # class MethodCommand < Command include Columnize def regexp /^\s* m(?:ethod)? \s+ (i(:?nstance)?\s+)?/x end def execute obj = bb_eval(@match.post_match) if @match[1] print "#{columnize(obj.methods.so...
true
30d2126312060770d69ab9e0a742f3f6c4fb124b
Ruby
tmharkins/ruby-music-library-cli-v-000
/lib/genre.rb
UTF-8
440
2.984375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require './concerns/findable.rb' class Genre extend Concerns::Findable attr_accessor :name, :songs, :artists @@all = [] def initialize(name) @name = name @songs = [] end def self.all @@all end def self.destroy_all all.clear end def self.create(name) new_genre = self.new(name) new_genre.sa...
true
65461173e1086db6f94e950eca74218bded407e3
Ruby
ruby-b/monka-rubybasic
/q5.rb
UTF-8
765
3.75
4
[]
no_license
# 以下の条件を踏まえて、期待通りにプログラムが動くように修正してください # 1. Productクラスは、商品の値段を管理することが出来る # 2. Taxモジュールは、税率を管理する事が出来る # 3. ProductクラスはTaxモジュールをMix-inしている module Tax # 税率 TAX_RATE = 1.08 private # 税込金額を返すメソッド def to_tax(money) (money *= TAX_RATE).to_i end end class Product include Tax def initialize(price) ...
true
e753729368f8e5a8857c8ac83d081711c63a4c99
Ruby
amadden80/hw
/tripcalc.rb
UTF-8
1,509
4.25
4
[]
no_license
def forceAboveZero(value) while value <= 0 print "Must be greater than zero... Try Again: " value = gets.chomp.to_f end return value end def adjustMilesPerGallon(milesPerGallon, speed) if (speed - 60) > 0 milesPerGallon -= (2 * (speed - 60)) end if milesPerGallon < 0 return 0.0 else...
true
2df15c7e8fa027485acf340b25e9f6cd64bf26e1
Ruby
ClementTANGUY/crolls
/app/models/fight.rb
UTF-8
1,085
2.765625
3
[]
no_license
class Fight < ApplicationRecord has_many :fighters, dependent: :destroy def add_combatant(combatant) current_fighter = fighters.find_by(combatant_id: combatant.id) if current_fighter.nil? && fighters.size < 2 current_fighter = fighters.build(combatant_id: combatant.id) end end def add_fight...
true
30ef0f8e7664aa7890b0821c7298f94e9066db0c
Ruby
medellinrb/artoo-arduino
/examples/dc_motor_speed_h-bridge_2_pins.rb
UTF-8
1,171
2.515625
3
[ "Apache-2.0" ]
permissive
require 'artoo' #Circuit's breadboard layout for the L293D: http://www.electrojoystick.com/tutorial/?p=759 #For the L239DNE: http://bit.ly/14QdjD5 connection :firmata, :adaptor => :firmata, :port => '/dev/ttyACM0' # linux #connection :firmata, :adaptor => :firmata, :port => '127.0.0.1:8023' device :board, :driver => ...
true
fc3ba9979aa137dbfe343a40cb2eb6c6b9a9a098
Ruby
Serabe/RMagick4J
/test/eyetests/tests/path_star_01.rb
UTF-8
333
2.546875
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
require File.join(File.dirname(__FILE__), 'new_image.rb') include Magick draw = Draw.new draw.fill 'red' draw.fill_rule 'nonzero' draw.stroke 'blue' draw.stroke_width(5) draw.path 'M100,10 L100,10 40,180 190,60 10,60 160,180 z' b = Image.new(300, 300, HatchFill.new('white', 'black')) draw.draw(b) b.write('path_...
true
9427b9d11b6524f827897448907218e93bed22c4
Ruby
sccp2017/sccp2017_final
/src/dba/market.rb
UTF-8
572
2.953125
3
[]
no_license
require 'sequel' class MarketAccess def initialize(db = Sequel.sqlite("./db/database.db")) db.create_table? :market do primary_key :id String :name end @market = db[:market] end # 店情報を追加 def add_market(market) @market.insert(market) end ...
true
6eba9b8b4cf1a451021ff2ecea2f82d405fb013c
Ruby
tomstuart/polarnet
/polarnet.rb
UTF-8
1,691
3.296875
3
[]
no_license
require 'dual_number' N = 40 LEARNING_RATE = 0.01 BIAS = 2.0 def main synone = Array.new(3) { Array.new(N) { rand * 0.1 } } syntwo = Array.new(N) { Array.new(2) { rand * 0.1 } } count = 0 loop do point = Complex.polar(rand, rand * 2 * Math::PI) input = point.polar + [BIAS] target = point.rectang...
true
1708a8c0ebe7bd5f7bf986662e44b8cad7923d8e
Ruby
igortice/t2a2
/mat_adj.rb
UTF-8
2,219
3.21875
3
[]
no_license
require 'pry' require 'highline/import' require 'matrix' require 'awesome_print' require 'terminal-table' matriz = [] vertices = [] arestas = [] loop do system('clear') say('Menu Opções') menu1 = ["1. Adicionar vertice: #{vertices if matriz.count != 0}", "2. Adicionar aresta: #{arestas.map { |e| "V#{e[0]};V#{e[...
true
e242ac01ca0664a5561622f8f5d0127f3975b7d0
Ruby
rogercampos/png_quantizator
/lib/png_quantizator.rb
UTF-8
1,576
2.84375
3
[ "MIT" ]
permissive
require "png_quantizator/version" require 'open3' require 'fileutils' require 'securerandom' require 'tempfile' require 'shellwords' module PngQuantizator class PngQuantError < StandardError; end class Image def initialize(file_path) raise ArgumentError, "could not find #{file_path}" unless File.file?(f...
true
70faabfbe7263b071a057a365f87fe47a93e72fb
Ruby
tiyd-ror-2016-06/class-notes
/week-2/3/person_spec.rb
UTF-8
1,212
3.203125
3
[]
no_license
require "pry" require "minitest/autorun" require "minitest/focus" begin require "minitest/reporters" Minitest::Reporters.use! Minitest::Reporters::ProgressReporter.new rescue LoadError warn "`gem install minitest-reporters` for pretty test output" end class Person def initialize first, last=nil @first = f...
true
ced8b3386151ed0525dccea0ae0e6983e07756c3
Ruby
augustt198/projects
/tinyhi.rb
UTF-8
805
2.921875
3
[]
no_license
MATCHERS = { "comment" => /\/\/.*(\r\n|\r|\n)?/, "str" => /\".*?\"/, "op" => /(=|==|>=|<=|>|<|&&|\|\||&|\||!=|!|<<|>>|\+|-|\/|\*)/, "kw" => /\b(int|float|double|char|void|long|bool|if|else|for|while|return)\b/, "float" => /\b(\d*\.\d+)\b/, "int" => /\b((?<!\.)(0x)?\d+(?!\.))\b/, "hex" => /\b0x[0-9a-fA-F]+...
true
aabd1bb2b4a9bcf35019814589358d8155164e4b
Ruby
rhonall/6Nimmt
/classes/deck.rb
UTF-8
673
3.359375
3
[]
no_license
require 'json' class Deck attr_reader :deck def initialize @deck = {} end # Match each card to the corresponding number of cattle heads def prepare_deck (1..104).each do |i| v = [1, 2, 3, 5, 7] if i == 55 @deck[i] = v[4] elsif (i % 11 == 0.0) && i != 55 @deck[i] = ...
true
68e69d7bab5a1e1bb514ec650a8c3e6667d52b7b
Ruby
JTomaney/CodeClan-project-vet-surgery
/models/client.rb
UTF-8
1,675
3.1875
3
[]
no_license
require_relative('../db/sql_runner.rb') class Client attr_reader :id attr_accessor :first_name, :last_name, :contact_number, :email def initialize(options) @id = options['id'].to_i if options['id'] @first_name = options['first_name'] @last_name = options['last_name'] @contact_number = options['...
true
083c0c875395eb6aed9da4e541443c708b9b6d91
Ruby
jgraichen/acfs
/lib/acfs/resource/persistence.rb
UTF-8
6,641
2.5625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# frozen_string_literal: true class Acfs::Resource # # Allow to track the persistence state of a model. # module Persistence extend ActiveSupport::Concern # @api public # # Check if the model is persisted. A model is persisted if # it is saved after being created # # @example Newly...
true
26a6a4b0d7241034d74c07d174106f172124fd71
Ruby
evaldasg/dotfiles
/bin/domainr
UTF-8
554
2.78125
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby # encoding: utf-8 # From @jerodsanto # http://blog.jerodsanto.net/2012/11/a-domainr-cli-in-less-than-15-lines-of-ruby/ %w(json open-uri).each { |lib| require lib } abort "Usage: #{File.basename __FILE__} [query]" unless ARGV.first response = open("https://domainr.com/api/json/search?q=#{ARGV.firs...
true
55615ebe3461ae3deef1b439614bac172ac38b01
Ruby
Mloweedgar/eloquent_ruby_code
/17/ex_8c_break_spec.rb
UTF-8
445
3.125
3
[]
no_license
require '../code/doc3' require 'doc_each_word' def count_till_tuesday( doc ) ##(main count = 0 doc.each_word do |word| count += 1 break if word == 'Tuesday' end count ##main) end describe 'each_word method with break' do it 'should work exit the calling method...
true
8604a37ed30b32fa7cb6de99331e6f2814a512c6
Ruby
kivi/deal
/app/models/order.rb
UTF-8
686
2.671875
3
[]
no_license
class Order < ActiveRecord::Base has_many :line_items has_many :deals, :through => :line_items def shipping_cost 400 end def price line_items.sum(&(:price)) end def total_incl_shipping() price + shipping_cost end def vat() total_incl_shipping * 0.19 end def total() t...
true
1845111f255bc7ea00b78dadeef2aa3646213d06
Ruby
bryanmytko/project_euler
/10.rb
UTF-8
546
4.15625
4
[]
no_license
# Summation of primes # Problem 10 # The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. # Find the sum of all the primes below two million. def is_prime?(num) return false if num == 1 return true if num == 2 (2..Math.sqrt(num)+1).each do |x| return false if num%x == 0 end true end s = (1..2000000).i...
true
a84201909b5ae1827f2b777a5e34e3c70940cdc0
Ruby
bdiveley/book_club
/spec/features/user_adds_new_book_spec.rb
UTF-8
1,659
2.609375
3
[]
no_license
require 'rails_helper' describe 'new book page' do it 'form submission adds new book to database' do visit new_book_path fill_in("book[title]", with: "farewell to arms") fill_in("book[pages]", with: "650") fill_in("book[authors]", with: "ernest hemmingway, ghost writer") fill_in("book[year]", w...
true
1a9984a4b6f97e3c4b87e3ce399147b457f6345f
Ruby
jtavarez14/deli-counter-onl01-seng-pt-032320
/deli_counter.rb
UTF-8
655
3.75
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
katz_deli = [] def line(katz_deli) phrase = "The line is currently:" if katz_deli.length > 0 katz_deli.each_with_index do |name, index| phrase += " #{index + 1}. #{name}" end puts phrase else puts "The line is currently empty." end end def take_a_number(katz_deli_li...
true
edf510f3615323937a85a87e0505a1126a4973f8
Ruby
Alejandro19921222/2-3
/upcase.rb
UTF-8
77
2.984375
3
[]
no_license
puts "webcamp".upcase puts "webcamp".swapcase puts "webcamp".tr("a-z","A-Z")
true
9b3b3aa9b1b2de260089b8709389a330bf0401a3
Ruby
willcosgrove/advent_of_code
/2017/7b.rb
UTF-8
1,027
3.390625
3
[]
no_license
class Program INPUT_REGEX = /(\w+) \((\d+)\)(?: -> (.+))?/ attr_reader :name, :weight @@programs = {} def self.from_input(line) match = line.match(INPUT_REGEX) if match new(match[1], match[2], match[3]&.split(", ") || []) else raise end end def initialize(name, weight, childre...
true
8d3b6b49486572f9b85cd8b38f0340d332e8c76b
Ruby
anderson-81/my-studies
/ruby/ruby/date.rb
UTF-8
214
3.328125
3
[]
no_license
time = Time.new puts time.inspect birthday = Time.local(1981,11,12) puts "#{birthday.day}/#{birthday.month}/#{birthday.year}" puts "\n----------\n#{time.to_a}" puts "Birthday: #{birthday.strftime("%d/%m/%Y")}"
true
2b25b015cecba1d46a6226c74493bfbd77639a6e
Ruby
gagoit/cado
/config/initializers/devise_confirmable.rb
UTF-8
2,598
2.6875
3
[]
no_license
# module Devise # module Models # # Confirmable is responsible to verify if an account is already confirmed to # # sign in, and to send emails with confirmation instructions. # # Confirmation instructions are sent to the user email after creating a # # record and when manually requested by a new confi...
true
d26f5d9d6a443807545d3ca25172e4f60ee3d6bd
Ruby
kclowes/intro_to_tdd
/spec/leap_year_spec.rb
UTF-8
257
2.953125
3
[]
no_license
require 'rspec/core' require "leap_year" describe "Leap_Year" do it "Calls a method to see if the year is a leap year" do leapyear = LeapYear.new() expected = "Not a leap year" actual = leapyear.yes?(1900) expect(actual).to eq(expected) end end
true
c9ac6c44581edaf5a1583b350efdf1513f3b4694
Ruby
charleyhine/ulikes
/app/models/.svn/text-base/query.rb.svn-base
UTF-8
1,625
2.765625
3
[ "Apache-2.0" ]
permissive
class Query < ActiveRecord::Base has_and_belongs_to_many :items, :join_table => "items_queries", :order => ' vote_count, name desc' belongs_to :city belongs_to :state validates_presence_of :query_text, :location_text, :city, :state validates_length_of :query_text, :minimum => 2 #location_text has to be at...
true
90998d557ff520b3d1e577a3800c358df393bc8a
Ruby
kostya/jober
/bench/queue.rb
UTF-8
477
2.9375
3
[ "MIT" ]
permissive
require 'rubygems' require 'bundler/setup' Bundler.require $summary = 0 class Bench < Jober::Queue def perform(x, y) $summary += x + y end end Jober.logger = Logger.new nil t = Time.now threads = [] 5.times do |ti| threads << Thread.new do 10000.times { |i| Bench.enqueue(i + ti * 10000, -(i + ti * 100...
true
91a2e7875a16f02a425ca07858bafbace5482164
Ruby
agm1988/flipp
/lib/file_parser/base.rb
UTF-8
356
2.6875
3
[]
no_license
# frozen_string_literal: false module FileParser class Base def self.call(file) parser = self.new(file) parser.file.nil? ? [] : parser.parse_data end attr_reader :file def initialize(file) @file = file end def parse_data fail NotImplementedError, 'Not implemented me...
true
2658e0be3f97384020a0fc7c3080240607a12582
Ruby
oliverlai55/ruby-programming
/error-handling.rb
UTF-8
507
3.578125
4
[]
no_license
# Don't use this syntax begin puts 8/0 rescue "Rescued the error" end # Now we have a more detailed way of error handling begin puts 8/0 rescue ZeroDivisionError => e puts "Error occured: #{e}" end # Check the diff between StandardError and ZeroDivisionError?? # Custom Error Handling def error_logger(e) Fi...
true
e9179e93f88dee215a66eecfd487a3f46649d6af
Ruby
RubyDiscord/pearl-bot
/lib/pearl/config.rb
UTF-8
577
2.515625
3
[]
no_license
module Pearl class Config attr_writer :token attr_accessor :prefix attr_accessor :client_id def token return @token unless @token.nil? raise "No Token provided" end def command_config self.to_h.select do |key| %i[token prefix client_id] end end privat...
true
a860d644c24230c772c136533a732429ce8e2fa6
Ruby
dchelimsky/decent_exposure
/spec/lib/decent_exposure_spec.rb
UTF-8
4,720
2.625
3
[ "WTFPL" ]
permissive
require File.join(File.dirname(__FILE__), '..', 'helper') class Quacker extend DecentExposure def self.helper_method(*args); end def self.hide_action(*args); end def memoizable(*args); args; end expose(:proxy) end module ActionController class Base def self.helper_method(*args); end def self.hide_...
true
71d3c1cec57b221c8d245251f4b93f369fd3653b
Ruby
cmaher92/launch_school
/coursework/rb100/ruby_basics_again/greeting.rb
UTF-8
73
2.90625
3
[]
no_license
def hello "Hello" end def world "World" end puts "#{hello} #{world}"
true
fef40975c332f6d16cd5def505222b5ba07eeed8
Ruby
BlakeMesdag/bugwalk
/lib/github_html.rb
UTF-8
1,409
2.796875
3
[]
no_license
class GithubHTML < Redcarpet::Render::HTML GITHUB_URL = "https://github.com/" def gfm(text) # Extract pre blocks extractions = {} text.gsub!(%r{<pre>.*?</pre>}m) do |match| md5 = Digest::MD5.hexdigest(match) extractions[md5] = match "{gfm-extraction-#{md5}}" end # prevent foo...
true
3aa069632f6054f078f9c4814cd2e0f2ee6e3bde
Ruby
BlueVajra/sinatra_test
/app.rb
UTF-8
636
2.53125
3
[]
no_license
require 'sinatra/base' require './lib/item_repository' class App < Sinatra::Application ITEM_REPOSITORY = ItemRepository.new get '/' do erb :index, locals: {:items => ITEM_REPOSITORY.items} end get '/item/new' do erb :new_item end post '/' do ITEM_REPOSITORY.add(params[:new_item]) redir...
true
c7e6eb8dfa77836a35534254a3777f77ecc3e455
Ruby
Laner12/flashcards
/test/card_test.rb
UTF-8
421
2.84375
3
[]
no_license
require "./test/testhelper" require "./lib/card" class CardsTest < Minitest::Test def setup @card = Card.new("What is the capital of Alaska?", "Juneau") end def test_creating_a_card assert_instance_of Card, @card end def test_card_has_a_question assert_equal "What is the capital of Alaska?", @...
true
f1c7e0cf063e714f30563c2bf3c72a64d30ae567
Ruby
AliceNewton/finder-api
/lib/elastic_search_registerer.rb
UTF-8
536
2.53125
3
[ "MIT" ]
permissive
require 'multi_json' class ElasticSearchRegisterer def initialize(client, namespace) @http_client = client @namespace = namespace end def store_map(mapping) http_client.put(index_path) http_client.put(mapping_path(mapping), json_mapping(mapping)) end private attr_reader :http_client, :names...
true
9353b7065e9ceec53849750b2d8c7f57e08934cf
Ruby
kingsleyh/shield-system
/src/systems/label.rb
UTF-8
2,173
2.9375
3
[]
no_license
require 'RMagick' class Label def initialize(label_name, label_text, label_colour, label_text_colour, background_colour, output_path, custom_font, height, font_size, font_family, buffer) @label_name = label_name @label_text = " #{label_text}" @label_colour = label_colour @label_text_colour = label...
true
c66a108aec436cb5e30deda4a2c844a0731d7de0
Ruby
heldaher/phase-0-tracks
/ruby/santa.rb
UTF-8
2,770
3.40625
3
[]
no_license
reindeer_ranking = [ "Rudolph", "Dasher", "Dancer", "Prancer", "Vixen", "Comet", "Cupid", "Donner", "Blitzen"] p reindeer_ranking age = 0 class Santa attr_reader :age, :ethnicity attr_accessor :gender # def initialize (gender, ethnicity, beard_description, weight) def initialize (gender, ethnicity, age) #p...
true
3ff7d129a6ff52db90a77852dcb6fc5a029d287b
Ruby
CelesteComet/Launch-School
/challenges/circ_buffer/circular_buffer.rb
UTF-8
1,542
3.53125
4
[]
no_license
class BufferEmptyException < Exception end class BufferFullException < Exception end class CircularBuffer def initialize(length) @buffer = Array.new(length) center = (@buffer.length/2).floor @reader = center @writer = center end def write!(value) if value == nil return end ...
true
c9238758df5c93a67ef77ad4176e94a6e665ee5f
Ruby
marcbobson2/lessons
/ch10_final/problem8.rb
UTF-8
180
3.015625
3
[]
no_license
#create a hash using old and new styles hash1={:name=>'flower'} hash2={name: 'power'} p hash1 p hash2 hash1[:destruction]='right' hash2[:destruction]='knight' p hash1 p hash2
true
3a7617c98fb7efdcbbc36552adee6b50c9b98f12
Ruby
mojoru2023/Recording_Ruby
/demo/r1.rb
UTF-8
305
3.390625
3
[]
no_license
#!/usr/bin/ruby -w # -*- coding:utf-8 -*- # # @name 是实例变量,能够被该类或子类继承引用 class Player def initialize(name="kaff") @name = name end def show() puts "player:#{@name}" end end kona = Player.new() kona.show() curry = Player.new("curry") curry.show()
true
3fb7c9585c76bec6a818602a7961fdbe08730925
Ruby
Epictetus/csv_rails
/test/dummy/test/unit/user_test.rb
UTF-8
2,305
2.6875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- require 'test_helper' require 'csv' class UserTest < ActiveSupport::TestCase setup do @user = User.create(:name => 'yalab', :age => '29', :secret => 'password') end test "#to_csv_ary without params" do assert_equal @user.attributes.length, @user.to_csv_ary.length assert_equal ...
true
6bd0dfa33cca4b7c58e1da6a6b271fe9f2d26e2a
Ruby
lizardbird/landlord
/db/seeds.rb
UTF-8
1,326
2.796875
3
[]
no_license
require_relative 'connection' require_relative '../models/apartment' require_relative '../models/tenant' Apartment.destroy_all Tenant.destroy_all abc = Apartment.create(address: "123 ABC St", monthly_rent: 950, sqft: 1000, num_beds: 3, num_baths: 2) sesame = Apartment.create(address: "456 Sesame St", monthly_rent: 85...
true
9bf4ea1c367187b01a7b1ead220c9b4169c33876
Ruby
linda-le1/sweater_weather
/app/poros/hourly_weather_forecast.rb
UTF-8
271
3
3
[]
no_license
class HourlyWeatherForecast attr_reader :time, :temperature, :summary def initialize(info, timezone) @time = Time.at(info['time']).in_time_zone(timezone) @summary = info['summary'] @temperature = info['temperature'].round(0) end end
true
6e10fc9797378fef67125244e0fd33474294e2db
Ruby
eloyesp/vfs
/lib/vfs/entries/entry.rb
UTF-8
2,626
2.71875
3
[]
no_license
module Vfs class Entry attr_reader :storage, :path, :path_cache def initialize *args if args.size == 1 and args.first.is_a? Entry entry = args.first @path_cache = entry.path_cache @storage, @path = entry.storage, entry.path else storage, path = *args ...
true
d823ae3434ab79cd9756cabb665de90f00a9d63e
Ruby
codesponge/doctorup
/test/test_codesponge_options.rb
UTF-8
1,152
2.796875
3
[ "MIT" ]
permissive
require 'helper' require 'codesponge' class TestCodespongeOptions < Test::Unit::TestCase context "A class that includes CodeSponge::Options" do setup do class ThingThatHasOptions @@options = {:color => "blue", :scoper => 'class original'} include CodeSponge::Options def initializ...
true
1f9eedaf6ccb4f055ca7af7fb5af74178825ee5b
Ruby
nagyist/philotic
/lib/philotic/connection.rb
UTF-8
5,142
2.78125
3
[ "MIT" ]
permissive
require 'json' require 'bunny' require 'logger' require 'bunny' require 'i18n/core_ext/hash' require 'philotic/constants' require 'philotic/config' require 'philotic/publisher' require 'philotic/subscriber' module Philotic class Connection class TCPConnectionFailed < StandardError attr_reader :url ...
true
90f1b9c9217bc79ca3191713780a33c4962c1af3
Ruby
Naitron-oss/Ruby
/rw_deck.rb
UTF-8
2,694
3.09375
3
[]
no_license
require_relative 'card' class RWDeck def initialize (card_selection = [[3,2,3,3,3,2,3,3,2,2],[2,2,2,3,3,3,3,2,3,2],[3,2,2,2,3,3,3,3,3,3]]) #type is 0, 1, or 2 if construction, attack, or magic card #cost is resource cost #target is 0 for self, 1 for opponent, 2 for both #effects will work in the foll...
true
b912cd041c94f54390b051785a9609027ef062d5
Ruby
DrDhoom/RMVXA-Script-Repository
/modern algebra/ATS Formatting.rb
UTF-8
31,171
2.828125
3
[ "MIT" ]
permissive
#============================================================================== # ATS: Formatting [VXA] # Version: 1.1.5 # Author: modern algebra (rmrk.net) # Date: 26 February 2015 #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Description: # # This script essentially...
true
61e3afb86b30e387802a78e90fee52a92a47df99
Ruby
kahirul/krewl
/lib/krewl/cli.rb
UTF-8
366
2.703125
3
[ "MIT" ]
permissive
require 'thor' module Krewl class Agent < Thor desc 'fetch KEYWORD', 'Fetching products based on KEYWORD' long_desc <<-FETCH Fetching product based on provided KEYWORD FETCH option :site, aliases: '-s' def fetch(keyword) site = options[:site] || :tp puts "Crawling for '#{keywor...
true
3ce0bcb5435911c0ad70627a3f50ad0d36c707e7
Ruby
poonam-Bacancy/spot-testing
/app/services/orders/price_calculators/discount.rb
UTF-8
2,116
2.671875
3
[]
no_license
# frozen_string_literal: true module Orders module PriceCalculators class Discount < BasicCalculator def call return 0.0 unless promotion_code discount_amount end private def promotion_code @promotion_code ||= begin return unless order_args[:promo_code]...
true
7f58bcc320d88ad8517a73c565b8420b4568410c
Ruby
S4NDER/room_quality_monitor
/dev-tools/sensor_simulator.rb
UTF-8
2,785
3.21875
3
[ "MIT" ]
permissive
require 'mqtt' require 'json' $min_luminosity = 0 $max_luminosity = 1000 $min_dB = 20 $max_dB = 110 $min_humidity = 0 $max_humidiy = 10 $min_temp = 5 $max_temp = 45 $send_interval = 10 #Time to wait between sending data $float_accuracy = 2 $float_factor_min = 1.1 $float_factor_max = 1.5 $device_count = 3 $m...
true
fc59d4551028989ba174a0c51000a5ca6c760af1
Ruby
yesi-aracawa/tictactoe
/prueba.rb
UTF-8
431
3.53125
4
[]
no_license
puts "give me the number of volume? only one number por example 3 --- = 3x3" n = STDIN.gets.chomp n = n.to_i n = n * n board = Array.new(n) (0..n-1).each do |i| board[i] = i end (0..n-1).each do |i| print "|_#{board[i]}_|" i...
true
c43adcce7620c4da2dd3f6fc68e715cfcd038277
Ruby
sanjaymavinkurve/obipost
/app/models/user.rb
UTF-8
1,854
2.515625
3
[]
no_license
class User < ActiveRecord::Base attr_accessor :password, :updating_password attr_accessible :name, :email, :password, :password_confirmation has_many :posts, :dependent => :destroy email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i validates :name, :presence => true, :length => { :maximum => 50 } val...
true
bc5681620c4e8d52498d470fc862056de79003aa
Ruby
flopezpires/cGA-GA
/src/cGA.rb
UTF-8
1,661
3.390625
3
[]
no_license
require 'ruby-prof' def onemax(vector) return vector.inject(0){|sum, value| sum + value} end def generate_candidate(vector) candidate = {} candidate[:bitstring] = Array.new(vector.size) vector.each_with_index do |p, i| candidate[:bitstring][i] = (rand()<p) ? 1 : 0 end candidate[:cost] = onemax(candidate[:bits...
true
14b12408d15ff046006e81d7e1b635a4edf0d105
Ruby
dbayo/knorbitheroku
/tools/spam_diff/spam_diff.rb
UTF-8
11,243
3.015625
3
[ "MIT" ]
permissive
require 'rubygems' require 'differ' class SpamDiff START_TAG = "\0"#"$"#"\0" END_TAG = "\1"#"%"#"\1" #FORMAT_START = %Q{<span style="color: #USER#;">} FORMAT_START = %Q{<span class="#USER#">} #%Q{<span style="color: #{userid};">} FORMAT_END = %Q{</span>} def self.diff(old, new, userid) old ||= "...
true
5b8ae97285413e7aa603ae9f07cac73b1bae68c9
Ruby
sunaku/tork
/bin/tork-master
UTF-8
4,378
2.859375
3
[ "ISC" ]
permissive
#!/usr/bin/env ruby =begin ======================================================================= # TORK-MASTER 1 2016-02-13 20.0.1 ## NAME tork-master - absorbs overhead and runs tests ## SYNOPSIS `tork-master` [*OPTION*]... ## DESCRIPTION This program absorbs your Ruby application's test execution overhead on...
true
3a851ddb33b7bfeb00f41035fac3b785d2d0d30b
Ruby
chastell/art_decomp
/test/art_decomp/puts_presenter_test.rb
UTF-8
1,167
2.671875
3
[]
no_license
require_relative '../test_helper' require_relative '../../lib/art_decomp/puts' require_relative '../../lib/art_decomp/puts_presenter' module ArtDecomp describe PutsPresenter do let(:puts_presenter) do puts = Puts[%i[0 - 1 - - 1 0 - - -], %i[- 0 1 - - 0 - 1 - -], %i[- - -...
true
b2336c44a8e190eb60dcf863140a8398fee238ab
Ruby
charlesbjohnson/super_happy_interview_time
/rb/lib/leetcode/lc_107.rb
UTF-8
1,612
3.375
3
[ "MIT" ]
permissive
# frozen_string_literal: true module LeetCode # 107. Binary Tree Level Order Traversal II module LC107 # Description: # Given the root of a binary tree, return the bottom-up level order traversal of its nodes' values. # (i.e., from left to right, level by level from leaf to root). # # Examples:...
true
4dd1c0adcc09cde0119bc9ab54d469e6612dccfb
Ruby
MasonHolland/headcount
/lib/district.rb
UTF-8
378
2.625
3
[]
no_license
require_relative 'district_repository' require_relative 'statewide_test' class District attr_reader :name, :statewide_test def initialize(input, repo = nil) @name = input[:name] @repo = repo end def enrollment @repo.find_enrollment(name) end def statewide_test @repo.sta...
true
e588a34bb1eb2bc2891c9dd07225d03a0bc3110a
Ruby
keoki33/ruby-objects-has-many-through-lab-london-web-career-031119
/lib/appointment.rb
UTF-8
242
2.8125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' class Appointment attr_accessor :date, :patient, :doctor attr_writer attr_reader @@all = [] def self.all @@all end def initialize(date, patient, doctor) @date = date @patient = patient @doctor = doctor @@all << self end end
true
54129b6cb7644c812665a3e5e36c3c12e681e7c2
Ruby
EdwardAndress/ruby_design_patterns
/iterator_pattern/external_iterator.rb
UTF-8
586
3.796875
4
[]
no_license
class Iterator #can work with arrays or strings def initialize(string_or_array) # @aggregate is the thing we want to iterate through @aggregate = string_or_array @current_item_index = 0 end def has_next? # returns true if there is another item beyond the current item (index) @current_item_index < @aggr...
true
81ef0aa5386897362e4a92763b8dbad27bdc50f9
Ruby
holderdeord/hdo-transcript-search
/scripts/correlation_finder.rb
UTF-8
3,123
2.828125
3
[]
permissive
require 'gsl' # brew install gsl && gem install rb-gsl class CorrelationFinder def initialize(opts = {}) @options = { unit: 'count', min: 0.85, flip: false, threshold: 5, min_length: 0, ignored_words: [ 'rotevatn', 'hansson', 'rasmus', 'sveinung', 'breivik', 'k...
true
5811eada81558f6613122e3e90179741b3023c18
Ruby
waagsociety/citysdk-rubygem
/lib/citysdk/file_reader.rb
UTF-8
14,330
2.515625
3
[ "MIT" ]
permissive
require 'csv' require 'geo_ruby' require 'geo_ruby/shp' require 'geo_ruby/geojson' require 'charlock_holmes' require 'tmpdir' module CitySDK class FileReader RE_Y = /lat|(y.*coord)|(y.*pos.*)|(y.*loc(atie|ation)?)/i RE_X = /lon|lng|(x.*coord)|(x.*pos.*)|(x.*loc(atie|ation)?)/i RE_GEO = /^(geom(etry)?|l...
true
2cea6ed2a3ed1edbde46175d4428fb3383b44d8e
Ruby
erplsf/ss-farmer
/application.rb
UTF-8
1,902
2.53125
3
[ "MIT" ]
permissive
require 'rubygems' require 'watir' require 'pry-byebug' require 'dotenv/load' def password_is_set? @password != nil end def setup_password!(browser) return if password_is_set? || !browser.text_field(placeholder: 'Password').exists? password = SecureRandom.hex(16) browser.text_field(placeholder: 'Password').s...
true
c280ce8f75b48a2f7175d0a055adc7b1b64bfc96
Ruby
Marega-Abdoulaye/Une-s-rie-d-exercices-en-Ruby
/exo_20.rb
UTF-8
288
3.453125
3
[]
no_license
puts "Salut, bienvenue dans ma super pyramide ! Combien d'étages veux-tu ?" height = gets.chomp.to_i i = "#" if height >25 or height <1 puts "La pyramide contient entre 1 et 25 étages." else puts "Voici la pyramide :" height.times do puts i i = i + "#" end end
true
7122d3525bd26c10124d893221157d744737356d
Ruby
TakashiMatsuda/ractIP_hom
/testdata/dataset/Concatenated2/jikkenn/testable/toolbox/toolbox/put_by_hyb.rb
UTF-8
1,115
2.609375
3
[]
no_license
#!/usr/bin/ruby files = Dir::entries(Dir::pwd) for filepath in files # find a answer file if /.fa$/ =~ filepath if /hyb-0.fa/ =~ filepath `mv #{filepath} ./hyb-0/` elsif /hyb-1.fa/ =~ filepath `mv #{filepath} ./hyb-1/` elsif /hyb-0.1/ =~ filepath `mv #{filepath} ./hyb-0.1/` elsif /hy...
true
60f78eaf1d60b06cdac1784d428b7a4b5614da1a
Ruby
JosephZhang3/treasure
/src/Loop.rb
UTF-8
739
4.125
4
[]
no_license
# while loop index = 1 while index <= 5 puts index index = index + 1 # ruby 中没有 var++ var-- 写法 end # ++var --var 的写法不起作用 puts index # 打印 6 puts ++index # 同样打印 6 # for loop puts '迭代从0到4' for num in 0..4 puts num end puts '迭代字母表' letter = ['a','b','c','d','e'] for l in letter puts l end # 迭代 Hash 中的键值对。想想Java写同样的逻...
true
18af4e088077ec3bc703852c01b045363f764826
Ruby
dannehdan/chitter-challenge-apprenticeships
/lib/peeps.rb
UTF-8
736
2.796875
3
[]
no_license
require 'pg' require 'date' class Peeps attr_reader :message, :timestamp def initialize(message, timestamp) @message = message @timestamp = Time.parse(timestamp).strftime('%I:%M %p %b %-d, %Y ') end def self.all connection = Peeps.connect peeps = connection.exec 'SELECT * FROM peeps ORDER BY...
true
84cfd58c5e643bf61b2e0a598b522b40664aa0fa
Ruby
sanjsanj/battleships-march-2
/lib/battleships.rb
UTF-8
1,429
2.703125
3
[]
no_license
require 'sinatra/base' require_relative 'board' require_relative 'cell' require_relative 'game' require_relative 'player' require_relative 'ship' require_relative 'water' class BattleShips < Sinatra::Base enable :sessions set :views, Proc.new { File.join(root, "..", "views") } GAME = Game.new get '/' do ...
true
dd411e8fd7967f4e3e188e75f84932d340dee7a6
Ruby
joshbuddy/optitron
/spec/simple_spec.rb
UTF-8
2,560
2.53125
3
[]
no_license
require 'spec_helper' describe "Optitron::Parser" do context "A simple command" do before(:each) { @parser = Optitron.new { cmd "start" cmd "stop" } } it "should parse 'start'" do response = @parser.parse(%w(start)) response.command.should == 'start' respons...
true
1d907ea8302c151ecdde17e1d1afc5e1211d7a89
Ruby
id774/sandbox
/ruby/fixnum_hack.rb
UTF-8
1,500
3.40625
3
[]
no_license
def t(n,e) puts n + ' -- ' + e.inspect end class Fixnum def self.method_missing(mn,*args) hit_single = /^(one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty|thirty|fourty|fifty|sixty|seventy|eighty|ninety)$/ single_integ = P...
true
7b4412a7fac3a079da544747da41f154394ad46f
Ruby
lbluefishl/ruby-exercises
/caesar_cipher.rb
UTF-8
611
4.15625
4
[]
no_license
def caesar_cipher(string, shift) lowercase_alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] upcase_alphabet = lowercase_alphabet.map{|e| e.upcase} new_array = [] split_string = string.split('') split_string.each {|e| if lowercase_alpha...
true
eb77876447cb266daaea177f4f7008894a8af85b
Ruby
Freyzhou/Hatter
/lib/views/view.rb
UTF-8
1,883
2.921875
3
[]
no_license
require 'configuration' require 'termbox' class View attr_reader :colors, :mailbox def initialize(location) @Border_width = 1 @start_x = location[:x0] @start_y = location[:y0] @end_x = location[:x1] @end_y = location[:y1] set_mailbox set_colors end def draw_text(text, x, y) w...
true
39f6f552596764ea5012f55cda8352136c7afef4
Ruby
BobrImperator/coder-dojo-2015
/code_eval_206/spec/lib/lucky_tickets_spec.rb
UTF-8
1,227
2.796875
3
[]
no_license
describe LuckyTickets do describe "#count_lucky_tickets" do it "profiles our awesome example" do require 'ruby-prof' result = RubyProf.profile do LuckyTickets.new(6).count_lucky_tickets end printer = RubyProf::GraphPrinter.new(result) printer.print(STDOUT, {}) end it...
true
dbc6fc0a6482d4b10544c57cf306fb6513d985ad
Ruby
philmccarthy/futbol
/lib/game_teams_manager.rb
UTF-8
3,391
3.0625
3
[]
no_license
require 'csv' require_relative './mathable' require_relative './supportable' class GameTeamsManager include Mathable include Supportable attr_reader :game_teams def initialize(file_location) all(file_location) end def all(file_location) game_teams_data = CSV.read(file_location, headers: true, he...
true
f9eb6ac21305f89672b5f9d517ca30829bee8ca8
Ruby
Arthus2/semaine2_mardi
/3.rb
UTF-8
135
3.171875
3
[]
no_license
def test array = [17,3,6,9,15,8,6,1,10] array.map.with_index do |n, i| if n < array[i+1] puts n else end puts test
true
d97a6e612c302fdc2a4902677c6c1b0c7d396926
Ruby
gonecd/subsmgr
/common/banner.rb
UTF-8
2,336
2.578125
3
[]
no_license
class Banner def initialize(root_dir) # Initialisation des banières de séries @root_dir = root_dir @seriesBanners = @series = {} load_plist cleanup_banners set_banners end # recupere, stocke, et retourne l'image de la serie def retrieve_for(myserie) myserie = myserie.downcase path = banner_path...
true
c6436a2439432b01a23594e1dffb9ceb0e91d9eb
Ruby
kakheti/pathfinder
/app/workers/office_upload_worker.rb
UTF-8
450
2.546875
3
[]
no_license
class OfficeUploadWorker include Sidekiq::Worker def perform(file, delete_old) if delete_old logger.info('Deleting Offices') Objects::Office.delete_all end Zip::File.open file do |zip_file| zip_file.each do |entry| upload_kml(entry) if 'kml' == entry.name[-3..-1] end ...
true
ebbbe1cbe692818e9e200b9dca5c3bd37ebbbc2e
Ruby
kodolabs/examples
/mt/services/stripe_service.rb
UTF-8
2,341
2.53125
3
[]
no_license
class StripeService attr_reader :patient, :token def initialize(patient = nil, token = nil) @patient = patient @token = token end def authorize return [false, nil] unless patient && token return create_customer unless patient.stripe_id customer = Stripe::Customer.retrieve(patient.stripe_i...
true
07244ffca1e055259b703f54f58ae79e9e24c7ed
Ruby
gramo-org/echo_common
/spec/lib/configuration_spec.rb
UTF-8
3,331
2.703125
3
[]
no_license
require 'spec_helper' require "echo_common/configuration" describe "Echo configuration" do let(:env) do { 'SESSION_TIMEOUT_MINUTES' => "120", 'MAX_THREADS' => "8", 'SMS_FROM' => "Gramo" } end class TestConfig < EchoCommon::Configuration private def session_timeout_minutes ...
true
eebd2c183dc43d8768f528f1151329467da165bf
Ruby
jlebrijo/wallet
/app/models/wallet.rb
UTF-8
977
2.515625
3
[]
no_license
class Wallet < ApplicationRecord belongs_to :wallatable, polymorphic: true, optional: true has_many :source_transactions, class_name: 'Transaction', foreign_key: :source_id has_many :target_transactions, class_name: 'Transaction', foreign_key: :target_id def to_s "#{wallatable.name} (##{id})" end def ...
true
535344fdb50e169b210644f88a3193afad154860
Ruby
ccgguang/testup-2
/tests/SketchUp Ruby API/TC_Sketchup_Texture.rb
UTF-8
7,753
2.578125
3
[ "MIT" ]
permissive
# Copyright:: Copyright 2015 Trimble Navigation Ltd. # License:: The MIT License (MIT) # Original Author:: Thomas Thomassen require "testup/testcase" require 'fileutils' # class Sketchup::Texture # http://www.sketchup.com/intl/developer/docs/ourdoc/texture class TC_Sketchup_Texture < TestUp::TestCase def setup ...
true
4d4faaffaee131b7c4f266ae1446a964f076aeae
Ruby
francomac/ruby-concepts
/loops.rb
UTF-8
233
3.09375
3
[]
no_license
enano = 0 gigante = 2 while enano < gigante do puts "hola Enano" enano += 1 end puts "ya no eres Enano :O" for x in 1..100 do puts "hola, esto cuenta #{x}" end indx = 0 for indx in 1..100 do puts indx if indx % 5 == 0 end
true
dad1ffa460f90b3fd01fb6a6431f07e81098093f
Ruby
GarrettJMU/LocalArtFinder
/test/models/message_test.rb
UTF-8
1,431
2.703125
3
[ "MIT" ]
permissive
require 'test_helper' class MessageTest < ActiveSupport::TestCase test 'responds to name, email and body' do msg = Message.new assert msg.respond_to?(:name), 'does not respond to :name' assert msg.respond_to?(:email), 'does not respond to :email' assert msg.respond_to?(:body), 'does not respond to...
true
60c9fdeaa4b226fd8b597743b7a95935f38db232
Ruby
Inndy/ruby-lab
/003_ifelsif.rb
UTF-8
160
3.515625
4
[ "LicenseRef-scancode-public-domain" ]
permissive
print "Which year? " this_year = gets.chomp.to_i if this_year > 2000 puts "y2k is over :)" elsif this_year < 1800 puts "NO WAY!" else puts "Okey..." end
true
e4364a4a9fff806d086c5b148c1cad120373d472
Ruby
lanej/algorithms-ruby
/twopass.rb
UTF-8
1,773
3.171875
3
[]
no_license
require "logger" require "pp" require "set" module Twopass def self.pretty_print(array_of_arrays) array_of_arrays.each { |row| puts row.join(" | ") } end def self.process(picture, debug: false) logger = Logger.new(debug ? STDOUT : nil) region = 0 m = picture.size n = picture.first...
true
4fc0f74fcb7dcfc84575870dc1c8a9c95f3e52a2
Ruby
jpavioli/ruby-object-initialize-lab-houston-web-career-040119
/lib/person.rb
UTF-8
227
3.375
3
[]
no_license
class Person #initialize #name with the persons name def initialize(name) @name = name end #add functionality to update the persons name using the #name= method def name=(new_name) @name = new_name end end
true
4b43380fd30ebf48ef711cb61dfc3dcd9add079f
Ruby
ShinJaehun/association_test01
/app/controllers/messages_controller.rb
UTF-8
3,590
2.53125
3
[]
no_license
class MessagesController < ApplicationController before_action :set_message, only: [:show, :edit, :update, :destroy ] before_action :authenticate_user! load_and_authorize_resource # def show # @posts = Post.where(postable_id: @book.id, postable_type: "Book").order(created_at: :desc) # end # def edit # en...
true
c29ae2ad9aaa15d05264bad57753a7a4327bdda6
Ruby
osorubeki-fujita/odpt_tokyo_metro
/lib/tokyo_metro/factory/convert/customize/api/railway_line/chiyoda_branch_line/generate/list.rb
UTF-8
4,855
2.5625
3
[ "MIT" ]
permissive
class TokyoMetro::Factory::Convert::Customize::Api::RailwayLine::ChiyodaBranchLine::Generate::List < TokyoMetro::Factory::Convert::Common::Api::MetaClass::Fundamental::Updated def initialize( object ) super( object ) @chiyoda_main_line = @object.find { | item | item.same_as == ::TokyoMetro::Modules::Di...
true
c7bd1f2d672b9586f3635ead47bce0961301fa95
Ruby
itsolutionscorp/AutoStyle-Clustering
/assignments/ruby/combine_anagrams/src/19593.rb
UTF-8
125
3.0625
3
[]
no_license
def combine_anagrams(words) result_hash = words.group_by { |a| a.downcase.chars.sort.to_s } return result_hash.values end
true
bc0ad6faf06542db97ca44d6717681ffe0d78295
Ruby
jimbarritt/tutorial
/dojo/ruby/poker/spec/card_spec.rb
UTF-8
356
2.53125
3
[]
no_license
require 'rspec' require 'card' describe Card do it "should have a denomination" do card = Card.new('A','C') card.denomination.should == 'A' end it "should have a suit" do card = Card.new('A','C') card.suit.should == 'C' end it "should have a suit" do card = Card.new('A','H') ...
true
25935ed4fe60a53a66c9976f2e885f99dc132733
Ruby
YosukeItabashi/mercari
/db/fixtures/development/item.rb
UTF-8
869
2.5625
3
[]
no_license
Item.seed do |s| s.id = 1 s.name = "あめ" s.image = "aaa.img" s.description = "オススメ商品です。" s.state = "新品、未使用" s.postage = "送料込み" s.region = "北海道" s.shipping_date = "2〜3日" s.price = "1000" s.saler_id = 1 s.buyer_id = 2 end Item.seed do |s| s.id = 2 s.name = "かさ" s.image = "aaa.img" s.descript...
true