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
3e85a9d6599ac5a242a7bf74189cd271ddeed5c0
Ruby
ndelagex/spotify
/app/helpers/logic_helper.rb
UTF-8
1,178
2.5625
3
[]
no_license
module LogicHelper def implement_logic_features(feats) logicHash = {} #is_dancing if feats['danceability']['median'] >= 0.7 and feats['energy']['median'] >= 0.65 and feats['tempo']['median'] >= 115 logicHash['is_dancing'] = 2 elsif feats['danceability']['median'] < 0.5 and feats['energy']['medi...
true
d8b88ee9f6e32a61bc5263b1355e3b8e68260838
Ruby
nicoasp/TOP---Ruby-Rspec-Testing
/lib/board.rb
UTF-8
3,470
3.109375
3
[]
no_license
require "./lib/node.rb" class Board attr_reader :array_of_nodes, :array_of_4s, :a1, :a2, :a3, :a4, :a5, :a6, :b1, :b2, :b3, :b4, :b5, :b6, :c1, :c2, :c3, :c4, :c5, :c6, :d1, :d2, :d3, :d4, :d5, :d6, :e1, :e2, :e3, :e4, :e5, :e6, :f1, :f2, :f3, :f4, :f5, :f6, :g1, :g2, :g3, :g4, :g5, :g6 def initialize @a1 = Node...
true
ea205dad91c520d793bdd34a569798d967737737
Ruby
brandao19/Colcho.net
/app/models/review.rb
UTF-8
386
2.546875
3
[ "MIT" ]
permissive
class Review < ActiveRecord::Base # Criamos um Array de 5 elementos, ao invés de range. POINTS = (1..5).to_a belongs_to :user belongs_to :room, counter_cache: true validates_uniqueness_of :user_id, scope: :room_id validates_presence_of :points, :user_id, :room_id validates_inclusion_of :points, in: POIN...
true
e36b25c493723f9236648a3a91ddf8fd218c30c5
Ruby
glamouracademy/daftchat
/app/models/user.rb
UTF-8
232
2.71875
3
[]
no_license
class User < ActiveRecord::Base has_many :messages def answer_correct?(user_answer) puts "Answer for #{name} is #{answer}" puts "user_answer for #{name} is #{user_answer}" /#{answer}/i.match(user_answer) end end
true
094edc2477b12e6090851dd6aaf4555ec7e03266
Ruby
RobertoM80/Introduction-to-programming
/chapters/7.Arrays/ex4.rb
UTF-8
193
4.21875
4
[]
no_license
#What does each method return in the following example? arr = [15, 7, 18, 5, 12, 8, 5, 1] 1. arr.index(5) 2. arr.index[5] 3. arr[5] #1. 3 # #2. ? wrong it was a error! # #3. 8 # # # #
true
17f563af4853b0e03caf49ba484c08d342545b8c
Ruby
kmaksimovv/seo_service_site
/app/services/check_domain.rb
UTF-8
719
2.765625
3
[]
no_license
require 'net/https' require 'net/http' require 'uri' class CheckDomain attr_reader :uri_http, :uri_https, :uri_http_www, :uri_https_www def initialize(domain) @domain = domain @uri_http = URI.parse("http://#{@domain}") @uri_https = URI.parse("https://#{@domain}") @uri_http_www = URI.parse("http://...
true
a31046096454b22cdcbfb6159586192fc9e42b7a
Ruby
TobiasDws/FIT5H_EuP
/Arbeit/Drewes, Tobias.txt
UTF-8
1,697
3.3125
3
[]
no_license
class Bibliothek attr_accessor :buecher attr_reader :name def initialize(name) @buecher = [] @name = name end def add_book(buch) @buecher << buch end def ausgabe @buecher.each do |buch| puts "Maier, #{buch.title}, #{buch.gekauft_am}" end end def buch_aktion jetzt = 2014 @buecher.each d...
true
01d17ed7ea34e8321b94778171b2d6f8ba27792f
Ruby
copperheads-2014/Fix8
/spec/models/property_spec.rb
UTF-8
1,733
2.53125
3
[]
no_license
require 'rails_helper' RSpec.describe Property, :type => :model do let(:property) {Property.new(owner_id: 1, name: "The Lucas", address: "123 Aussie Boulevard")} describe 'Validations' do it "is valid with an owner_id, name and address" do property = Property.new(owner_id: 1, name: "The Lucas", address:...
true
9da7164fb9c9cb6cd4ba12a331cc44c6b9de57f5
Ruby
CadeOnTheCoast/LaunchSchoolExercises
/SmallProblems/Easy3/palindromic_num.rb
UTF-8
222
3.46875
3
[]
no_license
def palindromic_number?(int) rev_words = int.to_s.chars.reverse rev_words.join.to_i == int end puts palindromic_number?(34543) puts palindromic_number?(123210) puts palindromic_number?(22) puts palindromic_number?(5)
true
045a1bdba86c6811eaef81171c6bfa633b65629d
Ruby
twingly/rack-indicium
/lib/rack/indicium.rb
UTF-8
957
2.640625
3
[ "MIT" ]
permissive
require "rack/indicium/version" require "jwt" module Rack class Indicium HTTP_AUTHORIZATION = "HTTP_AUTHORIZATION".freeze BEARER_REGEXP = /\ABearer /i def initialize(app, secret, decoder = nil) @app = app @secret = secret @decoder = decoder || lambda { |jwt, secret| JWT.decode(jwt, s...
true
a3128dcdaca69fb2d3c5a0dd20c412733b25e088
Ruby
ippa/triangle_wars
/src/power_up.rb
UTF-8
1,700
2.671875
3
[]
no_license
class PowerUp < Chingu::GameObject attr_reader :type, :radius, :status has_trait :collision_detection def initialize(options) super @speed_x = options[:speed_x] @speed_y = options[:speed_y] @type = options[:type] @powerup_bg = Image["powerup_bg.png"] @powerup = Image["#{@type}.png"] ...
true
4e1955d5b508684fb39ce6826f2fba50f00a5fda
Ruby
kkempin/devtest
/lib/panel_providers/calculators/array.rb
UTF-8
381
2.6875
3
[]
no_license
module PanelProviders module Calculators class Array < Base NODE_SIZE = 10 def process(data) json = JSON.parse(data) counter = (json['docs'].count > NODE_SIZE) ? 1 : 0 json['docs'].to_a.inject(counter) do |sum, el| sum + el.count{ |k, x| (x.class.to_s == 'Array' && x...
true
02bc2a3413b6c972b7b189e61d56ae6b95a4e23e
Ruby
msayson/substitution_cipher_utilities
/test_shift_by_n.rb
UTF-8
930
3.203125
3
[ "MIT" ]
permissive
require_relative 'shift_by_n' require 'test/unit' # Unit tests for shift_by_n class TestShiftByN < Test::Unit::TestCase def test_get_shift_value shift_val = ShiftByN.get_shift_value('e', 'm') assert_equal(8, shift_val) end def test_shift_by_n cipher_text = 'TEXQHFKALCZXHBPELRIATBEXSB'.downcase e...
true
cae952485efef90d159edc41670af7bce0abc3b9
Ruby
ryaan-anthony/cbb-picks
/app/helpers/parlay_helper.rb
UTF-8
1,429
3.046875
3
[]
no_license
module ParlayHelper def parlays @parlay.picks.combination(@parlay.num_teams).to_a.shuffle.each_with_object([]) do |parlay, memo| middle_matches = select_matches(parlay, @parlay.middle_teams) bottom_matches = select_matches(parlay, @parlay.bottom_teams) next if count_occurrences(middle_matches, ...
true
22c703e2ab35327d264467cd4e2e10ca3c668643
Ruby
jahpd/rake-abnTeX
/Rakefile
UTF-8
6,690
2.546875
3
[]
no_license
# -*- coding: utf-8 -*- require './abnTeX' require 'safe_yaml' require 'rake' include ABNT::TeX # Interacao no prompt de comando def answer(msg) puts Time.now puts msg STDIN.gets.chomp end def log(msg) puts "#{Time.now}---> #{msg}" end # cria string cabecalho em LaTeX com padrao ABNT def latex_cabecalho(yam...
true
2e54b5858c2ac08bf2940848a92cbe72c771e8a8
Ruby
felipegruoso/spotify-api
/lib/spotify/models/simplified/album.rb
UTF-8
469
2.75
3
[ "MIT" ]
permissive
module Spotify module Models # # This class is kept only to provide a better visualization. # class Simplified::Album < Models::Album # # Sets the arguments to its variables. # # @param [Hash] args the arguments that will be placed on each variable. # ...
true
10c0dc5a0c0425a284909380f1f971b81091ea7b
Ruby
TomK32/acts_as_follower
/lib/follower_lib.rb
UTF-8
491
2.515625
3
[ "MIT" ]
permissive
module FollowerLib private # Retrieves the parent class name if using STI. def parent_class_name(obj) if obj.class.superclass != ActiveRecord::Base return obj.class.superclass.name end return obj.class.name end def follower_and_followable_conditions(follower, followable) {:follo...
true
c1e5f8c87f4abfb302ea6b3b2dea879ddabf4b6d
Ruby
kmagida110/final
/app/controllers/cities_controller.rb
UTF-8
1,642
2.515625
3
[]
no_license
class CitiesController < ApplicationController def show @city = City.find_by(id: params[:id]) end def index @cities = City.order(:name).paginate(:page => params[:page],:per_page => 50) if params[:keyword].present? @cities = @cities.where("full_name LIKE ? OR name = ?", "%#{params[:keyword]}%", par...
true
d785d038705badca3c1552ca67a3feba6f727acb
Ruby
Firfi/showmojo_listing_api_test
/listing_api_test.rb
UTF-8
1,222
2.515625
3
[]
no_license
require 'uri' require 'net/http' def main token = '989d89549e932d34ecc2a3403ba44871' address = 'https://dev.showmojo.com' @json = '{"listings":[{"code":"cd-1","available_date":"03/09/2013","address":"750 N Rush St","city":"Chicago","state":"IL","title":"2BR/2BA Apartment - Chicago","square_feet":"1237","highli...
true
fcce1f5533adfafd987e493949ac09f5c449c350
Ruby
Sparksyyy/MSPhysics
/RubyExtension/MSPhysics/joint_curvy_slider.rb
UTF-8
7,728
2.65625
3
[ "MIT" ]
permissive
module MSPhysics # @since 1.0.0 class CurvySlider < Joint DEFAULT_LINEAR_FRICTION = 0.0 DEFAULT_ANGULAR_FRICTION = 0.0 DEFAULT_ALIGNMENT_POWER = 0.0 DEFAULT_CONTROLLER = 1.0 DEFAULT_LOOP_ENABLED = false DEFAULT_ALIGNMENT_ENABLED = true DEFAULT_ROTATION_ENABLED = true # Create a Cu...
true
3540c40832129eb39eb9d1437707efd10453c344
Ruby
FosterKizer/blocitoff
/db/seeds.rb
UTF-8
597
2.65625
3
[]
no_license
require 'faker' # Create some users 10.times do user = User.new( name: Faker::Name.name, email: Faker::Internet.email, password: Faker::Lorem.characters(10) ) user.skip_confirmation! user.save! end users = User.all 75.times do Item.create!( user: users.sample, name: Faker::Lorem.sentence, created...
true
5c62124af26c6dfbcb95b753b60578235817bc5a
Ruby
quantitare/quantitare
/app/models/concerns/categorizable.rb
UTF-8
1,600
3.140625
3
[ "MIT" ]
permissive
# frozen_string_literal: true ## # Shared logic for models that point to a category with some metadata. # # 1. Set a constant called +CATEGORY_KLASS+. This class must respond to +.get+ and +.default+. # 2. Optionally, use the +category_attribute+ macro to set the name of the attribute with which you wish to use to # ...
true
119a6be1427ef2dd267462a3d51d2832e8eeb6d6
Ruby
chadc76/Minsweeper
/tile.rb
UTF-8
1,798
3.140625
3
[]
no_license
class Tile require "colorize" attr_reader :type, :mine def initialize(type, coordinates, grid_size) @type = type @mine = is_mine? @flagged = false @revealed = false @coordinates = coordinates @grid_size = grid_size end def is_mine? type == :m end def reveal return false i...
true
8c6816e18426f39a0f226d20a6782f11b1f23ad7
Ruby
rodhilton/console_table
/lib/console_table.rb
UTF-8
13,352
3.09375
3
[ "MIT" ]
permissive
# ConsoleTable allows you to define a table with columns set to specific sizes, # and then give that table rows of data which it will format into a view that fits # inside a terminal/console. # # Author:: Rod Hilton # License:: MIT module ConsoleTable # Define a console table. Requires a table layout which spe...
true
efd467f227571c5bee7d40a02be39d455dc47f07
Ruby
jamesduan/devops
/main/providers/init_businesse_data/main/packages/register_pvo_client-v1.0/main/register_pvo.rb
UTF-8
2,424
2.59375
3
[]
no_license
# ruby program to change service weight prob data stored in zk # # contributed by qw0044! 2014-08-07! # require 'optparse' require 'ostruct' require 'mysql2' require 'securerandom' require 'json' def reg_cli(host, username, password, name, type, url, dbname) client_id = SecureRandom.hex(10) + SecureRandom.random_...
true
91d2b50e5c0c680887583a26baa8eeb4ef1135f5
Ruby
magma-labs/harvested2
/lib/harvest/behavior/crud.rb
UTF-8
3,400
2.59375
3
[ "MIT" ]
permissive
module Harvest module Behavior module Crud # Retrieves all items # @return [Array<Harvest::BaseModel>] an array of models depending on where you're calling it from (e.g. [Harvest::Client] from Harvest::Base#clients) def all(query_options = {}) response = request(:get, credentials, api_mo...
true
eea93aa2802c97881615e2afd4cd519730b7036b
Ruby
shioimm/til
/practices/exercism/ruby/2019/binary.rb
UTF-8
151
3.421875
3
[]
no_license
# Binary from https://exercism.io class Binary def self.to_decimal(char) raise ArgumentError if char.match? /[^01]/ char.to_i(2) end end
true
d455eac32a624dd18369f2e0cdd4d3aeffe348a4
Ruby
jonathanbouren/my_ruby_practice
/drill57.rb
UTF-8
428
3.78125
4
[]
no_license
=begin Using the folowing code, compare the value of name with the string 'RoGer' while ignoring the case of both strings. Print true if the valuees are the same print false if they aren't. Then, perform the same case-insensitive comparison, except comparing the value of name with the string 'Dave'. =end name = ...
true
fbf207314b52c23f6c2227a88a9015446d6c73ec
Ruby
SnacksOnAPlane/advent
/15-1.rb
UTF-8
1,314
3.328125
3
[]
no_license
require 'pry' $ingredients = {} $calories = {} File.readlines("15-1.data").each do |line| match = /(.*): capacity (.*), durability (.*), flavor (.*), texture (.*), calories (.*)/.match(line.chomp) _, ingredient, capacity, durability, flavor, texture, calories = match.to_a $ingredients[ingredient] = [capacity, d...
true
10154409903cf154ee6f0e3c650d82e5cb869027
Ruby
masayag/manageiq-providers-kubevirt
/app/models/manageiq/providers/kubevirt/memory_calculator.rb
UTF-8
1,715
3
3
[ "BSD-3-Clause", "Apache-2.0", "BSD-2-Clause" ]
permissive
# # Copyright (c) 2017 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
true
af754496c7deb298d397fff007d3c542be2e7f56
Ruby
hdhillon05/rubyexercises
/calculatorv5.rb
UTF-8
1,829
4.21875
4
[]
no_license
require 'highline/import' class Calculator def user_enter_question loop do @str1 = ask ('Please enter your equation (enter \'exit program\' to quit):') # testing for a valid input -- user can exit program by entering 'exit program' if ((/(plus|minus|divide|divid|multip|times)/ =~...
true
af42f8035042ccdae1df925f3f1e53375d79b0a5
Ruby
jmorc/Rehearsable
/db/seeds.rb
UTF-8
6,331
2.609375
3
[]
no_license
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
true
147f8d1ca75960848a83c8e2e5f17dda0439c06c
Ruby
stuarthalloway/jtestr
/jtestr/test/functional/helper_check.rb
UTF-8
2,472
2.765625
3
[ "MIT" ]
permissive
functional_tests do test "TestCase helper should be available" do assert respond_to?(:should_be_available_everywhere) end test "all helper should be available" do assert respond_to?(:should_be_available_in_all_tests) end test "functionals helper should be available" do assert respond_to?(:s...
true
f11abc8eb4005eb9a0b5c484ea2ed34af4ee8a2b
Ruby
larskanis/ruby-ffi-inline
/lib/ffi/inliner/builders.rb
UTF-8
1,866
2.65625
3
[]
no_license
module FFI; module Inliner Signature = ::Struct.new(:return, :name, :arguments, :arity, :blocking) class Builder @builders = [] def self.[](name) return name if name.is_a?(Builder) @builders.find {|builder| builder.name.downcase == name.downcase || builder.aliases.any? { |ali| ali.downcase =...
true
34676008ef4e0e7016705d9e80ef8aaef376a894
Ruby
RomanADavis/learn-programming
/learn-ruby-the-hard-way/ex22.rb
UTF-8
3,721
3.765625
4
[]
no_license
# So, how well do I remember this? # #: octothorps or hash symbols make comments # $: dollar sign come before certain variable names. I think that makes them #global? # def: defines methods/ functions # end: ends functions and blocks # (: open parenthesis open up the list of arguments / parameters # ,: comma sep...
true
7c9b4dca51115dccc82ce243fa6f963b54447216
Ruby
ritthai/HackerAcademy-App
/app/helpers/contests_helper.rb
UTF-8
407
2.546875
3
[]
no_license
module ContestsHelper def duration_between(from_date, to_date) hours, minutes, seconds, fracs = Date.send( :day_fraction_to_time, to_date.minus_with_duration(from_date)) days = (hours/24).round hours = hours % 24 return [ pluralize(days, "day"), pluralize(hours, "hour"), plural...
true
b67841b3b5f84bfc9e0e8bea1492aacbd7bd41f5
Ruby
tkt989/atcoder
/old/donuts.rb
UTF-8
169
3.046875
3
[ "MIT" ]
permissive
include Math n, x = gets.chomp.split(" ").map(&:to_i) m = [] n.times do m << gets.chomp.to_i end m.each do |v| x -= v end r = (x / m.min).floor puts m.size + r
true
47f36711e50fc447bf4b499bca4257bc2125c7c1
Ruby
dadarek/Ruby-Tic-Tac-Toe
/lib/human_player.rb
UTF-8
161
3.0625
3
[]
no_license
class HumanPlayer attr_accessor :ui def initialize(ui) @ui = ui end def next_move(board) @ui.get_square end def to_s "You" end end
true
8ddfde20fc211b00e3f7a1c179ec97c2e25273bd
Ruby
mtwilliams/ryb
/lib/ryb/dependency.rb
UTF-8
911
2.59375
3
[]
no_license
module Ryb class Dependency < Pour::Mould end class InternalDependency < Dependency property :product, Typespec.symbol def initialize(product) self.product = product end alias :eql? :== def ==(other) self.product == other.product end end class ExternalDependency < Depen...
true
3786e8647ab7dcd469761c7cea180152bffc760c
Ruby
nateberkopec/emmett9002
/server.rb
UTF-8
1,653
3.046875
3
[]
no_license
class Emmett def initialize @mark = MarkyMarkov::TemporaryDictionary.new(1) @mark.parse_file(File.open('config/dictionary.txt', 'a+')) @dark = MarkyMarkov::TemporaryDictionary.new @dark.parse_file 'config/blogposts.txt' @english = YAML.load(File.open('config/english.yaml')) end def generate_...
true
5b716d19f929b22f0149cb21956f03122f6225f0
Ruby
pooza/cfms
/lib/ruby/mailparser/conv_charset.rb
UTF-8
639
2.515625
3
[]
no_license
# Copyright (C) 2007-2010 TOMITA Masahiro # mailto:tommy@tmtm.org require "iconv" require "nkf" class MailParser::ConvCharset CHARSET = { "sjis" => "cp932", "x-sjis" => "cp932", "shift_jis" => "cp932", "shift-jis" => "cp932", } def self.conv_charset(from, to, str) from = CHARSET[from...
true
a1c15d36feef2c85f77c98c9fb9c56cde1b91552
Ruby
shinob/guestcard
/lib/make_state_chart.rb
UTF-8
3,125
3.03125
3
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
#!/usr/bin/env ruby # -*- coding: utf-8 -*- # alone : application framework for small embedded systems. # Copyright (c) 2009-2012 Inas Co Ltd. All Rights Reserved. # # This file is destributed under BSD License. Please read the COPYRIGHT file. # # ワーカーのステートマシンを評価して、ステート表を表示する。 # ## # pickup state / even...
true
3aa9cafec40a6aff1953236c4d6b8c07925f2d43
Ruby
mattb20/student-directory
/directory.rb
UTF-8
3,634
4.09375
4
[]
no_license
@wizards = [] # empty array accessible to all methods @options_for_user = ["Input the wizards", "Show the wizards", "Show wizards by house","Print by first letter of name", "Save the list of wizards", "Load the wizards", "Exit"] # array to store the possible options for the interactive menu def interactive_menu loop ...
true
7df16891ed895736a0a967ecf28c0ff8791127c1
Ruby
ckane30691/aa-algo-projects
/BSTs/lib/binary_search_tree.rb
UTF-8
3,447
3.59375
4
[]
no_license
# There are many ways to implement these methods, feel free to add arguments # to methods as you see fit, or to create helper methods. require 'bst_node' class BinarySearchTree attr_accessor :root def initialize @root = nil end def insert(value) unless @root @root = BSTNode.new(value) else ...
true
d31d8fc38848817c0ea227e77a8d39e80d468c7a
Ruby
benburkert/schemr
/lib/DOM/dtd_translator.rb
UTF-8
6,023
2.578125
3
[]
no_license
module Schemr::DOM module DtdTranslator #element attribute names ELEMENT_NAME = "element-name" ELEMENT_CATEGORY = "category" ELEMENT_CONTENT = "element-content" #attlist attribute names ATTRIBUTE_NAME = "attribute-name" ATTRIBUTE_TYPE = "attribute-type" DEFAULT_VALUE = "defau...
true
35d956619e9bb89d3cbf3fc60a04cb71cad6c9a7
Ruby
Jolomono/introduction-to-programming-with-ruby
/1_the_basics/3.rb
UTF-8
536
4.4375
4
[]
no_license
# Write a program that uses a hash to store a list of movie titles with the year they came out. Then use the puts command to make your program # print out the year of each movie to the screen. The output for your program should look something like this: =begin 1975 2004 2013 2001 1981 =end movies = { "Goodfellas" =>...
true
bf00958b3109ad34fa5f4e59b83b42b3455dd895
Ruby
nerab/riki
/lib/riki/type_registry.rb
UTF-8
536
2.875
3
[ "MIT" ]
permissive
module Riki # # Maps a MediaWiki type to the corresponding Riki class # class TypeRegistry class << self def get(type) self.send(type.to_sym) end def subcat Category end def method_missing(sym, *args, &block) if respond_to?(sym) Rik...
true
6a235c5338cddc56cead3c8cdcad759f5cdd443c
Ruby
phifty/gom
/lib/gom/storage/remover.rb
UTF-8
739
2.6875
3
[ "MIT" ]
permissive
# Removes an object from the storage. class GOM::Storage::Remover attr_reader :object attr_reader :id def initialize(object_or_id) @object, @id = object_or_id.is_a?(GOM::Object::Id) ? [ nil, object_or_id ] : [ object_or_id, nil ] end def perform check_mapping remove_object remo...
true
861244ba6aae7b37cdcc6de1da9542d033b50cb0
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/src/463.rb
UTF-8
158
2.59375
3
[]
no_license
def compute(array1='', array2='') bytes1, bytes2, index = array1.bytes, array2.bytes, -1 bytes1.count{|entry| index+=1; entry != bytes2[index] } end
true
b75e501994da5b3145ac753d1efc9667cb3e08bd
Ruby
TristanJMcCormick/email_prediction_challenge
/Email_Prediction_Module.rb
UTF-8
6,532
3.328125
3
[]
no_license
class EmailObject #These are like objc properties #give setter/getters for instance variables attr_accessor :name, :first_name, :last_name, :first_local_part, :last_local_part, :domain, :email_format, :email def initialize(name = "no_name", email = "no_email") @name = name @email_format = ...
true
2f8d3d45f1d2abba05bb19dd787e157fda90904c
Ruby
dischglv/thinknetica-course-ruby
/route.rb
UTF-8
1,450
3.703125
4
[]
no_license
class Route include InstanceCounter include Validation attr_reader :stations def initialize(start_station, end_station) @stations = [start_station, end_station] validate! register_instance end def add_station(station) self.stations.insert(-2, station) end def delete_s...
true
821d768a1645664ff89eeb69848094d074e2abce
Ruby
chrisb/opengtd
/lib/models/task.rb
UTF-8
927
2.546875
3
[]
no_license
class Task < ActiveRecord::Base belongs_to :user validates_presence_of :title validates_presence_of :user_id def complete! self.completed = true self.completed_at = Time.now self.tags = self.tags_array << 'completed' save end def add_tag!(tag) self.tags = tags_array.push(tag) ...
true
0fe2095bb358a32a76566e6fcee96a92b5bc732c
Ruby
thomasjwebb/scripts
/make_icons.rb
UTF-8
484
2.734375
3
[ "BSD-2-Clause", "LicenseRef-scancode-public-domain", "BSD-3-Clause" ]
permissive
#!/usr/bin/env ruby # Makes different icon sizes from an svg, appending size name if ARGV.size < 1 puts "Must supply filename" exit end ios_sizes = [57, 72, 114, 144, 512, 1024] ARGV.each do |filename| match = /^(.*)\.svg$/.match(filename) if not match puts "#{filename} isn't an svg file, skipping...
true
9820453536664db84abffff33cb34a9ac4150181
Ruby
AaronNovakDev/Healthapp_T1A3
/presentation_info.rb
UTF-8
4,141
3.828125
4
[]
no_license
# Hello every one, my names Aaron. And welcome to my Daily Health App. # I am creating this app so that its very easy to use, people of all ages and levels of education can learn it with ease. # I would like every one to use this app so they can help themselves stay on track , basically with anything they see fit. #...
true
9791a066e596a69fa900da7e1b0a10cbfb0edd45
Ruby
mymorkkis/code-clan-karaoke
/specs/drink_spec.rb
UTF-8
495
3.078125
3
[]
no_license
require('minitest/autorun') require('minitest/rg') require_relative('../drink') class TestPerson < MiniTest::Test def setup @drink_1 = Drink.new('vodka & coke', 2.50) @drink_2 = Drink.new('beer', 4.00) @drink_3 = Drink.new('half pt beer', 2.00) @drink_4 = Drink.new('coke', 1.00) @drink_5 = Drink...
true
b4f110a53a78d4a4728ebee7ad37891f67facf28
Ruby
techapj/chris-pine-learn-to-program
/05_6_2_full_name_greeting.rb
UTF-8
463
4.03125
4
[]
no_license
# Write a program that asks for a person's first name, then middle, and then last. # Finally it should greet the person using their full name. puts 'Please input your first name below.' first_name = gets.chomp puts 'Please input your middle name below.' middle_name = gets.chomp puts 'Please input your last name below....
true
8433ca14550a1db9dfee5ee3769f9b0a575dc975
Ruby
rwestgeest/dialoogtafels
/app/models/schedulable.rb
UTF-8
1,417
2.828125
3
[ "MIT" ]
permissive
module Schedulable def start_date=(new_value) set_date_value(:start, new_value) end def start_date start_time && start_time.to_date || nil end def start_time=(new_value) set_time_value(:start, new_value) end def end_date=(new_value) set_date_value(:end, new_value) end def end_date...
true
11a7fee0092bb772f8690f17836ab6d18fcb2285
Ruby
MrLuigiBean/Ruby-Codes
/Encryption and Decryption/fbecv2.rb
UTF-8
552
3.9375
4
[]
no_license
puts "Please insert text for encryption:" puts text = gets.chomp.to_s textlength = text.length puts print "How many times should the process be applied? " final=gets.to_i counter=0 puts "Here's your encrypted text!" puts while counter < final output="" for x in 0..textlength output=output+ text[...
true
73426f999662f034fcfa8c55ff471e44b5c8c0ee
Ruby
jenlaister/instance-methods-lab-ruby-web-1116
/lib/person.rb
UTF-8
482
3.15625
3
[]
no_license
class Person def talk puts "Hello World!" end def walk puts "The Person is walking" end end adele_goldberg = Person.new alan_kay = Person.new # 5. DEFINE #TALK IN PERSON # Add an instance method #talk to your Person class in lib/person.rb that will puts "Hello World!" # 6. DEFINE #WALK IN PERSON #...
true
b711f31c18f94ce5786de2e5a62b9cd86cc9820c
Ruby
mpsuzuki/suishu-review
/makeCharNameList.rb
UTF-8
612
2.78125
3
[]
no_license
#!/usr/bin/env ruby1.9 Encoding.default_internal = "utf-8" Encoding.default_external = "utf-8" lines = Array.new while (STDIN.gets) next if ($_.chomp !~ /1B[3-5][0-9A-F]{2}.*SHUISHU/) toks = $_.chomp.gsub(/^\s*/, "").gsub(/\s*$/, "").split(/\s+/) ucsHex = toks[0] ucsInt = toks[1].encode("UCS-4BE").unpack("N"...
true
33006ca9763233742c67d4dcc011904793d05bca
Ruby
sway9119/method_collection
/section041/case_test.rb
UTF-8
838
3.75
4
[]
no_license
# 次の例では、すべて"OK"と表示する # 同値性判定 case 1 when 0 p "NG" when 1, 2 p "OK" else p "NG" end # クラス判定(直接のインスタンスである場合) case 1 when Integer p "OK" end # クラス判定(サブクラスの場合)。最初にマッチしたwhen節を評価するので # when Integerの部分は評価されない case 1 when Numeric p "OK" when Integer P "NG" end # モジュールのインクルード判定 case [1] when Enumerable p "OK" ...
true
d70d883dd114a8a05602ff23ae3fc638edeb52ac
Ruby
j-christoffersen/fakebook
/app/helpers/posts_helper.rb
UTF-8
972
2.640625
3
[]
no_license
module PostsHelper #returns string for captioning posts about likes def render_likes_caption likers num_likers = likers.count if likers.include? current_user if num_likers > 2 return "You, #{likers.first == current_user ? likers.second.name : likers.first.name}, and #{num_likers-2} oth...
true
da6b3faf6e975af71bcdfe5c7fecd72acdc731eb
Ruby
bibendi/samson
/test/support/single_cov.rb
UTF-8
2,125
2.609375
3
[ "Apache-2.0" ]
permissive
class SingleCov COVERAGES = [] class << self def expect(file, percent) COVERAGES << [file, percent] end def verify!(result) COVERAGES.each do |file, expected_percent| uncovered!(file) unless coverage = result[File.expand_path(file)] line_of_code = coverage.compact.count ...
true
37d9b49008a5240fe7cadc4cd81079d03f10b035
Ruby
srydos/twitter_bot
/tweet.rb
UTF-8
347
2.59375
3
[]
no_license
#!/usr/bin/env ruby WORK_DIR=File.expand_path(__FILE__).sub(/[^\/]+$/,'') require WORK_DIR + 'Class/TetesolTwitter.rb' #半角スペース対応 tweet_user = TetesolTwitter.new(WORK_DIR + 'Config/user.yml') msg = '' ARGV.each do | text | msg += text + ' ' end msg[/ $/]= '' begin tweet_user.tweet(msg) rescue puts 'tweet error!' ...
true
515944d2242fd4403fce1edbadedc1d36c0e328e
Ruby
babelian/service_operation
/lib/service_operation/error_handling.rb
UTF-8
2,400
2.625
3
[ "MIT" ]
permissive
# frozen_string_literal: true module ServiceOperation # ActiveModel compatable ErrorHandling # depends on {Base#context} and {Errors} module ErrorHandling def errors @errors ||= Errors.new end # @param [Failure, Hash, nil] error(s) merge into {#errors} def fail!(error = {}, more = {}) ...
true
133b402b4df77852ac84d6b783b15d98b32db00b
Ruby
Kappie/clustering
/lib/distance_matrix.rb
UTF-8
1,783
3.71875
4
[]
no_license
module Clustering # A class that calculates distances between objects given a distance function. # @example # numbers = { one: 1, two: 2} # add = lambda { |a, b| a + b } # matrix = DistanceMatrix.new(numbers, add) # matrix.distances #=> { one: { one: 2, two: 3}, two: { one: 3, two: 4} } class ...
true
16aa49b49a439dab812021ac56d5f89ce1733192
Ruby
MarinaAndenko/OlympicTasksMarina
/task_beauty.rb
UTF-8
1,376
3.59375
4
[]
no_license
class Letter def initialize(str) @string = str end def calculate_beauty str = convert(@string) str_arr = string_sort(str) count_arr = [] count = 1 j = 0 str_arr.each_index do |i| if str_arr[i] == str_arr[i+1] count+=1 else count_arr[j] = count j+=1 ...
true
0842ff62ace78f2a6604b741c21a16fcae93fa1c
Ruby
capricious-slingshot/square_array-v-000
/square_array.rb
UTF-8
118
3.515625
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def square_array(array) square_array = [] array.each do |num| square_array << num * num end square_array end
true
f06c0794196d9d424f245514fbb6b741a3daa126
Ruby
Epic91/mirror-backend
/app/controllers/api/v1/auth_controller.rb
UTF-8
1,148
2.515625
3
[]
no_license
class Api::V1::AuthController < ApplicationController def create user = User.find_by(username: params[:username]) if user && user.authenticate(params[:password]) render json: user # payload = {user_id: user.id } #create a token and hide the ussers id ...
true
984485a44a3d53191f9c7c5ebf8458a5023cd998
Ruby
DocPrior/oop_class_methods_and_class_variables
/exercise1.rb
UTF-8
907
3.6875
4
[]
no_license
class BankAccount @@interest_rate = 0.05 @@accounts = [] attr_accessor :balance def initialize @balance = 0 end def deposit(num) @balance += num end def withdraw(num) @balance -= num end def self.create BankAccount.new @@accounts end def self.total_funds @@account...
true
eb14c808c252e5ad18f7d643ccb04306c1ffa0b0
Ruby
sanmingzi/study_algorithm
/algorithm/binary_search/binary_search.rb
UTF-8
712
3.5625
4
[]
no_license
# find the first index which value is bigger than target def binary_search(begin_index: 0, end_index: nil, arr: [], target: 0) end_index ||= arr.length while begin_index < end_index mid_index = begin_index + (end_index - begin_index) / 2 if arr[mid_index] <= target begin_index = mid_index + 1 else...
true
77d0c681512c38345bace58cd110c14bb89e0516
Ruby
francescobbo/riak_odm
/lib/riak_odm/bucket.rb
UTF-8
2,508
2.703125
3
[ "MIT" ]
permissive
module RiakOdm class Bucket # Initializes a new bucket object. # # @param cluster [RiakOdm::Cluster] the cluster in which the bucket resides. # @param bucket_name [String] the name of the cluster def initialize(cluster, bucket_name) @cluster = cluster @name = bucket_name end #...
true
cf63f9039a94034f20299eb65fb3f0b4a66eef5b
Ruby
cscheye/poker
/lib/card.rb
UTF-8
316
3.09375
3
[]
no_license
require 'card_value' class Card include CardValue attr_reader :suit, :value def initialize(suit, value) @suit, @value = suit, value end def point_value value == :ace ? 13 : VALUES.index(value) end def suit_rank SUITS.index(suit) end def render "#{value} of #{suit}s" end end
true
605cc8427117b1a57815ede9d07e72d5707507fe
Ruby
bill-jia/utunes-api
/spec/controllers/albums_controller_spec.rb
UTF-8
5,004
2.578125
3
[]
no_license
require 'rails_helper' # This spec was generated by rspec-rails when you ran the scaffold generator. # It demonstrates how one might use RSpec to specify the controller code that # was generated by Rails when you ran the scaffold generator. # # It assumes that the implementation code is generated by the rails scaffold...
true
27f7c52727a3dc8ca707a56ff96e05cecbd0dd7b
Ruby
rafaelp/myfinance-prosoft-importer
/index.rb
UTF-8
4,518
2.75
3
[]
no_license
#!/usr/bin/env ruby require 'ap' require 'thor' require 'qif' require 'date' require 'rest_client' require 'pry' require 'xmlsimple' class MyfinanceImporter < Thor desc "import -f [FILE]", "Imports XML [FILE] to MyFinance" method_option :xml, :aliases => "-f", :desc => "Specify a filename of xml exported from Pro...
true
234a939679a28884c29b2248789a5ec7eff80987
Ruby
haml/haml
/lib/haml/ruby_expression.rb
UTF-8
610
2.75
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'ripper' module Haml class RubyExpression < Ripper class ParseError < StandardError; end def self.syntax_error?(code) self.new(code).parse false rescue ParseError true end def self.string_literal?(code) return false if syntax_error?(...
true
8b13b0e23447d15e37779af79fb2922f75f19406
Ruby
orohellec/drivy-challenge
/backend/level5/Service/calcul_service.rb
UTF-8
2,129
2.921875
3
[]
no_license
module CalculService def calcul_rental_time_pricing(days, price_per_day) total = 0 day = 1 while day <= days total += price_per_day if day == 1 total += price_per_day * 0.9 if (day > 1 && day <= 4) total += price_per_day * 0.7 if (day > 4 && day <= 10) total += price_per_day * 0.5...
true
5d7f577110a9f6223156d70f2e69c3eb451ec20c
Ruby
siman-man/Ruby
/ryudai_rb/ryudai_rb5/keyword.rb
UTF-8
275
3.390625
3
[]
no_license
def keyword(name: "siman" , say: "") p name p say puts "#{name} say #{say}" end def non_keyword(operation={}) p operation[:name] || "Simanman" p operation[:say] || "Hello world" end keyword(say: "Hello World!", name: "Tamayose") non_keyword(say: "Hello World!")
true
429de39c6d802b12f0f6c2d7826e70074b1b05e6
Ruby
Emmapr123/thermostat
/server/lib/Thermostat.rb
UTF-8
662
2.953125
3
[ "MIT" ]
permissive
class Thermostat def self.temperature @temperature ||= 20 end def self.set(temp) @temperature = temp end def self.city @city ||= 'London' end def self.set_city(city) @city = city end end # def down # if(this.temperature > 10) { this.temperature-- }; # end # powerSavi...
true
78a141e227b517b93b524a173cd5b3a40a2efc1c
Ruby
bethsebian/exercism
/ruby/raindrops/raindrops.rb
UTF-8
382
3.265625
3
[]
no_license
require 'pry' class Raindrops VERSION = 1 def self.convert(number) conversion = "" conversion << "Pling" if divisible_by(number, 3) conversion << "Plang" if divisible_by(number, 5) conversion << "Plong" if divisible_by(number, 7) conversion.empty? ? number.to_s : conversion end def self.d...
true
5396057e11f1ee19a4f512f97bd460792d2ae240
Ruby
Borrajo/DaVinci-Bestnid
/app/models/producto.rb
UTF-8
945
2.5625
3
[]
no_license
class Producto < ActiveRecord::Base scope :activos, -> { where("finalizado = false") } has_many :ofertas, dependent: :destroy has_many :preguntas, dependent: :destroy belongs_to :user validates :nombre,presence: true,length: {minimum: 4, maximum: 30}, uniqueness: true validates :descripcion, presen...
true
e6c630165fb76b2bf900bddf3653014c6337bc6d
Ruby
spcwhls/learn_to_program_redux
/old_school_roman.rb
UTF-8
997
4.28125
4
[]
no_license
# write a method that when passed an integer between 1 and 30000 returns a string containing the proper old-school roman numeral. # 9 = VIIII no prepend items # I = 1 # V = 5 # X = 10 # L = 50 # C = 100 # D = 500 # M = 1000 def old_school num numeral = '' numeral += 'M'*(num/1000) num = num % 1000 numer...
true
505d1f762944412b59add079cb161221748ff770
Ruby
karafto/hang-ai
/hangman.rb
UTF-8
2,541
3.28125
3
[]
no_license
require './board' require './solo_player' require './ai_player' require 'json' class Hangman MIN_WORD_LENGTH = 6 MAX_WORD_LENGTH = 12 SOLO = 'solo_game_data.json' AI = 'ai_game_data.json' def initialize puts "\n***** Welcome to HANGMAN! *****" dictionary = File.readlines('dictionary.txt...
true
e5e0c8d84efdcbec4cf183ab3a44fb58f16fd1f9
Ruby
clydeat/Morpion_mardi
/morpion1.rb
UTF-8
1,782
3.75
4
[]
no_license
require 'rubocop' require 'pry' require_relative 'boardcase' require_relative 'board' require_relative 'player' # Ajout d'un commentaire pour tester class Game def initialize #TO DO : créé 2 joueurs, créé un board puts"On va jouer au morpion!" puts "le premier qui a un alignement gagne" puts " " ...
true
e8c50e1dfbdf28a058ad4f7d70574cd46e847b96
Ruby
fupuchu/exercism-code-samples
/ruby/bracket-push/bracket_push.rb
UTF-8
403
3.15625
3
[ "MIT" ]
permissive
class Brackets BRACKETS = { '(' => ')', '[' => ']', '{' => '}' } def self.paired?(string) stack = [] string.chars.each do |char| if BRACKETS.keys.include?(char) stack.push(char) elsif BRACKETS.values.include?(char) return false unless BRACKETS[stack.pop] == char ...
true
593841ff51019df232096ccd2610514e4e630ae4
Ruby
Hidayat-rivai/ruby_integer
/to_integer.rb
UTF-8
140
3.171875
3
[]
no_license
s = "123" puts "nilai dari s adalah #{s} dengan kelas #{s.class()}" a = s.to_i() puts "nilai dari a adalah #{a} dengan kelas #{a.class()}"
true
224c2de26079b48d2e83078bcd462fc3a6746f76
Ruby
arman000/delorean_lang
/lib/delorean/engine.rb
UTF-8
12,419
2.765625
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'delorean/const' require 'delorean/base' require 'set' require 'pp' module Delorean class Engine attr_reader :last_node, :module_name, :line_no, :comp_set, :pm, :m, :imports, :sset def initialize(module_name, sset = nil) # name of current module ...
true
624303756c1aecdc87b5d9bb6d7bb434271f458f
Ruby
makhalif/Ruby
/method.rb
UTF-8
322
3.78125
4
[]
no_license
#!/usr/bin/ruby puts "Enter your First name: " fname = gets.chomp puts "Enter your Last name: " lname = gets.chomp def myName(fn, ln) puts "my name is #{fn} #{ln}" end myName(fname, lname) puts "characters of my first name is #{fname.length}" fulname = fname+lname puts "my full name has #{fulname.length} characters...
true
dc1a5c049cce18c0167f351d4818c23ceffecc08
Ruby
jobalcazar/phase-0-tracks
/ruby/shout.rb
UTF-8
617
4.15625
4
[]
no_license
#----Release 1---- # module Shout # def self.yell_angrily(words) # words + "!!!" + " :(" # end # def self.yelling_happily(words) # words + "!!!" + " :)" # end # end # require 'Shout' # Shout # Shout.class # Shout.yell_angrily("hello") # Shout.yelling_happily("hello") #---Release 3---- module Shout d...
true
e7c4caef34c075a662d0b571d904ff6f16fc56eb
Ruby
qatutor/winter_rails
/lesson5/conv.rb
UTF-8
590
4.1875
4
[]
no_license
puts "what is your currency? " puts "1. rub" puts "2. dol" var1 = gets.chomp.to_i def convert price = gets.chomp.to_f puts "how much you have? " num = gets.chomp.to_f res = num * price puts "result: " + res.to_s end if var1 == 1 #start convert to dol puts "what is cost for 1 dol now? " conv...
true
e2f4a88175e2b45f08bf78e1e463298f606bfced
Ruby
wtartanus/music-shop-stock-controller
/models/seeds.rb
UTF-8
2,758
2.5625
3
[]
no_license
require( 'pry-byebug' ) require_relative( 'artist.rb' ) require_relative( 'album.rb' ) require_relative( 'discography.rb' ) require_relative( 'shop.rb' ) require_relative( '../db/sql_runner.rb') Discography.delete_all() Album.delete_all() Artist.delete_all() artist1 = Artist.new( {'name' => 'rihanna'} ) artist2 = Ar...
true
a0e61e5420d3143746d38b766c832ab775ac5ea5
Ruby
BobDeng1974/deep-learning-from-scratch-2
/ruby/lib/simple_cbow.rb
UTF-8
1,342
2.984375
3
[]
no_license
require "numo/narray" require "mat_mul" require "softmax_with_loss" require "embedding" class SimpleCBow attr_reader :params, :grads, :word_vecs def initialize(vocab_size, hidden_size) v, h = vocab_size, hidden_size # 重みの初期化 w_in = 0.01 * Numo::DFloat.new(v, h).rand w_out = 0.01 * Numo::DFloat.ne...
true
953936713000d64e4d499a39c40009836b2dfd9c
Ruby
zahrank21/module-one-final-project-guidelines-web-012918
/app/models/job.rb
UTF-8
701
2.546875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Job < ActiveRecord::Base belongs_to :company belongs_to :location def self.insert_table Adapter.api_call.each do |job_hash| Job.create(name: job_hash["title"], company_id: Company.get_company_id(job_hash["company"]), location_id: Location.get_location_id(job_hash["location"]), description: job_ha...
true
1ed7f0921cda2ee87a3a4afb9c373cfd393256b4
Ruby
MJ-sfo/phase-0-tracks
/ruby/vampires.rb
UTF-8
2,282
3.671875
4
[]
no_license
puts "how many employees will be processed today?" proces=gets.chomp proces=proces.to_i while proces>=1 # survey start process puts "What is your name?" newemp=gets.chomp puts "How old are you?" age = gets.chomp age=age.to_i puts "What year were you born? " yearB =gets.chomp yearB = ...
true
2f036b0609b02244035f417b7b051cf5df0e4521
Ruby
jamesjefferies/energy-sparks_analytics
/lib/dashboard/simulator/heating_regression_models_deprecated.rb
UTF-8
18,839
2.9375
3
[ "MIT" ]
permissive
# older heating regression models temperarily deprecated module AnalyseHeatingAndHotWater class HeatingModel # deprecated methods class RegressionModel < RegressionModelTemperature attr_reader :base_temperature def initialize(key, long_name, a, b, r2, base_temp, samples, x, y) super(key, lon...
true
cbffd49a13827788595b88f1f6bf828554ec5605
Ruby
robinclart/rlisp
/lib/rlisp/native.rb
UTF-8
2,327
2.921875
3
[ "MIT" ]
permissive
module Rlisp class Native class << self def native(name) @native = name.to_sym end def natives @natives ||= {} end def method_added(name) @natives ||= {} @natives[@native] = name.to_sym @native = nil super end end def ...
true
546f97f205e32f42c477b708a7201d62809448a2
Ruby
josephan/exercism_ruby
/grade-school/grade_school.rb
UTF-8
451
2.875
3
[]
no_license
class School def initialize @students = {} end def students(grade) @students[grade.to_s] ||= [] end def add(name, grade) students(grade) << name @students[grade.to_s].sort! end def students_by_grade everyone = [] @students.each do |grade, students| everyone << { grade: gra...
true
69f1cd15a25fc7b44f520bd3c5089c25816c6879
Ruby
pulibrary/dspace-cli
/library/list.rb
UTF-8
1,173
2.921875
3
[]
no_license
#!/usr/bin/env jruby require 'dspace' # Neatly list all items in a community DSpace.load # postgres # fromString = "COMMUNITY.145" # QUESTION: This hard-coded handle is not found elsewhere. Any thoughts of where # it's from? com = DSpace.fromString('88435/dsp01g732d9019') def tsv_title puts %i[acaesioned depos...
true
1e40b92cea1dd25a5499e86efa1c595789965e86
Ruby
japiber/tzispa_rig
/lib/tzispa/rig/tokens/statement.rb
UTF-8
2,565
2.546875
3
[]
no_license
# frozen_string_literal: true require 'forwardable' module Tzispa module Rig module Tokens class Loop < Rig::Token extend Forwardable attr_reader :id, :body_parser def_delegators :@body_parser, :attribute_tags, :loop_token def initialize(parser, match) super(pa...
true
791f5871661a21513d583cdf692b7702dd3c4ad7
Ruby
adamgibbons/project-euler
/007/solution.rb
UTF-8
709
4.125
4
[]
no_license
# Problem 7 # # 10001st prime # # By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. # What is the 10 001st prime number? # ######################################## def isPrime(num) (2..num/2).each do |n| return false if num % n == 0 end true end def getNthP...
true