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
4659ab8a7dd198f1b6539a3689cb813a97f5a043
Ruby
dawena/neuralize.me
/lib/som/ruby/lib/distance.rb
UTF-8
796
3.21875
3
[]
no_license
class RubySOM module Distance def index_distance(closer, range) [ (closer[0]-range[0]).abs, (closer[1]-range[1]).abs ].max end def euclidean_distance(x, y) dist = 0 x.each_index do |k| dist += (x[k]-y[k])**2 end Math.sqrt(dist) end def closer(x,...
true
953f78f1ddff7045f3c1feb664264973d2ac7c4a
Ruby
tangbtqzy/harmonious_dictionary
/bin/harmonious_server
UTF-8
1,986
2.6875
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby $:.unshift File.expand_path(File.dirname(__FILE__)) # begin # require 'harmonious_dictionary' # rescue LoadError # require 'rubygems' # require 'harmonious_dictionary' # end require_relative '../lib/harmonious_dictionary/rseg' require_relative '../lib/harmonious_dictionary/app' require 'opt...
true
159a2db8ff43c7d4542bb0521637b4571b95c668
Ruby
alanrubin/seo-statistics
/lib/seo-statistics/helpers/word_index.rb
UTF-8
454
3.109375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
class WordIndex def initialize @index = Hash.new(nil) end def index(aPhrase, only_include=nil) aPhrase.scan /\w[-\w']+/ do |aWord| # extract each word aWord.downcase! next unless only_include.nil? || only_include.include?(aWord) @index[aWord] = 0 if @index[aWord].nil? ...
true
5923b12b9c17e762c2c19b39770801004015c694
Ruby
NJBow/learn_to_program
/ch09-writing-your-own-methods/ask.rb
UTF-8
242
3.234375
3
[]
no_license
def ask question # your code here while true puts question answer = gets.chomp.downcase return true if answer == "yes" return false if answer == "no" puts "please answer \"yes\" or \"no\" " end end comp = "do you use a PC?" puts comp
true
fb19b85197886e7b8744c9598f5c77cf981ee3bf
Ruby
budikpet/SemestralWork_RUB
/lib/renamer.rb
UTF-8
6,546
2.78125
3
[ "MIT" ]
permissive
# frozen_string_literal: true require_relative 'renamer/cli_logic' require_relative 'renamer/replace_modes' require 'bundler/setup' require 'thor' module Renamer # A special string variable that is used to indicate where numbers of format command should be NUM_LOCATOR = '\i' # Thor CLI interface for Renamer CL...
true
f97fd7bf9e94d474e49c24312d0380d726de2b9e
Ruby
ichabodcole/humanitywar-rails
/spec/models/entry_spec.rb
UTF-8
2,280
2.75
3
[]
no_license
require 'spec_helper' describe Entry do context "game scope" do before(:each) do @black_card = BlackCard.create!(:text => "test black", :blanks => 1) @white_card = WhiteCard.create!(:text => "test white") @entry = Entry.create() @entry.white_card = @white_card @entry.black_card = @b...
true
6b213bf79fb48dbd2e31cbe31f6d1a7bb730b0fb
Ruby
schazbot/ruby-objects-has-many-through-lab-london-web-career-021819
/lib/run.rb
UTF-8
353
2.640625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require_relative "./artist.rb" require_relative "./song.rb" require_relative "./genre.rb" require 'pry' #drs d1 = Doctor.new("Doolittle") d2 = Doctor.new("Jones") #patient p1 = Patient.new("Charl") p2 = Patient.new("Hunter") #appts a1 = Appointment.new("22/2/19", p1, d1) a2 = Appointment.new("11/1/19", p2, d2) bi...
true
d87a3575893d720bf4f649fb96f39c337071035f
Ruby
mariuszkapcia/toggl-sync
/vendor/bundle/gems/oauth-0.5.1/lib/oauth/consumer.rb
UTF-8
13,127
2.609375
3
[ "MIT" ]
permissive
require 'net/http' require 'net/https' require 'oauth/oauth' require 'oauth/client/net_http' require 'oauth/errors' require 'cgi' module OAuth class Consumer # determine the certificate authority path to verify SSL certs CA_FILES = %W(#{ENV['SSL_CERT_FILE']} /etc/ssl/certs/ca-certificates.crt /etc/pki/tls/ce...
true
4776a1541315abfd5059166bc855af845013a548
Ruby
ryclorak/Ruby-Stuff
/MegaGreeter.rb
UTF-8
948
4.125
4
[]
no_license
#!/usr/bin/env ruby class MegaGreeter attr_accessor :names #easy way of saying attr_reader and attr_writer which are built in getters and setters def initialize(names = "World") @names = names end def SayHi if @names.nil? puts "..." elsif @names.respond_to?("each") # @names is a list, so iterate ...
true
6a07252b83e2677f1179cb9a4eaaeb541dd731a2
Ruby
SasukeBo/wangbo-study
/ruby/oldCodes/hereDocument.rb
UTF-8
381
2.734375
3
[]
no_license
#!/usr/bin/ruby -w # -*- coding : utf-8 -*- print <<EOF # EOF和<<之间不能有空格 这是第一种方式创建here document 。 多行文字。 EOF print <<"EOF"; # 与上面相同 这是第二种方式创建here document。 多行文字 EOF print <<'EOC' echo hi there echo lo there EOC print <<"foo", <<"bar" I said foo. foo I said bar. bar
true
f30a4c11a25af7a396dd95f8a2af39e1a9a7df1c
Ruby
dalspok/exercises
/small_problems_i3/easy_9/9.rb
UTF-8
257
3.625
4
[]
no_license
def get_grade(*scores) mark = scores.sum / scores.size case mark when (90..100) then "A" when (80...90) then "B" when (70...80) then "C" when (60...70) then "D" else "F" end end p get_grade(95, 90, 93) == "A" p get_grade(50, 50, 95) == "D"
true
dc7485244b91924a172650d5137326e33cc7f0d9
Ruby
caioertai/488-food-delivery
/repositories/room_repository.rb
UTF-8
493
3.109375
3
[]
no_license
require "csv" require_relative "../models/room" class RoomRepository def initialize(csv_path) @csv_path = csv_path @rooms = [] load_csv end def find(id) @rooms.find { |room| room.id = id } end private def load_csv csv_options = { headers: true, header_converters: :symbol } CSV.fo...
true
17533d8cc1ce9fb847480c847ad15f5875528425
Ruby
cameron-prc/SpotifyHistory
/lib/SpotifyHistory/core.rb
UTF-8
583
2.765625
3
[]
no_license
module SpotifyHistory class Core attr_reader :store def initialize @store = Store.new end def run artists = SpotifyHistory::GetRecentArtists.call existing_artists = SpotifyHistory::GetKnownArtists.call artists.select! do |artist| !existing_artists.any? do |existing_a...
true
d6fad495b90434e36386a8e5761c4a8f7af65eaa
Ruby
RickySauce/BeerReview-JQUERY
/lib/scraper.rb
UTF-8
681
2.671875
3
[ "MIT" ]
permissive
require 'nokogiri' require 'open-uri' class Scraper def self.parse self.new.create_beers end def create_beers doc = Nokogiri::HTML(open("https://www.beeradvocate.com/lists/top/")) doc.css("table tr").drop(2).each do |beer_info| beer = { :name => beer_info.css("td a b").text, ...
true
945372108bff724e7908908f06aa13b73f4f56dd
Ruby
henryco1/LS100
/lesson1_basics/exercise6.rb
UTF-8
168
3.328125
3
[]
no_license
=begin Write a program that calculates the squares of 3 float numbers of your choosing and outputs the result to the screen. =end puts 1.2**2 puts 2.4**2 puts 3.5**2
true
f7aabf662fa4bef2952a1d7313d6c9100ba71904
Ruby
Samellenrider/learn-to-program
/chapter02/stringordigit.rb
UTF-8
88
3.109375
3
[]
no_license
# 12 = number # '12' = string of digits puts 19 + 19 puts '19' + '19' puts '19 + 19'
true
65e019e6904a667217a36eed4a308f83303d7be2
Ruby
yasuhiroki/ruby-pattern-matching
/sample/00_value.rb
UTF-8
263
3.71875
4
[]
no_license
def value(val) case val in 0 :zero in -1..1 :range in Integer :class else :nothing end end p value(0) # => zero p value(1) # => range p value(-1) # => range p value(100000) # => class p value("1") # => nothing
true
b3abb54ec181f67b9d226acc72ee814523e892ec
Ruby
RochelLevi/sql-crowdfunding-lab-web-103017
/lib/sql_queries.rb
UTF-8
1,837
3.109375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Write your sql queries in this file in the appropriate method like the example below: # # def select_category_from_projects # "SELECT category FROM projects;" # end # Make sure each ruby method returns a string containing a valid SQL statement. def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabe...
true
abe0e96f6b9113d09610f2dda181ea4f3023e85c
Ruby
oliverguenther/openproject-revisions_git
/lib/open_project/revisions/git/git_access.rb
UTF-8
2,463
2.59375
3
[ "MIT" ]
permissive
module OpenProject::Revisions::Git class GitAccess DOWNLOAD_COMMANDS = %w{ git-upload-pack git-upload-archive } PUSH_COMMANDS = %w{ git-receive-pack } def download_access_check(actor, repository, is_ssl = false) # First check that SmartHTTP is enabled for repository return smart_http_is...
true
d980aa704a4f0d560ce7276c1196fa3ee5dddf0c
Ruby
Grekz/coding-problems-ruby
/lib/mx/grekz/leetcode/easy/E696_CountBinarySubstrings.rb
UTF-8
405
3.421875
3
[ "MIT" ]
permissive
# @author grekz class E696_CountBinarySubstrings # @param {String} s # @return {Integer} def count_binary_substrings(s) res, p, c, n = 0, 0, 1, s.size - 1 n.times{ |i| if s[i] != s[i+1] res += [p,c].min p = c c = 1 else...
true
43073884add30195e5a627419f623803b603df25
Ruby
PeterHickman/Miho
/rules/aiml/humor.rb
UTF-8
9,073
2.921875
3
[]
no_license
# Free software (c) 2011 ALICE A.I. Foundation. # This program is open source code released under # the terms of the GNU General Public License # as published by the Free Software Foundation. # Complies with AIML 1.0 Tag Set Specification # as adopted by the ALICE A.I. Foundation. # # Last modified 10/5/2011 learn "JO...
true
3a3c100394f217a0a00adfa0d26c9fa179f77780
Ruby
whalec/stock-desk
/lib/portfolio/day.rb
UTF-8
769
3.03125
3
[]
no_license
module Portfolio class Day attr_accessor :date, :open, :high, :low, :close, :volume, :adj_close, :studies def initialize(args = []) @date = Date.parse(args[0]) @open = Float(args[1]) @high = Float(args[2]) @low = Float(args[3]) @close = Float(args[4]) @volume = Integer(ar...
true
268f5e66369ab65dd297960bc4bc99feb5abdc42
Ruby
devlab-oy/pupenext
/app/classes/woo/products.rb
UTF-8
2,656
2.796875
3
[]
no_license
class Woo::Products < Woo::Base # 1. adds products to webstore # 2. update stock of products in webstore # Create products to woocommerce def create created_count = 0 products.each do |product| if get_sku(product.tuoteno) logger.info "Tuote #{product.tuoteno} on jo verkkokaupassa" ...
true
9f0baa901e719d594fdbdee7d8e74adc682a047b
Ruby
CarsonBills/New-example
/tip_calculator3.rb
UTF-8
640
3.921875
4
[]
no_license
puts "Enter the cost of your meal before tax." meal = Float(gets) puts "Enter your local tax percentage." tax = Float(gets) puts "Enter what percent you would like to tip?" tip = Float(gets) def convert(base, percent) amount = base * percent/100 end tax_value=convert(meal, tax) meal_with_tax=meal+tax_value tip_value...
true
2a8062ac50f4d33effe73ab1c8562850b7fd3ba2
Ruby
karimabuseer/bank-tech-test
/spec/bank_account_spec.rb
UTF-8
2,215
3.1875
3
[]
no_license
# frozen_string_literal: true require 'bank_account' require 'transaction' describe BankAccount do describe 'initialization' do it 'The account balance starts at 0' do expect(subject.balance).to eq(0) end end describe '#deposit' do it 'Depositing money adds to an account balance' do de...
true
013dc0ddba0d6dfa4caebc5a694d7d4a6ed23255
Ruby
DianaTavares/codea
/3-Rookie/Ruby/numeros_primos.rb
UTF-8
585
3.6875
4
[]
no_license
require "prime" def prime_factors (num) factors=[] prime_numbers=[] Prime.each(100) do |prime| if prime < num prime_numbers << prime else break end end prime_position = 0 while Prime.prime?(num)==false && num!=1 while num % prime_numbers[prime_position] == 0 factors << prime_numbers[prime_posit...
true
8c4e1a313651f26478b8966041a3b8a9d77f5af2
Ruby
joshddunn/fawkes
/fawkes
UTF-8
1,395
2.671875
3
[]
no_license
#!/usr/bin/env ruby require 'optparse' class Fawkes attr_accessor :options attr_reader :command COMMANDS = [ 'attach', 'build', 'rise', ] def initialize(string) @args = string @options = { name: 'MyApp' } @command = (COMMANDS & [string.first]).first || 'build' parse...
true
9773462d01fb59e76755267b01e93d478010169c
Ruby
charlieegan3/twitter-roundup
/lib/webhook_notifier.rb
UTF-8
555
2.796875
3
[]
no_license
class WebhookNotifier def initialize(endpoint, tweets) @endpoint, @tweets = URI.parse(endpoint), tweets end def post request = Net::HTTP::Post.new(@endpoint.request_uri, 'Content-Type' => 'application/json') request.body = { tweets: @tweets, tweets_html: tweets_html, }.to_json Net...
true
a4dde3068eb9938855993a6ce9bf442418933002
Ruby
BenRKarl/WDI_work
/w01/d02/Steven_Doran/calculator/calculator.rb
UTF-8
2,279
4.375
4
[]
no_license
# A user should be given a menu of operations # A user should be able to choose from the menu def menu puts "Please enter the first letter of the operation you would like to carry out: \n (A)ddition \n (S)ubtraction \n (M)ultiplication \n (D)ivision \n (P)ower \n (S)quare root \n (Q)uit" end menu response = gets.cho...
true
2115bdd96b4773f5f5a0be63a2434bf7228b6c80
Ruby
rudyoyen/starSearch
/rubySolution/utils/Movie.rb
UTF-8
364
3.125
3
[]
no_license
class Movie attr_reader :id, :title, :release_year, :director attr_accessor :cast @@movie_id = 0 @@movies = Hash.new def initialize(data_array) @title = data_array[0] @release_year = data_array[1] @director = data_array[2] @cast = [] @id = @@movie_id @@movies[@id] = self @@movie_id += 1 end def...
true
46fd504512a3244407b8bc2969e243565055f4d6
Ruby
WarnerMichaelJ/W6D3-Chess
/knight.rb
UTF-8
312
3.046875
3
[]
no_license
require_relative 'piece.rb' require_relative 'slideable.rb' require_relative 'stepable.rb' class Knight < Piece # include Slideable attr_accessor :position include Stepable def initialize(board, position) @position = position @board = board @symbol = 'KN' end end
true
8678964b8017ca8918d286b6b12fe87b6378e626
Ruby
secretpray/TK_School
/Lesson 8/lib/wagon.rb
UTF-8
253
2.625
3
[]
no_license
class Wagon include Manufacture COMPANY_NAME = 'Vega Inc.'.freeze attr_reader :type_wagon, :size_wagon alias size size_wagon def initialize(size_wagon) @company_name = COMPANY_NAME @size_any = size_wagon end end
true
feb9a2497616ad1608bbca19190716bb9705fcaf
Ruby
rennex/hellbender
/test/bot_test.rb
UTF-8
3,322
2.828125
3
[]
no_license
require_relative "test_helper" require_relative "../bot.rb" include Hellbender describe Bot do before do @bot = create_test_bot end it "has a getter for config" do assert_kind_of Hash, @bot.config end it "tracks its own nickname" do assert_equal "Hellbender", @bot.nick @bot.process_msg(m("...
true
fe095fa19c3fdc3cdb5eacd24e55aba00d2b52c8
Ruby
ishikawa-yuki/ruby
/fizzbuzz.rb
UTF-8
337
4.03125
4
[]
no_license
=begin 1から100まで数値を出し、3の倍数ならFIZZ、5の倍数ならBUZZ 15の倍数ならFIZZBUZZを表示する =end 1.upto(100){|i| print i case when (i%15 == 0) puts " FIZZBUZZ" when (i%5 == 0) puts " BUZZ" when (i%3 == 0) puts " FIZZ" else puts end }
true
74bb1e121f05f985dd37015fb89ae007a9133325
Ruby
jcabasc/drawing-tool
/spec/canvas_spec.rb
UTF-8
474
2.59375
3
[]
no_license
require 'spec_helper' describe Canvas do describe '.matrix' do subject { described_class.new(10,4).matrix.to_a } it "create a canvas of width 10 and height 4" do expect(subject).to eql response_canvas puts subject.to_table end end end describe Matrix do describe "[]=" do let(:matri...
true
9d703af834b36f2855602819bd3e4954994789d1
Ruby
leroyg/algotraitor
/test/stock_test.rb
UTF-8
688
2.640625
3
[]
no_license
require File.dirname(__FILE__) + '/helper' class StockTest < Test::Unit::TestCase setup do @stock = Algotraitor::Stock.new("XYZ", 1.00) end test "initializer takes stock and initial price as arguments" do stock = Algotraitor::Stock.new("ABC", 15.00) assert_equal "ABC", stock.symbol assert_equa...
true
6a8378fc5fb279edac293a52c2915551f096f86f
Ruby
igkuz/configus
/lib/configus/storage.rb
UTF-8
623
2.9375
3
[ "MIT" ]
permissive
module Configus class Storage class KeyNotFoundException < RuntimeError end def initialize(hash) @hash = hash hash.each do |k, v| singleton_class.class_eval do result = if v.instance_of? Hash Storage.new v else v end defi...
true
c2c150bcd493247307beea4bfe7ad74d1a4c0e1f
Ruby
chadellison/junglebeat_project
/test/jungle_beat_test.rb
UTF-8
1,914
3.3125
3
[]
no_license
require 'minitest/autorun' require_relative '../lib/junglebeat' require 'pry' class JungleBeatTest < Minitest::Test def test_it_creates_a_new_node_object_when_it_initializes list = JungleBeat.new("beep") assert_equal "beep", list.head.data end def test_it_can_find_the_tail node = JungleBeat.new("b...
true
9b5b781fc52e2064d4d9750ffe869243a5e69b6e
Ruby
stestaub/exiv2-ruby
/spec/xmp_data_spec.rb
UTF-8
1,974
2.828125
3
[]
no_license
context "XMP data" do subject do image = Exiv2::Image.new image.open Pathname.new('spec/fixtures/test.jpg') image.xmp_data end it "should read XMP data" do expect(subject).to be_a(Exiv2::XmpData) expect(subject.inspect).to eq('#<Exiv2::XmpData: {"Xmp.dc.description"=>"lang=\"x-default\" This ...
true
5dc8287715ca8ad03f03448d119b7a079e41cb0f
Ruby
liguang2080/linux_tools
/aws/upload_to_s3
UTF-8
481
2.59375
3
[]
no_license
#!/usr/local/ruby/bin/ruby require "rubygems" require "aws/s3" if ARGV.size != 2 puts "usage: upload_to_s3 file_path buck_name" exit end up_file, bucket = ARGV unless File.exist?(up_file) puts "#{up_file} is no exist" exit end AWS::S3::Base.establish_connection!( :access_key_id => 'AKIAIRXV5QKMV54AINLA',...
true
50b075f14940bb875bea06f4dd03cca0dd2dae45
Ruby
michaeldawson/startup-adelaide
/config/initializers/inflections.rb
UTF-8
1,006
2.875
3
[]
no_license
# Be sure to restart your server when you modify this file. # Add new inflection rules using the following format # (all these examples are active by default): # ActiveSupport::Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', ...
true
bb0cba939c5cad88f4a73590f2665d45edeadae7
Ruby
scarlettajulia/generasi-GIGIH
/Final-Project/spec/controllers/trending_controller_spec.rb
UTF-8
1,878
2.765625
3
[]
no_license
# frozen_string_literal: true require 'json' require_relative "../test_helper" require_relative '../../controllers/trending_controller' require_relative '../../models/post' require_relative '../../models/comment' describe TrendingController do context 'get hastagh in sentence of post' do it 'should return list ...
true
86fc13a96902376225ef8ee269563f2123cc6039
Ruby
edeutschie/ride-share-two
/lib/rider.rb
UTF-8
1,173
2.9375
3
[]
no_license
require "csv" require_relative 'trip' require_relative 'driver' module RideShareTwo class Rider attr_reader :rider_id, :name, :phone_num def initialize(rider_id, name, phone_num) @rider_id = rider_id @name = name @phone_num = phone_num end def self.all_riders all_riders = [...
true
00471ccf85c45a01ebfb50292fca6a5bacae56d1
Ruby
Hitch77/aa_classwork
/W5D1/skeleton/lib/p03_hash_set.rb
UTF-8
945
3.6875
4
[]
no_license
require_relative 'p02_hashing.rb' class HashSet attr_reader :count, :store def initialize(num_buckets = 8) @store = Array.new(num_buckets) { Array.new } @count = 0 end def insert(key) return false if include?(key) i = key.hash % store.length store[i] << key @count += 1 if count ...
true
181770c86fa5b1d989371a7ac13293f573884e60
Ruby
BlookHo/TreeFams
/app/models/name.rb
UTF-8
3,166
2.734375
3
[]
no_license
class Name < ActiveRecord::Base validates :name, presence: true, uniqueness: { scope: :sex_id, message: "Имя уже существует с данным sex_id" } # Нельзя сохранить имя, не указав пол # 1 - муж, 0 - жен validates :sex_id, inclusion: [0, 1] # Пол имен синонимов должен соответствовать по...
true
99a904541e0014184707e34a2c3c981033b559c8
Ruby
grubern/texp
/lib/texp/errors.rb
UTF-8
334
2.609375
3
[ "MIT" ]
permissive
module TExp # Base error for TExp specific exceptions. Error = Class.new(StandardError) # Raised when the units on the every method are not recognized. TExpUnitError = Class.new(TExp::Error) # Raised if an error is encountered during the parsing of a temporal # expression. ParseError = Class.new(TEx...
true
84c703eac5d656c0de28a1f8006079f561d12046
Ruby
dldinternet/dldinternet-mixlib-logging
/lib/dldinternet/mixlib/logging.rb
UTF-8
22,059
2.5625
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
unless defined? ::DLDInternet::Mixlib::Logging::ClassMethods require 'dldinternet/mixlib/logging/version' module DLDInternet module Mixlib module Logging require 'rubygems' require 'rubygems/gem_runner' require 'rubygems/exceptions' Object.send(:remove_const, :Logging) r...
true
703f14661bc716cb7c7f8ba66bac21b773070f3b
Ruby
skurzinz/anystyle
/lib/anystyle/normalizer/location.rb
UTF-8
532
2.5625
3
[ "BSD-2-Clause", "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module AnyStyle class Normalizer class Location < Normalizer @keys = [:location] def normalize(item, **opts) map_values(item) do |_, value| location = strip value if !item.key?(:publisher) && location.include?(':') location, publisher = location.split(/\s*:\s*...
true
755919e54d01b3b6baf2a21725da688eeaffeba1
Ruby
DouglasAllen/MY_Ruby
/non_course/encrypt.rb
UTF-8
78
2.515625
3
[]
no_license
class String def encrypt tr "a-z","b-za" end end puts "cat" puts "cat".encrypt
true
8bb24b25b839b491b2a248cc0c76e31473d50543
Ruby
lumoslabs/aleph
/spec/lib/pagination_search/attribute_set_spec.rb
UTF-8
2,656
2.515625
3
[ "MIT" ]
permissive
require 'spec_helper' module PaginationSearch describe AttributeSet do let(:base_class) { Query } let(:attribute_locations) do { title: { association: :base, column: :title, type: :text }, body: { association: :base, column: :latest_body, type: :text }, author: { ...
true
d895c3fbdc7382dc18562b3bc2580c17a48a1316
Ruby
gbcdef/introduction_to_programming_with_ruby_by_launchschool
/1_the_basics/e4.rb
UTF-8
56
2.6875
3
[]
no_license
years = [1988,2013,2003,1978] years.each { |i| puts i }
true
5ce2ec288328a3beffeb9a63775d3545f54d436e
Ruby
dkeehl/chopsticks
/lib/chopsticks/sql_model.rb
UTF-8
2,484
2.640625
3
[ "MIT" ]
permissive
require 'sqlite3' require 'chopsticks/util' DB = SQLite3::Database.new 'test.db' module Chopsticks module Model class SQLite def initialize(data = nil) @hash = data end def [](name) @hash[name.to_s] end def []=(name, value) @hash[name.to_s] = value e...
true
9a3c22af7ce0467d8de28947610e2ba50a8f3ce8
Ruby
cielavenir/procon
/codeforces/tyama_codeforces1066A_TLE.rb
UTF-8
89
2.625
3
[ "0BSD" ]
permissive
#!/usr/bin/ruby gets;$<.read.split.map(&:to_i).each_slice(4){|_,v,l,r|p _/v-r/v+(l-1)/v}
true
13d1a5c369df2b60be3b6d0fc32764d201040d07
Ruby
marieloisa/QE_training_BDT_ruby
/Maria/Session06_24-03-17/Tasks/session06-arrays-practice2.rb
UTF-8
923
4.78125
5
[]
no_license
=begin 1. Create a class with two methods method 1: No arguments defined Should ask to the user the number of elements in the array According the value inserted ask for each value of the array and push it in a new array Return the array method 2 Should receive 1 argument (the array returned in method 1) should print th...
true
c45f4b59d5e11b82e8b3746c7777f9ff9664c10a
Ruby
dukegreene/the-hookup
/hookup.rb
UTF-8
1,375
2.71875
3
[ "MIT" ]
permissive
# This is a rough, hastily-researched solution for a domain-specific, time-sensitive use case. # It is March 31, and I have less than 18 hours to pull off a gentle prank. # I am optimizing for silliness and setup speed. # Forgive me, Gods of Good Code, for I know not what I am doing. module Hookup def self.setup_l...
true
e3b243970fdef98570abc0095e84c669e49fa544
Ruby
jef4490/deli-counter-ruby-apply-000
/deli_counter.rb
UTF-8
643
3.875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Write your code here. katz_deli = [] def line(deli) if deli == [] puts "The line is currently empty." return "The line is currently empty" else line_string = "The line is currently:" counter = 1 deli.each do |person| line_string << " #{counter}. #{person}" counter += 1 end ...
true
aa3353568d38de5df74aae536cdc2242a9f639fa
Ruby
jadeyen/CS61APrepCourse
/ch2/myAgeInSeconds.rb
UTF-8
56
2.875
3
[]
no_license
puts 'My age in seconds is: ' + (60*60*24*365*18) + '.'
true
dced7741ae12947c7e5e345a6c46ffcfa5bd07e5
Ruby
liantics/MetisPracticeFiles
/music_problem/jukebox.rb
UTF-8
1,028
3.921875
4
[]
no_license
#ask for input #import databse #loop: # => ask user for artist name # => print out the songs for that artist require "./music_database_reader" class Jukebox def initialize(music_database) @music_database = music_database end def play #puts @music_database loop do artist_name = prompt_for_artist_name ...
true
21d91f16dfa8ce7af187fcc22df71460ae8f225a
Ruby
sztupy/valasztas-adatbazis
/2018/excel/lista_from_oevk.rb
UTF-8
1,112
2.578125
3
[]
no_license
#!/usr/bin/env ruby require 'csv' require 'json' ADATOK = {} MAPPING = { "FIDESZ - MAGYAR POLGÁRI SZÖVETSÉG-KERESZTÉNYDEMOKRATA NÉPPÁRT" => "FIDESZ", "LEHET MÁS A POLITIKA" => "LMP", "MAGYAR SZOCIALISTA PÁRT-PÁRBESZÉD MAGYARORSZÁGÉRT PÁRT" => "MSZP", "MOMENTUM MOZGALOM" => "MOMENTUM", "JOBBIK MAGYARORSZÁGÉ...
true
574dd3c4ce7de6d20fa3a00aa06c5608c87a41d2
Ruby
osorubeki-fujita/odpt_tokyo_metro
/lib/tokyo_metro/factory/before_seed/api/meta_class/timetables/train_type/pattern.rb
UTF-8
1,119
2.5625
3
[ "MIT" ]
permissive
class TokyoMetro::Factory::BeforeSeed::Api::MetaClass::Timetables::TrainType::Pattern def initialize( pattern_id , train_type , railway_line_info_id , terminal_station_info_id , operation_day_id ) @pattern_id = pattern_id @train_type = train_type @railway_line_info_id = railway_line_info_id @terminal...
true
f69bb1483bd6c5727605a71f1a1133de20aae387
Ruby
brainopia/floq
/floq/lib/floq/schedulers/base.rb
UTF-8
1,198
2.625
3
[]
no_license
class Floq::Schedulers::Base attr_reader :options, :queues CLEANUP_PERIOD = 120 def initialize(options={}) @options = options @queues = options.delete(:queues) { [] } end def run check_handler start_cleanup_thread loop { pull_and_handle } end def split(count) return [self] if c...
true
0f7788520c730d0ded99c3e30181207c171f2fb1
Ruby
Belkot/learn_ruby
/08_book_titles/book.rb
UTF-8
225
3.25
3
[]
no_license
class Book NO_CAPITALIZE_WORDS = %w( the a an and in of ) attr_writer :title def title @title.capitalize.split .map { |e| NO_CAPITALIZE_WORDS.include?(e) ? e : e.capitalize } .join(' ') end end
true
6a1dbd6cd2442911006c740fc592ec22634f1658
Ruby
sspiderd/peuler
/src/problem21.rb
UTF-8
408
3.546875
4
[]
no_license
require "./utils.rb" def sum(numbers) return numbers.inject(0) {|result, element| result + element} end amicables = [] for i in (1..10000) next if amicables.include?(i) sum_of_divisors = sum(get_proper_divisors(i)) if sum(get_proper_divisors(sum_of_divisors)) == i and sum_of_divisors != i #This is an amicable ...
true
d744e630c5320e6cf70f08091b47233f8b9f4c69
Ruby
bradx3/filtered_db_dump
/lib/filtered_db_dump.rb
UTF-8
2,954
2.953125
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require "filtered_db_dump/version" module FilteredDbDump class Dumper attr_accessor :output_dir attr_accessor :mysql_options attr_accessor :db_connection attr_accessor :column_filters attr_accessor :table_filters attr_accessor :post_dump_command attr_accessor :file_extension # Expec...
true
b5f9a0d58dd2265ebc2115484157e5bba37ec384
Ruby
mluts/ruby-curses
/point.rb
UTF-8
1,527
3.203125
3
[]
no_license
gem 'curses' require 'curses' def clamp(min, n, max) if n <= min min elsif n >= max max else n end end class Screen include Curses def initialize @termcaps = {} end def create init_screen nonl cbreak noecho at_exit { destroy } end def destroy close_scree...
true
afe8b087a1c0797e9663a3a3feca2008ed5440e9
Ruby
idegn/playground
/junk/2014/07-09-172435.rb
UTF-8
478
3.046875
3
[]
no_license
# -*- coding: undecided -*- #paiza N,K,X = gets.split.map(&:to_i) graph = {} K.times do k,v = gets.split.map(&:to_i) if graph[k] graph[k] << v else graph[k] = [v] end end s = graph[1] graph.delete(1) bl = [X] # | graph[X] prev = [] while prev != bl prev = bl.dup graph.each do|key,value| #select使う...
true
c108fb13e9d3f6517f1d39916b5346f77f56186a
Ruby
NUBIC/ncs_navigator_core
/app/models/field/merge.rb
UTF-8
10,363
2.515625
3
[]
no_license
# -*- coding: utf-8 -*- require 'ncs_navigator/core' require 'case' require 'facets/hash/weave' require 'forwardable' require 'set' module Field ## # Performs a 3-way merge across the current state of Core's datastore, a # fieldwork set sent to a field client, and a corresponding fieldwork set # received fro...
true
cb4f3aef153911dda7d880e120a2f93b3ab8ef20
Ruby
logaan/windows-vim-files
/vimfiles/irb/buffer_seo_campaign.rb
UTF-8
446
2.515625
3
[]
no_license
start_time = Time.now # urchin_ids = SeoCampaign.find(:all).find_all{|sc| sc.urchin_id != 0}. # map{|sc| sc.urchin_id}.sort # urchin_ids.each do |campaign| # begin # StatsReport.new(campaign, "foo", "bar").save # puts "#{campaign} saved" # rescue # puts "#{campaign} failed" # end # end St...
true
4cc63680ef628b72788fe7e29828e3cb21f86306
Ruby
zseero/ACSL
/binarydemo.rb
UTF-8
714
2.9375
3
[]
no_license
class Array def specialJoin(basekey) r = [] for i in 0..(basekey.length - 1) rr = "" (basekey[i].to_s.length - 1).times do rr += ' ' end rr += self[i].to_s r << rr end r.join(' ') end end def nExit puts exit end require_relative 'basetranslate.rb' include Base printf "Base: " base = ge...
true
f538c772a887d0805cba4f4df911e6f04c6f998d
Ruby
beet/alfred_noteplan_actions
/lib/note_plan/x_callback_url/base.rb
UTF-8
1,903
3.234375
3
[]
no_license
require "cgi" =begin Template class for creating NotePlan x-callback-urls. Concrete classes must define: * #parameters: hash like { noteDate: 20180122 } All parameter values will be CGI escaped. The naming convention is to derive the NotePlan x-callback-url action from the class name. For example, an action of "ad...
true
67209962c12e53cb70486a66899d9cf8220f7c8d
Ruby
KonstantinFaleev/GH_Sea_Battle
/app/sea_battle/ai.rb
UTF-8
253
2.5625
3
[]
no_license
class Ai attr_reader :my_ships, :my_shots def initialize(battlefield) @battlefield = battlefield @my_ships = generate_my_ships @my_shots end def attack (shild, coords) [] end private def generate_my_ships end end
true
a59dcd84613b8f797f2017a9989186beb2812090
Ruby
setsumaru1992/ddd_practice_ruby_application
/app/domain_models/domain/person/birthdate.rb
UTF-8
352
2.609375
3
[]
no_license
module Domain::Person class Birthdate < ::Domain::Base::ValueObject FIELDS = %I(year month date) attr_reader *FIELDS attr_updater *FIELDS def exist_full_date? @year.present? && @month.present? && @date.present? end def to_date return unless exist_full_date? Date.new(@year, ...
true
0bf1283893f6feff41c53feb47c5fa373b4066aa
Ruby
afishcalledrob/boris-bikesfriday
/spec/bike_spec.rb
UTF-8
553
2.671875
3
[]
no_license
require 'bike' describe Bike do bike = Bike.new it 'should state if bike is working or not' do expect(bike.working?).to eq true expect(bike).to respond_to(:broken=) expect {bike.broken = true}.to change {bike.working?} end # three expectations... should be three clearly separat...
true
f4c7021a925f07de3dde076e813446615e0c8b26
Ruby
mishyjari/active-record-querying-methods-lab-nyc-web-033020
/app/models/show.rb
UTF-8
524
2.53125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Show < ActiveRecord::Base def self.highest_rating self.all.maximum(:rating) end def self.most_popular_show Show.all.find_by(rating: self.highest_rating) end def self.lowest_rating Show.all.minimum(:rating) end def self.least_popular_show Show.all.find_by(rating: Show.lowest_rating) ...
true
0fabe06abce0112abe97004d00cc2b6cf5215aec
Ruby
tem3/rdl
/lib/rdl_ctc.rb
UTF-8
7,124
2.75
3
[]
no_license
module RDL class Contract2 def apply(v); end def check(v); end def to_s; end def to_proc x = self Proc.new { |v| x.check v } end end class MyCtc < Contract2 def initialize(s = "myctc", &p) @str = s.to_s; @pred = p end def apply(*v) (check v) ? v : (...
true
96f5ae28a917b1bb7fa836c28446d93cc046f3c5
Ruby
theironyard-rails-atl/Julie_Torres
/HW7.31/survey_script.rb
UTF-8
280
3.046875
3
[]
no_license
require './survey.rb' survey = Survey.new(Questions, 3) until survey.finished? survey.ask_question end puts "Survey finished." puts "Your highest rating was #{survey.highest}" puts "Your lowest rating was #{survey.lowest}" puts "Your average rating was #{survey.mean}" exit
true
b14f2b15df8a8a63ca57648df61150e1a57a0693
Ruby
masui/ExpandHelp
/sb2js.rb
UTF-8
2,128
2.78125
3
[]
no_license
# -*- coding: utf-8 -*- # -*- ruby -*- # # Scrapbox.io/GyazoなどのExpandHelp記述を取得してJSに変換 # require './lib/get' require 'uri' name = 'Gyazo' name = ARGV[0] if ARGV[0] # # Glossaryの定義を取得 # keywords = {} defs = {} get("https://scrapbox.io/api/pages/#{name}/glossary/text").split(/\n/).each { |line| if line =~ /\[(\S+)\]...
true
1935868d49e1ff8a3e73c5cc3221974dd886501b
Ruby
metainnovative/inpi
/lib/inpi/seized_imr.rb
UTF-8
3,281
2.515625
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'nokogiri' require 'stringio' require 'tempfile' require 'zip' require 'inpi/rncs_server_error' module NokogiriRefinements refine Nokogiri::XML::Node do def to_hash if text? text.presence elsif element? elements = children.map(&:to_hash).compact...
true
cd6e4341f4f0dbf513301ad70728e6d949cf23e7
Ruby
cardmagic/dm-works
/lib/data_mapper/validations/number_validator.rb
UTF-8
975
2.765625
3
[ "MIT" ]
permissive
require 'data_mapper/validations/validator' module DataMapper module Validations class NumberValidator < Validator def <(max) @max_excl = max end def <=(max) @max_incl = max end def >(min) @min_excl = min end def >=(min) @min_incl = m...
true
297bc69fbc3cad5f76cac0f6a0b2826b4b9a3dda
Ruby
bitcraze/bitcraze-website
/tools/validate/src/url_check.rb
UTF-8
782
2.53125
3
[ "CC-BY-3.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
class UrlCheck < ::HTMLProofer::Check def href? @link.href end def www? is_www = @link.href.include? 'www.bitcraze.io' is_blog_post = @link.href.match /www.bitcraze.io\/[0-9]*\// is_www and not is_blog_post end def se? is_se = @link.href.include? 'bitcraze.se' is_files = @link.href...
true
58c16f98498692013454e787e99bd0def5494dc2
Ruby
ruby-git/ruby-git
/tests/units/test_url_parse.rb
UTF-8
3,616
2.515625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# frozen_string_literal: true require 'test/unit' # Tests Git::URL.parse # class TestURLParse < Test::Unit::TestCase def test_parse_with_invalid_url url = 'user@host.xz:/path/to/repo.git/' assert_raise(Addressable::URI::InvalidURIError) do Git::URL.parse(url) end end def test_parse GIT_UR...
true
7c4a411ae74ce09e2545fe7b8f6be3949880ca8e
Ruby
xight/ip_notifier
/lib/ip_notifier.rb
UTF-8
2,822
2.796875
3
[ "MIT" ]
permissive
require "ip_notifier/version" require "ip_notifier/cli" require "yaml" require "logger" require "typhoeus" module IpNotifier @@config = YAML.load_file("config.yaml") @@URL = "https://dyn.value-domain.com/cgi-bin/dyn.fcg?ip" @@logger = Logger.new('log/log') def self.check current_ip = get_current_ip previous_...
true
2949fa8e37daef671ffbe0b4b98565da40ed18ec
Ruby
sblaurock/euler
/19/19.rb
UTF-8
1,028
3.65625
4
[]
no_license
#time 0m0.05s # Initialize variables based off the given information $monthCounts = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] curDay = 1 curMonth = 1 curYear = 1900 curDOW = 1 # Monday startYear = 1901 endDay = 31 endMonth = 12 endYear = 2000 numFirstSundays = 0 def getMonthDays month, year _monthDays = $m...
true
8d8ed2d73a8ab99c83f5d3459207c58ea9fbb750
Ruby
YashUppal/appAcademy
/Software Engineering Foundations/Additional Projects/rspec_exercise_5/lib/exercise.rb
UTF-8
2,385
3.71875
4
[]
no_license
def zip(*args) zipped = [] outer_iterator = 0 while outer_iterator < args.first.length inner_iterator = 0 zip = [] while inner_iterator < args.length zip << args[inner_iterator][outer_iterator] inner_iterator += 1 end zipped << zip outer_iterator += 1 end zipped end def pr...
true
8148827e94d21c903a6df72df2f002d15b5b7bb1
Ruby
arseny-emchik/zifs
/lab4/main.rb
UTF-8
918
3.515625
4
[]
no_license
require 'colorize' require 'prime' primes = Prime.take_while {|p| p < 500 } ksi1 = primes[rand(0..primes.size - 1)] ksi2 = primes[rand(0..primes.size - 1)] puts "ksi1: #{ksi1}\nksi2: #{ksi2}".blue mod = ksi1 * ksi2 u = rand(10**5..10**6) sequence = u.to_s(2) alpha = rand(1..mod - 1) beta = (alpha ** 2) % mod puts "alph...
true
f077a1c0b9d70b12407c8087081845c8517d99b0
Ruby
wtfspm/advent_of_code
/2020/04/passport.rb
UTF-8
1,546
3.046875
3
[]
no_license
#!/usr/bin/env ruby require 'set' FIELDS = %w[ byr iyr eyr hgt hcl ecl pid cid ] FIELD_MATCHER = Regexp.new("(?:(#{FIELDS.join('|')}):([^\s]+)(?:\s+|$))", Regexp::MULTILINE) REQUIRED_FIELDS = Set.new(FIELDS - ['cid']) def parse(data) field_sets = data.split(/(?:\r?\n){2}/).map { |field_set| fie...
true
52a38572635235865aefce3f8e2fa0ca3e225c28
Ruby
zachjyoung/Schmoogle
/_site/atm/atm.rb
UTF-8
949
3.859375
4
[]
no_license
accounts = { } puts "Enter your pin or type 'new' to create a new account: " input = gets.chomp if input == 'new' puts "Welcome to my awesome bank." pin = nil pin_confirmation = "1" while pin != pin_confirmation print "Please enter a PIN for your account. " pin = gets.chomp if accounts.keys.inc...
true
0bfb2fdd9bb5264326d8bc29253eb7612c7f6f8e
Ruby
ranganathk/data_structures
/linked_list/04-find-start-of-circular-linked-list.rb
UTF-8
1,292
3.640625
4
[]
no_license
# Write a method that takes a circular linked list as argument and returns # the zero-based-index of the start of loop of linked list. # Assume that the linked list is circular. # Circular linked list is a linked list of the shape 9 require_relative 'linked_list' require "minitest/autorun" def find_start_of_loop(ll)...
true
5498c2541bff6e2357e797f07eea4da1f397b6ce
Ruby
devitagus/fullstack-challenges
/01-Ruby/04-Hash-Symbols/01-Modeling-with-Hash/lib/mc_donald.rb
UTF-8
1,404
3.5
4
[]
no_license
# encoding: UTF-8 MENU = { "Big Mac" => 300, "Mc Bacon" => 400, "Cheese Burger" => 290, "Royal Cheese" => 130, "French fries" => 130, "Potatoes" => 130, "Coca" => 160, "Sprite" => 170, "Happy Meal" => ["Cheese Burger", "French fries", "Coca"], "Best Of Big Mac" => ["Big Mac", "French fries", "Coca"...
true
8480ff4446598390eabf508f208eaef1f58a184c
Ruby
taraujo310/distributed-chat
/Application/data_manager.rb
UTF-8
1,069
2.96875
3
[]
no_license
require_relative 'wlocker.rb' require_relative 'rlocker.rb' class DataManager class NoNameForFileError < StandardError; end def initialize(args) @@base ||= {} @@base[args[:filepath]] = locker_factory(args[:strategy], args[:filepath]) @baseMutex = Mutex.new end def read(filepath, id) locker = ...
true
f06bfc8dbeefb058efcabb59d902cdfe6388bd9e
Ruby
DevinDow/UT-Ruby-3-ruby_view_server
/page_generator.rb
UTF-8
1,769
3.828125
4
[]
no_license
require 'erb' require 'date' def process_erb(string) template = ERB.new string return template.result(binding) end ## Define a function # def add_thes_together(x,y) # return x + y # end ## Replace contents from a string # str = "i rode a plane today" # puts str.gsub('rode', 'bought') # => "i bought a p...
true
5e43cfbf87c562b1a4944a771ba7cfb287a4a695
Ruby
rajivmaskara/LearningRuby
/array.rb
UTF-8
1,535
4.1875
4
[]
no_license
# Array is an ordered, integer indexed, collection of objects numbers = [432,34,345,234,345,45] names = ["rajiv","rohit","perform"] puts numbers.to_s puts numbers[1] puts numbers[2] puts "Reverse : #{numbers.reverse.to_s}" puts "Sort : #{numbers.sort.to_s}" #immutable methods puts "First Value : ...
true
3b8e4d214e81720a170fcebe933d6b50adacc725
Ruby
wesleyit/ruby_pw_checker
/spec/pwchecker_spec.rb
UTF-8
2,012
2.96875
3
[]
no_license
# encoding: UTF-8 require 'spec_helper' require 'pw_checker' describe PwChecker do before do @password = PwChecker.new("Q1w2e3r4T5%%") end describe '#rule_has_good_length?' do it "must contain at least 8 characters" do expect(@password.rule_has_good_length?).to eq(true) ...
true
f161115a32ef0343fd64318cbdd00d269e0a0caa
Ruby
zachmmeyer/BasicRubyProjects
/stock_picker/stock_picker.rb
UTF-8
569
3.671875
4
[]
no_license
def stock_picker(days_array) combined_days = days_array.combination(2).to_a days_result = [] while combined_days.length > 1 if ((combined_days[0][1]-combined_days[0][0]) > (combined_days[1][1] - combined_days[1][0])) combined_days.delete_at(1) else combined_days.delete_at(0) end end ...
true
bf1e5c166de4483358108607499ca41374b45e3d
Ruby
ellehallal/LRTHW
/ex34.rb
UTF-8
839
3.78125
4
[]
no_license
animals = ['bear', 'ruby', 'peacock', 'kangeroo', 'whale', 'platypus'] #1 The animal at 1 is at 1 and is a ruby #2 The third (3rd) animal is at 2 and is peacock #3 The first (1st) animal is at 0 and is a bear #4 The animal at 3 is at 3 and is a kangeroo #5 The fifth (5th) animal is at 4 and is a whale #6 The a...
true
be3d15955a319a6d373be773bdffe63415a1cccb
Ruby
BartSakowski/programming-univbasics-nds-nds-to-insight-understand-lab-chicago-web-033020
/lib/nds_explore.rb
UTF-8
409
2.796875
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
$LOAD_PATH.unshift(File.dirname(__FILE__)) require 'directors_database' # Call the method directors_database to retrieve the NDS def pretty_print_nds(nds) # Change the code below to pretty print the nds with pp pp(nds) end def print_first_directors_movie_titles i=0 while i<directors_database[0][:movies].le...
true
149b39b7fcea2d37849e87b84f04fb4c054dbf00
Ruby
HDKHALILI/fight-club-saad-vs-michael
/weapon.rb
UTF-8
703
2.515625
3
[]
no_license
module Weapon module_function def give weapons_inventory = [ ["White board eraser", 1, "pounds"], ["James’s umbrella", 20, "pricks"], ["Potted plant", 15, "smites"], ["Chris’s Coffee cup", 20, "burns"], ["Packet of shapes", 15, "torments"], ["Computer Monitor", 30,"pulverises"], ["Be...
true
23d5dc08e666bc5eccbd3895a2cd776543798419
Ruby
jethrodaniel/exercism
/ruby/raindrops/raindrops.rb
UTF-8
393
3.765625
4
[ "MIT" ]
permissive
class Raindrops def self.factors?(a, b) a % b == 0 end def self.convert(n) rain_speak = "" rain_speak += 'Pling' if self.factors?(n, 3) rain_speak += 'Plang' if self.factors?(n, 5) rain_speak += 'Plong' if self.factors?(n, 7) unless self.factors?(n, 3) || self.factors?(n, 5) || self.fa...
true
8ee0003ee810727a5963494e6a28bffed7cb299a
Ruby
JonathanWexler/wdi-november-lecture-code
/Week 3/Day 4/sinatra_params/main.rb
UTF-8
537
2.578125
3
[]
no_license
require 'sinatra' require 'mail' require 'net/smtp' # params = {:name => "jon", :password => 12345} get '/' do "Hello World" end get '/home' do puts "*******************" puts params[:name] @user_name = params[:name] # puts params[:password] erb :home end post '/sign-in' do puts "INFOR...
true
73e91d92df0f16dcfb0105ca6c469dc332d50bd1
Ruby
mdunsmuir/project_euler
/25-to-49/problem_27_quadratic_primes.rb
UTF-8
985
3.265625
3
[]
no_license
class Fixnum def prime? @@iprime ||= 2 @@prime_hash ||= {2 => 2} if self <= @@iprime if @@prime_hash[self] return @@prime_hash[self] else return nil end end (@@iprime + 1).upto(self) do |num| root = Math.sqrt(num).floor catch :notprime do ...
true