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
72774fba6c53ac93922eec9421fd8be8f622ca22
Ruby
macZombie/R-PiPanTilt
/I2C/gpio.rb
UTF-8
2,323
2.671875
3
[]
no_license
class GPIO < I2CExpander def initialize(name,channel,address) super(name,channel,address) return end end ; # end of class GPIO class GPIOA < GPIO IODIR = 0 ...
true
a983d6a8693e7eb146261afde94bc831826704bf
Ruby
jonathancadepowers/filmnutonrails
/app/helpers/fasts_helper.rb
UTF-8
438
2.53125
3
[]
no_license
# frozen_string_literal: true module FastsHelper def title_fast(timestamp, time_fasted) title_values = { timestamp.to_date.strftime("%a, %b") => " ", timestamp.to_date.day.ordinalize => ", ", timestamp.to_date.strftime("%Y") => " - ", ChronicDuration...
true
90c940adf114aacba324f583c4bb604e4855657c
Ruby
RKB1923/homework_assignments
/numbers_letters_and_variables/number_of_seconds.rb
UTF-8
1,039
3.921875
4
[]
no_license
#!/usr/bin/env ruby seconds_in_a_minute=60 minutes_in_an_hour=60 hours_in_a_day=24 days_in_a_week=7 weeks_in_a_year=52 puts "There are #{seconds_in_a_minute} seconds in a minute" puts "There are #{minutes_in_an_hour} minutes in an hour" puts "There are #{hours_in_a_day} hours in a day" puts "There are #{days_in_a_wee...
true
a1ea4c7bdd33bbb1f267f8b9f99033b91105d5bc
Ruby
dgokman/advent_of_code_2018
/aoc_2018_16.rb
UTF-8
3,762
3.234375
3
[]
no_license
def number_of_registers(before, instructions, after) count = [] opcode, a, b, c = instructions ra, rb, rc = before[a], before[b], before[c] if (after[c] == 1 && a > rb) || (after[c] == 0 && a <= rb) count << "gtir" end if (after[c] == 1 && ra > b) || (after[c] == 0 && ra <= b) count << "gtri" ...
true
34a87d088c4398ccf65d8fb1926480d67a1c7de2
Ruby
dasilva1b/RubyLengs
/Codigo/main.rb
UTF-8
821
3.25
3
[]
no_license
#!/usr/bin/ruby load 'Planta.rb' # # Implementacion del sistema de creacion de la cerveza glaciar brebaje Stolz # class Main def main #Obtengo los 5 elementos del terminal if ARGV.length != 5 abort "Argumentos: <numero de ciclos> <cantidad cebada> <cantidad mezcla arroz/maiz> <cantidad de l...
true
8e02bc49d065343ff85ac9360b54891bc8999380
Ruby
melnock/ruby-objects-has-many-through-lab-web-012918
/lib/song.rb
UTF-8
193
2.90625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Song attr_reader :name, :genre attr_accessor :artist def initialize(name, genre) @name = name @genre = genre genre.add_songs(self) end def add_to_genre end end
true
43c18dca6b61242b84717ab6c25bdb04b215b34b
Ruby
erichwelz/ruby_fundamentals1
/exercise2.rb
UTF-8
249
3.484375
3
[]
no_license
puts (55 * 0.2) # return to screen amount of 20% tip puts (55 * 0.2).to_i #syntax error occurs when mixing str and int/floats in output puts "The answer is: #{45628*7839}" puts (true && false) || (false && true) || !(false && false) #returns true
true
3b79cab3242db66abbae459823836720ca2fd003
Ruby
niktexnik/FindGitName-Rails-
/lib/name_generator.rb
UTF-8
374
3.140625
3
[]
no_license
# frozen_string_literal: true class NameGenerator def self.process(name, numeric = false) firstname, lastname = name.split num = %w[1 2 3 4 5 6 7 8 9 0] freename = [] i = 0 while i < name.length i += 1 str = firstname[0...i] + lastname[0...i] str += num.shuffle[i].to_s if numeric...
true
3272cb8d62a32204b93751b88acff7ea712afd09
Ruby
lg901127/final_project
/app/services/game_character_stat_calculator.rb
UTF-8
1,128
2.953125
3
[]
no_license
class GameCharacterStatCalculator attr_reader :game_character def initialize(game_character) @game_character = game_character end def parse_strength game_character_strength = game_character.game_character_attributes.find_by_stat_id(13).value game_character_item_strength = 0 game_character.game...
true
eb517d37d41d7aaa846d917d463f348a3e926216
Ruby
Katherine-Bishop/my_mint
/app/models/transaction.rb
UTF-8
1,651
2.609375
3
[]
no_license
class Transaction < ActiveRecord::Base has_one :budget # validates_presence_of :description validates_presence_of :date, :unless => proc { new_record? } def self.import(file) CSV.foreach(file, headers: true) do |row| #skips credit card payments next if row[5] == 'Credit Card Payment' #converts...
true
fdeb59ae6061fbb0aef5323dd99442e76cf97253
Ruby
SiamKing/looping-loop-v-000
/looping.rb
UTF-8
88
2.625
3
[]
no_license
def looping puts "Wingardium Leviosa" looping #your code here end #call your method here looping
true
521b1c2cf4463cccc3375750a8b143835b46ec56
Ruby
Tinend/FantasyKarte
/lib/NuetzlicheFunktionen/berechneEntfernung.rb
UTF-8
2,220
3.078125
3
[ "MIT" ]
permissive
# coding: utf-8 require "RandPixel" def berechneEntfernung(bild)# berechnet für jeden Pixel, wie weit er von Transparenten Pixeln oder dem Rand entfernt ist richtungen = [[-1, -1], [-1, 0], [-1, 1], [0, -1], [0, 1], [1, -1], [1, 0], [1, 1]] distanz = 0 randPixel = [] entfernungen = Array.new(bild.height) {Arra...
true
80631f19748d27add548c879dc759163d47b3462
Ruby
pieterjongsma/tournament-system
/lib/tournament_system/voetlab.rb
UTF-8
2,533
2.703125
3
[ "MIT" ]
permissive
require 'tournament_system/algorithm/swiss' require 'tournament_system/swiss/dutch' require 'tournament_system/swiss/accelerated_dutch' module TournamentSystem # Robust implementation of the swiss tournament system module Voetlab extend self # Generate matches with the given driver. # # @param dri...
true
46484c4205ee835f0358e8772cbc849a81843c32
Ruby
dalalsunil1986/algorithms_ruby
/stacks/min_max_stack.rb
UTF-8
977
3.8125
4
[]
no_license
class MinMaxStack def initialize @stack = [] @min_max_stack = [] end def push(val) new_min_max = [val, val] if @min_max_stack.any? last_min_max = @min_max_stack.last new_min_max[0] = [last_min_max[0], new_min_max[0]].min new_min_max[1] = [last_min_max[1], new_min_max[1]].max ...
true
27b8dbf74bd7c0e12521894227c5686795a4b769
Ruby
VIKO-eif-RoR/ThirdTask
/SimpsonFormula/simpsonformulamain.rb
UTF-8
368
3.03125
3
[]
no_license
# frozen_string_literal: true require_relative 'simpsonformula.rb' n = 4 startingpoint = 2 endingpoint = 50 value = SimpsonsFormula.new.simpson_formula_calculator(startingpoint, endingpoint, n) if startingpoint < endingpoint if n.even? puts(value) else puts('Enter lyginis intervalas') end else puts('S...
true
bf01c4869726653ca4740629c1aefb155a815bd5
Ruby
SADIAMALIK1980/ruby
/if_else.rb
UTF-8
918
4.09375
4
[]
no_license
//simple math equation if 1+1 == 2 puts "1 and 1 does indeed equal 2" end //string my_name ='Skillcrush' if my_name == 'Skillcrush' puts "Hellooooo, Skillcrush!" end //if else statement my_name = 'Sadia' if my_name == 'Skillcrush' puts "Hellooooo, Skillcrush!" else puts "oops, I thought your na...
true
d2c095bbf8196a8497587128fbf1934b3c5f626f
Ruby
tiffany-simionescu/ruby-course
/arrays.rb
UTF-8
395
3.71875
4
[]
no_license
friends = Array["Kevin", "Karen", "Oscar", "Andy"] puts friends puts friends[0] puts friends[-1] puts friends[-2] # index 0 and 1 not 2 puts friends[0, 2] friends[0] = "Dwight" puts friends[0] puts friends.length() puts friends.include? "Karen" puts friends.reverse() # must be same type in order to sort puts frien...
true
f20c0932becab4889dda30bad64a47e4201f0c80
Ruby
tommetge/impersonator
/lib/impersonator/markov.rb
UTF-8
1,775
3.375
3
[]
no_license
# http://www.rubyquiz.com/quiz74.html class MarkovChain attr_reader :order, :beginnings, :freq def initialize(text, order = 2, max = 22) @order = order @max = max @beginnings = [] @freq = {} add_text(text) end def add_text(text) # make sure each paragraph ends with some senten...
true
8a48b18a384aa01f894b5c817dfa28f6ea359e33
Ruby
MichaelWales/Pub-Lab
/specs/customer_spec.rb
UTF-8
679
2.625
3
[]
no_license
require("minitest/autorun") require('minitest/reporters') require_relative("../customer") Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new class CustomerTest < MiniTest::Test def setup @customer1 = Customer.new("Ali G", 50, 32, 0) end def test_get_name() assert_equal("Ali G", @customer...
true
eb6cada10b7c222456cc5f16fbcb1855a1b595f3
Ruby
CarterNelms/blueberry-cal
/spec/cal_month_integration_spec.rb
UTF-8
1,460
3.015625
3
[]
no_license
RSpec.describe "Cal's full month integration" do it "should correctly print July 2017" do expected = <<EOS July 2017 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 EOS actual = `./cal 07 2017` ac...
true
169ce51a8ee0ffdf681c5b107a60aa871130a388
Ruby
nickcbrierley/sep-assignments
/02-algorithms-and-complexity/03-algorithms-sorting/heap_sort.rb
UTF-8
966
3.703125
4
[]
no_license
require 'benchmark' def heap_sort(array) buildMaxHeap(array) lastElement = array.length - 1 while(lastElement > 0) swap(array, 0, lastElement) heapify(array, 0, lastElement) lastElement -= 1 end end def buildMaxHeap(array) i = (array.length / 2 - 1).floor while(i >= 0) heapify(array, i,...
true
511ada2a376d3dec29d67da500975d3bdf2b25c5
Ruby
arthurljones/junkrig-calc
/src/engineering/material.rb
UTF-8
1,124
2.71875
3
[]
no_license
require "options_initializer" module Engineering class Material include OptionsInitializer @@materials_cache = nil attr_reader :name options_initialize( :yield_strength => { :units => "psi" }, :density => { :units => "lbs/in^3" }, :modulus_of_elasticity => { :units => "psi" }, ...
true
6eb4064f495726d6de6e5e03af7fee46f90e15d1
Ruby
coreyjuliandavis/101
/lesson_2/mortgage.rb
UTF-8
941
3.875
4
[]
no_license
def prompt(message) puts("=> #{message}") end loan_amt = '' apr = '' apr_mo = '' duration = '' duration_mo = '' prompt("I hear you're in the market for a home!") prompt("How much of the cost will be financed?") loop do loan_amt = gets.chomp loan_amt = loan_amt.to_f if loan_amt == 0.0 prompt("Please put ...
true
3f4814b6702323ae89266c42887a8e4d49b807cb
Ruby
hamdans1/diplomacy
/lib/random_data.rb
UTF-8
678
3.234375
3
[]
no_license
module RandomData def self.random_sentence strings = [] rand(3..5).times do strings << random_word end sentence = strings.join(" ") sentence.capitalize << "." end def self.random_word letters = ("a".."z").to_a letters.shuffle! letters[0, rand(3..8)].join end def self....
true
48ba93705d9bd74425c2743ede4dfa0b88e9e5a0
Ruby
medical-tribune-polska/streaming
/app/forms/stream/import_form.rb
UTF-8
464
2.65625
3
[ "MIT" ]
permissive
module Stream class ImportForm attr_reader :accesses def initialize(accesses) @accesses = accesses end def process @accesses.each(&:save) end def check_accesses accesses.each_with_object({}).with_index do |(access, errors), i| errors[i] = check_access(access) ...
true
a558cefde9b1eea104a8a7fe4f41971c5f52fbe7
Ruby
bpieck/rubyx
/lib/risc/block_compiler.rb
UTF-8
1,662
2.734375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module Risc # A BlockCompiler is much like a Mehtodcompiler, exept for blocks # class BlockCompiler < CallableCompiler attr_reader :block , :risc_instructions , :constants alias :block :callable def initialize( block , method) @method = method super(block) end def source_name ...
true
329c77077cc9ff93128b95c2c7e54f06d812bc7b
Ruby
darthschmoo/epubforge
/lib/epubforge/core_extensions/kernel.rb
UTF-8
911
2.59375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module EpubForge module CoreExtensions module Kernel # yields an alternate reality block where instance methods # are different from what they were. At the end of the block # it resets the initial values of the instance variables. def with_locals locals = {}, &block old_local_vars...
true
b6b118979e8bf75fea6073c344b4bf794f726f8b
Ruby
rhys117/LaunchSchoolCurriculum
/Backend/120/lesson4/easy2.rb
UTF-8
5,083
4.25
4
[]
no_license
=begin 1. You are given the following code: What is the result of calling oracle = Oracle.new oracle.predict_the_future -- The result will be a return string value of "You will " and one of the elements from the array in the choice method. =end class Oracle def predict_the_future "You will " + choices.sample ...
true
96a4f1cdaf2fc335501f265a45df546c36dab1b5
Ruby
naoto/animemap
/bin/animemap
UTF-8
139
2.609375
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require 'animemap' Animemap.location(ARGV.first).each do |data| puts "#{data.week} #{data.time} #{data.title}" end
true
3891f5c5e9e76dc623eb118e8def289dc96f9f19
Ruby
emartech/ezlog
/lib/ezlog/logging_layout.rb
UTF-8
1,575
2.625
3
[ "MIT" ]
permissive
require 'time' require 'oj' module Ezlog class LoggingLayout < ::Logging::Layout def initialize(context = {}, options = {}) @initial_context = context @level_formatter = options.fetch(:level_formatter, ->(numeric_level) { ::Logging::LNAMES[numeric_level] }) end def format(event) log_en...
true
474ed18f22469c9db7e352ecf15265a0d84a87b9
Ruby
salysm/ruby-enumerables-cartoon-collections-lab-dc-web-012720
/cartoon_collections.rb
UTF-8
965
3.375
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
dwarves = ["Doc", "Dopey", "Bashful", "Grumpy", "Sneezy", "Sleepy", "Happy"] def roll_call_dwarves(dwarves) dwarves.each_with_index do |dwarf, index| puts "#{index + 1}. #{dwarf}" end end planeteer_calls = ["earth", "wind", "fire", "water", "heart"] def summon_captain_planet(planeteer_calls) planeteer_calls....
true
6643e756a480ac5c66b41ad7949be57b9a02bc0c
Ruby
TooColline/Cryptarithm
/script.rb
UTF-8
2,585
3.71875
4
[ "MIT" ]
permissive
# frozen_string_literal: true # This class in an example of the cryparithmic solution class Example include Enumerable # Instantiate global empty arrays and range @@global_range = Array(100..999) @@bbg = [] @@fun = [] @@stn = [] def listoffunpossibilities # FUN values should meet the criteria below:...
true
ef1cfb67b827af13b8d2ae3fe0e22a002a77a9b4
Ruby
pedro/autoroku
/lib/autoroku/cli.rb
UTF-8
1,637
2.765625
3
[ "MIT" ]
permissive
require "netrc" class Autoroku::CLI def self.start(*args) new.run(args) end def initialize @key = fetch_api_key @api = Autoroku::Lib.new(:api_key => @key) end def fetch_api_key netrc["api.heroku.com"][1] end def run(*args) cmd = args.first.first method = cmd.gsub(":", "_") ...
true
e1b7be882fa5e7c24128c92b6b8c8301578a5050
Ruby
gazeldx/call-web
/lib/core_ext/date_time_ext.rb
UTF-8
2,476
3.03125
3
[]
no_license
class DateTime def self.from_hash_with_hour(hash) civil_from_format(:local, hash[:year].to_i, hash[:month].to_i, hash[:day].to_i, hash[:hour].to_i, 0) end def self.from_hash_with_day(hash) civil_from_format(:local, hash[:year].to_i, hash[:month].to_i, hash[:day].to_i, 0, 0) end def self.transfer_str...
true
33fc273fd3d38b8dddc4a039d367b02e4ed396d3
Ruby
Juan1808/EjerciciosRails
/CursoRuby/src/HolaMundo.rb
UTF-8
2,122
3.703125
4
[]
no_license
puts "Hola Mundo!!" # Esto es un comentario en Ruby =begin Esto serua un comentario de varias líneas podemos poner todas las que queramos, los comentarios son muy importantes para el código =end #variable es una buena prática declarar siempre las variables en Ruby #no empiezan con ninguna palabra reservada #son total...
true
d8ca717e145ff03ce599337b2fc55b341f7d1d0c
Ruby
charlottebrf/57-shades-of-ruby
/08_pizza_party.rb
UTF-8
4,306
4.46875
4
[ "MIT" ]
permissive
# Problem: Write a program to evenly describe pizzas.Prompt for the number of people, the number of pizzas, and the number of slices per pizza. Ensure that the number of pieces comes out even. Display the number of pieces of pizza each person should get. If there are leftovers. show the number of leftover pieces. # # E...
true
525c6d2615078c82e260b453c222e1342447e10c
Ruby
greciaro/LeetCode
/1002.rb
UTF-8
583
3.796875
4
[]
no_license
Given an array A of strings made only from lowercase letters, return a list of all characters that show up in all strings within the list (including duplicates). For example, if a character occurs 3 times in all strings but not 4 times, you need to include that character three times in the final answer. You may ret...
true
150702e8bc435c2402558da9b0c4b952e5ee3002
Ruby
rodrigoruas/food-delivery-01-with-base-repo
/app/views/meals_view.rb
UTF-8
455
3.375
3
[]
no_license
class MealsView def initialize end def ask_for_name_and_price puts "What is the name of the meal?" name = gets.chomp puts "What is the price of the meal?" price = gets.chomp.to_i {name: name, price: price} end def display_all(meals) meals.each_with_index do |meal, index| puts "...
true
bad6993d1c0eb49b809cfd983832a04ccb23c884
Ruby
Edward4j/grape-simple-app
/api/c.rb
UTF-8
462
2.90625
3
[]
no_license
# module GrapeSampleApp # def c_constant # "Hello from module GrapeSampleApp - c_constant!" # end class C < Grape::API puts caller version 'v1', using: :header, vendor: 'geek.co.il' format :json # helpers do def C.c_constant "Hello from C c_constant!" end # end d...
true
9c7df76829f6be51157fd890feff7399f1f3bb52
Ruby
alf-tool/alf-core
/lib/alf/engine/to_array.rb
UTF-8
1,695
3.09375
3
[ "MIT" ]
permissive
module Alf module Engine # # Ensures an order of tuples, recursing on relation value attributes, that are # converted as arrays as well. # # Example: # # res = [ # {:price => 12.0, :rva => Relation(...)}, # {:price => 10.0, :rva => Relation(...)} # ] # ToArray...
true
19e24bd68982396b32f555a7999105a4bdcfdcf9
Ruby
the-color-bliu/futbol
/test/game_team_manager_test.rb
UTF-8
4,473
2.515625
3
[]
no_license
require 'minitest/autorun' require 'minitest/pride' require 'mocha/minitest' require 'Pry' require './lib/game_team' require './lib/game_team_manager' class GameTeamManagerTest < MiniTest::Test def setup game_team_path = './data/game_teams_dummy.csv' @game_team_manager = GameTeamManager.new(game_team_path, '...
true
ff814f8c848064d3c543933d87bff51eb267a0e8
Ruby
GeorgieGirl24/sweater-weather
/app/poros/image.rb
UTF-8
391
2.6875
3
[]
no_license
class Image attr_reader :image, :credit def initialize(image_data, location) @image = { location: location, image_url: image_data[:urls][:regular], link: image_data[:links][:html], } @credit = { source: 'https://unsplash.com/', artist: image_data[:user][:name...
true
349e4aa46a89d801de93d2825c1ade079b870079
Ruby
lintci/laundromat
/lib/command_service.rb
UTF-8
600
2.59375
3
[]
no_license
# Simple abstraction of common functionality from services class CommandService class << self def call(*args) new(*args).call end def callback(*names) names.each do |name| define_method name do |*args, &block| @_callbacks ||= Hash.new(->(*){}) if block ...
true
776da681bc1834af50743f6392d9cfab5832acd0
Ruby
kyle-baker/tealeaf_precourse
/final_exercises/exercise5.rb
UTF-8
128
3.703125
4
[]
no_license
# exercise5.rb a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] # Remove from end of array a.pop # Append a.push(3) p a
true
d728ae2f122b7a30d42d0f287d55d4908af87f1c
Ruby
yourgirlfriend/Fight-for-the-Skys
/ship.rb
UTF-8
2,259
2.75
3
[]
no_license
class Ship attr_reader :x, :y, :height, :width attr_reader :x, :y, :width, :height, :dead, :iswallleft, :iswallright attr_accessor :image, :x_velocity, :x, :y def initialize() @x = 400 @y = 800 @y_velocity = 10 @width = 71 @height = 120 @dead = false ...
true
61b9f3e5cecbe7e796d2126ad6e68b34564544f5
Ruby
DIcove/ror_beginner
/Lesson_5/route.rb
UTF-8
836
3.328125
3
[]
no_license
# frozen_string_literal: true # Route class Route include InstanceCounter attr_reader :stations def initialize(first_station, last_station) @stations = [first_station, last_station] register_instance end def add_station(station) return if stations.include?(station) stations << station e...
true
c85622ca74b554144ffdc7c1bb8255b24a530ad3
Ruby
JonathanTrEs/MatricesDensasYDispersas
/lib/MatrizDSL.rb
UTF-8
1,193
3.265625
3
[ "MIT" ]
permissive
require 'matriz.rb' class MatrizDSL < Matriz attr_accessor :resultado def initialize(tipo_operacion, &block) @operandos = [] @resultado = nil @tipo_resultado = :densa @operacion = :nada case tipo_operacion when "suma" @operacion = :suma when "resta...
true
cda8d32321d031193ccc01ab7759479c4c569cc1
Ruby
edyoda/ruby-course
/myGem/lib/mygem.rb
UTF-8
96
2.890625
3
[]
no_license
class MyGem def sum(*args) x = *args return x.map {| i | i.to_i}.inject(:+) end end
true
6a45b09fce28c0d4db6937af4349fc6421b5cc92
Ruby
dgraham/yajl-ffi
/lib/yajl/ffi/parser.rb
UTF-8
10,307
3.015625
3
[ "MIT" ]
permissive
module Yajl module FFI # Raised on any invalid JSON text. ParserError = Class.new(RuntimeError) # A streaming JSON parser that generates SAX-like events for state changes. # # Examples # # parser = Yajl::FFI::Parser.new # parser.key { |key| puts key } # parser.value { |value...
true
48745d621ec472fc23e59b363cf1466659ae6f28
Ruby
AaronRodrigues/lrthw
/ex15.rb
UTF-8
621
3.671875
4
[]
no_license
filename = ARGV.first #takes in the first argument when running the rb file txt = open(filename) #opens the file and assigns it to txt puts "Here's your file #{filename}:" #prints the filename as a string print txt.read #prints the contents of the file print "Type the filename again: " ...
true
4e7e4bdc2aeda4109171a2e4c5dadc1ab8c76324
Ruby
tedconf/graphite_client
/lib/graphite_client.rb
UTF-8
631
2.625
3
[ "MIT" ]
permissive
require 'socket' class GraphiteClient # "host" or "host:port" def initialize(host) @host, @port = host.split ':' @port = 2003 if ! @port @port = @port.to_i end def socket return @socket if @socket && !@socket.closed? @socket = TCPSocket.new(@host, @port) end def report(key, value, tim...
true
0758656998255a30cb049ac7afdc3bcc36a07b1e
Ruby
libkazz/aix_message_delivery-textris
/lib/aix_message_delivery.rb
UTF-8
2,527
2.890625
3
[ "MIT" ]
permissive
require 'textris' require 'uri' require 'net/http' require 'aix_message_test_delivery' class AixMessageDelivery < Textris::Delivery::Base VERSION = '0.1.0'.freeze API_BASE_URL = 'https://qpd-api.aossms.com/'.freeze ENDPOINT = "#{API_BASE_URL}/p11/api/mt.json".freeze SHORTEN_URL_ENDPOINT = "#{API_BASE_URL}/p1/a...
true
f18fc3638b5ff064d577c43d07912764272ba4d5
Ruby
smithcole264/hw-ruby-intro
/lib/ruby_intro.rb
UTF-8
1,095
3.875
4
[]
no_license
# When done, submit this entire file to the autograder. # Part 1 def sum arr sum = 0 arr.each do |i| sum += i end return sum end def max_2_sum arr sum_2 = 0 sum_2 = arr.sort.last(2).sum end def sum_to_n? arr, n !!arr.uniq.combination(2).detect { |a, b| a + b == n } end # Part 2 def hello(name) ...
true
4a8477d8cdae49387739cd3850ccca3ba58af25f
Ruby
Gurpartap/cognizant
/lib/cognizant/shell.rb
UTF-8
3,827
2.671875
3
[ "MIT" ]
permissive
require "logger" require "optparse" require "readline" require "shellwords" require "cognizant/client" module Cognizant class Shell def initialize(options = {}) @app = "" @app = options[:app] if options.has_key?(:app) and options[:app].to_s.size > 0 @path_to_socket = "/var/run/cognizant/cogn...
true
bb788c235a203cacb97834ab10b5f565ebfcddad
Ruby
sangamkaushik/AlgorithmsPractice
/recursion_exercises.rb
UTF-8
4,035
3.953125
4
[]
no_license
require 'byebug' # Binary Search def binary_search arr, target return nil if arr.length <= 1 && arr[0] != target middle_idx = arr.length/2 return middle_idx if arr[middle_idx] == target if target > arr[middle_idx] right = arr[middle_idx+1..-1] right_target = binary_search(right, target) right_targe...
true
ebcd68128da058e002e99464fd7c49499653b4c3
Ruby
klaszcze/codility_lessons
/3_tape_equilibrium.rb
UTF-8
297
3.25
3
[]
no_license
def solution(a) right_sum = a.inject(:+) - a[0] left_sum = a[0] min_diff = (right_sum - left_sum).abs 1.upto(a.length - 1) do |i| right_sum -= a[i] left_sum += a[i] min_diff = (right_sum - left_sum).abs if (right_sum - left_sum).abs < min_diff end return min_diff end
true
b7bab41e07aa7a03d6e01f4af9dcd6c4e4f399ee
Ruby
dshue20/interview-prep
/ruby/binary_tree_next.rb
UTF-8
1,596
3.90625
4
[]
no_license
# You are given a perfect binary tree where all leaves are on the same level, and every parent has two children. The binary tree has the following definition: # struct Node { # int val; # Node *left; # Node *right; # Node *next; # } # Populate each next pointer to point to its next right node. If there...
true
3954d83d0518cc42464f66d15b380f5dcb6ef967
Ruby
ztaylorpossible/DailyProg
/Ruby/7e.rb
UTF-8
1,732
4.0625
4
[]
no_license
# Daily Programmer Easy Challenge #7 June 17, 2013 # Summary: # Write a program that can translate Morse code in the format of ...---... # A space and a slash will be placed between words. ..- / --.- # For bonus, add the capability of going from a string to Morse code. # Super-bonus if your program can flash or beep th...
true
67e4b5d8593476ed5f41d9d412feec6fb8b8514d
Ruby
Jaybraum/black_thursday
/spec/invoice_spec.rb
UTF-8
2,704
2.5625
3
[]
no_license
require './lib/invoice' RSpec.describe Invoice do describe 'instantiation' do it '::new' do mock_repo = double('InvoiceRepo') invoice = Invoice.new({:id => 6, :customer_id => 7, :merchant_ir => 8, :status => 'pendi...
true
551153dd72c9b0c43cbae4b9ed7cfffa352db606
Ruby
jezman/qna
/app/models/concerns/likable.rb
UTF-8
377
2.640625
3
[]
no_license
module Likable extend ActiveSupport::Concern included do has_many :likes, dependent: :destroy, as: :likable end def vote_up(user) vote(user, 1) end def vote_down(user) vote(user, -1) end def rating_sum likes.sum(:rating) end private def vote(user, rate) likes.create!(user...
true
251bea9340ed511ec5f371ac27e8872541a72507
Ruby
gumgl/project-euler
/67/67.rb
UTF-8
489
3.375
3
[ "MIT" ]
permissive
def maximum_path_sum(filename) lines = File.readlines(filename) triangle = lines.map {|string| string.split(' ').map {|n| Integer(n, 10)}} (triangle.length-2).downto(0).each {|row| for col in 0..row triangle[row][col] = triangle[row][col] + [triangle[row+1][col], triangle[row+1][col+1]].max end }...
true
5f0dfda94e1c3acbfe5c0756748e697ffd5c7133
Ruby
kristianmandrup/geo_units
/lib/geo_units/core_ext.rb
UTF-8
2,254
3.203125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'sugar-high/numeric' module GeoUnitExt ::GeoUnits.units.each do |unit_type| define_method "#{unit_type}_to" do |unit| unit = GeoUnits.normalized(unit) self.to_f * GeoUnits::Maps::Meters.from_unit[unit_type] * GeoUnits::Maps::Meters.to_unit[unit] end end include NumberDslExt # from su...
true
395211acb46f9e0d94983761c4ea47b91d7b83b1
Ruby
t-kot/bungakuhub
/features/step_definitions/branch_steps.rb
UTF-8
1,076
2.859375
3
[]
no_license
#coding: utf-8 #language: ja もし /^以下のブランチが存在している:$/ do |table| table.rows.each do |repo, branch| Repository.find_by_name(repo).branches.create(name:branch) end end もし /^以下のブランチを作成する:$/ do |table| table.rows.each do |repo, branch| Repository.find_by_name(repo).branches.create(name:branch) end end もし /...
true
a2d2a8f07fa734973d5cb23aefc0dbbb0ea10e03
Ruby
brady-robinson/launchschool-introRuby
/loopsiterators/each_with_index.rb
UTF-8
101
3.515625
4
[]
no_license
x = ["Do", "Go", "My", "Love"] x.each_with_index do |item, index| puts "#{index + 1}. #{item}" end
true
6609f085df1a2d7a438c2a76df64a6efef4529ab
Ruby
das11706/happy_plastics
/lib/happy_plastics/plastic.rb
UTF-8
381
2.8125
3
[ "MIT" ]
permissive
class HappyPlastics::Plastic attr_accessor :num, :name, :facts @@all = [] def initialize(num, name) @num = num @name = name @facts = [] save end def self.all HappyPlastics::Scraper.scrape_plastic if @@all.empty? @@all end def get_fact HappyPlastics::Scraper.scrape_...
true
31e4d6b97e771c551f0474cfc9b3133d3c53e881
Ruby
fuadsaud/uniTunes
/app/interactions/purchase_medium.rb
UTF-8
1,635
2.75
3
[]
no_license
class PurchaseMedium def call(user:, medium_id:) wallet = find_wallet(user) medium = find_medium(medium_id) purchase = Purchase.new(split_shares(medium.price).merge( wallet: wallet, medium: medium, amount: medium.price )) if purchase.valid? begin response = Active...
true
31e86e13ed5475c72f57f5bea367ffba1cf35715
Ruby
yourkarma/daemonic
/lib/daemonic/pool.rb
UTF-8
1,750
2.9375
3
[ "MIT" ]
permissive
# Stolen from RubyTapas by Avdi Grimm, episode 145. module Daemonic class Pool class StopSignal def inspect "[STOP SIGNAL]" end alias_method :to_s, :inspect end STOP_SIGNAL = StopSignal.new attr_reader :producer def initialize(producer) @producer = producer ...
true
31d57151b46a570098f9308f157d872bb29ab2cc
Ruby
sebastianmendo1995/aA-classwork
/W2D4/Sebastian_Mendo_more_problems.rb
UTF-8
6,529
3.640625
4
[]
no_license
def no_dupes?(arr) ans = [] (0...arr.length).each do |i| temp = arr[0...i] + arr[i+1..-1] if !temp.include?(arr[i]) ans << arr[i] end end ans end p no_dupes?([1, 1, 2, 1, 3, 2, 4]) # => [3, 4] p no_dupes?(['x', 'x', 'y', 'z', 'z']) # => ['y'] p no_dupes?(...
true
dc5f4dd8bea5f2ac8bf551a21c77105180b29eaa
Ruby
ElContreh/curalito
/main.rb
UTF-8
4,553
2.828125
3
[]
no_license
require 'telegram/bot' require 'i18n' require_relative 'dependencies/gen-dep.rb' I18n.load_path << Dir[File.expand_path("text") + "/*.yml"] #Methods #Funciones def set_user(users, message) #Comprobar si ya ha escrito y ver su estado #Check if the user has written something already, and see their statu...
true
ffad1100be009db48803b9aff698fda71fb9a2ee
Ruby
geczirebeka/w1_d2_functions_lab
/ruby_functions_practice.rb
UTF-8
1,054
3.9375
4
[]
no_license
def return_10() return 10 end def add(add_one, add_two) return add_one + add_two end def subtract(sub_1, sub_2) return sub_1 - sub_2 end def multiply(mult_1, mult_2) return mult_1 * mult_2 end def divide(divi_1, divi_2) return divi_1 / divi_2 end def length_of_string(string) return string.l...
true
b2c732bd3cc31ab28ce86d3a162d74141eaecc82
Ruby
styd/smart_kv
/lib/smart_kv/core.rb
UTF-8
1,865
2.671875
3
[ "MIT" ]
permissive
require 'set' require_relative "errors" require_relative "helper" module SmartKv::Core include SmartKv::Helper def required(*args) init_required @required += args @optional -= @required if @optional @required end def required_keys init_required @required.to_a end def init_require...
true
33da813c8c7c6582e8be3195fdeec5338e4fcd04
Ruby
ICC4103-202010-WebTech/lab5-lab5-figueroa-izquierdo
/lib/tasks/model_queries.rake
UTF-8
1,972
2.703125
3
[]
no_license
namespace :db do task :populate_fake_data => :environment do # If you are curious, you may check out the file # RAILS_ROOT/test/factories.rb to see how fake # model data is created using the Faker and # FactoryBot gems. puts "Populating database" # 10 event venues is reasonable... create_l...
true
6af807f16c5c0686fba4e8aaad05444abf000c4d
Ruby
captproton/scooter_on_rails
/lib/tasks/mqtt_publish.thor
UTF-8
2,481
2.65625
3
[]
no_license
require "thor" require 'mqtt' # gem install mqtt ; https://github.com/njh/ruby-mqtt class MqttPublication < Thor ADAFRUIT_THROTTLE_PUBLISHES_PER_SECOND = 2 # limit to N requests per second # Required require "./config/environment" ADAFRUIT_USER = ENV['ADAFRUIT_USER'].freeze ADAFRUIT_IO_KEY =...
true
ed1810af604e3432f9854e244d65ab7b9f1809ec
Ruby
keynmol/octane
/lib/octane/network.rb
UTF-8
2,137
2.6875
3
[ "MIT" ]
permissive
module Octane class LayerDelegator include Enumerable def initialize(net, layer) @layer=net.layers[layer] @net=net @layer_number=layer end def each @layer.each {|u| yield u} end def unit(unit_number) return @layer[unit_number] end def disable(units) @net.disable_unit(@layer_nu...
true
ca0576d9a4fabd985e6128b101e43400e134b671
Ruby
Quarkex/beatroot_challenge
/lib/beatroot.rb
UTF-8
1,804
2.90625
3
[]
no_license
require 'net/http' require 'net/https' require 'uri' require 'json' require_relative 'track' require_relative 'release' class Beatroot attr_accessor :token, :api_base_url, :user def initialize(api_base_url, user, token) @api_base_url = api_base_url @user = user @token = token end def track(id) ...
true
ab771dcbec98e8bb5fc447bd801753e7c5838e3e
Ruby
hannahsquier/blackjack
/lib/deck.rb
UTF-8
463
3.421875
3
[]
no_license
class Deck attr_reader :deck_arr def initialize(deck_arr = nil) @deck_arr = make_deck(deck_arr) end def deal @deck_arr.pop end private def make_deck(deck_arr) if deck_arr.nil? deck_arr = (1..13).to_a * 4 suits = %w(s) * 13 + %w(h) * 13 + %w(c) * 13 + %w(d) * 13 deck_arr...
true
12d09816defbf32d0104a51c116103064aecfd08
Ruby
Attamusc/rumbrl
/lib/rumbrl/formatter.rb
UTF-8
686
2.90625
3
[]
no_license
require 'logger' require 'rumbrl/smash' module Rumbrl # Log4r formatter class Formatter < ::Logger::Formatter def call(_severity, _timestamp, _prog, msg) return '' if omit_empty? && empty?(msg) "#{format_msg(msg)}\n" end def omit_empty(switch) if [TrueClass, FalseClass].include? swi...
true
b64019269d933b301993e3bde28c93900d943879
Ruby
MooreJesseB/gluten_free
/person_class.rb
UTF-8
838
4
4
[]
no_license
class Person attr_reader :name, :stomach, :allergies def initialize(name) @name = name @stomach = [] @allergies = [] end def add_allergy(allergy) @allergies.push(allergy) puts "You now have an allergy to #{allergy}" puts "You are now have food allergies to the following: #{@allergies.join(", ")}" en...
true
c056d80f8c4d426e7810180e78abd85a97cd0ab9
Ruby
bpainter/frankenstein
/commands/example.rb
UTF-8
652
2.875
3
[]
no_license
# Used to extend commands in Nanoc and depreciates the need for a separate Rakefile. # Based on Cri, http://rubydoc.info/gems/cri/2.0.0/file/README.md usage 'dostuff [options]' aliases :ds, :stuff summary 'does stuff' description 'This command does a lot of stuff. I really mean a lot.' flag :h, :help,...
true
9a740add0069578284cc22583c2c58b4637dc332
Ruby
martinbjeldbak/p3-project
/program/foodl/app/helpers/search_helper.rb
UTF-8
1,117
2.84375
3
[ "MIT" ]
permissive
module SearchHelper #Formats a value nicely, with fractions def format_quantity( value ) #Remove everything below .## value = (value * 100).round() / 100.0; #Check for common fractions fracs = Hash[ 0.25=>"1/4", 0.33=>"1/3", 0.5=>"1/2", 0.66=>"2/3", 0.75=>"3/4" ] if fracs.has_key?( value ) return fra...
true
10ba9e27ff033641941e77d983d3e96334241edc
Ruby
nard-tech/atcoder-crystal
/contests/abc143/d.rb
UTF-8
666
3.296875
3
[]
no_license
# ABC 143 D - Triangles # https://atcoder.jp/contests/abc143/tasks/abc143_d # 1607 ms, 1912 KB # https://atcoder.jp/contests/abc143/submissions/12697559 n = gets.chomp.to_i l = gets.chomp.split(/ /).map(&:to_i).sort # puts sticks.inspect # puts "" count = 0 0.upto(n - 3) do |i| a = l[i] (i + 1).upto(n - 2) do |...
true
5720fe323fb3e01f5abdb4ee136d99ca1a730703
Ruby
AakashOfficial/licensee
/lib/licensee/content_helper.rb
UTF-8
4,834
2.703125
3
[ "MIT", "BSD-3-Clause", "BSD-3-Clause-Clear", "LGPL-3.0-only", "GPL-1.0-or-later", "GPL-2.0-only", "BSD-2-Clause", "LGPL-2.0-or-later", "LGPL-2.1-only", "GPL-3.0-only" ]
permissive
require 'set' require 'digest' module Licensee module ContentHelper DIGEST = Digest::SHA1 END_OF_TERMS_REGEX = /^[\s#*_]*end of terms and conditions\s*$/i HR_REGEX = /[=\-\*][=\-\*\s]{3,}/ ALT_TITLE_REGEX = License::ALT_TITLE_REGEX ALL_RIGHTS_RESERVED_REGEX = /\Aall rights reserved\.?$/i WHIT...
true
896717fd1c4f8045ac6d712e6eb41a2aca8a4bc5
Ruby
kleinmann/personal-homepage
/lib/blog/blog_post.rb
UTF-8
741
3.21875
3
[]
no_license
class BlogPost attr_reader :title, :text, :created_at, :index, :teaser def initialize(text, created_at, index) @title = text.lines.to_a[0] @created_at = Date.strptime(created_at, "%Y%m%d") @index = index @teaser = create_teaser(text.lines.to_a[1..-1].join) @text = create_text(text.lines.to_a[1..-1].join) ...
true
0149ec6ba965cdd21bf68beb05f13ebcf1d4ecda
Ruby
JustinData/GA-WDI-Work
/w01/d03/Justin/MTA.rb
UTF-8
3,267
3.875
4
[]
no_license
#Arrays and Hashes predefine n = ['ts', '34th', '28th-n', '23rd-n', 'us', '8th'] l = ['8th', '6th', 'us', '3rd', '1st'] s = ['gc', '33rd', '28th-s', '23rd-s', 'us', 'astor'] mta = {} mta[:n] = n mta[:l] = l mta[:s] = s #===================== #Start of methods #takes in starting and ending points def which_station(st...
true
2516d1fa94e5054791c7633f9ac741e1597b463e
Ruby
SpencerB3/launch_school
/precourse_ruby/intro_to_programming_with_ruby/09_exercises/exercise_9.rb
UTF-8
96
3.234375
3
[]
no_license
h = {a:1, b:2, c:3, d:4} puts h[:b] h[:e] = 5 puts h h.select! do |k, v| v > 3.5 end p h
true
55dc24c99656d959ab03fa669c54a7bf047b5da2
Ruby
matlex/thinknetica_ror
/Lesson 7/train.rb
UTF-8
2,907
3.375
3
[]
no_license
require_relative 'instance_counter' require_relative 'custom_errors' class Train include InstanceCounter include CustomErrors attr_reader :type, :number, :wagons, :current_speed POSSIBLE_TRAIN_TYPES = ['Passenger', 'Cargo'] NUMBER_FORMAT_PATTERN = /^[a-z0-9]{3}-?[a-z0-9]{2}$/i TRAIN_NUMBER_LENGTH = 5 ...
true
cde3701fb7821aff15d1c33ad844b6b31dc3aa87
Ruby
Byambaa0325/ruby-object-initialize-lab-cb-gh-000
/lib/dog.rb
UTF-8
105
2.65625
3
[]
no_license
class Dog def initialize(_name, _breed="Mutt") @name= _name @breed= _breed end end
true
cb30c98837b8186086aad4256ac3f7afdfd21c8d
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/accumulate/7a69069c237d4031873d7a35b5afb164.rb
UTF-8
132
3.46875
3
[]
no_license
class Array def accumulate result = [] i = 0 while self[i] result << (yield self[i]) i += 1 end result end end
true
d64414b6dad50ad5be36d85923d511122ba6d832
Ruby
ellebaum/weekendpuzzles
/2020-07-05.rb
UTF-8
3,120
3.421875
3
[]
no_license
#Think of an eight-letter word for something we all crave now. It consists of three consecutive men's nicknames. What are they? #Answer: normalcy dictionary_file = File.read "/usr/share/dict/words" dictionary_hash = {} dictionary_file.lines.each do |line| if line.gsub(/[^a-zA-Z]/, '').chomp.downcase.length == 8 di...
true
55064486ca55ae4de9d0d1b530ef62461ea4617c
Ruby
internetee/auction_center
/lib/messente/sending_error.rb
UTF-8
559
2.765625
3
[ "MIT" ]
permissive
module Messente class SendingError < StandardError attr_reader :response_code attr_reader :response_body attr_reader :message attr_reader :request_body def initialize(response_code, response_body, request_body) @response_code = response_code @response_body = response_body @reque...
true
7a236487923746dafc5cf51da4f4e3c50828eaf0
Ruby
ryanflach/headcount
/lib/enrollment.rb
UTF-8
1,694
3.109375
3
[]
no_license
require_relative 'calculations' class Enrollment include Calculations attr_accessor :enrollment_data def initialize(enrollment_data) @enrollment_data = enrollment_data end def name @enrollment_data[:name].upcase end def kindergarten_participation enrollment_data[:kindergarten_participatio...
true
53cee4d9ec28c880609310e676639bab2a8c8371
Ruby
TAEB/RubyTAEB
/ai/taskhandler.rb
UTF-8
2,155
3.3125
3
[]
no_license
#!/usr/bin/ruby $:.push('ai/task/') require 'door.rb' require 'eatfood.rb' require 'elbereth.rb' require 'ensure.rb' require 'explore.rb' require 'fight.rb' require 'fixhunger.rb' require 'randomwalk.rb' require 'search.rb' class TaskHandler def initialize() @tasks = [ [99999, TaskEnsure.new() ], # ...
true
650e24a569f5122facc5a3778cbc7ceaa22f4bc2
Ruby
Terry-Thompson/collections_practice-v-000
/collections_practice.rb
UTF-8
719
3.5625
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def sort_array_asc(array) array.sort { |a, b| a <=> b } end def sort_array_desc(array) array.sort { |a, b| b <=> a } end def sort_array_char_count(array) array.sort { |a, b| a.length <=> b.length } end def swap_elements(array) c = [] c << array[0] c << array[2] c << array[1] c end def swap_elements_...
true
f5ccb4aa84d646b4a16088cd056a1a1d089f84e5
Ruby
joshwlewis/unitwise
/test/unitwise/unit_test.rb
UTF-8
2,316
3
3
[ "MIT" ]
permissive
# encoding: UTF-8 require 'test_helper' describe Unitwise::Unit do let(:ms2) { Unitwise::Unit.new("m/s2") } let(:kg) { Unitwise::Unit.new("kg") } let(:psi) { Unitwise::Unit.new("[psi]")} let(:deg) { Unitwise::Unit.new("deg")} describe "#terms" do it "must be a collection of terms" do _(ms2).mus...
true
626a2532c297d24d714c0c0acbaef07919c2e27d
Ruby
JoseGomez247/codeacamp
/newbie/semana1/Martes/firstl.rb
UTF-8
261
3.5625
4
[]
no_license
def first_letters(word) r= [] word.split.each { |w| r << w.chars.first} r end p first_letters("Hoy es miércoles y hace sol") == ["H", "e", "m", "y", "h", "s"] p first_letters("tienes ocho candados indios nuevos omega") == ["t", "o", "c", "i", "n", "o"]
true
3516e699c7e3a3b4b46a25851ec89fc074b3b319
Ruby
tpinto/panda
/app/models/clipping.rb
UTF-8
3,220
2.53125
3
[ "MIT" ]
permissive
# Clipping for a given encoding or parent video. # class Clipping include LocalStore def initialize(video, position = nil) @video = video @_position = position end def filename(size, opts = {}) raise "Invalid size: choose :thumbnail or :screenshot" unless [:thumbnail, :screenshot].include?...
true
97361148544dc0bc4b4a7972c7fc66f080c43df5
Ruby
AdamClemons/cartoon-collections-online-web-sp-000
/cartoon_collections.rb
UTF-8
683
3.28125
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def roll_call_dwarves(dwarves)# code an argument here # Your code here dwarves.each_with_index {|dude, index| puts "#{index+1}. #{dude}"} end def summon_captain_planet(calls)# code an argument here # Your code here summon = calls.collect {|dude| dude.capitalize!.insert(-1, "!")} end def long_planeteer_calls(c...
true
a03261f738b61a5e100f9109514a1b886c1d5bee
Ruby
wallaby-rails/wallaby-core
/lib/wallaby/class_array.rb
UTF-8
1,852
3.375
3
[ "MIT" ]
permissive
# frozen_string_literal: true module Wallaby # This is a constant-safe array that stores Class value as String. class ClassArray include Classifier # @param [Array] array def initialize(array = []) @internal = array || [] return if @internal.blank? @internal.map!(&method(:to_class_n...
true
2dd59af9ad04629d0a0361e3aab55b1c3933b107
Ruby
guang-zh/Ruby
/Code/2021_07/06_hashes_and_symbols.rb
UTF-8
3,751
4.46875
4
[]
no_license
# Hashes and Symbols - Module 6 # 1. HASHES RECAP # C.R.U.D: # C. Create # R. Read # U. Update # D. Delete # C. Create a hash: new_hash = {} # or new_hash = Hash.new #or meals = { "breakfast" => "bacon and eggs", "lunch" => "pasta", "snack" => "dill pickle chips", "dinner" => "Steak and salad" } # R. ...
true
7ead4ed6a437bd04e10098f936ff75309cb0312e
Ruby
HubSpot/sample-apps-leaky-bucket
/ruby/cli.rb
UTF-8
1,140
2.703125
3
[ "Apache-2.0" ]
permissive
require_relative 'config' class Cli def run self.emails = (1..3).map { |i| "leaky_bucket_app#{i}@hubspot.com" } 200.times { start_worker } end private attr_accessor :api, :ids, :emails def start_worker puts 'Sleep 1 second to avoid 429 error' sleep 1 api_client = ::Hubspot::Crm::Cont...
true