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
709a33828c8e5f05f3f4716309a353fbfb56030a
Ruby
bitjourney/mato
/lib/mato/timeout.rb
UTF-8
590
2.53125
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'timeout' module Mato class Timeout attr_reader :filter attr_reader :duration_sec attr_reader :on_timeout def initialize(filter, timeout:, on_timeout:) @filter = filter @duration_sec = timeout @on_timeout = on_timeout unless on_timeout ...
true
06fe3ed657a687e86210f5aef2243425b7bc4597
Ruby
Agathasta/tower_of_hanoi
/lib/board.rb
UTF-8
1,939
3.625
4
[]
no_license
# frozen_string_literal: true class Board def initialize loop do puts "\n\e[33mHow many disks do you want to play with?\e[0m (minimum 3)" print '> ' @n = gets.chomp.to_i break if @n > 2 end @board = Array.new(3) { Array.new(@n) } @board[0] = (1..@n).map { |n| 'o' * n } dis...
true
2e926772f2c0d2dbc6f931edfb369f801b442ae2
Ruby
fkchang/react_rb_examples
/app/magic_move_buddy_list.rb
UTF-8
1,243
2.65625
3
[]
no_license
require 'magic_move_wrapper' class MagicMoveBuddyList include React::Component define_state :buddies, type: Array before_mount do buddies! [ { name: 'Michelle', online: true }, { name: 'Ethan', online: false }, { name: 'David', online: true }, { name: 'Shawn', onl...
true
85d99c58e7b67a4a49d71545495a17d6b3878515
Ruby
Sbrady11/rubyPractice
/factorial.rb
UTF-8
217
3.65625
4
[]
no_license
# Write a method that takes an integer `n` in; it should return # n*(n-1)*(n-2)*...*2*1. Assume n >= 0. # # As a special case, `factorial(0) == 1`. # # Difficulty: easy. def factorial(n) (1..n).inject(:*) || 1 end
true
3189823a35183c2257f68dca90aa21b8c79c31a3
Ruby
Coding-Gymnasium/2020_turing_module_0
/backend_module_0_capstone/day_4/exercises/say.rb
UTF-8
329
3.828125
4
[]
no_license
puts "hello" puts "hi" puts "how are you" puts "I'm fine" def say(words) puts words + '.' end say("hello") say("hi") say("how are you") say("I'm fine") def say(words= 'hello') puts words + '.' end say() say("hi") say("how are you") say("I'm fine") def some_method(number) number = 7 end a = 5 some_method(a)...
true
0f05bbda2e3d624213d7e2ca5cf72981eac1be1e
Ruby
msware/metasploit-framework
/lib/msf/core/exploit/file_dropper.rb
UTF-8
2,387
2.53125
3
[ "BSD-3-Clause" ]
permissive
# -*- coding: binary -*- module Msf module Exploit::FileDropper # # When a new session is created, attempt to delete any files that the # exploit created. # # @param (see Msf::Exploit#on_new_session) # @return [void] # def on_new_session(session) if session.type == "meterpreter" session.core.use("stdapi"...
true
9d2ebd0db49e4b0e87cc848234557ad084923f1e
Ruby
lholden/http_router
/lib/http_router/path.rb
UTF-8
1,543
2.640625
3
[]
no_license
require 'cgi' class HttpRouter class Path attr_reader :parts, :extension attr_accessor :route def initialize(path, parts, extension) @path, @parts, @extension = path, parts, extension @eval_path = path.gsub(/[:\*]([a-zA-Z0-9_]+)/) {"\#{args.shift || (options && options.delete(:#{$1})) || raise...
true
b52a97d139714b1a0d9504d69713e2ef1dbc4495
Ruby
adeyfemi/RB-101
/lesson_4/more_methods.rb
UTF-8
2,043
4.4375
4
[]
no_license
# => Enumerable#any? [1, 2, 3].any? do |num| num > 2 end # => true # => two return values to be aware of: method returna and block return # => any? looks at the truthiness of the block's return value in order... # => to determine what the method's return will be # => if the block returns a 'truthy' value for any el...
true
78d5128835a549f5f85bb7d2bd43646f344c8b2d
Ruby
davidjeddy/learning_ruby
/ruby-learning/p042regex.rb
UTF-8
155
2.984375
3
[]
no_license
m1 = /Ruby/.match("The future is Ruby") puts m1.class # it returns MatchData m2 = "The future is Ruby" =~ /Ruby/ puts m2 # it returns 14
true
a16267184ba357ab93693225ebbe2a05293876d1
Ruby
vkglh/vegan_singles
/app/models/user.rb
UTF-8
1,593
2.5625
3
[]
no_license
class User < ActiveRecord::Base scope :male, -> { where(gender: 'Male') } scope :female, -> { where(gender: 'Female') } scope :genderfluid, -> { where(gender: 'Genderfluid') } scope :nonbinary, -> { where(gender: 'Non-binary') } mount_uploader :avatar, AvatarUploader mount_uploader :gallery_img_1, Gal...
true
1b17d185457583f827f1976e8ad0c4d8076eccf1
Ruby
janephilipps/ga_homework
/week_6/custom_iterators.rb
UTF-8
1,697
4.5
4
[]
no_license
# Each iterator # Define function each that takes in an array def each(arr) # Define variable i, set to 0 i = 0 # Start while loop to iterate over array while i < arr.length # While iterating over array, call yield (callback) of each (below) yield(arr[i]) # Increment i to continue iteration i +...
true
664d4a4b4b5a9aca9ba7418756e72fcc0570296d
Ruby
WillLiang918/App_Academy
/w1d1/enumerables.rb
UTF-8
1,927
3.9375
4
[]
no_license
class Array def my_each(&prc) i = 0 while i < self.length prc.call(self[i]) i += 1 end return self end def my_select(&prc) result = [] my_each do |el| result << el if (prc.call(el)) end result end def my_reject(&prc) result = [] my_each do |el| ...
true
2bed69041a46cc50ead2fffb853c23bb446bbaa9
Ruby
ChimeraCoder/Babar
/userlist.rb
UTF-8
2,957
2.828125
3
[]
no_license
module Babar class UserList #TODO enforce IMMEDIATE save when ID is defined/not known #Otherwise, retrieve will not work #Also, it is a bad idea not to have an ID defined # # #This constructor should NEVER be called to initialize a new object by the user #The user should create all o...
true
951c371e08103c46b775084f808bea9b64d3b4be
Ruby
Bonky564/furima-35366
/app/models/buy_address.rb
UTF-8
869
2.5625
3
[]
no_license
class BuyAddress include ActiveModel::Model attr_accessor :postal_code, :prefecture_id, :city, :house_num, :building_name, :telephone_num, :user_id, :item_id, :token with_options presence: true do validates :user_id validates :item_id validates :token validates :city validates :house_num ...
true
90643dd3d8d7b9e47dbc9e57f5648407c49c9bb8
Ruby
mmcnickle-float/aoc2020
/day7/node.rb
UTF-8
717
3.359375
3
[]
no_license
# frozen_string_literal: true class Node attr_reader :name, :children, :parents def initialize(name) @name = name @children = [] @parents = [] end def add_child(child, number = 1) children << [child, number] end def add_parent(parent) parents << parent end def ancestor_nodes ...
true
e24ca18b2bb4ea103aa82c745e7e4d05f4d2b135
Ruby
kalehummus/aboringrepo
/app/controllers/books_controller.rb
UTF-8
492
2.59375
3
[]
no_license
class BooksController < ApplicationController require 'uri' def index @query = params[:q] if @query @books = search_by_title(@query) end end def make_url(search) "https://www.googleapis.com/books/v1/volumes?q=" + URI.escape(search.to_s) end def search_by_title(query) url = make_...
true
1289443d352f1f917182db535d526d98c068b74a
Ruby
martinbohman/aoc17
/day6/main.rb
UTF-8
739
3.140625
3
[]
no_license
file = File.open(__dir__ + '/input.txt', 'r') def largest_bank_index(banks) largest_index = 0 for i in 1..banks.length - 1 largest_index = i if banks[i] > banks[largest_index] end largest_index end def redistribute_blocks(banks) i = largest_bank_index(banks) largest_bank_blocks = banks[i] banks[i] =...
true
94420d964db70fc887a5c2ebf77231c3feeeeb9e
Ruby
anjackson/hansard
/spec/models/office_holder_spec.rb
UTF-8
1,679
2.625
3
[]
no_license
require File.dirname(__FILE__) + '/../spec_helper' describe OfficeHolder, " when asked for holders in an interval" do before(:all) do @start_date = Date.new(1844, 1, 3) @end_date = Date.new(1855, 2, 3) @office = mock_model(Office) end it 'should ask for all office holders with associated peo...
true
c64f2d2401768a5ec2d5238c4a729dda00e47b8b
Ruby
icl/cove_old
/lib/def_import.rb
UTF-8
1,992
2.625
3
[ "MIT" ]
permissive
class Def_Import =begin modding code from Paul Panarease's interval import. Pratik Commented it =end def self.import! Dir.foreach("tmp/definitions/") do |file| #for each file in tmp definitions if file =~ /[^(\.|\.\.)].*csv$/ #check if its a CSV file note_file = File.new("tmp/definitions/...
true
63d782dd5210d9a785fab893a7b435f2dc8322e1
Ruby
ogorun/de
/test/de_operator_test.rb
UTF-8
1,514
2.875
3
[]
no_license
require 'test/unit' require 'de' class DeOperatorTest < Test::Unit::TestCase class SomeOperator < De::Operator; end class SomeValidOperand < De::Operand; def valid? true end end class SomeInvalidOperand < De::Operand; def valid? false end end def test_constructor assert_ra...
true
2a8758b5c4fee47c13d95e368a6fed1afcdfe7ef
Ruby
jaswanthJeenu/Ruby-to-MIPS-Compiler
/asgn3/test/test8.rb
UTF-8
254
3.203125
3
[]
no_license
a+1 class Sample @@val =1 @@num = 0 def hello(abc,var) puts "Hello Ruby!" @@num = @a @@b = @@c @a = abc @c = 1 end def bye puts "Bye Ruby" end end object = Sample.new ary = [1,2,3,4,5]
true
5fc3951775c3fd510e7e90167ef990dba5d86258
Ruby
ryandoyle/r10k
/lib/r10k/util/subprocess.rb
UTF-8
2,685
2.8125
3
[ "Apache-2.0" ]
permissive
require 'r10k/logging' require 'r10k/errors' module R10K module Util # The subprocess namespace implements a subset of childprocess. It has # three # main differences. # # 1. child processes invoke setsid() # 2. there are no dependencies on C extensions (ffi) # 3. it only support unixy...
true
90b8b2b6e44564fb414c65b9c7446ff77053b732
Ruby
mcmire/super_diff
/lib/super_diff/operation_tree_flatteners/hash.rb
UTF-8
700
2.640625
3
[ "MIT" ]
permissive
module SuperDiff module OperationTreeFlatteners class Hash < Collection protected def open_token "{" end def close_token "}" end def item_prefix_for(operation) key = key_for(operation) format_keys_as_kwargs? ? "#{key}: " : "#{key.inspect} => ...
true
a95f7410be24e159870c9ace2ea1ed6898445b29
Ruby
VladDaImpaler18/WhatsForDinner-Erb
/lib/scrapers/food_network.rb
UTF-8
2,925
2.8125
3
[]
no_license
# require 'json' module Scrapers module FoodNetwork attr_accessor :payload, :error def self.grab(url) check_url(url) scrape_data(url) @payload end # def valid? # @error.empty? # end protected def self.scrape_data(url...
true
ddb4c02a17d71ce218f8f32ab6aa3ed0e4901a27
Ruby
taw/crypto-fun
/z3_hash_attacks/sha1
UTF-8
2,445
3.296875
3
[]
no_license
#!/usr/bin/env ruby require "digest/sha1" require "pry" def leftrotate(value, shift) return (((value << shift) | (value >> (32 - shift))) & 0xffffffff) end def pad_message(message) byte_string = message.unpack("C*") + [128] extra_zeroes = -(message.size + 9) % 64 byte_string += [0] * extra_zeroes + [message.s...
true
0114c9899a563fc4be006617640a45fec9d100d0
Ruby
nog/atcoder
/contests/abc123/d/main.rb
UTF-8
944
2.609375
3
[]
no_license
x, y, z, k = gets.split.map(&:to_i) a = gets.split.map(&:to_i).sort.reverse b = gets.split.map(&:to_i).sort.reverse c = gets.split.map(&:to_i).sort.reverse results = [] q = [[a[0]+b[0]+c[0],0,0,0]] checks = Hash.new { |h,k| h[k] = Hash.new(&h.default_proc) } while qq = q.shift do results.push qq[0] if results.siz...
true
28d9efd1fb2fc96032881646001c72a0fd23153d
Ruby
car2323/w1
/day5/classrook.rb
UTF-8
313
3.328125
3
[]
no_license
class Rook def initialize (xp, yp, colorp) @x = xp @y = yp @color = colorp end def move? (final_xp, final_yp) if ((@x == final_xp) || (@y == final_yp)) value_return = true else value_return = false end value_return end end
true
bed549810378edbc68ba708638b87b139430f14f
Ruby
aws/aws-sam-cli-app-templates
/ruby3.2/step-func/{{cookiecutter.project_name}}/functions/stock_seller/app.rb
UTF-8
1,142
3.21875
3
[ "Apache-2.0" ]
permissive
require 'securerandom' require 'date' def lambda_handler(event:, context:) # Sample Lambda function which mocks the operation of selling a random number # of shares for a stock. # For demonstration purposes, this Lambda function does not actually perform any # actual transactions. It simply returns a mocked ...
true
e3de75053360df0680c145d6e78973eb54568946
Ruby
delphinefoo/tealeaf_intro_to_programming
/Variables/name.rb
UTF-8
1,095
4.0625
4
[]
no_license
# 1. puts "Type in your name" name = gets.chomp puts "Hi there, #{name}!" #3. 10.times do puts name end #4. puts "What's your first name?" first_name = gets.chomp puts "What's your last name?" last_name = gets.chomp puts "Your full name is " + first_name + ' ' + last_name =begin 5. Look at the following programs...
true
b687916ad9d2e606d926d7131e3cfba8c444edb7
Ruby
samvera/questioning_authority
/app/services/qa/linked_data/authority_url_service.rb
UTF-8
4,565
2.546875
3
[ "Apache-2.0" ]
permissive
# Provide service for constructing the external access URL for an authority. module Qa module LinkedData class AuthorityUrlService class << self # Build a url for an authority/subauthority for the specified action. # @param action_config [Qa::Authorities::LinkedData::SearchConfig | Qa::Autho...
true
65a386ef3d4a2f67410eb44b6183eefab8c7c82d
Ruby
CelesteComet/Image-Check
/imagetest.rb
UTF-8
2,937
2.578125
3
[]
no_license
gem 'minitest' require 'minitest/autorun' require 'phashion' class ImageTest < Minitest::Test def check_images(img1, img2, true_or_false, description) img1 = Phashion::Image.new(img1) img2 = Phashion::Image.new(img2) print description + ":" + img1.distance_from(img2).to_s assert_equal true_or_false...
true
dadd4fcf240456da9a952f628aa66efd16993d60
Ruby
Mattc007/ruby_euler
/145.rb
UTF-8
693
3.71875
4
[]
no_license
# Some positive integers n have the property that the sum # [ n + reverse(n) ] consists entirely of odd (decimal) digits. # For instance, 36 + 63 = 99 and 409 + 904 = 1313. We will call # such numbers reversible; so 36, 63, 409, and 904 are reversible. # Leading zeroes are not allowed in either n or reverse(n). # ...
true
cfb82733c6e6c52115cd9c4faaed146b76f85a2f
Ruby
willhowes/caesar_shift
/spec/caesar_shift_spec.rb
UTF-8
1,140
3.296875
3
[]
no_license
require 'caesar_shift' describe '#moving_shift' do it 'increments a given letter by the number given as a parameter' do expect(moving_shift('a', 1)).to eq(['b', '', '', '', '']) end it 'increments a given letters by the number and plus one for additional letters' do expect(moving_shift('ab',1)).to eq(['b...
true
f8fa339fb8235074940057d8f2c0d002713e2bd9
Ruby
nathanielltaylor/Korning
/import.rb
UTF-8
3,137
2.875
3
[]
no_license
# Use this file to import the sales information into the # the database. require 'CSV' require "pg" require 'pry' def db_connection begin connection = PG.connect(dbname: "korning") yield(connection) rescue PG::UniqueViolation ensure connection.close end end employees = [] customers = [] products ...
true
0c9669ed9b941037c7da248433fc661f41d47e98
Ruby
Ronica27/ruby
/method_practice.rb
UTF-8
156
3.046875
3
[]
no_license
def my_first_method puts "This is my first method!" end def adding_numbers puts 2+2 puts "This is my second method!" end my_first_method adding_numbers
true
d1d6ab9980ced66c91ee39b13d07c0f8c298bfd9
Ruby
davenguyen/book_em
/lib/annotator.rb
UTF-8
4,006
2.6875
3
[]
no_license
class Annotator DB = Sequel::Model.db MODELS_PATH = Rails.root.join('app', 'models') class << self def annotate models_updated = [] table_names = DB.tables.map(&:to_s) table_names.each do |table_name| begin schema = Schema.new(table_name) schema.commit! ...
true
35b146d187129da8e146329cfb1ee982bfe4b34b
Ruby
rmk8796/Ruby
/bike_showroom_application/run_showroom.rb
UTF-8
1,669
3.859375
4
[]
no_license
require './bike' require './validate_input' include ValidateInput # Display menu of showroom def display options = [ '********Welcome to BikeInfo********', '1. Add Bike', '2. Compare Bikes', '3. Change Bike Details', '4. List Bikes', '5. Find Bike with Max Milege', '6. Find Bike with Max ...
true
f0ce017207af7f1d56dbddc59d572778952d6b23
Ruby
RobinSoubry/phase-0
/week-6/gps.rb
UTF-8
4,338
3.96875
4
[ "MIT" ]
permissive
# Your Names # 1) Robin Soubry # 2) Caitlin Hoffman # We spent [2] hours on this challenge. # Bakery Serving Size portion calculator. # INITIAL SOLUTION # # Creation of a method to evaluate the number of items you can make, based on the number of ingredients available. # def serving_size_calc(item_to_make, num_of_in...
true
9c387775d7bffb6bf200c2f7ee7acdd23f34bd87
Ruby
Yesware/deferrable_gratification
/spec/deferrable_gratification/primitives_spec.rb
UTF-8
2,081
2.703125
3
[ "MIT" ]
permissive
require 'deferrable_gratification' describe DeferrableGratification::Primitives do describe '.success' do describe 'DG.success' do subject { DG.success } it { should succeed_with_anything } end describe 'DG.success(42)' do subject { DG.success(42) } it { should succeed_with 42 ...
true
4e7ea583360ebc6f63c9051bfdba754e83d2744f
Ruby
darrenhaken/admix
/lib/admix/admix_controller.rb
UTF-8
1,728
2.828125
3
[ "MIT" ]
permissive
require_relative '../../lib/admix/utils/settings' require_relative '../../lib/admix/cumulative_flow_diagram_logic/mingle_cfd_data_point_loader' require_relative '../../lib/admix/cumulative_flow_diagram_logic/cfd_filler_for_worksheet' require_relative '../../lib/admix/utils/backfill_date_calculator' class AdmixControll...
true
4367424f19b056226137009d2836e4286d6434b3
Ruby
wenbo/rubyg
/sample/CHAPTER06/139/transpose.rb
EUC-JP
834
3.71875
4
[]
no_license
a1 = [1,2,3]; a2 = [4,5,6]; a3 = [7,8,9] a = [a1,a2,a3] # => [[1, 2, 3], [4, 5, 6], [7, 8, 9]] # Array#transposeפžֹ롣 a.transpose # => [[1, 4, 7], [2, 5, 8], [3, 6, 9]] # Array#zipפꤹ뤳ȤǤžֹϵ롣 a1.zip(a2,a3) # => [[1, 4, 7], [2, 5, 8], [3, 6, 9]] # ԰פε󼡸롣 a4 = [7,8]; a = [a1,a2,a4]...
true
2780921843ddacbdace6046f22e05602b4cd5913
Ruby
steveklabnik/request_store
/lib/request_store/middleware.rb
UTF-8
714
2.515625
3
[ "MIT" ]
permissive
require 'rack/body_proxy' # A middleware that ensures the RequestStore stays around until # the last part of the body is rendered. This is useful when # using streaming. # # Uses Rack::BodyProxy, adapted from Rack::Lock's usage of the # same pattern. module RequestStore class Middleware def initialize(app) ...
true
9fadc2d9343d7169a666a649528b5d4717b4ebc6
Ruby
yushch/Algorithm_Practice
/algo-part1-coursera/week3/random_contraction_2.rb
UTF-8
1,217
3.171875
3
[]
no_license
def find_min_cuts(graph, trials) def contract(graph, node_1, node_2) # joins the two nodes' edges and eliminates self loops graph[node_1] = (graph[node_1] + graph[node_2]) graph[node_1].delete(node_1) graph[node_1].delete(node_2) graph.delete(node_2) graph end def update_graph(gra...
true
23d6ed754f24355a50c04cb43888ee8215de3c67
Ruby
swathidev2021/Rubyassignment
/exercise1.rb
UTF-8
222
3.0625
3
[]
no_license
puts "hello world" puts "hello again" puts "I like typing this" puts "This is fun." puts "I like Drawing" puts "i like painting" puts "I \"said\" do not touch this" puts "I'd must rather you 'not'" # puts "what did it do"
true
43bc47c454640026c93f979ad4c38a6b088ed486
Ruby
Reoooh/FoA5
/02/mergesort.rb
UTF-8
768
3.859375
4
[ "Apache-2.0" ]
permissive
# better one: https://gist.github.com/bih/9726300 def merge(array_u, array_v) i,j,k = 0,0,0 u = array_u.length - 1 v = array_v.length - 1 array_s = Array.new while i <= u && j <= v if array_u[i] < array_v[j] array_s << array_u[i] i += 1 else array_s << array_v[j] j += 1 e...
true
213c16f30b4784a3376e6a6298caf551229b4d8a
Ruby
gavinlaking/vedeu
/lib/vedeu/error.rb
UTF-8
4,664
2.921875
3
[ "MIT" ]
permissive
# frozen_string_literal: true module Vedeu # Custom exceptions/errors which Vedeu will raise in certain # circumstances. # # @api private # module Error # Raised with Vedeu attempts to access a client application # controller's action that does not exist. # class ActionNotFound < Standard...
true
0ce6d13045714a2eee2f646c68abe7f713591945
Ruby
jacobyarborough/relational_rails
/spec/features/subscribers/index_spec.rb
UTF-8
2,368
2.59375
3
[]
no_license
require 'rails_helper' RSpec.describe 'the subscribers index page' do before :each do @channel_1 = Channel.create(name: 'ABC', cost: 25, spanish: false) @channel_2 = Channel.create(name: 'CBS', cost: 20, spanish: true) @sub_1 = @channel_1.subscribers.create(name: 'Jacob', age: 25, top_mark...
true
b5b4254bff4dd94b098482c55fde6bd5c635db53
Ruby
Jonwheeler/sandbox
/lib/sandbox/connection.rb
UTF-8
587
2.578125
3
[ "MIT" ]
permissive
require "rest_client" module Sandbox class Connection BASE_URL = "http://some-url.com/api/v1/containers" attr_reader :resp def initialize @resp = {} end def create(params) @resp = RestClient.post("#{BASE_URL}/create", params) self end def destroy(name) @resp = ...
true
9acee74933f67e467ee4b0d8272c3d78d71a58d1
Ruby
BenWix/climbing_routes_finder
/lib/route.rb
UTF-8
1,075
3.40625
3
[]
no_license
class Route attr_reader :name, :grade, :type, :stars, :id, :location, :specific_location, :pitches @@all = [] def initialize(name, grade, type, stars, id, specific_location, pitches, location) @name = name @grade = grade.split(".")[1] @type = type @stars = stars @i...
true
dcbb292e32883268c6b08e61084758c34d90c69a
Ruby
onokatio/usb-script2015
/gui.rb
UTF-8
661
2.671875
3
[]
no_license
#!/usr/bin/ruby require "tk" window = TkRoot.new { title 'gui' # resizable [0,0] } window2 = TkToplevel.new { title 'gui2' geometry '30x20+1+1' } #TkRoot.new() { title "Hello, Linux World ! " } TkLabel.new(nil,:"text" => "Hello, Linux World ! ",).pack myproc = Proc.new { puts 'a' } name = '' entry = TkEn...
true
799e7c79e3ede9c1a177c9bab53ffa65c22d4d5c
Ruby
alu0100845396/p10-coveralls
/lib/mygem_prct06/alimento.rb
UTF-8
3,082
3.75
4
[]
no_license
# encoding: utf-8 # Programa principal - Práctica 9: Programación funcional # Esta clase ha sido creada para la realización # de las prácticas de Ruby de la asignatura Lenguajes y Paradigmas de la Programación, # basada en la clasificación de alimentos según su grupo alimentario, junto a su proporción # de proteínas, ...
true
41dce6cb1aacddfe197ce3858fef0cc28a5b728d
Ruby
lgants/remarkup
/spec/models/highlights_model_spec.rb
UTF-8
1,999
2.65625
3
[]
no_license
require 'factory_girl_rails' require "rails_helper" describe Highlight, '.transform_snippets' do before do @ind_1 = 10 @ind_2 = 20 @cur_snippet_0 = [] @cur_snippet_1 = [[@ind_1, @ind_2]] @highlight_0 = Highlight.new(snippets: "#{@cur_snippet_0}") @highlight_1 = Highlight.new(snippets: "#{@cur...
true
95b288c9452b3eda287e8d5796a8023d8b18036f
Ruby
estebansa19/the-well-grounded-rubyist
/submodule-6/quit_or_not.rb
UTF-8
322
3.328125
3
[]
no_license
def quit_or_not print 'Exit the program? (yes or no):' answer = gets.chomp case answer when 'yes', 'y' puts 'bye!' exit when 'no' puts 'Ok, we will continue' else puts 'that is an unknown answer, assuming you meant no' end puts 'continuing with program...' quit_or_not end quit_or_no...
true
7ee8f9b9f341d9632206f931a31019259541b2b3
Ruby
saifulAbu/ProgrammingRuby
/24/class-eval2.rb
UTF-8
69
2.5625
3
[]
no_license
"cat".instance_eval('puts "upper=#{upcase}, length=#{self.length}"')
true
523e0fa43c7e3b88d88a057dbdaa7d20f9f96284
Ruby
dejakin/oo-basics-london-web-082619
/lib/shoe.rb
UTF-8
612
3.671875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Shoe def initialize(brand) @brand = brand end def brand @brand end def color=(color_name) @color = color_name end def color @color end def size=(number) @size = number end def size @size end def material=(str...
true
77e88ba7e688ef9cc8fd1985356a9b5c14e1b0c6
Ruby
antor3/ejerciciosCondicionales
/pruebas.rb
UTF-8
1,262
4
4
[]
no_license
#CONDICIONALES #Saluda a través de la consola! ej: "Hola makers, mi nombre es:-----" #1. A través de la consola es posible pedirle al usuario que ingrese su nombre, si es su nombre debe decir "hola (tuNombre)", de lo contrario, "No eres (nombre), intenta de nuevo" #2.Si el número esta entre 10 y 15 imprimir "El núme...
true
4b8f4942704cf60187cb08934b6894b39ec34a9b
Ruby
epistemeiosis/moonphases
/test/test_fullness.rb
UTF-8
3,258
2.921875
3
[ "MIT" ]
permissive
require 'test/unit' require 'moonphases' require 'date' require 'pathname' class FullnessTest < Test::Unit::TestCase def test_fullness_to_s fullness = Fullness.new(99, "+") assert_equal "Phase: Full", fullness.to_s end def test_fullness_newmoon fullness = Fullness.new(1, "-") assert_equal "Ph...
true
64bf53fa4c74fdaf7d35c6b2d785523ac56352d9
Ruby
mohammadaliawan/ls-prep
/intro_to_prog/hashes/practice1.rb
UTF-8
204
2.796875
3
[]
no_license
#The #merge method returns a new hash consisting of the contents of two hashes #while #merge! method modifies the original hash by adding the contents of other_hsh to hsh. # merge! is a mutating method.
true
e2d788b9b4919feb2a2e0f7b216729c70b4fb3a3
Ruby
RabeaGleissner/tictactoe
/app/models/match.rb
UTF-8
2,246
2.984375
3
[]
no_license
class Match < ActiveRecord::Base has_many :moves belongs_to :player_x, class_name: 'User', foreign_key: 'player_x_id' belongs_to :player_o, class_name: 'User', foreign_key: 'player_o_id' belongs_to :winner, class_name: 'User' def computer_position all_positions = [1,2,3,4,5,6,7,8,9] player_x_moves = ...
true
47900fb00b72498f5dffc4095b2745564d050cc2
Ruby
nickf94/Question-and-Answers
/src/questions_answers.rb
UTF-8
2,636
3.328125
3
[]
no_license
class Questions_and_Answers attr_reader :questions def initialize #questions arr passed here maybe? @questions = [ { question: "What years was world war 2 in?", answers: [ "1939 - 1945", "1914 - 1918" ], correct: "1939 - 1945" ...
true
01cca9b4390d903eece1320104086ba6f1d17b0e
Ruby
jennyf0792/01-mario-lab
/pyramid.rb
UTF-8
969
3.71875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
#write your code here def mario_blocks(height) level = 1 height.times do puts " "*(height-level) + "#"*level + " " + "#"*level level += 1 end end puts "How tall would you like to make your pyramid?" user_height = gets.chomp.to_i puts "how many of the pyramids do you want?" ...
true
f9cbe2d350fa4114547538b25ce3c77b551e8f95
Ruby
akexinad/topics
/05-ruby/ex1.rb
UTF-8
484
4.875
5
[]
no_license
# 1. Drinking age? # Ask the user for their age. # Remember that anytime you get input, it is a string, so you will need to change the age input to a number. # If age is less than 18, print an appropriate message. # If the age is equal to or over 18, print a different message. print "How old are you? " age = gets.chom...
true
a324fe623a79c0d19b6ec24b10460374391c52b5
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/accumulate/2cdfed84a8eb43f6a481c1fe937f8a91.rb
UTF-8
88
3.140625
3
[]
no_license
class Array def accumulate r = [] each do |e| r << (yield e) end r end end
true
4c22b68ca78c4eb75a64dd3c13fefc83bfe82c8a
Ruby
monterail/foosball
/app.rb
UTF-8
1,056
2.53125
3
[]
no_license
# frozen_string_literal: true require "sinatra" require "pry" require "json" require_relative "app/slack_authorizer" require_relative "app/slack" require_relative "app/team" require_relative "app/notification_builder" use SlackAuthorizer team = Team.new def user_params(params) params.values_at("user_id", "user_na...
true
4a8c73741a45f244f6d6f66f7185e8d9e658461d
Ruby
doctorjane/purpleair_advance_pipeline
/bin/fetch_sensor_data.rb
UTF-8
888
2.515625
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require "date" require "json" require_relative "../lib/script_helpers" sensor_list_file = ARGV[0] start_date = Date.parse(ARGV[1]) end_date = Date.parse(ARGV[2]) def pa_url(thingspeak_id, thingspead_read_key, start_date, end_date) "https://thingspeak.com/channels/#{thingspeak_id}/feed.json?api_k...
true
7e787e99fce4907818aba5bd0794d1433be56a09
Ruby
RTurney/Bank-tech-test
/lib/bank.rb
UTF-8
1,373
3.625
4
[]
no_license
# frozen_string_literal: true require_relative 'statement' # Bank class class Bank attr_reader :balance # Error message contsants NEGATIVE_BALANCE_ERROR = 'Request denied. Not enough money in account.' NEGATIVE_INPUT_ERROR = 'Cannot input negative values.' INCORRECT_INPUT_ERROR = 'Request denied. Please ent...
true
8e6e3b8d8f808b23db1d7312663109ed8208d860
Ruby
PinkDeer/ruby
/rubyschool/lesson09/app2.rb
UTF-8
168
3.234375
3
[]
no_license
def get_password print "Type password: " # введите пароль return gets.chomp * 3 end xx = get_password puts "Был введен пароль: #{xx}"
true
f26356be41da0306ae77656ab8b8309903b1b294
Ruby
isabella232/skoogle-docs
/lib/skoogle_docs/bots/styled_lists.rb
UTF-8
1,258
2.90625
3
[ "MIT" ]
permissive
module SkoogleDocs module Bots # Bot in charge of applying custom directives to lists # # @api public class StyledLists < SkoogleDocs::Bots::Bot # Looks for lists with directives and applies css class to them # # @param dom [Nokogiri::HTML::Document] the html document to transform ...
true
baa87302bf9bf9f5f67165c036b9d005dbb65714
Ruby
ga-wolf/wdi-18
/07-sql/animals_with_ar/main.rb
UTF-8
3,686
2.96875
3
[]
no_license
require 'pry' # Debugging require 'sinatra' # Server require 'sinatra/reloader' # Live updating server require 'sqlite3' # Ruby interface to SQLite3 require 'active_record' ActiveRecord::Base.establish_connection( :database => 'database.db', :adapter => 'sqlite3' ) # ActiveRecord::Base.logger = Logger.new( STDERR ...
true
dd297e2bcbb0c54fce47614380d451b23a46b5c6
Ruby
calabash/run_loop
/lib/run_loop/physical_device/life_cycle.rb
UTF-8
7,192
2.640625
3
[ "MIT" ]
permissive
module RunLoop # @!visibility private module PhysicalDevice # Raised when installation fails. class InstallError < RuntimeError; end # Raised when uninstall fails. class UninstallError < RuntimeError; end # Raised when clear app data fails class ResetAppSandboxError < RuntimeError; end ...
true
b68eaa1eb712453ef0148773984b159a02871ea3
Ruby
flinc/concealer
/lib/concealer/strategy/blacklist.rb
UTF-8
333
2.71875
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
class Concealer::Strategy::Blacklist < Concealer::Strategy::Allow def initialize(blacklist) @blacklist = blacklist end def allow?(model, method, args) return false if blacklisted_methods(model).include?(method) super end private def blacklisted_methods(model) @blacklist[model.class] ||= ...
true
236a2a171696d9bf006bcccffd27feb71aedf73e
Ruby
pjotrp/rq
/lib/rq/orderedhash.rb
UTF-8
4,525
2.78125
3
[ "BSD-3-Clause" ]
permissive
# AUTHOR # jan molic /mig/at/1984/dot/cz/ # # DESCRIPTION # Hash with preserved order and some array-like extensions # Public domain. # # THANKS # Andrew Johnson for his suggestions and fixes of Hash[], # merge, to_a, inspect and shift # # USAGE # just require this file and use OrderedHash instead of...
true
6ffed9daa84ec274a32622507ed105661ea87221
Ruby
jmschles/advent-of-code
/day3/spherical_houses.rb
UTF-8
1,895
3.703125
4
[]
no_license
DIRECTION_PARSER = { '<' => :west, '>' => :east, 'v' => :south, '^' => :north } class Santa attr_accessor :x_pos, :y_pos, :active def initialize(name) @name = name @active = false @x_pos = 0 @y_pos = 0 end end class HouseMap attr_reader :grid, :santas def initialize(santas) @sa...
true
f204dc9002b97d9b748b27783abe36add05faf44
Ruby
jcoglan/eventful
/lib/eventful.rb
UTF-8
3,815
3.15625
3
[ "MIT" ]
permissive
require 'observer' require 'methodphitamine' # Adds named event publishing capabilities to the class that includes it. # Actually composed of three modules: +Observable+ (from Ruby stdlib), # +ObservableWithBlocks+, and +Eventful+ itself. See +README+ for examples. module Eventful VERSION = '1.0.0' # The +Obser...
true
092795dbaee59a15331e19bb5786d2ad9b482980
Ruby
MahmudH/learn_to_program
/ch09-writing-your-own-methods/roman_numerals.rb
UTF-8
845
4.0625
4
[]
no_license
def roman_numeral num roman = '' roman = roman + 'M' * (num / 1000) roman = roman + 'D' * (num % 1000 / 500) roman = roman + 'C' * (num % 500 / 100) roman = roman + 'L' * (num % 100 / 50) roman = roman + 'X' * (num % 50 / 10) roman = roman + 'V' * (num % 10 / 5) roman = roman + 'I' * (num % 5 / 1) # r...
true
ff7fc671151db5184508d16ccb2462b93d8ca786
Ruby
koss-lebedev/assorted-riddles
/run_length_encoding.rb
UTF-8
273
2.578125
3
[]
no_license
def encode(input) input.gsub!(/(.)\1*/) { |match| (match.size > 1 ? match.size.to_s : '') + match[0] } end require 'minitest/autorun' describe 'encode function' do it 'returns correct result' do assert_equal encode('aaabb77daa8cccd'), '3a2b27d2a83cd' end end
true
21a90a279932ead2b2cfed701e3cfb5a618bb159
Ruby
nunsez/ruby-rush
/rubytut2/lesson15/03/spec/game_spec.rb
UTF-8
522
2.78125
3
[ "Apache-2.0" ]
permissive
require 'game' describe Game do it 'should be lose' do game = Game.new('загадка') %w[п о р а ж е н и е].each { game.next_step(_1) } expect(game.status == -1).to be true expect(game.errors).to eq 7 end end describe Game.new('загадка') do it { is_expected.to have_attributes(s...
true
effecc9e50c8f3532e026fb97f9df1b12ca556f8
Ruby
marcusfgardiner/bank_tech_test
/lib/transactions.rb
UTF-8
1,629
3.640625
4
[]
no_license
require 'date' require_relative 'statement_printer' class Transactions attr_reader :balance, :transactions, :statement_printer ERRORS = { number_format: 'Please provide an integer or number to 2 decimal places', positive_number: 'Please provide a positive amount', date_format: "Not a correct date. Ple...
true
5e91697b3cfe760d3dee9ed0081cd0b9a5962912
Ruby
LucyWeltner/cartoon-collections-online-web-ft-110419
/cartoon_collections.rb
UTF-8
489
3.296875
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def roll_call_dwarves(dwarf_array)# code an argument here dwarf_array.each_with_index do |dwarf, index| puts "#{index + 1}. #{dwarf}" end end def summon_captain_planet(calls) calls.map do |call| call[0] = call[0].upcase call + "!" end end def long_planeteer_calls(calls) calls.any? {|call| call.l...
true
166528aca4a6c6369b3b775244068f423ed9fed1
Ruby
HasanAbbadi/config
/movie.rb
UTF-8
5,450
2.75
3
[]
no_license
require 'httparty' require 'open-uri' require 'nokogiri' require 'cli/ui' print "Search: " input = gets if (input.chomp === ":q") then abort("exit") end search_query = input.gsub(" ", "+") search_url = "https://s3.dotcima.com/?s=" + search_query CLI::UI::StdoutRouter.enable CLI::UI.frame_style = :bracket url = "" ...
true
9c1cb963ad8b642855326b36d67ac92446e92a8d
Ruby
sylantyev/adam
/experimental/calypso/bloomberg_requester.rb
UTF-8
5,242
2.578125
3
[]
no_license
# Author:: Tom Statter, Andy Griffiths # Date:: Aug 2008 # # About:: Quick n Dirty class to build request, connect & decrypt from BBG ftp site # => TODO - Needs productionising - where config and env detials come from etc require 'rubygems' require 'thread' require 'erb' require 'bloomberg_ftp' require ...
true
6929563a804ef113ed55f31b2b2723992f12148e
Ruby
arlequine/CC-Rub_CSV
/csv.rb
UTF-8
2,047
3.875
4
[]
no_license
#use the CSV format. Information read and know overwrite files in this format #'faker' and 'CSV' are required require 'faker' require 'csv' class Person #Create the Person class with the following attribute: #first_name, last_name, email, phone, created_at #read an write attributes attr_accessor :first_nam...
true
859640af0909c79436b259600898c86ce6dda067
Ruby
m00p1ng/learn-ruby-on-rails
/01-example/array.rb
UTF-8
600
4.21875
4
[]
no_license
a = [1, 2, "mooping"] puts a[0] puts a[2] puts a.include?("mooping") puts a.reverse # ! used for mutate variable puts a.reverse! # .to_a = to array puts (0..25).to_a b = (1..10).to_a # [1, 2, 3, ..., 10] b.push(25) b << 25 # [1, 2, 3, ..., 10, 25] b.unshift(-1) # [-1, 1, 2, 3, ..., 10] b.pop # [1, 2, 3, ..., ...
true
580c4f0c3cc460ff047e6b50d6f05d5ed141d07c
Ruby
albertobraschi/stats_for_all
/lib/stats_for_all/stats_for_all_client.rb
UTF-8
8,859
2.953125
3
[ "MIT" ]
permissive
require 'drb' module StatsForAll module Client def self.included(base) base.extend ClassMethods end module ClassMethods def stats_for_me(*types) has_many :stats, :dependent => :destroy, :as => :model types.each do |type| StatsForAll::CONFIGURATION["types"][typ...
true
685f22bdc343684f7757438215bdfc191b31ab08
Ruby
sinefunc/ohm
/test/mutex_test.rb
UTF-8
1,868
2.84375
3
[ "MIT" ]
permissive
require File.expand_path(File.join(File.dirname(__FILE__), "test_helper")) class TestMutex < Test::Unit::TestCase class Person < Ohm::Model attribute :name end setup do Ohm.flush @p1 = Person.create :name => "Albert" @p2 = Person[1] end context "Using a mutex on an object" do should "pr...
true
3117b2edaa166d3201596a816f1538323bc8d6b2
Ruby
spencerdcarlson/206
/class/Test_LinkedList.rb
UTF-8
227
3.171875
3
[]
no_license
require './LinkedList.rb' begin @ll = LinkedList.new @ll.unshift "Tom" @ll.push "Spencer" @ll.push "Geffory" @ll.each {|n| puts n} @ll.shift @ll.shift @ll.shift @ll.shift @ll.push "THANKS" @ll.each {|n| puts n } end
true
63e55f1f4761bc493b4b7bcd2fd665d2ef41df05
Ruby
KazkiMatz/rack-esi
/lib/rack-esi/threaded.rb
UTF-8
1,020
2.609375
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
require 'thread' #require 'timeout' class Rack::ESI class Finisher < Proc def self.wait(queue) finisher = new do |worker| puts "Finishing #{ worker.inspect }..." worker[:finish] = true queue.push finisher end # cast the first stone queue.push finisher # wa...
true
29e4c9168e591708f7dc8b13d3cb98a91a6d9533
Ruby
isaacjarquin/sinatra_app
/app/adapters/bill_adapter/package_adapter.rb
UTF-8
891
2.796875
3
[]
no_license
class BillAdapter class PackageAdapter def initialize(package) @package = package end def self.adapt(package) new(package) end def subscriptions bill_subscriptions.map do |subscription| SubscriptionAdapter.adapt(subscription) end end def total packa...
true
32b6a8dce73d579cabf4f59454eb9f4afa937265
Ruby
mattetti/pomodori
/lib/pomodori/migration.rb
UTF-8
749
2.53125
3
[]
no_license
require 'pomodori/kirby_storage' require 'thirdparties/kirbybase' class Migration TIMESTAMP_REGEXP = /\|timestamp:Time/ def self.migrate(file) content = File.read(file) File.open(file, 'w+') do |f| f << content.gsub(TIMESTAMP_REGEXP, "|timestamp:String") end end ## # Database migr...
true
3fb016523714e41d9ffee961740eda41ca0b469d
Ruby
tbbennett1/AppAcademy
/code_for_video_demos-master/W7D2|W2D4 - Big O/4 - Binary Search/bsearch.rb
UTF-8
1,189
3.609375
4
[]
no_license
class Array def slow_search(target) self.each_with_index do |el, i| puts 'Slowly searching...' return i if target == el end nil end # O(n) def bsearch(target) puts 'Bsearching...' return nil if self.empty? probe_index = self.length / 2 case tar...
true
77d947d5600a4205ae69d4429637196c82c6f536
Ruby
Lucx14/Exercism-Ruby
/perfect-numbers/perfect_numbers.rb
UTF-8
329
3.375
3
[]
no_license
# frozen_string_literal: true # Perfect Numbers module PerfectNumber def self.classify(num) raise RuntimeError unless num.positive? aliquot = (1...num).select { |n| n if (num % n).zero? }.sum if aliquot == num 'perfect' elsif aliquot > num 'abundant' else 'deficient' end ...
true
bfe9143139a7054c09255eb3c0ce99a152da1070
Ruby
godaddy/spree
/core/app/models/spree/stock/adjuster.rb
UTF-8
580
2.625
3
[ "BSD-3-Clause" ]
permissive
# Used by Prioritizer to adjust item quantities # see prioritizer_spec for use cases module Spree module Stock class Adjuster attr_accessor :variant, :need, :status def initialize(variant, quantity, status) @variant = variant @need = quantity @status = status end ...
true
2abe988ba39f1f9bb3f6f0b883ade244e44608cb
Ruby
notori0us/sitemap
/sitemap.rb
UTF-8
961
2.890625
3
[]
no_license
require_relative 'page' def site_map(starting_url: 'https://mozilla.org', max_depth: 10) discovered = {} search_recursive(URI(starting_url), discovered, max_depth) puts "Writing file 'sitemap.json'" File.open('sitemap.json', 'w') do |f| f.write(JSON.pretty_generate(discovered.values.map {|page| page.to_h_...
true
f714f278dcbde8c580fa5ffb10c505ef135ee6c3
Ruby
1c7/neb.rb
/lib/neb/key.rb
UTF-8
4,206
2.78125
3
[ "MIT" ]
permissive
# encoding: utf-8 # frozen_string_literal: true module Neb class Key KDF = "scrypt".freeze CIPHER_NAME = "aes-128-ctr".freeze MACHASH = "sha3256".freeze KDF_N = 1 << 12 KDF_R = 8 KDF_P = 1 DKLEN = 32 KEY_CURRENT_VERSION = 4 KEY_VERSION_3 = 3 attr_accessor ...
true
a68f1f3ee227934976ff4ac4d948442152ddfbe0
Ruby
DouglasAllen/code-Programming_Ruby_3rd_ed
/Part_IV--Ruby_Library_Reference/ch27_Built-in_Classes_and_Modules/Alphabetical_Listing/Time/cdesc-Time.rb
UTF-8
2,170
2.6875
3
[]
no_license
=begin Time < Object ------------------------------------------------------------------------------ Includes: Comparable (from ~/.rdoc) (from ~/.rdoc) ------------------------------------------------------------------------------ Time is an abstraction of dates and times. Time isstored internally as the number of se...
true
0d8c92af170f3ca40cae6e3744c42f7daeb2fd69
Ruby
JoseDLopez/DL_Ruby
/Clase030_Ejercicios_06_Multiple_Array.rb
UTF-8
667
3.875
4
[]
no_license
# Se tienen dos arreglos # El primero es del tipo [1,2,3,0,1,2,2,1,2,1,2,0,3] El segundo es del tipo [:azul, :verde, # :amarillo] # Se pide cambiar todas las apariciones del número que aparece en el arreglo 1 por el # elemento con el mismo índice del arreglo 2, en caso de no existir el elemento deberá # ser remplazado ...
true
aa6efe91263461db7a7860440b483fb2a664651f
Ruby
Lojistic/DarkSky-gem
/lib/darksky_weather/api/weather_collection.rb
UTF-8
1,393
3.1875
3
[ "MIT" ]
permissive
# Given a set of WeatherData objects, merge, normalize and aggregate data points for analysis purposes module DarkskyWeather module Api class WeatherCollection include WeatherAnalysis attr_reader :start_date, :end_date, :daily, :hourly, :minutely def initialize(*weather_datas) @weathe...
true
0d55a186e0386c16df0e1a734edd107ed3c8ee06
Ruby
suzuki-navi/atcoder
/ARC104/D_Multiset_Mean/v4.rb
UTF-8
661
3.28125
3
[]
no_license
# TLE n, k, m = gets.strip.split(" ").map(&:to_i) table = [[1]] for i in 1..n-1 t1 = table[i-1] t2 = [] for j in 0 .. i * (i+1) * k / 2 a1 = ((j - (i - 1) * i * k / 2) + i - 1) / i; a1 = 0 if a1 < 0 a2 = j / i; a2 = k if a2 > k s = 0; for a in a1 .. a2 s += t1[j - a * i] end ...
true
d61acd33ca32cd6a783c2d2598a5bfbe3d9bf84f
Ruby
msimon42/sweater_weather
/app/models/apikey_generator.rb
UTF-8
156
2.71875
3
[]
no_license
class ApikeyGenerator def self.generate letters = ('a'..'z').to_a numbers = (0..9).to_a (letters + numbers).sample(25).shuffle.join end end
true
1ca7a5c2eed46dcb792295942fa0c60ef639ad56
Ruby
kasey-purvor/reviews-katas
/june7th/spec/filter_spec.rb
UTF-8
1,294
3.28125
3
[]
no_license
require 'filter.rb' array = [60,10,45,60,1500] example_output = [60,40,45,60,1000] lower = [20] upper = [1500] no_change = [500] three_in_a_row = [20, 1500, 500] describe Filter do it "applies the default filter to the example array" do f = Filter.new expect(f.bandpass(lower)).to...
true