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
e525882f8b297312a1e7ccf589a6f52a7f9f7875
Ruby
mindmatters/fixturama
/lib/fixturama/changes/chain/raise_action.rb
UTF-8
1,086
2.53125
3
[ "MIT" ]
permissive
class Fixturama::Changes::Chain # # @private # Raise a specified exception as a result of stubbing # class RaiseAction attr_reader :repeat def call raise @error end private def initialize(**options) @error = error_from options @repeat = repeat_from options rescue ...
true
b5a7a5f869f5525318f01fc19d1440a45b641cad
Ruby
cfritsch5/app_academy_work
/W1/W1/W1D1_enumerables/susoku/tile.rb
UTF-8
272
3.296875
3
[]
no_license
require 'colorize' class Tile def initialize(value = nil , given = false) @given = given @value = value end def to_s if @given @value.nil? ? " " : @value.to_s.colorize(:blue) else @value.to_s.colorize(:light_black) end end end
true
091a9cb540d5b806bb209a27376909202f89e691
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/word-count/dac56a5bb0024187963a035187616b3a.rb
UTF-8
335
3.421875
3
[]
no_license
class Phrase def initialize(sent) @sent_arr = sent.scan(/\w+'\w+|\w+/i) end def word_count count_hash = {} @sent_arr.each do |word| if count_hash[word.downcase] == nil count_hash[word.downcase] = 1 else count_hash[word.downcase] += 1 end end return count_h...
true
9360da6bc80cff912b92fd554e0391cb024f9ad7
Ruby
felipemfp/programacao-de-computadores
/listas/lista-03/exercicio-15.rb
UTF-8
479
3.125
3
[]
no_license
s = gets.chomp.split('') r = '' s.each do |char| r += case char when 'P' 'Z' when 'O' 'E' when 'L' 'N' when 'A' 'I' when 'R' 'T' when 'Z' 'P' when 'E' 'O' when 'N' 'L' when 'I' 'A' when 'T' 'R' when 'p' 'z' when 'o' 'e' when 'l' 'n' when ...
true
08e8a48615a41d0d2ae186493e41e754188c2c12
Ruby
nholden/deaf_grandma
/talk_to_grandma.rb
UTF-8
176
3.21875
3
[]
no_license
require './grandma.rb' grandma = Grandma.new puts 'Grandma: HELLO, SONNY!' until grandma.heard_bye? print 'You: ' puts 'Grandma: ' + grandma.respond_to(gets.chomp!) end
true
c31dcd89ce76f9337c7bc605946d2e030e51acb7
Ruby
tysonbloxham/challenges
/frame.rb
UTF-8
324
3.4375
3
[]
no_license
puts "What sentence would you like to frame for posterity?" input = gets.chomp.split limit = 0 input.each do |x| if x.length > limit limit = x.length end end (limit+2).times do print "*" end puts input.each do |x| extra = limit - x.length puts "*" + "#{x}" + " "*extra + "*" end (limit+2).times do print "*"...
true
3960a1cc685172dbf095600fd35d969ce4c67570
Ruby
abazlinton/week_5_project_1
/models/animal.rb
UTF-8
1,686
3.390625
3
[]
no_license
require_relative('../db/sql_runner') require('pry') class Animal attr_accessor :name, :type, :admission_date, :owner_id, :adoptable attr_reader :id def initialize(options) @id = options['id'].to_i if options['id'] @name = options['name'] @type = options['type'] @admission_date = options['admiss...
true
83d6262d8a042b3d5502a116f85eabec857706db
Ruby
idkjay/Launch
/week2-http/magical-creatures/models/magical_creature.rb
UTF-8
286
3.515625
4
[]
no_license
class MagicalCreature attr_reader :name, :ability, :age def initialize(name, ability, age = nil) @name = name @ability = ability @age = age end def ancient? if @age.nil? || @age > 200 return true elsif @age <= 200 return false end end end
true
e165bef9b414fa27d8454bda619dce3b466b9f84
Ruby
torresga/launch-school-code
/exercises/challenges/medium_1/luhn.rb
UTF-8
5,025
4.25
4
[]
no_license
# Luhn Algorithm # # The Luhn formula is a simple checksum formula used to validate a variety of identification numbers, such as credit card numbers and Canadian Social Insurance Numbers. # # The formula verifies a number against its included check digit, which is usually appended to a partial number to generate the fu...
true
bbbd3a90224abadbd3240ed0e50cb5d3dd5a54b4
Ruby
yehudamakarov/growing
/app/models/user.rb
UTF-8
577
2.546875
3
[ "MIT" ]
permissive
class User < ActiveRecord::Base validates_format_of :email, with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i validates_presence_of :username, :email validates_uniqueness_of :username has_secure_password has_many :tasks def slug self.username.downcase.gsub(" ", "-") end def self.find_by_slug(slu...
true
bf6fc5829e284a5a7994f25b238f0a1ed9c54e6f
Ruby
cppforlife/bosh_release_diff
/lib/bosh_release_diff/filters/comparator.rb
UTF-8
764
2.59375
3
[ "MIT" ]
permissive
require "bosh_release_diff/filters/abstract" require "bosh_release_diff/filters/changes_and" require "bosh_release_diff/filters/values_and" module BoshReleaseDiff::Filters class Comparator def self.from_changes_and_values(changes, values) filters = [MatchAll.new] # default filters << ValuesAnd.from_...
true
fee7a9ddde58b75c9adab8cfdb83bd37c76e93cf
Ruby
marianovarela/login-exercise
/models/user.rb
UTF-8
704
3.46875
3
[]
no_license
require_relative '../models/invalid_password_error.rb' class User def initialize(username, password) if(is_a_valid_password(password)) @username = username @password = password else raise InvalidPasswordError.new("Invalid Password") end end def username return @userna...
true
430e21c30a5a6ec199bd7ed2690a23270fe12c7d
Ruby
iracooke/protk
/bin/maker_to_proteindb.rb
UTF-8
3,575
2.640625
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby # # This file is part of protk # Created by Ira Cooke 4/9/2013 # # require 'protk/constants' require 'protk/tool' require 'protk/gff_to_proteindb_tool' require 'bio' tool=GffToProteinDBTool.new([:explicit_output,:debug,:add_transcript_info]) tool.option_parser.banner = "Create a protein database ...
true
cab15c30f813a94025abad241d0ab1c59b93e5bc
Ruby
abhmul/project-euler
/problem-scripts/factorial_sum.rb
UTF-8
307
3.75
4
[]
no_license
def factorial(num) product=1 while num!=1 do product*=num num-=1 end product end def sum(num) str = num.to_s array = str.split("") array1 = array.map(&:to_i) sum = array1.inject(:+) sum end #puts factorial(100) puts sum(factorial(100))
true
4b5919a4d315f64b20f5a2cc66a5b9c70bd6f3fd
Ruby
mrwerner392/ruby-enumerables-reverse-each-word-lab-dumbo-web-080519
/reverse_each_word.rb
UTF-8
244
3.703125
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# reverse each word in a string without changing word order def reverse_each_word(string) words_arr = string.split reversed_words_array = words_arr.collect{ |word| word.reverse } reversed_words_string = reversed_words_array.join(" ") end
true
aafd68589c0e98839981fc3772e5e0dd0afcfeae
Ruby
cryptoshell/ar-exercises
/exercises/exercise_5.rb
UTF-8
582
3.234375
3
[]
no_license
require_relative '../setup' require_relative './exercise_1' require_relative './exercise_2' require_relative './exercise_3' require_relative './exercise_4' puts "Exercise 5" puts "----------" # Use sum to output total revenue @sum_revenue = Store.sum(:annual_revenue) puts @sum_revenue # Use average to output average...
true
68330a868e056ed0d54e68f8fb05c4febcee5ef8
Ruby
scalpol/taller-objetos-2
/ejercicio.rb
UTF-8
573
3.75
4
[]
no_license
class Carta attr_reader :pinta, :numero def initialize pintas = %i[corazon pica diamente trebol] @pinta = pintas[rand(3)] @numero = rand(1..13) end end def menu puts '¿Que desea hacer? (jugar, mostrar, salir)' gets.chomp.downcase end seleccion = '0' while seleccion != 'salir' seleccion = menu ...
true
c16795fb79d6cbfb5e2f9f3f732850327d89da03
Ruby
Calvinjwala/ruby_challenges_lab
/challenge_bonus.rb
UTF-8
477
4.0625
4
[]
no_license
$result = Array.new def user(response) if response == "yes" name elsif response == "no" puts "Here is a summary of your student array:" $result.each_with_index do |values, index| p "The student at #{index} is #{values}" end end end def name puts "What is the student's name?" students ...
true
d5d81b6fb80a1dc34ec10989ba56f8e78803cb11
Ruby
xiaohui-zhangxh/pg_query
/lib/pg_query/deparse/interval.rb
UTF-8
3,310
2.90625
3
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class PgQuery module Deparse module Interval # A type called 'interval hour to minute' is stored in a compressed way by # simplifying 'hour to minute' to a simple integer. This integer is computed # by looking up the arbitrary number (always a power of two) for 'hour' and # the one for 'mi...
true
15e041aa66b37b38a97fc3f8ed621398c7cc10b1
Ruby
Linzeur/codeable-exercises
/week-2/extended-project/banzai/todo-list/cli_test.rb
UTF-8
2,463
3.21875
3
[]
no_license
require "./cli" def init puts "init" @task = read_file end def back puts "back" save_file(@task) end RSpec.describe "Test cli" do before(:each) do init end after(:each) do back end # context "in method read" do # it "expect read_file! return 3 elements" do # tasks = read_file ...
true
36cbb1dbd33d77f82a65f88adb38d87c20dfbb94
Ruby
schambers/snippets
/jazzjukebox/src/Volume.rb
UTF-8
279
3.421875
3
[]
no_license
class Volume def initialize self.left_channel = self.right_channel = 99 end attr_accessor :left_channel, :right_channel def set(volume) self.left_channel = self.right_channel = volume end def to_s "channels: #{self.left_channel} - #{self.right_channel}" end end
true
d96072a968a2bb28bd52ba096c3b0e015d22ae47
Ruby
shaunjacobsen/learning_ruby
/bonus-wheel_of_fortune.rb
UTF-8
6,037
3.71875
4
[]
no_license
# This script seeks to emulate the Wheel of Fortune game show @puzzles = [ ["Occupation", "Front end developer"], ["Person", "The Queen of England"], ["Before & After", "A Hole in One Way Ticket"], ["Before & After", "Beer Nuts And Bolts"], ["Family", "Venus and Serena Williams"], ["On the Map"...
true
3e415cb6c4f80afa85cf455fb58fe7adb9ceef0c
Ruby
jrbeck/dotmatrix
/dot_matrix.rb
UTF-8
1,568
3.359375
3
[ "MIT" ]
permissive
require './font_reader.rb' require './sample_font.rb' require 'pp' class EmojiWriter DEFAULT_POSITIVE_SPACE = '.'.freeze DEFAULT_NEGATIVE_SPACE = ' '.freeze def initialize(positive_space, negative_space) @positive_space = positive_space || DEFAULT_POSITIVE_SPACE @negative_space = negative_space || DEFAU...
true
8909a5606773d977e80dcd326a4f46850d0333d9
Ruby
JustinData/GA-WDI-Work
/w03/d03/Bradley/sandbox/crunchbase_scrape.rb
UTF-8
93
2.59375
3
[]
no_license
file = File.new("companies.txt", "a+") file[0..10].each do |line| puts line end file.close
true
0113c3365485801bd1c52c0f22604fbe50b5d8b6
Ruby
woundedfrog/Ruby-prep-exercises
/ruby final exercises/ex14.rb
UTF-8
513
3.234375
3
[]
no_license
contact_data = [["joe@email.com", "123 Main st.", "555-123-4567"], ["sally@email.com", "404 Not Found Dr.", "123-234-3454"]] contacts = {"Joe Smith" => {}, "Sally Johnson" => {}} keys = [:email, :address, :phone] #assigns these 3 hashes to the "keys" variable contacts.each_with_index do |(name, hash), ...
true
790acce94a709d0ddc2ffe6a2871603e94bde0e8
Ruby
stephancom/xkcd-287
/lib/exord/menu.rb
UTF-8
973
3.171875
3
[ "MIT" ]
permissive
module Exord # a collection of menu items class Menu attr_reader :items def initialize(title = 'Menu') @title = title.strip @items = SortedSet.new end def add_item(item) @items << item end alias << add_item def parse_lines(lines) lines.each do |line| @i...
true
2b679796959baf0280b5207cbd489328e3afc42a
Ruby
BelgianBiodiversityPlatform/data.biodiversity.be
/lib/tasks/utils.rake
UTF-8
3,696
2.671875
3
[]
no_license
CUST_FOLDER_NAME = 'custom' CUST_FOLDERS = ['./config/locales/','./public/documents/','./public/images/', './public/stylesheets/', './app/views/' ].map { |x| x + CUST_FOLDER_NAME } namespace :utils do desc "Un-customize the application." task :uncustomize do config_folder_path = ENV['config_folder_path'] ...
true
3812b6fcd73bb793201b5b083615314bf41a4455
Ruby
feedreader/pluto.live.starter
/planet.rb
UTF-8
854
2.53125
3
[ "LicenseRef-scancode-public-domain" ]
permissive
# encoding: utf-8 class Planet < Sinatra::Base ####################### # Models include Pluto::Models # e.g. Feed, Item, Site, etc. ################### # Helpers def feed_path( feed ) "/feed/#{feed.key}" end def root_path() "/" end ############################################## ...
true
5f2b329f426f796b16d3ee3088fc197b33a824cb
Ruby
jessicacaley/slack-cli
/specs/user_spec.rb
UTF-8
1,451
2.71875
3
[]
no_license
require_relative "test_helper" describe "User" do describe "Initialization" do let(:slack_id) { 20 } let(:username) { "soph" } let(:real_name) { "Sopheary" } let(:status_text) { "Good to go" } let(:status_emoji) { ":)" } it "can be instantiated" do user = Slack::User.new(slack_id, user...
true
b543d8e2c03f962f15f22be54c4caa6319fcdb02
Ruby
evendis/gmail_cli
/lib/gmail_cli/imap.rb
UTF-8
1,749
2.671875
3
[ "MIT" ]
permissive
require 'net/imap' require 'net/http' require 'uri' require 'gmail_xoauth' module GmailCli # Command: convenience method to return IMAP connection given +options+ def self.imap_connection(options={}) GmailCli::Imap.new(options).connect! end class Imap include GmailCli::LoggerSupport attr_accesso...
true
edbdd595653e8c0f589d879456cc0ddc40d3dd60
Ruby
Havko/projecteuler
/ruby/problem2.rb
UTF-8
449
3.34375
3
[]
no_license
def fib() prev = 1 newnum = 1 sum = 0 limit = 4000000 (0..4000000).each do |i| if (prev%2 == 0) sum += prev end current = newnum newnum+=prev prev = current if sum >= limit break end end return sum end def fibtest(num) prev = 1 newnum = 1 sum = 0 (0..n...
true
42e0ac7a2774c2f660e3d2cd77e085369a947933
Ruby
jlalmeidaf/escopa_15T
/card.rb
UTF-8
467
3.25
3
[]
no_license
class Card def initialize valor,naipe @valor = valor @naipe = naipe end def valid? (1..13).include? @valor end def value @valor end def value_for_escopa (@valor < 8) ? @valor : @valor - 3 end def name return "as" if @valor == 1 return @valor.to_s if @valor > 1 and @valor < 11 retu...
true
91debcc54662c4dfc7622b70200b697dfe2324f4
Ruby
whtouche/wdi_1_ruby_lab_methods
/demo.rb
UTF-8
1,178
3.90625
4
[]
no_license
## One method =begin def greeting(first_name, last_name, options = {}) options[:product] = 'WDI' if options[:product].nil? options[:excited] = true if options[:excited].nil? greeting = "Hi, #{first_name} #{last_name} here for #{options[:product]}!" options[:excited] ? greeting.upcase : greeting end puts greet...
true
318243fb7a3bbd2df512a7bc2c7abdfc44b0f65c
Ruby
RomanADavis/challenges
/advent/2015/day13/solutions/part1.rb
UTF-8
1,652
3.9375
4
[]
no_license
# --- Day 13: Knights of the Dinner Table --- # In years past, the holiday feast with your family hasn't gone so well. Not # everyone gets along! This year, you resolve, will be different. You're going # to find the optimal seating arrangement and avoid all those awkward # conversations. # # You start by writing ...
true
073af334c4e7ef970f111cb357c44b19c39ea266
Ruby
dsshim/Chiseler
/lib/list_parser.rb
UTF-8
691
3.140625
3
[]
no_license
require "pry" class ListParser attr_accessor :text, :format_text, :f_list, :list, :first_char def initialize(text) @text = text @f_list = "" end def self.parse(text) new(text).parse end def parse paragraph apply_tags end def paragraph para_text = @text.split("\n") para_t...
true
26bda8946b77c0497a24fb7b17da977b26886c2e
Ruby
codeAligned/aa-prep-work
/codeeval/easy/62_n_mod_m/spec/62_n_mod_m_spec.rb
UTF-8
1,192
3.828125
4
[]
no_license
require "62_n_mod_m" # # N MOD M # ## CHALLENGE DESCRIPTION: # # # Given two integers N and M, calculate N Mod M # (without using any inbuilt modulus operator). # # ### INPUT SAMPLE: # # Your program should accept as its first argument # a path to a filename. Each line in this file contains # two comma separated posit...
true
d596311820e30b8951494e5b72ef73eb82dc28df
Ruby
shafiqam/leetcode
/ruby/graphs/clone_graph.rb
UTF-8
739
3.53125
4
[]
no_license
# Definition for a Node. # class Node # attr_accessor :val, :neighbors # def initialize(val = 0, neighbors = nil) # @val = val # neighbors = [] if neighbors.nil? # @neighbors = neighbors # end # end # @param {Node} node # @return {Node} def cloneGraph(node) # O(n), O(n), n: edges + vertices...
true
00e7f3a46b90976b3ad54f3c3a03c6cceb2d25c5
Ruby
yakataN/Atcoder_practices
/abc123/D/main2.rb
UTF-8
536
2.953125
3
[]
no_license
x, y, z, k = gets.chomp.split.map(&:to_i) a_ary = gets.chomp.split.map(&:to_i) b_ary = gets.chomp.split.map(&:to_i) c_ary = gets.chomp.split.map(&:to_i) c_ary.sort! {|a, b| b <=> a } ans_ab = [] # 10^6 for i in 0...x for j in 0...y ans_ab << a_ary[i] + b_ary[j] end end # 10^6*logN ans_ab.sort! {|a, b|...
true
9daf312f3144e01d306b971585a75d7cb35ec992
Ruby
Jesus/hashcode2018
/lib/position.rb
UTF-8
159
3.3125
3
[]
no_license
class Position attr_accessor :r, :c def initialize(r, c) @r = r @c = c end def distance_to(pos) (pos.r-@r).abs + (pos.c-@c).abs end end
true
bd3cd1356826a052431e6cd01e08607412c3a8b3
Ruby
RossCodes/LRTHW
/ex10.rb
UTF-8
1,059
3.984375
4
[]
no_license
# Exercise Ten tabby_cat = "\tI'm tabbed in." persian_cat = "I'm split\non a line." backslash_cat = "i'm \\ a \\ cat." fat_cat = """ I'll do a list: \t* Cat food \t* Fishies \t* Catnip\n\t* Grass """ puts tabby_cat puts persian_cat puts backslash_cat puts fat_cat # STUDY DRILL # Use ''' instead. Can you see why yo...
true
b78e04dd90c484a11ce88da802820801acda380e
Ruby
habanero2012/aizu_online_judge
/ALDS1/1_12_a.rb
UTF-8
1,834
3.171875
3
[]
no_license
class Vertex class << self def register(index, weights) @vertexes ||= {} @vertexes[index] = new(index, weights) end def find(index) @vertexes[index] end def each @vertexes.each { |_, v| yield v } end end attr_reader :index attr_accessor :parent def initializ...
true
a351e3ac87814e6e997c1eb717f6a7ce3d5737c2
Ruby
dahal/tailwindcss-rails
/test/purger_test.rb
UTF-8
1,986
2.515625
3
[ "MIT", "OFL-1.1" ]
permissive
require "test_helper" class Tailwindcss::PurgerTest < ActiveSupport::TestCase test "extract class names from string" do assert_equal %w[ div class max-w-7xl mx-auto my-1.5 px-4 sm:px-6 lg:px-8 sm:py-0.5 translate-x-1/2 ].sort, Tailwindcss::Purger.extract_class_names(%(<div class="max-w-7xl mx-auto my-1.5 p...
true
5cfb1509c45ecd8e45c9cb1bcdbd89aad74031e7
Ruby
aknishi/SQL-AA-questions
/user.rb
UTF-8
1,453
2.765625
3
[]
no_license
require_relative 'references.rb' class User attr_accessor :fname, :lname def self.all data = QuestionDBConnection.instance.execute("SELECT * FROM users") data.map { |datum| User.new(datum) } end def self.find_by_id(id) data = QuestionDBConnection.instance.execute(<<-SQL, id) SELECT ...
true
3de22a1e941304796a548e3c4e8d6ed57089bb37
Ruby
fsanggang/Learn_Ruby_The_Hard_Way
/ex28/ex28.rb
UTF-8
769
3.171875
3
[]
no_license
puts "1: #{true and true}" puts "2: #{false and true}" puts "3: #{1 == 1 and 2 == 1}" puts "4: #{"test" == "test"}" puts "5: #{1 == 1 or 2 != 1}" puts "6: #{true and 1 == 1}" puts "7: #{false and 0 != 0}" puts "8: #{true or 1 == 1}" puts "9: #{"test" == "testing"}" puts "10: #{1 != 0 and 2 == 1}" puts "11: #{"test" != ...
true
ab182bc592d5b571e71c246fbfcd0ad92c598c51
Ruby
project-kotinos/ConOnRails___ConOnRails
/app/models/concerns/truthiness.rb
UTF-8
107
2.9375
3
[ "Apache-2.0" ]
permissive
module Truthiness def is_truthy?(flag) ['true', 'TRUE', :true, true, '1', 1].include? flag end end
true
02487cf173cfc71c6b449104cb767bd6e4c3381d
Ruby
cjkula/stunt
/spec/stunt/javascript_spec.rb
UTF-8
4,690
2.78125
3
[]
no_license
require 'spec_helper' class TestClass def some_method; end end def jsTestClass "function TestClass(value) { window.testFlag = true; this.value = value; }\n" end module SomeNamespace class NamespacedClass; end end def jsClassContainer "window.SomeNamespace = { NamespacedClass: function() { ...
true
53cb0088c8250fd715ed939bac89f4787aca7a52
Ruby
ExtractOfCactus/week_2_homework_1
/library/spec/library_spec.rb
UTF-8
1,173
3.15625
3
[]
no_license
require('minitest/autorun') require_relative('../library.rb') class TestLibrary < Minitest::Test def setup @library = Library.new(@books = [ { title: "book1", rental_details: { student_name: "Chuck", date: "06/11/2016" } }, { title: "book2", ...
true
982a15ac9b89a3ac4ba234e9b499031e9d3d63b6
Ruby
transparentclassroom/dojo
/ruby/hackerrank/medium/magic_square.rb
UTF-8
1,178
3.765625
4
[]
no_license
# https://www.hackerrank.com/challenges/magic-square-forming # # Given a 3x3 matrix, find the lowest cost to turn it into a magic square. # # Trainers: Andrew MAGIC_SQUARES = [[[8, 1, 6], [3, 5, 7], [4, 9, 2]], [[6, 1, 8], [7, 5, 3], ...
true
605ecc08851691e9281cf65555c2baa58dc0f61d
Ruby
ZeroCater/code-challenges
/generic-ruby/solutions.rb
UTF-8
351
2.796875
3
[]
no_license
require 'date' require_relative 'week' require_relative 'row' module Solutions def greater_than_avg(numbers) end def sort_fruit(fruits) end def reverse_hash_keys(hash) end def get_week_for(day) end def number_of_days_in_month_for(day) end def palindrome?(str) end def parse_ascii_table(a...
true
2f83efb28173420cfa3370e6c56730b37b5ea374
Ruby
feigningfigure/WDI_NYC_Apr14_String
/w01/d03/Joel_Rosenblatt/mta/test.rb
UTF-8
449
3.671875
4
[]
no_license
#puts "What line are you on? 'N', 'L', or 'S'?" #start_line = gets.chomp.downcase.to_sym def prompt puts "Where are you starting from?" start_station = gets.chomp if $trains[:n_line].include? start_station == true puts $trains[:n_line] elsif $trains[:l_line].include? start_station == true puts $trains[:l_line] els...
true
d2b0b2b88402a6da30929c6413061689cf949937
Ruby
kurisu/abcrunch
/lib/abcrunch/ab_result.rb
UTF-8
900
2.71875
3
[ "MIT" ]
permissive
module AbCrunch class AbResult attr_accessor :raw, :ab_options def initialize(raw_ab_output, ab_options) @raw = raw_ab_output @ab_options = ab_options end def command AbCrunch::AbRunner.ab_command(@ab_options) end def avg_response_time raw.match(/Time per request:\s*...
true
b2932dab91d863d0a9e32b76c01affa0661e211b
Ruby
Andriamanitra/adventofcode2020
/day01/benchmarks.rb
UTF-8
1,887
3.75
4
[]
no_license
require "benchmark" TARGET = 2020 input = ARGF.readlines def my_part1(input) numbers = input.map(&:to_i).sort left = 0 right = numbers.size - 1 while left < right while right > left && numbers[left] + numbers[right] > TARGET right -= 1 end while left < right && numbers[left] + numbers[right]...
true
b66cddacfb6a3c6e9f6d1a918eac6e6ecebe5107
Ruby
azirbel/dotfiles
/fish/recent_git_branches.rb
UTF-8
549
2.890625
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby # Written by Nick Green require 'io/console' begin require 'colorize' rescue LoadError puts 'Running without colors. Install colorize gem for colors' end branches = `git branch --sort=-committerdate | head -n 10`.lines max_length = branches.map(&:length).max branches.each_with_index do |bran...
true
f4532e346b957de8e1477c5ec436a8032e650a72
Ruby
id774/sandbox
/ruby/excel/write_sample.rb
UTF-8
1,098
2.78125
3
[]
no_license
require 'spreadsheet' Spreadsheet.client_encoding = 'UTF-8' book = Spreadsheet.open 'template.xls' # シート 1 を読み込み sheet1 = book.worksheet 0 # 事業部名 sheet1[0, 1] = "第五金融事業部" # 案件 sheet1[1, 2] = "ほげほげ案件 (作番 xxxx-xxxxx)" # 概要 sheet1[2, 4] = "概要を Ruby で記入します" # ユーザ sheet1[3, 4] = "ほげほげ商事" # 契約先 sheet1[3, 7] = "ふがふがシステ...
true
f10a81c912787eee1dc00c43c203a8b270debb75
Ruby
Tolaa1/simple-loops-london-web-career-031119
/simple_looping.rb
UTF-8
886
4.25
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# REMEMBER: print your output to the terminal using 'puts' def loop_iterator(number_of_times) loop do puts phrase = "Welcome to Flatiron School's Web Development Course!" answer = gets.chomp breake if answer == 10 end def times_iterator(number_of_times) 4.times do puts phrase = "Welcome to Flatiron Scho...
true
686392a13eeeeda12669f7c2c1eea4ca3c28f149
Ruby
rafaj777225/Cursocodeacamp
/Pre-Work/Examen.rb
UTF-8
4,075
3.859375
4
[]
no_license
=begin # ¿Qué tipo de datos son cada una de las siguientes variables? # ¿De que clase es cada uno y como lo puedes comprobar? v = 9.0 w = ["1", "f", 4] x = 1.4 y = "3" z = {name: "Javier", email: "mail@codea.mx", fase: 1} =end # ¿Qué tipo de datos son cada una de las siguientes variables? # Respuesta # v una variab...
true
ceeb9e03742582ccb63c5b77ca64f18789b9303c
Ruby
YoheiMurata/ComiChecker
/src/Twitter/Data/Contributor.rb
UTF-8
266
2.796875
3
[]
no_license
class Contributor # Twitter ID @id @screen_name def initialize @id = nil @screen_name = nil end def id return @id end def id=(id) @id = id end def screen_name return @screen_name end def screen_name=(name) @screen_name = name end end
true
66700f93e56216a5c35535c8aa61f653c99dd357
Ruby
byroot/agrora
/lib/nntp_client.rb
UTF-8
2,268
2.609375
3
[]
no_license
require 'nntp' class NNTPClient class Group attr_reader :name, :first, :last def initialize(name, first=0, last=0) @name = name @first = first.to_i @last = last.to_i end def to_s @name end end NNTPException = Class.new(Exception) UnknowGroupException =...
true
1f78e03baaa305393a843eb0d59acde5facc1161
Ruby
openbohemians/fly
/prototype/lib/fly/kernel.rb
UTF-8
5,752
3.109375
3
[ "BSD-2-Clause" ]
permissive
module Fly # Type type class Type YAML::add_private_type( 'type' ) { |type,val| Type.new(val) } attr_accessor :name, :template def intialize( str ) @template = parse( str ) end def parse( str ) # tie in kwalify system here str end def compile( name ) @name ...
true
4a5f1b7d50d6c9a12f7a521ac5eab9e4fca1159d
Ruby
barkerja/discordrb
/lib/discordrb/errors.rb
UTF-8
757
2.5625
3
[ "MIT" ]
permissive
# frozen_string_literal: true module Discordrb # Custom errors raised in various places module Errors # Raised when authentication data is invalid or incorrect. class InvalidAuthenticationError < RuntimeError # Default message for this exception def message 'User login failed due to an ...
true
333fa909e69b9a224f98f7028701c5a4c49e48f5
Ruby
joshuamsmith413/square_array-nyc-web-career-031119
/square_array.rb
UTF-8
107
3.0625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def square_array(array) # your code here answer = [] array.each { |i| answer << i ** 2} answer end
true
d07325a2d13792d11ba1b6a8dc7abf45ef83b1aa
Ruby
muxinc/mux-ruby
/lib/mux_ruby/api_error.rb
UTF-8
1,720
2.640625
3
[ "MIT" ]
permissive
=begin #Mux API #Mux is how developers build online video. This API encompasses both Mux Video and Mux Data functionality to help you build your video-related projects better and faster than ever before. The version of the OpenAPI document: v1 Contact: devex@mux.com Generated by: https://openapi-generator.tech OpenAP...
true
64fc33d063e7887a4cdb6a6550cd373962da3f6a
Ruby
pahoffart25/OO-Get-Swole-houston-web-012720
/tools/console.rb
UTF-8
528
3.09375
3
[]
no_license
# You don't need to require any of the files in lib or pry. # We've done it for you here. require_relative '../config/environment.rb' g1 = Gym.new("Gym 1") g2 = Gym.new("Gym 2") g3 = Gym.new("Gym 3") l1 = Lifter.new("Raul", 225) l2 = Lifter.new("Steven", 175) l3 = Lifter.new("Vidhi", 125) m1 = Membership.new(75, g1,...
true
3b0b11edfda7d5e09eea6ed40ed6c238344f6284
Ruby
Spayne21/pep_ood_challenge
/player_selector.rb
UTF-8
1,938
2.65625
3
[]
no_license
####### Program Dependencies ######## require 'json' # Templates - Remember remove or edit these line if you edit the file names etc. require './modules/module_template' # Must explicitly include modules to use them, unlike classes which are instantiated (created). include ModuleTemplate targets = File.read('transfer_...
true
bf465a68897a18dacc81e9a7d11b41ee30a83f05
Ruby
IanLawson8913/lesson_3
/test.rb
UTF-8
431
3.375
3
[]
no_license
def dot_separated_ip_address?(input_string) dot_separated_words = input_string.split(".") while dot_separated_words.size > 0 do word = dot_separated_words.pop break unless is_an_ip_number?(word) end return true end # Program purpose: determine if a given string is a dot separated IP address # ln2 - ...
true
f7d97c4e6fce174bdd38c53b7c177cfa9aa7c7b4
Ruby
keshav-c/Tic-Tac-Toe
/lib/player.rb
UTF-8
389
3.546875
4
[]
no_license
class Player attr_reader :name, :symbol def initialize(name, symbol) @name = name @symbol = symbol end def make_move?(position, board) if board.move_valid?(position) board.update(position, symbol) return true else return false end end de...
true
b9a1762decdb3632a6a1c836ddc35b5fc047fb20
Ruby
lenny/log4jruby
/lib/log4jruby/support/levels.rb
UTF-8
1,429
2.609375
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'logger' module Log4jruby module Support # Utility methods for dealing with log levels class Levels LOG4J_LEVELS = { Java::org.apache.logging.log4j.Level::DEBUG => ::Logger::DEBUG, Java::org.apache.logging.log4j.Level::INFO => ::Logger::INFO, ...
true
dacc05fc2a8fa5db70e50e0aee1876cfeee839b2
Ruby
joshuamsmith413/oxford-comma-nyc-web-career-031119
/lib/oxford_comma.rb
UTF-8
156
3.015625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def oxford_comma(array) if array.length >= 3 i = array.pop() answer = array.join(", ") foo = "#{answer}, and #{i}" else array.join(" and ") end end
true
74168a87dfddad7ee69b72e9f76930f03fa88f4f
Ruby
adrienbourgeois/fredwina
/lib/fredwina.rb
UTF-8
455
2.5625
3
[]
no_license
module Fredwina # file_name is the address of the file containing the coords of the top right of the paddock # plus the dogs instructions def Fredwina.move(file_name) f = File.open(file_name) parser = Parser.new(f) begin paddock = parser.paddock shepherd = Shepherd.new(paddock) sheph...
true
e4a0071e31b2b16dcc1e854bf007942808a9b51c
Ruby
shhavel/training_tasks
/spec/13_fibonacci_numbers/02_ladder_spec.rb
UTF-8
762
3.140625
3
[]
no_license
# frozen_string_literal: true describe 'solution' do # def fibonacci_modulo(n, m) # rt5 = Math.sqrt(5) # fi = (rt5 + 1) / 2 # ((fi ** (n + 1) - (-fi) ** -(n + 1)) / rt5).to_i % (2 ** m) # end F = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10...
true
76af8c310a7bac19d6a80e58630fc3bc97220eda
Ruby
public-affairs-data-journalism/padjo
/helpers/tutorial_helper.rb
UTF-8
387
2.625
3
[]
no_license
def topic_link(t, opts={}) topic = extract_topic(t) link_to( topic_name(topic), "/tutorials##{topic_slug(topic)}", opts) end def topic_name(t) extract_topic(t).capitalize end def topic_slug(t) extract_topic(t).downcase end def topic_url(topic) "/tutorials/#{topic_slug(extract_topic topic)}" end def extra...
true
f01590e5f6cc9d376e6d514ac9a9fd20d889f8bd
Ruby
LoudounCodes/RTanque
/lib/rtanque/heading.rb
UTF-8
4,475
3.59375
4
[ "MIT" ]
permissive
# -*- encoding: utf-8 -*- module RTanque # A Heading represents an angle. Basically a wrapper around `Float` bound to `(0..Math::PI * 2)` # # 0.0 == `RTanque::Heading::NORTH` is 'up' # # ##Basic Usage # RTanque::Heading.new(Math::PI) # # => <RTanque::Heading: 1.0rad 180.0deg> # # RTanque::...
true
a5fb7fb4284bd93c6baef633887d864656b8a31b
Ruby
elikantor/restaurant_review_app
/lib/methods.rb
UTF-8
6,900
2.953125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require_all 'lib' def add_a_bunch_of_lines_to_clear_CL 50.times {print "\n"} end def average_rating(res_name) id_of_res = 0 rating = 0 count = 0 Restaurant.all.select do |restaurant| if restaurant.name == res_name id_of_res = restaurant.id end end Review.all.each...
true
e0223b8b643b25776eb7970c567115017193ca3a
Ruby
omprasad-r/test-repository
/tools/fix-files-symlink-DG-9589.rb
UTF-8
3,345
2.953125
3
[]
no_license
#!/usr/bin/env ruby # One time hotfix script for DG-9589 to undo the files symlink (sites.php) # Half way through the sprint it was decided to revert back to using files only # because symlinks offer poor performance on gluster. # After some sanity check, this script will rm the 'files' symlink, mv the 'f' # directory...
true
ec93740960977c8782a256bc8e62d762468670de
Ruby
travis-ci/metriks
/lib/metriks/histogram.rb
UTF-8
2,466
3.3125
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
require 'atomic' require 'metriks/uniform_sample' require 'metriks/exponentially_decaying_sample' module Metriks class Histogram DEFAULT_SAMPLE_SIZE = 1028 DEFAULT_ALPHA = 0.015 def self.new_uniform new(Metriks::UniformSample.new(DEFAULT_SAMPLE_SIZE)) end def self.new_exponentially_decayi...
true
839846cfcdf48881d1ee6bf187b85493a7475314
Ruby
imdrasil/rubocop
/lib/rubocop/cop/mixin/preceding_following_alignment.rb
UTF-8
2,861
2.671875
3
[ "MIT", "CC-BY-NC-4.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking whether an AST node/token is aligned # with something on a preceding or following line module PrecedingFollowingAlignment private def allow_for_alignment? cop_config['AllowForAlignment'] ...
true
e517070cbfabb93a053df92c3ff8ef9bfc083ea1
Ruby
MadBomber/experiments
/time/time_this.rb
UTF-8
479
2.921875
3
[]
no_license
#!/usr/bin/env ruby ####################################################### ### ## File: time_this.rb ## Desc: Correct way to measure time to avoid NTP interference ## See: https://blog.dnsimple.com/2018/03/elapsed-time-with-ruby-the-right-way/ # def time_this &block _time_this_starting = Process.clock_gettime(P...
true
f928c8cc13ebcfa4d5f5b4a1595740e81e267d70
Ruby
hodrigohamalho/snake-game
/src/test/specs/snake_spec.rb
UTF-8
2,285
3.265625
3
[]
no_license
import org.rodrigoramalho.snakegame.model.Snake; import org.rodrigoramalho.snakegame.model.Direcao; describe Snake do before(:each) do @snake = Snake.new "3 5 5 NORTE" end context "com parametros válidos" do it "deveria receber o comprimento e as coordenadas iniciais" do @snake.comprimento.s...
true
c16cbb9335ac53ed10d5a73a890704f9f1364f40
Ruby
vtbookworm/ruby-challenges
/always_3_refactored_4.rb
UTF-8
505
4.625
5
[]
no_license
# This script asks the user for a number, # performs some calculations on the number, # and returns the answer, which is always 3 # Accepts one argument: num1 # Returns the numeric value of the calculation #define method "numerology" def numerology(num1) # Calculate answer (((((num1 + 5) * 2) - 4) / 2) - num1) end...
true
a3a799a6c7525d00eb4d5a7a61f93bc35334fbbe
Ruby
jrobertson/myoutline
/lib/myoutline.rb
UTF-8
4,750
2.625
3
[]
no_license
#!/usr/bin/env ruby # file: myoutline.rb require 'pxindex' require 'nokogiri' require 'filetree_xml' require 'polyrex-links' require 'md_edit' class MyOutline attr_reader :outline attr_accessor :md class Outline using ColouredText attr_reader :ftx, :links, :pxi def initialize(sourc...
true
a24839b143b7e774ad98346f0fae28a1e7726fba
Ruby
bendelonlee/sweater_weather
/app/serializers/forecast_serializer.rb
UTF-8
705
2.65625
3
[]
no_license
class ForecastSerializer < ActiveModel::Serializer belongs_to :city attributes :id, :day_summary, :week_summary, :current_hour, :current_day, :hours, :days, :current_time def current_time (Time.now.utc + object.city.timezone_offset.seconds).strftime('%m/%d ...
true
96c00e1df441056a78799bfb8973015110d78d78
Ruby
thisisDom/phase-0-tracks
/ruby/hamsters.rb
UTF-8
1,507
4.0625
4
[]
no_license
#hamster's name (the clerk names any hamsters who come in without name tags, so all hamsters have names) valid_input = false until valid_input puts "Does the hamster have a name?" response = gets.chomp.downcase if (response == "yes" || response == "no") if (response == 'yes') puts "What is its na...
true
9dabd15c8a188da49e141ea7d28a44c990851aa7
Ruby
byxorna/merlin
/lib/merlin/emitter.rb
UTF-8
8,742
2.671875
3
[ "Apache-2.0" ]
permissive
require 'merlin' require 'logger' require 'erubis' require 'fileutils' require 'open3' require 'merlin/logstub' require 'tmpdir' require 'merlin/monkey_patch/pathname' #TODO debounce events if configured, so we dont constantly emit configs module Merlin class Emitter include Logstub attr_accessor :destinati...
true
0841d885e15b92578ab9fdb43fb00379b4bc6744
Ruby
julien-lav/codewars
/ruby/sum_two_smallest_numbers.rb
UTF-8
164
3.3125
3
[]
no_license
def sum_two_smallest_numbers(numbers) return p numbers.sort[0] + numbers.sort[1] end # numbers.min(2).reduce(:+) sum_two_smallest_numbers([10,9,8,7,6,5,3,20,100])
true
ad632d3bf62a76d3a43e75401adc448feba025cb
Ruby
thegreatape/goathub
/app/models/user.rb
UTF-8
1,348
2.609375
3
[]
no_license
class User < ActiveRecord::Base has_one :news_feed validates_presence_of :news_feed validates_associated :news_feed validates :email, :presence => true, :uniqueness => true, :format => /[\w._%+-]+@[\w._%+-]+\.\w+/ validates :password, :confirmation => true attr_accessor :password_confirmatio...
true
c7c7ba13ebd18a0e90f8506bd6cb137ed8135ff8
Ruby
Sixeight/multi_auth
/lib/token_util.rb
UTF-8
360
2.796875
3
[]
no_license
module TokenUtil def self.create_token(size) return size.times.map { rand(16).to_s(16) }.join end def self.create_unique_token(klass, column, size) begin token = self.create_token(size) end while klass.exists?(column => token) return token end def self.create_token_regexp(size) r...
true
81af7ab5b191fcba1c0f6dbea84dc9a101d2aeef
Ruby
BillProudfoot/Snakes-and-Ladders
/specs/die_spec.rb
UTF-8
332
2.96875
3
[]
no_license
require('minitest/autorun') require('minitest/rg') require_relative('../die') class DieTest < MiniTest::Test def setup @die = Die.new([1, 2, 3, 4, 5, 6]) end def test_roll expected_result = 1..6 actual = @die.roll() included = expected_result.include?(actual) assert_equal(true, included) ...
true
f1ca9c4823ccb9943f97cd5363c36d9bfcdea351
Ruby
jronallo/abrizer
/lib/abrizer/read_adaptations.rb
UTF-8
1,376
2.578125
3
[ "MIT" ]
permissive
module Abrizer module ReadAdaptations def read_adaptations # Either we have a filepath to an original or we make the assumption we # really have an identifier instead of a filepath and we use that # identifier to look for an adaptations.json file. Failing finding the # adaptations.json fi...
true
3b404ef3d1212948c0dc533e8f6e5349b50ef0b0
Ruby
daybreak/daybreak
/vendor/plugins/google_events/lib/calendar.rb
UTF-8
2,233
2.5625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module Google class Calendar def to_xs(xml) #TODO: put into module for inclusion if xml.respond_to? :body #is this an html response? response = xml xml = response.body end XmlSimple.xml_in(xml) end attr_reader :simple, :id, :title, :edit_link, :version, :editable, :published, :updated, :acces...
true
9d5ab5ee72998bab97d97b2ea65c0bc0964d2a20
Ruby
midhunkrishna/game_of_life
/being.rb
UTF-8
745
3.546875
4
[]
no_license
class Being attr_reader :row, :column, :world attr_accessor :alive def initialize(world, alive, row, column) @row = row @column = column @alive = alive @world = world end def alive? alive end def neighbours(row, column) neighbour_positions.inject([]) do |result, offset| ro...
true
c07f7566af72d9e44d03e8870d9cd2f9e4b15d93
Ruby
seanmcoleman/stripe-decline-rate
/lib/stripe_decline_rate.rb
UTF-8
1,964
2.84375
3
[ "MIT" ]
permissive
require 'stripe' require 'date' require 'set' class StripeDeclineRate def initialize(api_key) Stripe.api_key = api_key end def latest saturday = starting_saturday sunday = starting_sunday 10.times do |i| puts "#{sunday} through #{saturday}: #{formatted_decline_ratio(sunday, saturday)}" ...
true
8edef47c5cd1c9f3c61f725deca5947ed4878930
Ruby
lorint/MongoApartment
/building.rb
UTF-8
647
2.578125
3
[]
no_license
class Building include Mongoid::Document field :address, type: String field :style, type: String field :has_doorman, :type => Boolean field :is_walkup, :type => Boolean field :num_floors, :type => Integer, default: 3 field :apartments, :type => Hash, default: {} has_many :apartments, autosave: true ...
true
49857d3f69351adf5607f2f1553bc8c8418a5311
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/bob/a48d0d0e4e994c6abc0f4c76c09e05f2.rb
UTF-8
527
4.0625
4
[]
no_license
class Bob def hey(something) if silence?(something) reply = "Fine. Be that way!" elsif shouting?(something) reply = "Woah, chill out!" elsif question?(something) reply = "Sure." else reply = "Whatever." end return reply end private def shouting?(something) uppercase_thing = something.u...
true
525d8a9a859ef0c443f90e25533f5f3d25e76074
Ruby
mmanousos/ruby-small-problems
/small_problems/easy6/seven_halvsies.rb
UTF-8
3,267
4.625
5
[]
no_license
=begin *assignment* Halvsies Write a method that takes an Array as an argument, and returns two Arrays that contain the first half and second half of the original Array, respectively. If the original array contains an odd number of elements, the middle element should be placed in the first half Array. Examples: halvsi...
true
caebed416939e59158f15fd23f18d784aaecd115
Ruby
sfcgeorge/vector_salad
/lib/vector_salad/standard_shapes/polygon.rb
UTF-8
1,059
2.96875
3
[ "MIT" ]
permissive
require "contracts_builtin" require "vector_salad/standard_shapes/basic_shape" require "vector_salad/standard_shapes/path" require "vector_salad/mixins/at" module VectorSalad module StandardShapes # Regular polygon shape. class Polygon < BasicShape include VectorSalad::Mixins::At attr_reader :sid...
true
c4a410ba858abe886c1af14cc6ccbdcc87ff27fd
Ruby
techbang/stickies
/lib/stickies/messages.rb
UTF-8
10,907
2.609375
3
[ "MIT" ]
permissive
# -*- encoding : utf-8 -*- ################################################################################ # # Copyright (C) 2007 pmade inc. (Peter Jones pjones@pmade.com) # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Soft...
true
08ed9315fd479aa7c36c5406f446d7457e11e0d3
Ruby
webdev36/registry_dev
/app/models/user.rb
UTF-8
2,468
2.578125
3
[]
no_license
class User < ActiveRecord::Base DRUPAL_HASH_COUNT = 15 DRUPAL_MIN_HASH_COUNT = 7 DRUPAL_MAX_HASH_COUNT = 30 DRUPAL_HASH_LENGTH = 55 has_many :luxe_registries has_many :orders has_many :payments has_many :subscriptions has_one :user_detail def authenticate password cur_pass = self.pass b...
true
eed8c596a72d25f49a5fbf12cc3a286f643e7e6f
Ruby
hmistry/petmatch
/app/services/pet_importer.rb
UTF-8
2,197
2.65625
3
[]
no_license
class PetImporter def initialize(api_key) @api_key = api_key @imported_count = 0 end def imported_count @imported_count end def import(shelter_ids) shelter_ids.each do |shelter_id| pets = fetch_pets(shelter_id) next if pets.nil? shelter = Shelter.where(id_pf: shelter_id).f...
true
a3d6e615b4fca8bb5d2a2d359d5b934905df5566
Ruby
yashoss/StockAnalysis
/stock_scrape.rb
UTF-8
2,370
3.484375
3
[]
no_license
require 'nokogiri' require 'httparty' require 'csv' require 'algorithms' class SOI def initialize(symbol, lowest, lowest_date, highest, highest_date, cutoff) @symbol = symbol @lowest = lowest @lowest_date = lowest_date @highest = highest @highest_date = highest_date @cutoff = cutoff end ...
true
492b5672031af480bf21d8080985d1073e27680d
Ruby
manojnaidu619/cc_issuer
/lib/cc_issuer.rb
UTF-8
2,449
3.171875
3
[ "MIT" ]
permissive
require "cc_issuer/version" class String def cci? if self =~ /[a-zA-Z[<>%\$~``!@#^&*()+=?;:{}\|''""'"]]/ then puts "Invalid Card Number" else sanitize() if self =~ /^4\d/ and self.length >= 12 and self.length <= 16 puts "Visa" elsif self =~ /^(5|2)[1-5][0-9...
true