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
a1d290f7001a135ade8820ded080aa72f5dcbe4a
Ruby
andersonpablo/Aulas_Ruby
/QuestoesProvaRuby-IFRN/Questao4.rb
WINDOWS-1252
1,019
4.75
5
[]
no_license
#Crie um script em Ruby que l trs valores, a, b e c e dizer se estes valores podem ser os lados de um tringulo. Para um tringulo ser formado, a soma de dois lados deve ser maior do que o terceiro lado: a + b > c e a + c > b e b + c > a. Quando os lados do tringulo forem vlidos, o script deve informar qual o tipo de tr...
true
458e0d91db21719247c7232a2e6f76fcb6195945
Ruby
sketchplugins/plugin-directory
/Rakefile
UTF-8
16,609
2.5625
3
[]
no_license
#encoding: utf-8 require 'json' require 'time' require "./lib/plugin-directory-utils" GITHUB_AUTH_TOKEN = ENV['GITHUB_TOKEN'] def title_for plugin title = plugin['title'] || plugin['name'] return titlefy(title) end def fix_plugin_title plugin if (plugin['name'] == plugin['title'] && !(IGNORE.include? plugin['...
true
b0c0a620bba2a444a8b1048fe7e70d5ae5380195
Ruby
mauricioszabo/Things-you-never-wanted-to-know
/private_methods/spec/self_spec.rb
UTF-8
379
2.546875
3
[]
no_license
require "private_methods" class SelfExample extend PrivateMethods public_method :myself do self end public_method :private_self do ret_private_self end private_methods :ret_private_self do self end end describe 'Self on methods' do it 'should correct the "self" on public methods' do ...
true
6a77688f59c18065559db916f60bf70fc163a2e8
Ruby
JustJace/CodeJam
/Qualifying Practice/SC.rb
UTF-8
270
3.3125
3
[]
no_license
# Store Credit def solve c, prices end N = gets.chomp.to_i for n in 1..N c = gets.chomp.to_i i = gets.chomp.to_i items = gets.chomp.split ' ' prices = [] for m in 0..i prices << items[m].to_i end print "Case #" + n.to_s + ": " puts solve c, prices end
true
943e97b1df30ff0cba77bdad66f2dac2f6de2881
Ruby
luizhcb0/eco_smarte
/app/helpers/application_helper.rb
UTF-8
812
2.609375
3
[]
no_license
module ApplicationHelper def user_type_array user_type_array = [["Pool/Spa User", "user"], ["Pool Company", "company"], ["Commercial Pool", "commercial"], ["Whole House Water Costumer", "whole_house"], ["Factory Monitor", "factory"]] end def yes_no(x) x ? "Yes" : "No" end def f_c(x) if ...
true
89eb2687c26200ba6cffbf1de19eef750e239972
Ruby
emsk/backlog_kit
/lib/backlog_kit/client.rb
UTF-8
5,915
2.5625
3
[ "MIT", "Ruby" ]
permissive
require 'backlog_kit/error' require 'backlog_kit/response' require 'backlog_kit/version' require 'backlog_kit/client/authorization' require 'backlog_kit/client/git' require 'backlog_kit/client/group' require 'backlog_kit/client/issue' require 'backlog_kit/client/notification' require 'backlog_kit/client/priority' requi...
true
1ad05c5d7ecc893fd0dd81a2b1c54466c70f89e9
Ruby
bitwes/bash_profile
/lib/cursor.rb
UTF-8
623
3.171875
3
[]
no_license
class Cursor # - Move the cursor up N lines: # \033[<N>A def self.up(n=1) p '\033[<' + n.to_s + '>A' end # - Move the cursor down N lines: # \033[<N>B def self.down(n=1) p '\033[<'+ n.to_s + '>B' end # - Position the Cursor: # \033[<L>;<C>H # Or # \033[<L>;<C>f # puts the cursor...
true
a9e904f02820284645daf00562ed8f5867c8e2ac
Ruby
JoshuaMcEvoy/WDi24-Homework
/ezra_mizrahi/week_04/day_01/calc.rb
UTF-8
3,292
4.53125
5
[]
no_license
def main_menu puts "(b) - basic calculator" puts "(a) - advanced calculator" puts "(q) - quit!" end def operations_menu puts "add" puts "subtract" puts "multiply" puts "divide" puts "(q) - quit!" end def advanced_menu puts "square root" puts "exponent" puts "(q) - quit!" end def prompt(message)...
true
6efef1eca2e276acb18c0a09607596b08e46991e
Ruby
minyoungryoo/Ironhack
/Week1/Day3/Game/lib/game.rb
UTF-8
1,597
3.46875
3
[]
no_license
class Game attr_accessor :space, :exit def initialize (space, exit) @space = space @exit = exit @item = Hash.new @inventory = Inventory.new @previous_pos = nil end def spacelimit(space) @space = space end def game_item(name, position) @inventory.add_inventory(name,position) end def play(charact...
true
18318131732c97975d8a3346d25a33afd54f69ed
Ruby
airbrake/airbrake-ruby
/spec/context_spec.rb
UTF-8
1,345
2.625
3
[ "MIT" ]
permissive
RSpec.describe Airbrake::Context do subject(:context) { described_class.current } before { described_class.current.clear } after { described_class.current.clear } describe "#merge!" do it "merges the given context with the current one" do context.merge!(apples: 'oranges') expect(context.to_h)...
true
58c81329ae343a28979034f160440b13245f51c7
Ruby
light940929/hadoop-bcftools
/lib/hadoop/bcftools/runner.rb
UTF-8
3,992
2.53125
3
[ "MIT" ]
permissive
require 'active_support/core_ext/hash' require 'hadoop/bcftools/streaming_configurator' require 'hadoop/bcftools/args_parser' require 'hadoop/bcftools/hdfs_uploader' require 'hadoop/bcftools/errors' module Hadoop::Bcftools # Runner is used to run Bcftools commands on Hadoop Streaming. # @author Wei-Ming Wu class...
true
e514533f874f0194536175b50c11dd28e9fe6612
Ruby
SANNIKUM/Hopewithoutreact
/build/database.rb
UTF-8
4,140
3.125
3
[]
no_license
require 'rubygems' require 'json' require 'yaml' require 'optparse' require 'erb' # def initialize(opts={}) # # opts.each { |k,v| instance_variable_set("@#{k}", v) } # end workspace = ARGV[0] host = ARGV[1] puts "Workspace = #{workspace}" puts "Host = #{host}" def get_items() ['bread', 'milk', 'eggs', 'spa...
true
62c4074009c104fc7e3260faad3037807988ae42
Ruby
mfung/the_test_game
/spec/person_spec.rb
UTF-8
1,875
3.09375
3
[]
no_license
require 'spec_helper' describe Person do describe "on initialization" do it "requires a name" do expect { Person.new() }.to raise_error(ArgumentError) expect { Person.new([])}.to raise_error(ParamError) end it "sets the name" do d = Person.new("foo") d.name.should == "foo" en...
true
fc29baf4953923f208d45bbcf6cf383970135fbe
Ruby
timotheeguerin/whats-in-the-fridge
/app/helpers/recipes_helper.rb
UTF-8
361
2.84375
3
[]
no_license
module RecipesHelper def time_prettify(time) hour = if time.hour > 0 "#{time.hour}h " else '' end minutes = if time.min > 0 "#{time.min}min " elsif time.hour == 0 'None' else '' ...
true
cf406ec2cf614e22eaaaa1f551204071370f34b5
Ruby
beaucouplus/programming_foundations
/lesson_6/tic_tac_toe.rb
UTF-8
4,425
3.578125
4
[]
no_license
require 'pry' require 'pry-byebug' INITIAL_MARKER = " " PLAYER_MARKER = "X" COMPUTER_MARKER = "O" FIRST_PLAYER = %w[player computer choose].sample WINNING_LINES = [[1, 2, 3], [4, 5, 6], [7, 8, 9], [2, 5, 8], [3, 6, 9], [3, 5, 7], [1, 4, 7], [1, 5, 9]] def prompt(msg) puts "=> #{msg}" end # rubocop...
true
5fc0af0a46051c2c391597ea2a67fb3ebce5a6af
Ruby
jchaselubitz/simple-blackjack-cli-london-web-career-010719
/lib/blackjack.rb
UTF-8
1,059
3.953125
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def welcome puts "Welcome to the Blackjack Table" end def deal_card newCard = 1 + rand(11) return newCard end def display_card_total(cardTotal) puts "Your cards add up to #{cardTotal}" end def prompt_user puts "Type 'h' to hit or 's' to stay" end def get_user_input gets.chomp end def end_game(cardTotal...
true
9f034a718526d3e172cbde8f99beed0776fb9dda
Ruby
smonard/sinatra-ddd
/server/domain/model/person.rb
UTF-8
299
3
3
[ "Unlicense" ]
permissive
# frozen_string_literal: true module Domain # Domain object in charge of every real-world operation concerning a Person class Person attr_reader :name def initialize(name = nil) @name = name end def to_hash { name: name } end alias to_h to_hash end end
true
453e843e0f8e46fa27ce7c8c33c9210cb59fd4c2
Ruby
mjey97/ruby_fastlane_tool
/Android/implementation/clean.rb
UTF-8
1,407
2.765625
3
[]
no_license
# clean.rb / public lane :clean #=================================================================== # Cleans the current git repository, if there is something to clean. #=================================================================== #==================================================================# #==========...
true
35b3c388b6824760234a34a8f9e84fb160c57a2f
Ruby
baileytalks/learn-to-program
/chapter09-writing-your-own-methods/9-5-psych-survey.rb
UTF-8
390
3.515625
4
[]
no_license
## Improved Ask Method def ask question while true puts question reply = gets.chomp.downcase if (reply == 'yes' || reply == 'no') if reply == 'yes' return 'Bed wetter!' else return 'LIES!' end else puts "Please answer yes or no" end end answer end ask "Burritos" ask ...
true
3600bce278cb0e53fb0e7215c7239dc660ab84b0
Ruby
andlogic/hackerrank
/ruby/greedy/jim-and-the-orders.rb
UTF-8
168
3.203125
3
[ "MIT" ]
permissive
n = gets.to_i h = {} i = 1 n.times do h[i] = gets.split(" ").map{|x| x.to_i}.reduce(:+) i += 1 end puts h.sort_by {|k, v| [v, k] }.map { |x| x.first }.join(" ")
true
fd9c73935ee4fb713ba87a4a1a16c5bbf0b1aed9
Ruby
sachin1mittal/assignments
/tour_mega/spec/lib/line_item_spec.rb
UTF-8
1,151
2.984375
3
[]
no_license
require_relative '../spec_helper' RSpec.describe LineItem do before do @product = Product.new('music CD', '55.0') @line_item = LineItem.new(@product, '5') end describe '#initialize' do it 'should initialize product and quantity' do expect(@line_item.product).to be(@product) expect(@line_...
true
90947fc168ba766bf9b96c7805db22a3c85c0439
Ruby
ali88b/ttt-10-current-player-cb-000
/lib/current_player.rb
UTF-8
294
3.671875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def turn_count(board) counter = 0 board.each do |item| item if item == "X" or item == 'O' counter += 1 end end counter end def current_player(board) if turn_count(board).even? return "X" else turn_count(board).odd? return "O" end end
true
4222606345c6bc03d84d2ca0049e0e9d9039866b
Ruby
cielavenir/procon
/codingame/community/candies.rb
UTF-8
237
2.625
3
[ "0BSD" ]
permissive
#!/usr/bin/ruby N,K=gets.split.map(&:to_i) def dfs(n,a) if n==0 puts a*' ' else (1..[K,n].min).each{|j| dfs(n-j,a+[j]) } end end dfs(N,[]) __END__ r=[1]+[0]*N 1.upto(N){|i| (1..[K,N].min).each{|j| r[i]+=r[i-j] } } p r[-1]
true
acb4e6148134a2d594502bd5a144182f572da8c7
Ruby
andrzejkrzywda/advent-of-code-2019
/restore_the_gravity_assist_program.rb
UTF-8
382
3.15625
3
[]
no_license
require_relative 'optcode' file = File.open('./input2.txt') string_input = file.read array_of_numbers = string_input.split(",").map(&:to_i) (0..99).each do |i| array_of_numbers[1] = i (0..99).each do |j| array_of_numbers[2] = j result = Optcode::Computer.new(STDIN, array_of_numbers.clone).execute[0] i...
true
98191078b91811133290854cf9ad7912681923ac
Ruby
seanhandley/adventofcode2017
/solutions/day_18/advent18.1.rb
UTF-8
1,925
3.125
3
[]
no_license
#!/usr/bin/env ruby def instructions @instructions ||= STDIN.read.split("\n").map{|i| parse_instruction(i)} end def parse_instruction(i) instruction, *args = i.split args = args.map{|a| Integer(a) rescue a } [instruction, args] end def registers @registers ||= {} end def last_sound @last_sound end trap...
true
47eb148df34ba3dba9a9744fcc0bc86f03216a29
Ruby
castor4bit/leetcode
/contests/Weekly_Contest_173/5320.Filter_Restaurants_by_Vegan-Friendly,_Price_and_Distance/test_5320.rb
UTF-8
867
2.828125
3
[]
no_license
require 'test/unit' require './5320' class LeetCodeSolutionTest < Test::Unit::TestCase def test_5320 restaurants = [[1,4,1,40,10],[2,8,0,50,5],[3,8,1,30,4],[4,10,0,10,3],[5,1,1,15,1]] vegan_friendly = 1 max_price = 50 max_distance = 10 assert_equal [3,1,5], filter_restaurants(restaurants, vegan_f...
true
28ff3d30714e5148b4de78828c57171288e4e71b
Ruby
sateesh3048/ruby_design_patterns
/creational_patterns/builder_pattern/builder_pattern_ex2.rb
UTF-8
1,886
3.421875
3
[]
no_license
class CPU end class BasicCPU < CPU end class TurboCPU < CPU end class Motherboard attr_accessor :cpu, :memory_size def initialize(cpu = BasicCPU.new, memory_size = 1024) @cpu = cpu @memory_size = memory_size end end class Drive attr_reader :type, :size, :writable def initialize(type, size, wr...
true
fa60ec9770dfe2940204cd9ff451349e461f697c
Ruby
kclar24/TTS-Ruby-Practice-2016
/secretsanta.rb
UTF-8
726
4.09375
4
[]
no_license
#SECRET SANTA # when you run through the first loop, you dont need to delete the first item each time, because the loop wont pass that item twice anyways. When you delete the first item, you shift the index numbers and the loop stops at the halfway point - basically double advancing. gifters = [ "kevin", "jacqueline"...
true
a819bcab1bf8a21a4bb6bc84eb5c8c92a4c463bb
Ruby
MarcusRiemer/sport.db
/sportdb-text/lib/sportdb/text.rb
UTF-8
1,320
2.515625
3
[ "LicenseRef-scancode-public-domain", "CC0-1.0" ]
permissive
# encoding: utf-8 require 'csv' ## 3rd party gemss require 'sportdb/config' ### # our own code require 'sportdb/text/version' # let version always go first require 'sportdb/text/structs/team' require 'sportdb/text/structs/match' require 'sportdb/text/structs/matchlist' require 'sportdb/text/struct...
true
0df1f9a7f17ce2be7dbfca8451e73ed1dafe49be
Ruby
inishchith/DeepSpeech
/swig/Examples/test-suite/ruby/aggregate_runme.rb
UTF-8
612
2.515625
3
[ "LicenseRef-scancode-swig", "GPL-3.0-or-later", "LicenseRef-scancode-unknown-license-reference", "GPL-3.0-only", "Apache-2.0" ]
permissive
#!/usr/bin/env ruby # # Put description here # # # # # require 'swig_assert' require 'aggregate' include Aggregate # Confirm that move() returns correct results under normal use result = move(UP) raise RuntimeError unless (result == UP) result = move(DOWN) raise RuntimeError unless (result == DOWN) result = mo...
true
e742780bbb15ef5f3d37018335c0a322b22a5618
Ruby
mtanda/fluent-plugin-logentries
/lib/fluent/plugin/out_logentries.rb
UTF-8
2,620
2.71875
3
[ "MIT" ]
permissive
require 'socket' require 'openssl' class LogentriesOutput < Fluent::BufferedOutput class ConnectionFailure < StandardError; end # First, register the plugin. NAME is the name of this plugin # and identifies the plugin in the configuration file. Fluent::Plugin.register_output('logentries', self) config_param...
true
4f6109b71768593275280f185717889d93d380e6
Ruby
veekram/chamber
/lib/chamber/filters/boolean_conversion_filter.rb
UTF-8
978
2.734375
3
[ "MIT" ]
permissive
# frozen_string_literal: true module Chamber module Filters class BooleanConversionFilter def initialize(options = {}) self.data = options.fetch(:data).dup end def self.execute(options = {}) new(options).__send__(:execute) end protected attr_accessor :data # rubocop:disable Metrics/BlockNe...
true
187338063d1986774da89e249d99de55632d79ab
Ruby
rr/rr
/lib/rr/deprecations.rb
UTF-8
2,543
2.53125
3
[ "MIT" ]
permissive
module RR module Adapters # People who manually include RR into their test framework will use # these constants module MiniTest def self.included(base) RR::Deprecations.show_warning_for_deprecated_adapter RR.autohook end end module TestUnit def self.included(bas...
true
903f54c58bc5e5765e807694e5ba77dab8531e0a
Ruby
Tiki7732/TicTacToe
/lib/tic_tac_toe_node.rb
UTF-8
1,483
3.5625
4
[]
no_license
require_relative 'tic_tac_toe' class TicTacToeNode attr_reader :board, :next_mover_mark, :prev_move_pos def initialize(board, next_mover_mark, prev_move_pos = nil) @board = board @next_mover_mark = next_mover_mark @prev_move_pos = prev_move_pos end def losing_node?(evaluator) if board.over?...
true
f99cdac9d3e7623842504f94ee3562d0e09d2fa8
Ruby
saikrishna321/calabash_wrapper
/features/step_definitions/calabash_steps.rb
UTF-8
2,251
2.546875
3
[]
no_license
require 'calabash-android/abase' load '/Users/saikrishna/Wrappermethods/commonmethods/sample.rb' Given(/^I press button$/) do macro 'verify command' touch_screen($sign_in) wait_for_element($user_name, 3) send_text($user_name, 'nav2@shop.com') send_text($password, 'qwerty') performAction('status_wifi', 'disable...
true
c41cfa7ca9556af1c332f7216c08f58441ad27dc
Ruby
nicholasjhenry/brandizzle
/lib/google_blog/search.rb
UTF-8
1,571
2.578125
3
[]
no_license
module GoogleBlog class BlogPost attr_reader :title, :url, :published_at, :content def initialize(attributes) @title = attributes[:title] @content = attributes[:content] @url = attributes[:url] @published_at = attributes[:published_at] end end class Searc...
true
04a3ab883ae688c3194da85d5b1050f27d793d6f
Ruby
LukeP91/codeeval
/labirynth/test_labyrinth.rb
UTF-8
1,154
2.75
3
[]
no_license
require 'minitest/autorun' require './labyrinth' class LabyrinthTest < Minitest::Test def test_goes_throug_straigh_line labyrinth = Labyrinth.new('test1.txt') solution = load_solution('solution1.txt') assert_equal labyrinth.solution, solution end def test_it_detects_turns labyrinth = Labyrinth.n...
true
e4ed1b76aed2220745b02dc9287a0b781d2e11a0
Ruby
KunalRaghav/GitHub-Writes-Code
/hacktoberfest.rb
UTF-8
281
2.71875
3
[]
no_license
class Hacktoberfest @@participants_list = [ "RyanJamesCaldwell" ] def initialize participants end def participants @@participants_list.each do |participant| puts "#{participant} contributed to this repo as a part of Hacktoberfest!" end end end
true
5a1fb97acc22a29bc579dbdf84c73d0009f58c0d
Ruby
kevinsuboy/aA_homework
/w3/d5/lib/stack.rb
UTF-8
576
3.734375
4
[]
no_license
class Stack def initialize # create ivar to store stack here! @arr = [] end def push(el) # adds an element to the stack @arr << el return true end def pop # removes one element from the stack @arr.pop() end def peek # returns, but doesn't ...
true
a0a22db4bb4a0bfc4e328febfdce5751ea90012a
Ruby
Codaisseur/Narnia-Return-to-Deathwater
/db/stories/198_213.rb
UTF-8
12,165
4
4
[]
no_license
quest = Quest.create( ref_number: 198, description: <<-STORY Foam flies from the dogs' powerful jaws as they lunge at you and Cheekimeek. The air becomes filled with shouts and growls, and you find yourself feeling quite sick with fear and anger. Moments later, you are struggling on your back in the straw...
true
ae451e0a06235f1b798dbe745db7dd306cb47e71
Ruby
kylemellander/video-uploader
/server/app/models/video.rb
UTF-8
1,588
2.59375
3
[]
no_license
class VideoValidator < ActiveModel::Validator def validate(video) if !check_is_file(video.file) video.errors[:file] << "There was no file attached to upload." elsif check_size(video.size, video.file) video.errors[:file] << "File Too Large. Maximum file size is 100MB" elsif !check_mp4(video.fi...
true
4a5ae14e542f462a71910cbd753a436c8b2a40cc
Ruby
stevielum1/aA_w2d3
/poker/lib/hand.rb
UTF-8
405
3.125
3
[]
no_license
class Hand attr_reader :cards def initialize(cards) @cards = cards end def hand_rank end def straight_flush? suit = cards.first.suit cards.each { |card| return false unless card.suit == suit } values = [] cards.each { |card| values << card.value } return false u...
true
230b01ab84fd16882cf90199d94dbb3380f81dbc
Ruby
admariner/infoboxer
/spec/infoboxer/templates/set_spec.rb
UTF-8
2,264
2.53125
3
[ "MIT" ]
permissive
module Infoboxer describe Templates::Set do context 'definition' do let(:set) { described_class.new do template 'Largest cities' do def city_names fetch(/city_\d+/).map(&:text) end end template 'Infobox', match: /^Infobox/i do ...
true
ea82015ca6b51e40cda73aac49d2e6e43e2bbe62
Ruby
jackmcc08/makers-progress
/week-3/week-3-code/Servers-practical/exercises.rb
UTF-8
642
3.484375
3
[]
no_license
# Exercise 1 & 2 require 'socket' require_relative 'notebook' server = TCPServer.new(2345) socket = server.accept notebook = Notebook.new loop do socket.puts "What do you say? (type 'quit' to exit)" socket.puts "Add it to your notebook if you want" they_said = socket.gets.chomp socket.close if they_said =...
true
6b96d440e121487bf42784126612aca1b6d90821
Ruby
bimbram/launchschool
/100_programming_back_end_prep/01/codeacademy_rubytrack/09_object-oriented_programming,_part_1/02_virtual_computer/06_who_are_the_users?.rb
UTF-8
1,180
3.59375
4
[]
no_license
# Who are the Users? #=============================================================================== # # -Let's create a class method to access our @@users class variable # #=============================================================================== # # Instruction # #==============================================...
true
44383769823e2c3ec155c0bc89a8c1c4f7168725
Ruby
goeran/DasBlog2totoMigration
/tests/learning_spec.rb
UTF-8
887
2.890625
3
[]
no_license
require 'rubygems' require 'spec' require 'htmlentities' require 'YAML' describe "HTMLEntities" do before :all do @coder = HTMLEntities.new end it "should be able to decode single quote" do coder = HTMLEntities.new input = "&rsquo;" result = coder.decode(input) result.should eql "’" end ...
true
16f967e37090a6d3f60d7dd5bd023003ca9bd59c
Ruby
mudboy/python-challenge
/level06/level6.rb
UTF-8
1,335
2.59375
3
[]
no_license
require 'rubygems' require 'zip/zip' Zip::ZipFile.open("channel.zip") do |file| output = "" nothing = 90052 begin while true nothing = file.read("#{nothing}.txt").scan(/\d+$/) output << file.get_entry("#{nothing}.txt").comment end rescue puts output e...
true
9fe68fc77bf191fa3fe6ce5789127476a5c44d2b
Ruby
jhawthorn/galette
/lib/galette/availability_set.rb
UTF-8
1,645
2.890625
3
[ "MIT" ]
permissive
module Galette class AvailabilitySet include Enumerable def initialize(availabilities=[], valid=nil) if availabilities.is_a?(Hash) @hash = availabilities.compare_by_identity else @hash = {}.compare_by_identity availabilities.each do |availability| @hash[availabil...
true
974eb895f25078372dc06ad90c7cf76b74a52303
Ruby
annuyadav/lengaburu_traffic
/file_parser.rb
UTF-8
536
3.15625
3
[]
no_license
class FileParser attr_accessor :name def initialize(name) @name = name end def inputs return [] unless file_present? || File.read(name) return [] unless File.read(name) parse end private def file_present? return false unless name File.file?(name) ...
true
dc6dca7b5430ddee03ffd445ca4e185d01d82567
Ruby
emergmedpa/TTS
/Textbook/textbook/TOC.rb
UTF-8
200
2.75
3
[]
no_license
line_width = 40 str1 = 'Table of Contents' str2 = 'Chapter 1' str3 = 'Getting Started' str4 = 'page 1' puts (str1.center ( line_width) ) puts (str2.ljust (line_width/2) + str4.rjust (line_width/2) )
true
fc78b01315d1bbcb492f9f7cfe9ac412d2277100
Ruby
DimitriOstapenko/emr
/db/seeds/01_patients.rb
UTF-8
2,648
2.671875
3
[ "Beerware", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
# # Seed patient table # # Next 3 lines allow to run it in stand-alone require_relative '../../config/environment' require 'date' require 'csv' puts "About to import NEW patients into DB table from HS CSV file. Validity checks for all but lname,dob,ohip_num (if ohip), ohip_ver (if ohip) should be off" csv_text = Fil...
true
9d3ceba8f3046462d2b74c62b55062528f9c8d71
Ruby
dyep49/Umpire-Auditor
/app/models/csvparser.rb
UTF-8
5,242
2.5625
3
[]
no_license
require 'nokogiri' require 'open-uri' require 'csv' require_relative 'call_calculator.rb' class CsvParser FILE_BASE_PATH = 'components/game/mlb' def self.parse_gid(file_path) f = File.open(file_path) doc = Nokogiri::XML(f) hash = Hash.from_xml(doc.to_s) gid = hash["game"]["id"] end def self.base_folder_path(g...
true
d7f165e2f58518247c12f631f68f0dfcf9c42f73
Ruby
workaahmed16/Ruby_Learning
/celcius_to_fahrenheit.rb
UTF-8
161
3.90625
4
[]
no_license
puts "What is the temperature in Celcius?: " c = gets.to_i def converter(c) return (c * (9/5.0) +32) end puts "Temperature in Fahrenheit: #{converter(c)}"
true
93124dd576d360689822b3b4b5c4e22257ccfb94
Ruby
mouchtaris/fictional-disco
/bin/azdb
UTF-8
1,369
2.625
3
[]
no_license
#!/usr/bin/env ruby require 'bundler/setup' require 'hashie' require 'json' require 'pp' def load_db(path) JSON .parse(File.read(path)) .map(&Hashie::Mash.method(:new)) end Policies = load_db 'azure.db/builtin_policies.json' Resources = load_db 'azure.db/resource_providers.json' Mode = ARGV.shift class P...
true
9a1b431d4c6e285647d0bb64c84c847d934bdcd4
Ruby
carakan/gema
/spec/models/busqueda_spec.rb
UTF-8
4,600
2.640625
3
[]
no_license
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe Busqueda do before(:each) do class Prueba attr_reader :busqueda def initialize(bus) @busqueda = bus end end end it '1 a 3 letras igual' do b = Busqueda.buscar('TA') b.expresiones[1].should =...
true
ba55ff0b1b966235ca944ddc3388f75d6988e8e4
Ruby
deeptymayi/branch_project
/lib/pages/live_view.rb
UTF-8
870
2.578125
3
[]
no_license
require_relative '../../lib/pages/abstract_page' require_relative '../../lib/pages/home_page' require_relative '../../lib/pages/quick_links' class LiveViewPage < AbstractPage def initialize (driver) super(driver) end def clickOnLink #### Validate text on Live view page @@driver.find_element(:tag_...
true
e5d05872ca8f6194e0150fcdf2d0aeeb8aefcbf6
Ruby
rossenhansen/Ruby
/089_Access_Single_ARRAY_Element_by_INDEX.rb
UTF-8
486
4.09375
4
[]
no_license
fruits = %w[Apple Orange Grape Bannana Pear] p fruits.length #=> 5 #Number of elements in the Array p fruits.values_at(1..3) #=> ["Orange", "Grape", "Bannana"] p fruits.values_at(0) #=> ["Apple"] p fruits[6] #=> nil p fruits[0] #=> "Apple" p fruits[1..3] #=> ["Orange", "Grape", "Bannana"] p fruits[fruits.length - 1] #=...
true
aeaf29766d02ec2ca17196df4affd55a91cee516
Ruby
WallPetrucci/ruby-basico-udemy
/Aula 34/papagaio.rb
UTF-8
519
3.46875
3
[]
no_license
class Papagaio attr_accessor :nome attr_accessor :idade def initialize(nome, idade) @nome = nome @idade = idade end def repetir_frase(frase = "Curupaco!") puts frase end end ###### papagaio1 = Papagaio.new("Aladin", 30) papagaio2 = Papagaio.new("Jasmine", 20) papagaio1.nome = "Aladin da Silva" papa...
true
5d00f11f2521d942db6a6029fc103a379bc2129f
Ruby
mikhailov/algorithmic_tasks
/sqrt.rb
UTF-8
740
3.421875
3
[]
no_license
class Sqrt def initialize(num) @num = num end def process if !validate raise ArgumentError end result = 1.0 10.times do |i| result -= (result * result - @num) / (2 * result) end result end def validate @num.instance_of?(Integer) && @num > 0 end end require '...
true
ed7ff21dce45019b2a1941c8b0fe9e0670ea65e9
Ruby
GraberGT/Thinknetica
/Thinknetica/Module_1/Lesson_2/6.rb
UTF-8
511
3.515625
4
[]
no_license
# frozen_string_literal: true check = {} sum = 0 loop do puts '1. Write product name' product = gets.chomp puts '2. Write price' price = gets.chomp.to_f puts '3. Write quantity' quantity = gets.chomp.to_f puts '0. Exit' puts '4. Add product' puts 'Write your choice: ' input = gets.chomp.to_f ...
true
87b957dfb4ddff5a272a02e7d9ab6509f4d24868
Ruby
alejandrotoledoweb/tic_tac_toe_ruby
/bin/main
UTF-8
2,521
3.9375
4
[]
no_license
#!/usr/bin/env ruby require_relative '../lib/game_class' require_relative '../lib/class_board' require_relative '../lib/set_up' reset = true while reset puts 'Welcome to our tic tac toe game!' p1_name = true p2_name = true while p1_name puts 'Player 1 type your name. ' begin player1_name = gets...
true
c6c8d50e5ff39a8984468700ec6adb991eb27dd6
Ruby
WoLkErSs/codebreaker-gem
/lib/entities/player.rb
UTF-8
540
2.75
3
[ "MIT" ]
permissive
module Codebreaker class Player include Validation attr_reader :name attr_accessor :errors_store LENGTH_RANGE = 3..20 def assign_name(name) @errors_store = [] return @name = name if validate_name(name) @errors_store << I18n.t(:when_wrong_name, min: LENGTH_RANGE.first, max: LE...
true
f550d882d1fa9d0d944c04320c48966697542d36
Ruby
david-mears/Bookmark-Manager
/lib/bookmark.rb
UTF-8
838
3.015625
3
[]
no_license
require 'PG' class Bookmark @@conn = PG.connect( dbname: 'bookmark_manager' ) def self.add(title, url) url = "https://#{url}" unless url =~ /http/ self.conn.exec( "INSERT INTO bookmarks (url, title) VALUES ('#{url}', '#{title}')") # Should be hackable with: # '); DELETE FROM bookmarks; INSERT INTO bo...
true
a7f84763fa2b1930a439b2ee9e5dfbe4dd7b310a
Ruby
primezeta/projecteuler
/p5.rb
UTF-8
284
3.71875
4
[]
no_license
def is_divisible_1_20(n) n.even? and n % 20 == 0 and n % 19 == 0 and n % 18 == 0 and n % 17 == 0 and n % 16 == 0 and n % 15 == 0 and n % 14 == 0 and n % 13 == 0 and n % 12 == 0 and n % 11 == 0 end (21..Float::INFINITY).each do |m| if is_divisible_1_20(m) puts m break end end
true
9c8808afaa3fa2577477b0ed02b32c67b20b147e
Ruby
colinsurprenant/devopsmtl-docker
/app/lib/pull_redis.rb
UTF-8
220
2.53125
3
[ "Apache-2.0" ]
permissive
require 'redis' redis = Redis.new(:host => ENV["REDIS_HOST"] || "localhost", :port => ENV["REDIS_PORT"] || 6379) puts("waiting for Redis data on test list") loop do data = redis.blpop('test') puts(data.inspect) end
true
43c9390fc81fa28388b8c39ed815926e6ec35603
Ruby
raschenc/TTS
/Intro_to_Ruby/Homework/homework6.rb
UTF-8
745
3.734375
4
[]
no_license
puts "How old are you?" STDOUT.flush age = gets.to_i ageseconds = age*31536000 agemercury = (age/0.241).round(2) agevenus = (age/0.615).round(2) agemars = (age/1.881).round(2) agejupiter = (age/11.86).round(2) agesaturn = (age/29.46).round(2) ageuranus = (age/84.01).round(2) ageneptune = (age/164.8).round...
true
0e49a0c062fd41932345557e31cb71f7fa0c5993
Ruby
e-tobi/rake-dotnet
/presentation/how_6_custom_tasks/foo_task.rb
UTF-8
203
2.625
3
[ "MIT" ]
permissive
require 'rake' require 'rake/tasklib' class FooTask < Rake::TaskLib def initialize define end # Create the tasks defined by this task lib. def define task :foo do puts 'foo!' end end end
true
d46b419ebdb7146716ea3476e2838251836a5099
Ruby
sumskyi/magent
/lib/magent/async_channel.rb
UTF-8
908
2.84375
3
[ "MIT" ]
permissive
module Magent class AsyncChannel < GenericChannel def push(target, method_chain, priority) if target.kind_of?(Class) enqueue([target.to_s, nil, method_chain], priority) elsif target.class.respond_to?(:find) && target.respond_to?(:id) enqueue([target.class.to_s, target.id, method_chain]...
true
18d0456c0d7c24eef07161aa691ed10a17371a65
Ruby
krzystof/track
/lib/commands/sum.rb
UTF-8
900
2.84375
3
[]
no_license
require "commands/base_command" require "track/cumulative_report" class Sum < BaseCommand @name = "sum" def execute if input.has_flag?(:project) project = get_project_like input.flag(:project) records = @timelog.on_project(project) else project = "" records = @timelog.all end ...
true
266d94632ebac4f4752c48429f0256d8563f5452
Ruby
MOPineyro/number-to-words-in-Ruby
/spec/numbers_to_words_spec.rb
UTF-8
482
3.15625
3
[]
no_license
require('numbers_to_words') require('rspec') describe("numbers_to_words") do it('Should take the integer 1 and return the string "one"') do numbers_to_words(1).should(eq("one")) end it("should take the integer 23 and return the string 'twentythree'") do numbers_to_words(23).should(eq("twentythree")) en...
true
41bb3fd6a5abf2b915627ba50a975e4113323174
Ruby
pconley/kazoku-server
/spec/api/members_range_spec.rb
UTF-8
778
2.625
3
[]
no_license
require 'rails_helper' describe "API Members Range", :type => :request do include ApiHelper before :each do (0..30).each { |n| Member.create! } puts ">>> member count = #{Member.all.count}" end def do_get(start,count) api_get "members", { start: start, count: count } expect(response).to be_su...
true
7106f08503c9fc589ba7458efe7f557b9ad31d6b
Ruby
LukasPol/team-pokedex
/app/services/get_pokedex.rb
UTF-8
580
2.96875
3
[]
no_license
require 'rest-client' require 'json' class GetPokedex attr_reader :pokemon def initialize(pokemon = '') @pokemon = "#{pokemon}/" @url = "https://pokeapi.co/api/v2/pokemon/#{@pokemon}?limit=1118" end def get_pokedex resp = RestClient.get(@url) resp = JSON.parse(resp.body)['results'] # Sort...
true
0495c4cc12475744050acb9b18960bd427bfcfa3
Ruby
jcsison/app-academy-projects
/Ruby/Enumerables/jesser_sison_enumerables/enumerables_array.rb
UTF-8
1,103
3.5
4
[]
no_license
class Array def my_each(&prc) for i in self.length.times do prc.call(self[i]) end end def my_select(&prc) array = [] self.my_each { |item| array << item if prc.call(item) } array end def my_reject(&prc) self.my_select { |item| !prc.call(item) } end def my_...
true
54ac103396aca9f3d14b0eaf3d759f9ddf10de33
Ruby
HypnoMama/ar-exercises
/exercises/exercise_7.rb
UTF-8
461
3.015625
3
[]
no_license
require_relative '../setup' require_relative './exercise_1' require_relative './exercise_2' require_relative './exercise_3' require_relative './exercise_4' require_relative './exercise_5' require_relative './exercise_6' puts "Exercise 7" puts "----------" puts "Enter a store name: " user_store = gets.chomp new_store...
true
05fe8dbbc2119ca8bfc91edd89727684c0ac9a9e
Ruby
Chida-Takuya/2-9
/modoriti.rb
UTF-8
65
2.921875
3
[]
no_license
def greeting "Hello, John!" "Hi, John!" end puts greeting
true
9a39a90cb596440ddc0b85019ae10699f71254f1
Ruby
achowatt/Rocket-Elevator-Foundation
/lib/ElevatorMedia/streamer.rb
UTF-8
2,500
3.046875
3
[]
no_license
require 'json' module ElevatorMedia class Streamer def self.getContent(param) #pokemon API -- Elevator::Streamer.getContent('pokemon') if param == "pokemon" id = rand(800) #randomize the ID number to get a different pokemon everytime to page loads ...
true
7510aed9f6c17c23763568c67645a87043c8a84c
Ruby
fakebenjay/oo-student-scraper-web-0217
/lib/scraper.rb
UTF-8
1,232
3.0625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'open-uri' require 'pry' class Scraper def self.scrape_index_page(index_url) html = File.read(index_url) raw_students = Nokogiri::HTML(html) students = [] raw_students.css('div.student-card').each do |s| student = { name: s.css('h4.student-name').text, location: s.css(...
true
5f82d2e58f84d267b75c4cddea4c94614a4e1798
Ruby
dflourusso/curso-programacao
/testcase.rb
UTF-8
465
3.078125
3
[]
no_license
require 'yaml' file = ARGV.first || "algoritmos/php/01-variaveis/03-tabuada.php" content = IO.read(file) scan = content.scan(/=begin\n(.*)\n=end/m) exit if scan.empty? exemplos = YAML.load(scan.first.first)["exemplos"] exemplos.each do |entrada, saida| entrada.to_s.strip! saida.to_s.strip! out = %x[php #{file} ...
true
6278a497ad44fc4495536c65dcc428b900859c1d
Ruby
grant-mc/LaunchSchool-RB130-Ruby-Foundations
/Ruby_Challenges/Easy_1/series.rb
UTF-8
385
3.40625
3
[]
no_license
class Series def initialize(string) @num = string @results = [] end def slices(len) raise ArgumentError.new if len > @num.length result = [] arr = @num.split('').map(&:to_i) arr.each_with_index do |dig, idx| @results << arr.slice(idx..(idx + len - 1)) if (idx + len) <= arr.size ...
true
1dc79727c911088928b72048daeccb2e48deab38
Ruby
RORvivak/ds_dp_rec
/check2.rb
UTF-8
885
3.078125
3
[]
no_license
# @param {Integer[]} candidates # @param {Integer} target # @return {Integer[][]} def findc(start, end_length, target, candidates, result, e) p result if target == 0 p e return if start >= end_length if target == 0 return result.push(e) end if target < 0 return end ...
true
b3f8adbb2a2afc1ccac398cfe82b0c36e1e50876
Ruby
vdaubry/codility_solutions
/7_Maximum_slice_problem/max_profit.rb
UTF-8
1,449
3.296875
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby def solution(array) max_profit = nil array.each_with_index do |price1, index| array[(index+1)..-1].each do |price2| current_profit = price2 - price1 max_profit = current_profit if max_profit.nil? || max_profit < current_profit end end if max_profit.nil? || max_profit <...
true
5029b50d4f1de6213e8f686a4ed0c1a0619fd699
Ruby
ranuseh/array_equals
/lib/array_equals.rb
UTF-8
515
4
4
[]
no_license
# Determines if the two input arrays have the same count of elements # and the same integer values in the same exact order array1 = [1,2,3,4,5] array2 = [1,2,3,4,5] # # same elements def array_equals(array1, array2) if array1.nil? == array2.nil? if array1.length == array2.length array1.length.times do |i...
true
d2df73919258e32e5923ee1982d21d483f1eca85
Ruby
rachjgriff/Battle
/spec/player_spec.rb
UTF-8
548
2.640625
3
[]
no_license
require 'player' describe Player do subject(:dave) {Player.new("Dave")} subject(:sarah) {Player.new("Sarah")} describe '#name' do it 'returns the name' do expect(dave.name).to eq "Dave" end end describe '#hit_points' do it 'returns the hit points' do expect(dave.hit_points).to eq d...
true
84a4f6f3800cfc40f1ea84c5ddd5e05a352fc49c
Ruby
recroot89/sandbox
/ruby/fib.rb
UTF-8
206
3.625
4
[]
no_license
def fibonacci_generator(x0, y0) Fiber.new do x = x0 y = y0 loop do Fiber.yield y x, y = y, x + y end end end g = fibonacci_generator(0, 1) 10.times { print g.resume, ' ' }
true
4539df65fe41e792a37cd50b4d67503af95c9298
Ruby
wtartanus/shop
/backend/models/stock.rb
UTF-8
1,842
3.1875
3
[]
no_license
require_relative('./../db/sqlRunner.rb') class Stock attr_reader :id, :productId attr_accessor :inStock, :size def initialize(options) @id = options['id'].to_i @productId = options['productid'].to_i @inStock = options['instock'] == "t" ? true : false @size = opti...
true
e6b7cddabd5f7130afb9f18d4e08e6febed73d8f
Ruby
Kristallam/phase-0
/week-4/count-between/my_solution.rb
UTF-8
979
4.21875
4
[ "MIT" ]
permissive
# Count Between # I worked on this challenge [by myself, with: ]. # count_between is a method with three arguments: # 1. An array of integers # 2. An integer lower bound # 3. An integer upper bound # # It returns the number of integers in the array between the lower and upper bounds, # including (potentially) t...
true
0051fedcfc83dda534c1e7f24686b1da0d0c2384
Ruby
mrYakamoto/phase-0
/week-4/leap-years/my_solution.rb
UTF-8
260
3.21875
3
[ "MIT" ]
permissive
# Leap Years # I worked on this challenge with: Jon Clayton. # Your Solution Below def leap_year? (year) case when year % 400 == 0 return true when year % 100 == 0 return false when year % 4 == 0 return true else return false end end
true
5ae54afee3b3aa8a937319f845c2e1a8a9f92ba4
Ruby
ercl/opentelemetry-ruby
/api/lib/opentelemetry/correlation_context/propagation/text_injector.rb
UTF-8
2,005
2.65625
3
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "Ruby" ]
permissive
# frozen_string_literal: true # Copyright 2019 OpenTelemetry Authors # # SPDX-License-Identifier: Apache-2.0 require 'cgi' module OpenTelemetry module CorrelationContext module Propagation # Injects correlation context using the W3C Correlation Context format class TextInjector include Cont...
true
bef8f9ab4efaff94f7c53d96f44537596c8fccb8
Ruby
adrianmarino/remote
/remote/lib/remote/String.rb
UTF-8
569
3.265625
3
[]
no_license
class String def capitalize_first_character tmp = self tmp[0] = tmp.capitalize[0] tmp end def remove_first self[1..-1] end def to_instance_variable_name String::at + self end def sub_after_last(a_pattern) self.split(a_pattern).last end def sub_before_last(a_pattern) s...
true
45304eb02f1ae21082fdff8bcc7040874686f243
Ruby
jotolo/zion_client
/loophole_manager.rb
UTF-8
1,504
3
3
[]
no_license
require './api_consumer' require './zip_manager' require './route' require 'date' require 'byebug' class LoopholeManager attr_accessor :all def initialize(passphrase) @passphrase = passphrase @source = 'loopholes' @all = [] end def import consumer = ApiConsumer::Resource.new(@passphrase, @sourc...
true
a09c31947ce46cccfd0ab737662250e1e326e167
Ruby
dev-cyprium/Hangman-Ruby
/lib/letter.rb
UTF-8
129
2.9375
3
[]
no_license
class Letter attr_accessor :visible attr_reader :letter def initialize(letter) @letter = letter @visible = false end end
true
63a0a224e55814092ce0446f1f7887ba239184ad
Ruby
Avinashkaur/Ruby
/ex9_arrayHash.rb
UTF-8
269
3.515625
4
[]
no_license
class Array def traversed_array new_hash = Hash.new { |hash, key| hash[key] = [] } for i in self i_length = i.to_s.length new_hash[i_length].push(i) end puts new_hash end end [1234,'abc','mno',1890, 12, 'vinsol','monkey'].traversed_array
true
f413a0dc3fbe95cb751189131bdc2da0270691e5
Ruby
wratterman/class_warmupd
/Warmups/namespacing/test/mod4_test.rb
UTF-8
1,241
2.84375
3
[]
no_license
require 'minitest' require 'minitest/autorun' require 'minitest/pride' require './lib/mod4' class Mod4Test < Minitest::Test def test_it_exists joey = Mod4::Student.new("Joey") assert_instance_of Mod4::Student, joey end def test_it_returns_the_name_it_was_given_at_initialize joey = Mod4::Student.ne...
true
859956398f14ae6f9e218d231ba321609e8cd483
Ruby
rholdy/rubylisp
/spec/evaluator_spec.rb
UTF-8
668
2.984375
3
[]
no_license
require "lisp" describe "Evaluator" do let(:evaluator) { Lisp::Evaluator.new } it "returns a number when it evaluates a number" do result = evaluator.evaluate 42 expect(result).to eq 42 end it "returns the identifier when it evaluates an identifier" do result = evaluator.evaluate "*" expect(r...
true
6bc3bd529f37f9ec813a88ff3e58596f31b36bf9
Ruby
morristech/spreet
/test/test_coordinates.rb
UTF-8
1,414
2.703125
3
[ "MIT" ]
permissive
# encoding: utf-8 require 'helper' class TestCoordinates < SpreetTest def test_importations assert_equal Spreet::Coordinates.new(0,0), Spreet::Coordinates.new("A1") assert_equal Spreet::Coordinates.new(0,0), Spreet::Coordinates.new("0-0") assert_equal Spreet::Coordinates.new(1,1), Spreet::Coordinates....
true
40fcd720844a668252e7bffcf0113ccab7cfd1b0
Ruby
Tempate/Advent-of-Code-2020
/day15/main.rb
UTF-8
778
3.984375
4
[]
no_license
file = File.open("input.txt") numbers = file.read.split(',').map(&:to_i) def run_game(numbers, max_length) hashmap = hashmap_from_list(numbers[0..-2]) last_number = numbers.last() last_index = numbers.length() - 1 while last_index + 1 < max_length if hashmap.has_key? last_number ...
true
cdf46500262659635fa614a2cdf3f39ac713cdf2
Ruby
nohaderf/haunted-manor
/app/models/room.rb
UTF-8
2,603
3.234375
3
[]
no_license
class Room < ActiveRecord::Base belongs_to :monster has_many :visited_rooms has_many :players, through: :visited_rooms def self.enter_room(room) system("clear") prompt = TTY::Prompt.new @current_room = Room.find_by(name: room) moonster = Monster.find_by(id: @current_room...
true
cb02910d5b155d88378f64aef4f38dd3d18a5acf
Ruby
codeitcaleb/Rotom-Pokedex-CLI
/lib/pokedex/cli.rb
UTF-8
3,687
3.59375
4
[ "MIT" ]
permissive
class CLI def run welcome response end def welcome puts "Pokedex now booting up...".colorize(:cyan) sleep 1 puts "Loading Pokemon...".colorize(:cyan) sleep 1 scrape_pokedex puts "Welcome User! Please state name:".colorize(:cyan) user_name = gets.chomp sleep 2 ...
true
ea4aad55ae79741d9d370703dde5a4a69e56dd6d
Ruby
kufu/yokoso
/app/models/chat_message_sender.rb
UTF-8
902
2.6875
3
[ "Apache-2.0" ]
permissive
# frozen_string_literal: true # チャットツールへのメッセージ送信を扱うクラス class ChatMessageSender def initialize @slack_api_client = Slack::Web::Client.new(token: ENV.fetch("SLACK_TOKEN")) end # 全ユーザーに見える形で投稿 # @param post_body [Hash] # @see https://api.slack.com/methods/chat.postMessage # @see https://github.com/slack-...
true
29b81df8316c53217b456e14c2d029aa62f8d5d9
Ruby
mellowjoeys/intro_to_apis
/dictionary_app.rb
UTF-8
1,168
2.96875
3
[]
no_license
require "http" p "Please enter a word you want to look up." word = gets.chomp example_response = HTTP.get("https://api.wordnik.com/v4/word.json/#{word}/examples?includeDuplicates=false&useCanonical=false&limit=5&api_key=9f63510ab680a9a2504370c0a530c846ba454b12337f0c6c0") pronunciation_response = HTTP.get("https://ap...
true