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
d9a8bab35daeddb83860538b9a706202efd0ce39
Ruby
BoyCook/TFSClient
/tfs
UTF-8
12,064
2.6875
3
[]
no_license
#!/usr/bin/env ruby # == Synopsis # This will recursivly loop through a directory and it's subdirectories, # scanning file headers to see if they are tfa managed # # == Examples # Search for available files: # tfs search org.cccs.jslibs jsMap 1.0 # File Export: # tfs export org.cccs.jslibs jsMap 1.0 #...
true
0718848b29a8e15b6dd37c49aaab2b6c6e7df7dc
Ruby
alde/sapphire
/app/models/item.rb
UTF-8
640
2.546875
3
[]
no_license
class Item < ActiveRecord::Base def tooltip difficulty if difficulty == :heroic WowheadParser.new.parse(self[:wowid_heroic]) else WowheadParser.new.parse(self[:wowid_normal]) end end def price difficulty return self[:price_normal] if difficulty == :normal self[:price_heroic] en...
true
59a56c3bbd9eb757192501ab4e0340f68d388236
Ruby
iain/autotest
/test/test_autotest_integration.rb
UTF-8
2,434
2.546875
3
[ "MIT" ]
permissive
require 'test/helper' require 'autotest' require 'shoulda' class TestAutotestIntegration < Test::Unit::TestCase def temp_dir "#{File.dirname(__FILE__)}/tmp" end def autotest_executable '../../bin/autotest' end def run_autotest(flag_string='') `cd #{temp_dir} && #{autotest_executable} #{flag_s...
true
a814ed91b88d22dfa145ea8840d721d01f483f4b
Ruby
marita30/laboratorio-practica
/lib/hola.rb
UTF-8
108
3.0625
3
[]
no_license
#El valor determinado es "mundo" #autor: Maria Jose(marita.jose.ch@gmail.com) name = ARGV.first || "World" puts "Hello, #{name}!"
true
1137296a9f9d524432739cdb88c2625f942bf73e
Ruby
munetoh/railroadmap
/lib/railroadmap/rails/abstraction/block.rb
UTF-8
8,222
2.65625
3
[ "MIT" ]
permissive
# -*- coding: UTF-8 -*- require 'sorcerer' module Abstraction ############################################################################# # Hold a block structure (tree) in the state # e.g. # cond exit ID # ---------------------------------------------------...
true
a5ec84931d949618609223d7cd380f7c326c3301
Ruby
tabascopepper/BankAccountRegister
/app/models/account.rb
UTF-8
757
2.8125
3
[]
no_license
# frozen_string_literal: true class Account < ApplicationRecord belongs_to :user has_many :transactions before_validation :set_amount validates :currency, presence: true validates :amount, numericality: { greater_than_or_equal_to: 0 } validate :currency_uniqueness, on: :create def deposit(amount) ...
true
e4e136e42cc3a837b81c7d825858b5da1e9a994a
Ruby
nzifnab/budget
/spec/models/quick_funds_unit_spec.rb
UTF-8
1,668
2.5625
3
[]
no_license
require 'rails_helper' RSpec.describe QuickFund do describe "#before_validation" do let(:account){Account.new(amount: 100, id: 200)} describe "the new account history object" do let(:quick_fund) do fund = account.quick_funds.build( account: account, fund_type: "Deposit", ...
true
41dd338bf8ae903c23c98cb55c3341d3073f846c
Ruby
jselbo/Skunk
/server/controllers/session_handshakes.rb
UTF-8
5,908
2.671875
3
[]
no_license
# IMPORTANT NOTE ABOUT SESSION REQUESTS: # # All requests for sessions require an HTTP header formatted as: # # Skunk-UserID: <user_id> # # Requests which do not provide this header will be automatically be rejected # with a response code of 401 Not Authorized. # POST /sessions/:id/terminate/request # { # "recei...
true
e14491cea9c444962500133114150cb127f6447e
Ruby
hohy/MI-RUB
/RUB_du3_Pentomino/test/test_box.rb
UTF-8
4,817
3.28125
3
[]
no_license
require 'test/unit' require_relative '../lib/pentomino/box' require_relative '../lib/pentomino/piece' class TestBox < Test::Unit::TestCase def test_access_space instance = Pentomino::Box.new(3, 5) result = instance[1,4] expected = 0 assert_equal(expected, result) end def test_write_space ...
true
211d42829c6f91788444958bdbff470df99050fa
Ruby
justinphelps/twitter-sentiment
/sentiment.rb
UTF-8
1,916
3.515625
4
[]
no_license
require 'net/http' require 'json' class Sentimentalizer def self.sentimentalize(tweet_object) uri = URI.parse("http://sentiment.vivekn.com/api/text/") # remove quotes that would blow up text string API puts tweet_object.content normalized_tweet = tweet_object.content.gsub("\"","") result = Net::...
true
b11bcf7a0146c96e3208cbd90fe164f39d60aec3
Ruby
greis/selenium-rack-driver
/lib/selenium-rack-driver/elements/anchor_element.rb
UTF-8
405
2.53125
3
[]
no_license
module SeleniumRackDriver class AnchorElement < Element def click href = self[:href] browser.process(method, href) end def valid_for_click? self[:href] && !self[:href].start_with?('#') end private def method if browser.respect_data_method? && self['data-method'] ...
true
093376f14cb6a973905368f6aa6acf76b9ab363f
Ruby
HemangPatel1/week4_test
/part2/spec/takeaway_spec.rb
UTF-8
765
2.84375
3
[]
no_license
require 'takeaway' describe Takeaway do let(:takeaway) { Takeaway.new } it 'should calculate the total price of Slaw and Chips as being 6' do order_from_person = { "Slaw" => 3, "Chips" => 3 } expect(takeaway.calculated_total_price_of(order_from_person)).to eq 6 end it 'should raise an error' do ex...
true
16f38178c9c021cdeef0ae9fbc66c9ccb685ebe0
Ruby
jackiefletcher/hair_salon
/lib/customer.rb
UTF-8
1,561
2.984375
3
[ "MIT" ]
permissive
class Customer attr_reader(:name, :phone, :stylist_id, :id) define_method(:initialize) do |attributes| @name = attributes.fetch(:name) @phone = attributes.fetch(:phone) @stylist_id = attributes.fetch(:stylist_id) @id = attributes.fetch(:id) end define_singleton_method(:all) do returned_cus...
true
9da9d319e8ee5e613f5f34be6aaeaf0663dac673
Ruby
ileitch/disruptor
/lib/disruptor/queue.rb
UTF-8
629
3.046875
3
[]
no_license
module Disruptor # # A simple n-reader, n-writer queue. # class Queue def initialize(size, wait_strategy) @buffer = RingBuffer.new(size, wait_strategy) @sequence = Sequence.new @barrier = ProcessorBarrier.new(@buffer, wait_strategy) end def push(obj) seq = @buffer.claim ...
true
33d7b2cefc73573173acd075834a36f61d6308e4
Ruby
kiritan-pop/mastodon_others
/numbers-game/timer.rb
UTF-8
16,828
2.546875
3
[]
no_license
# coding: utf-8 require 'mastodon' require 'nokogiri' require 'json' require 'highline/import' require 'oauth2' require 'dotenv' require 'pp' require 'clockwork' require 'fileutils' include Clockwork # --- config Dotenv.load TL='user' MASTODON_URL = ENV["MASTODON_URL"] INSTANCE= MASTODON_URL[8..MASTODON_URL.length-1]...
true
66ebb796508e78455b2b6669b10acaa7b4748a50
Ruby
warmer/fungames
/pushfour-website/regress/url_replace.rb
UTF-8
959
2.53125
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require_relative '../lib/common.rb' include Pushfour::Website::Common urls = { a: '/a', b: '/b/:id', c: '/c/:id/:name', } tcs = [ {page: :a, opts: nil}, {page: :a, opts: {id: 1}}, {page: :a, opts: {id: '1'}}, {page: :b, opts: nil}, {page: :b, opts: {id: 1}}, {page: :b, opts: {i...
true
df1b7c9aadb134cc617738f7d47582d275208e10
Ruby
matteofoccoli/katas
/2/sorting.rb
UTF-8
1,316
3.640625
4
[]
no_license
require 'test/unit' module Sorting def self.insertion_sort(array) return array if array.empty? (1..array.length - 1).each {|i| current = array[i] j = i - 1 while j >= 0 && array[j] > current array[j + 1] = array[j] j = j - 1 end array[j + 1] = current } re...
true
a533d33a6d2ff31f03fb30c36805a1b5134e8c66
Ruby
mrphishxxx/RecessApp
/lib/admin_controller_methods.rb
UTF-8
2,276
2.546875
3
[ "MIT" ]
permissive
# This module, included by all controllers in the admin namespace, # overrides AuthenticatedSystem methods to use browser-based # authentication rather using a login form. module AdminControllerMethods def self.included(base) base.send :prepend_before_filter, :check_admin_subdomain unless RAILS_ENV == 'test' ...
true
5baaef2a22e83fcb2283bad1f47929244f966d06
Ruby
joelchelliah/scrabble_dojo
/ordliste/word_prob.rb
UTF-8
1,641
3.96875
4
[]
no_license
#!/usr/bin/ruby # Calcualtes the probability of drawing a given word from a full bag of tiles def word_prob(word) letters = word.split(//) count = letters.count n = numerator(letters) count.times do |i| subbed_once = sub_nth_letter_with_blank(letters, i) (i...count).each do |j| subbed_once_or_t...
true
afc15de3b822eefd1c45a654833fbd7ddbb45c25
Ruby
makotz/CodeCore-Exercises
/2week/24MayDay7/codewars.rb
UTF-8
532
3.5625
4
[]
no_license
def get_count(*words) hash = Hash.new hash["vowels"] = 0 hash["consonants"] = 0 words.each do |e| if e == nil || e == "" || e.class == Array || e.class == Hash hash else split_words = e.downcase.delete(' ').split('') split_words.each do |elm| if elm == "a" || elm == "e" || elm == "...
true
e42c10872a9bcd78abe6ff140c88fdd00a243e8c
Ruby
Linrin-Square/Ruby-practice
/class.rb
UTF-8
422
3.515625
4
[]
no_license
class People def self.PeopleMethod p "私はPeopleクラスです" end def initialize p "Peopelのインスタンスが作られました" end attr_accessor :name end class ChildPeople < People def self.Childmethod p "私は目からビームが出せます" end end People.PeopleMethod people = People.new people.name = "名前だよ" p people.nam...
true
ddec02c0f220e576e029c4b09536f33cbc391787
Ruby
yammik/count-elements-nyc-web-082718
/count_elements.rb
UTF-8
191
3.390625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def count_elements(array) result = {} array.each do |element| if result.keys.include? element result[element] += 1 else result[element] = 1 end end result end
true
67b62e6375d8c71228a2c7d20b7d48a9021e28ee
Ruby
MidnightBlue/spreeeed_engine
/lib/spreeeed_engine/acts_as_option_tree.rb
UTF-8
2,761
2.71875
3
[ "MIT" ]
permissive
module ActsAsOptionTree def self.included(base) base.extend(ClassMethods) end module ClassMethods def option_tree_key "option_tree/#{self.to_s}" end def to_option_tree(force_update=false) if force_update or !(option_tree = Rails.cache.read(option_tree_key)) Rails.logger.debu...
true
01ea155f3534568219f60870fdbd20dea94aa5a3
Ruby
jhulford/rex12
/spec/rex12/parse_error_spec.rb
UTF-8
635
2.625
3
[ "MIT" ]
permissive
describe REX12::ParseError do it "should extend StandardError" do expect(described_class.new("my message").is_a?(StandardError)).to be_truthy end it "should take a segment & element" do seg = double('segment') el = double('el') e = described_class.new("message",seg,el) expect(e.segment).to eq ...
true
4a35516c794dcd6b882e7cb28f4ffb6771004ea5
Ruby
trekdemo/rovers_on_mars
/lib/mission_file_reader.rb
UTF-8
537
3.203125
3
[]
no_license
require 'position' class MissionFileReader attr_reader :path def initialize(path) @path = path end def rover_data line_seq.drop(1).each_slice(2).map do |(position, instructions)| x, y, orientation = position.split(' ') [Position(x.to_i, y.to_i, orientation), instructions] end end ...
true
709b78cfe328ae249a36f282928e62f0bf2b831e
Ruby
yuma-2000/HTML
/var.rb
UTF-8
53
2.75
3
[]
no_license
hello = "Hello, Ruby!" num = 42 puts hello puts num
true
597cb4736ae565bd381e8e28cbf139c651e0db74
Ruby
tilia/tilia-vobject
/lib/tilia/v_object/recur/r_rule_iterator.rb
UTF-8
19,540
3.25
3
[ "BSD-3-Clause" ]
permissive
module Tilia module VObject module Recur # RRuleParser. # # This class receives an RRULE string, and allows you to iterate to get a list # of dates in that recurrence. # # For instance, passing: FREQ=DAILY;LIMIT=5 will cause the iterator to contain # 5 items, one for each...
true
7a7a002d7086c3cc87e39fe4fdbbc436af93018d
Ruby
mileshobby/algorithms
/algorithms/strings/overlapping_strings.rb
UTF-8
481
3.703125
4
[]
no_license
def concat(str1, str2) str_builder = [] len_diff = str1.length - str2.length first = 0 last = str2.length - 1 if len_diff > 0 first = len_diff elsif len_diff < 0 last += len_diff end while first <= last same = true (last - first).times do if str1[first...-1] == str2[0...last] ...
true
bcc52485667aa8b3259e4c1dcb333efb9a15d9fa
Ruby
vgdcarvalho/qa_full_stack
/basico/loops.rb
UTF-8
392
3.53125
4
[]
no_license
5.times do |i| puts 'mensagem de times ' + i.to_s + ' vez(es)' end puts '' init = 0 while init <= 10 do puts 'mensagem do while ' + init.to_s + ' vez(es)' init += 1 end puts '' for item in (0...10) puts 'mensagem do for ' + item.to_s + ' vez(es)' end puts '' testArray = ['arrayItem1', 'arrayItem2', '...
true
12f4c528153a7b8a983a6ac38c3ebd4aab5c67fa
Ruby
trptom/FootballManager_Rails2
/app/helpers/permissions_helper.rb
UTF-8
3,874
2.65625
3
[]
no_license
# Helper used globally for working with permissions and their checking. Should # be included in ApplicationController. module PermissionsHelper # Filter used in ApplicationController. It must be defined because in # ApplicationController i don't have access to +current_user+ during # initialization. def prem...
true
a9929dbfbe40ed1493c269e324e9120208864541
Ruby
vnegrisolo/guide-algorithms
/palindrome.rb
UTF-8
396
3.78125
4
[ "MIT" ]
permissive
# frozen_string_literal: true # Algorith to palindroma class Palindrome def palindrome?(text) text = let_alpha_numeric(text) return true if text.size < 2 i = 0 j = text.size - 1 while i < j return false if text[i] != text[j] i += 1 j -= 1 end true end private de...
true
437b3b7f626e7f4ad42560b87299bf4b78c2e1fd
Ruby
Jun1106/project-euler
/euler004.rb
UTF-8
422
2.984375
3
[]
no_license
#! ruby -E Windows-31J:utf-8 def Sahrzad‎?(num) n = num.to_s for i in (0..(n.length / 2).to_i - 1) do return false if n[i] != n[n.length - i - 1] end true end def euler004 n = 0 i = 100 while i < 1000 j = i while j < 1000 v = i * j j += 1 next unless Sahrzad‎?(v) ne...
true
3eebb059e4bbf78fcdcd985da0ffdbb16fb7e535
Ruby
funeace/Ruby_become_a_professional
/spec/convert_length_spec.rb
UTF-8
549
2.6875
3
[]
no_license
require './lib/convert_length' describe "長さの単位変換プログラムのテスト" do context "メートル変換" do it "第1引数がインチ" do expect(convert_length(15,from: :in,to: :m)).to eq 0.38 end it "第1引数がフィート" do expect(convert_length(35000,from: :ft,to: :m)).to eq 10670.73 end end context "フィート変換" do end context "...
true
618f098a92b62ff2ecd5f978de6fac76b6823003
Ruby
Uvacoder/baseball-public
/bbref/scrapers/draft_picks.rb
UTF-8
2,950
2.515625
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby # coding: utf-8 bad = " " require "csv" require "mechanize" agent = Mechanize.new{ |agent| agent.history.max_size=0 } agent.user_agent = 'Mozilla/5.0' base = "http://www.baseball-reference.com/draft/?draft_type=junreg&query_type=overall_pick" table_xpath = '//table[@id="draft_stats"]/tbody/tr' #...
true
9d8b28d20a1d06d29665665386c022e65584b0b1
Ruby
miguelitomola/my_blog
/db/seeds.rb
UTF-8
1,361
2.671875
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
f7a0c476207446979c2a31f9db6748498df30553
Ruby
osirislab/CSAW-CTF-2013-Quals
/Reversing/keygenme/server/server.rb
UTF-8
1,348
2.625
3
[]
no_license
require 'socket' require 'timeout' require 'securerandom' ''' keygenme server for CSAW CTF 2013 Jeffrey Crowell Users must get 10 correct serials within 5 seconds each ''' server = TCPServer.open(80085) # Socket to listen on port 2000 loop { # Servers run forever Thread.start(server....
true
0ea6ef77831b60fd69f7b832906f1ac6a61d1819
Ruby
nmhalloran/sql-library-lab-v-000
/lib/querying.rb
UTF-8
1,192
2.53125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def select_books_titles_and_years_in_first_series_order_by_year "SELECT title, year FROM books WHERE series_id = 1;" end def select_name_and_motto_of_char_with_longest_motto "SELECT name, motto FROM characters ORDER BY motto ASC LIMIT 1;" end def select_value_and_count_of_most_prolific_species "SELECT specie...
true
95b5121767fd3a1940d07c8e0ab8441580a40052
Ruby
PeterViss/keys-of-hash-dc-web-career-040119
/lib/keys_of_hash.rb
UTF-8
250
3.359375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Hash def keys_of(*arguments) array = [] arguments.each do |animals| self.each do |animal, country| if country == animals array << animal end end end return array end end
true
72ec7e54667ea4d6df34ed72d158d0507067d150
Ruby
jmf4nier/oo-relationships-practice-houston-web-051319
/app/models/AirBnB.rb
UTF-8
2,168
3.484375
3
[]
no_license
class Guest def self.all @@all end attr_reader :name @@all = [] def initialize(name) @name = name @@all << self end def listings trip_array = Trip.all.select {|obj| obj.guest == self} trip_array.map {|trip_obj| trip_obj.listing} end def trips trip_array = Trip.all.select {|obj|...
true
a60ce79de04cdc6bb7014c13de1f6181e6280294
Ruby
anclist/problem_solving_01_reinforcement
/exercise1.rb
UTF-8
1,595
3.09375
3
[]
no_license
trains = [ {train: "72C", frequency_in_minutes: 15, direction: "north"}, {train: "72D", frequency_in_minutes: 15, direction: "south"}, {train: "610", frequency_in_minutes: 5, direction: "north"}, {train: "611", frequency_in_minutes: 5, direction: "south"}, {train: "80A", frequency_in_minutes: 30, direction: "east"}, {t...
true
ad047594a8ee7b87bcd7e716c309c34b33708841
Ruby
dallaswmorgan/chess
/chess/board.rb
UTF-8
3,745
3.546875
4
[]
no_license
require 'byebug' require_relative 'piece.rb' require_relative 'nullpiece.rb' require_relative 'queen.rb' require_relative 'bishop.rb' require_relative 'rook.rb' require_relative 'pawn.rb' require_relative 'king.rb' require_relative 'knight.rb' require_relative 'slidingpiece.rb' require_relative 'steppingpiece.rb' clas...
true
19bde4ee4b9e094fe279900959a055ddeaed1d72
Ruby
lsrck/Tic-Tac-Toe
/boardcase.rb
UTF-8
143
3.15625
3
[]
no_license
class BoardCase attr_accessor :value #The BoardCase can be empty or take either (X or O) def initialize(value) @value = value end end
true
0d6b130666eceba3d4222bbe3aa661db3c42e4b5
Ruby
skanev/split
/lib/split/store.rb
UTF-8
1,072
2.609375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module Split module Store class Session def initialize(context) @session = context.send :session end def get(key) session_hash[key] end def choose(key, value) session_hash[key] = value end def delete(key) session_hash.delete key en...
true
b62ee6eb09c1c2fe869d23d52e8ddd97d7000a8e
Ruby
thebravoman/software_engineering_2015
/VhodnoNivo/Ivaylo_Arnaudov/Ivaylo_Arnaudov_12.rb
UTF-8
634
3.828125
4
[]
no_license
def count_full_tiles(x, y, w, h) big_tile_area = x * y small_tile_area = w * h big_tile_area / small_tile_area end x = ARGV[0].to_i y = ARGV[1].to_i w = ARGV[2].to_i h = ARGV[3].to_i if x > 0 && y > 0 && w > 0 && h > 0 puts count_full_tiles(x, y, w, h) width_cutting_coords = Array.new current_width = w ...
true
a6ccf29ecae0c93794e19d8069767a524facebbe
Ruby
sal-ortiz/life_dot_rb
/spec/life_field_helper_spec.rb
UTF-8
4,239
2.953125
3
[]
no_license
require File.join( File.dirname( __FILE__ ), '.', 'lib', 'spec_helper.rb' ) # our spec helper. require File.join( File.dirname( __FILE__ ), '..', 'lib', 'life_field_helper.rb' ) # our source code to be tested. describe "the LifeFieldHelper module" do describe "the LifeFieldHelper::coord_to_index method"...
true
1aa6ccf22bf545c354f6e862d866f387bceb69a8
Ruby
kylejschulz/sweater_weather
/app/poros/daily_weather.rb
UTF-8
527
3.03125
3
[]
no_license
class DailyWeather attr_reader :datetime, :sunrise, :sunset, :max_temp, :min_temp, :conditions, :icon def initialize(data) @datetime = Time.at(data[:dt]).to_s(:db) @sunrise = Time.at(data[:sunrise]).to_s(:time) @sunset =...
true
aae0229faf6afe99f44534ae12ee9f4b92028fbb
Ruby
pbomba/Dungeon_Time
/lib/models/battle.rb
UTF-8
13,656
3.265625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Battle def self.attack_damage(attacker) min_dam = Weapon.find_by(name:attacker.main_hand).min_damage max_dam = Weapon.find_by(name:attacker.main_hand).max_damage damage = rand(min_dam..max_dam) + Monster.attribute_bonus(attacker.strength) damage end def self.combat(attacker, defender) attacke...
true
277e85ad54120a98ad0f81531167c6378f21604f
Ruby
synion/Codeval
/ruby.rb
UTF-8
371
3.484375
3
[]
no_license
require 'pry' def pascal(k,line = [],pasc = [1]) if k == 1 print 1 else (k - 1).times do |i| line.unshift 1 line.push 1 pasc[i + 1] = line line = [] 0.upto pasc[i + 1].length - 2 do |j| line << pasc[i + 1][j] + pasc[i + 1][j + 1] end end p...
true
f80b8f9635eb938463ed455fd199d1a205519fb5
Ruby
DaisukeShinoku/paiza_b_up
/01-5.rb
UTF-8
239
3.421875
3
[]
no_license
# 指定した配列(リスト)を定義し、それらの要素のうち5以上の数を全て足して結果を出力してください。 array = [4, 0, 5, -1, 3, 10, 6, -8] array2 = array.select{|a| a >= 5} puts array2.inject(:+)
true
ae71f5db4aa9ef833abbaff7b513e46ee017ff42
Ruby
jtibbertsma/basic-ext-9001
/spec/functionality_spec.rb
UTF-8
929
2.71875
3
[]
no_license
require 'basic-ext-9001' RSpec.describe BasicExt9001::Guts do before :each do @guts = BasicExt9001::Guts.new end let(:err) { BasicExt9001::GutsError } describe '#push' do it 'should throw an error when full' do @guts.push(nil) until @guts.full? expect { @guts.push nil }.to raise_error(err)...
true
dba842f310e107c3a44cf5fb6f5f763c0c61e466
Ruby
vishnu403/ruby-learning
/mars-rover-problem/rover.rb
UTF-8
842
3.8125
4
[]
no_license
require_relative "coordinate.rb" require_relative "next_state.rb" class Rover attr_accessor :coordinate, :direction, :plateau def initialize(coordinate, direction, plateau) @coordinate = coordinate @direction = direction @plateau = plateau end def track(path) i = 0 n...
true
ecd6b593a922db4a6207e773927496a42f98f46c
Ruby
mkarganov/aqualuks_old
/app/helpers/products_helper.rb
UTF-8
277
2.671875
3
[]
no_license
module ProductsHelper def total_price(products) products.map(&:price).inject {|price, total| total + price } end def price_with_currency(price) if price == 0 "уточняйте" else "#{price} " << t('shared.product.currency') end end end
true
74b037e7b3bfdd853cdf2a8dba6f5f51783419d8
Ruby
Codewick/discrete_math
/lib/modules/topics/demos/algorithm_demo.rb
UTF-8
2,826
3.4375
3
[]
no_license
require 'algorithms' require 'faker' require 'benchmark' require_relative './lib/movie.rb' require_relative '../../../../lib/utils/processing_spinner' module AlgorithmDemo module Helpers def self.generate_movies_list_of_size(size) movies = [] size.times do movies << Movie.new(Faker::Name.last...
true
7662466082746b6064dcdda328414a881c11955f
Ruby
margaretbrickel/binary_tree
/lib/node.rb
UTF-8
852
3.65625
4
[]
no_license
require 'empty_node' module BinaryTree class Node attr_reader :value attr_accessor :left, :right def initialize(value) @value = value @left = EmptyNode.new @right = EmptyNode.new end def insert(value) case @value <=> value when 1 then insert_left(value) when...
true
e23a84ea5a72471af4d7c6912278903940ed1c24
Ruby
kimdhendrick/certotrack
/app/models/inspection_type.rb
UTF-8
239
2.65625
3
[]
no_license
class InspectionType < ActiveHash::Base self.data = [ {id: 1, text: 'Inspectable'}, {id: 2, text: 'Non-Inspectable'} ] alias :to_s :text INSPECTABLE = InspectionType.find(1) NON_INSPECTABLE = InspectionType.find(2) end
true
1180c955051654bc645ae4fee53034db89e28dc1
Ruby
dgokman/advent_of_code_2020
/aoc_2020_14.rb
UTF-8
1,470
2.734375
3
[]
no_license
A = File.read("aoc_2020_14.txt") # 1 rules = A.split("\n") mask, addr, val = nil bits = [] rules.each do |a| if a.include?("mask") mask = a.split(" = ").last end if a.include?("mem") vals = a.split(" = ") addr = vals[0][4..-2].to_i value = vals[1].to_i.to_s(2) len = value.length value = ...
true
1e9c9b39ef38d8cbf614a5228d0c8896a53d6d95
Ruby
ugaliguy/phase-0
/week-6/credit-card/my_solution.rb
UTF-8
4,126
4.03125
4
[ "MIT" ]
permissive
# Class Warfare, Validate a Credit Card Number # I worked on this challenge with Becky Lehmann. # I spent [#] hours on this challenge. # Pseudocode # Input: A 16-digit number # Output: True (if valid) or False (if invalid) # Steps: =begin Step 1- Read card_number IF card_number has 16 digits crea...
true
89a95cc8af5d56533a58471e72702fefeece911e
Ruby
xunker/modular_keyboard
/lib/assemblies/modular_keyboard_assembly.rb
UTF-8
1,254
2.84375
3
[]
no_license
class Modular_keyboardAssembly < CrystalScad::Assembly PART_SPACING = 5 # Assemblies are used to show how different parts interact on your design. # Skip generation of the 'output' method for this assembly. # (will still generate 'show') skip :output def part(show) # # Create a test cube # cube = TestCube.n...
true
c05c209177593fceab1f9c4db345e69ae49545f6
Ruby
Nursultan91/checkout
/spec/lib/mass_group_discount_spec.rb
UTF-8
1,522
2.671875
3
[]
no_license
require 'mass_group_discount' require 'product' require 'purchase' describe MassGroupDiscount do describe '#apply' do let(:discount) do described_class.new( target_short_name: target_short_name, amount_threshold: amount_threshold, discount: discount_amount ) end ...
true
9000b3002ce9bdeaf599c339457062f2121f4f5a
Ruby
perseids-project/llt-form_builder
/lib/llt/form_builder.rb
UTF-8
11,189
2.65625
3
[ "MIT" ]
permissive
require 'set' require 'llt/helpers' require 'llt/constants' require 'llt/core_extensions/array' require 'llt/form' require 'llt/form_builder/version' require 'llt/form_builder/helpers/adjective_like_building' require 'llt/form_builder/helpers/pronoun_segments' require 'llt/form_builder/helpers/stem_hash_parser' requi...
true
c20ea8623fc88299a56bbbded99a7bacd7c3d671
Ruby
sophsong/intro-to-tdd-rspec-and-learn-nyc-web-051319
/spec/current_age_for_birth_year_spec.rb
UTF-8
329
3.234375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require_relative '../current_age_for_birth_year.rb' def current_age_for_birth_year (birth_year)2003- birth_year end describe "current_age_for_birth_yearmethod" do it "returns the age of a person based on the year of birth" do age_of_person = current_age_for_birth_year(1984) expect(age_of_person).to eq(19) ...
true
5b8fc1f00c4221144b4073c9e7455e32f516541d
Ruby
hellojustin/rocco
/lib/rocco/tasks.rb
UTF-8
4,386
3.078125
3
[ "MIT" ]
permissive
#### Rocco Rake Tasks # # To use the Rocco Rake tasks, require `rocco/tasks` in your `Rakefile` # and define a Rake task with `rocco_task`. In its simplest form, `rocco_task` # takes the path to a destination directory where HTML docs should be built: # # require 'rocco/tasks' # # desc "Build Rocco Docs" # ...
true
56d8add885ac35d5ddd1ec18183a97410b979353
Ruby
yoolk/yoolk_liquid
/spec/support/custom_matchers/alias_from_matcher.rb
UTF-8
891
2.71875
3
[ "MIT" ]
permissive
# RSpec matcher for alias_method. # https://gist.github.com/1950961 # Usage: # # describe User do # it { should alias_from(:username).to(:email) } # end RSpec::Matchers.define :alias_from do |alias_method| match do |subject| begin subject.send(alias_method) rescue NoMethodError rai...
true
c95db78c22f3c6974ea94893e3170b452ed0e858
Ruby
learnor/aA-algo
/algo_project_7/lib/dynamic_programming.rb
UTF-8
1,166
3.484375
3
[]
no_license
require 'byebug' class DynamicProgramming def initialize @blair_cache = { 1 => 1, 2 => 2 } end def blair_nums(n) @blair_cache[n] ||= blair_nums(n - 1) + blair_nums(n - 2) + ((n - 1) * 2 - 1) end def blair_nums_bottom_up(n) b_nums = { 1 => 1, 2 => 2 } 3.upto(n) { |i| b_nums[i] = b_nums[i - 1...
true
e19fc3c90eb8fa7f780d948be514796730dfb7f0
Ruby
fanjieqi/LeetCodeRuby
/1401-1500/1413. Minimum Value to Get Positive Step by Step Sum.rb
UTF-8
174
3.28125
3
[ "MIT" ]
permissive
# @param {Integer[]} nums # @return {Integer} def min_start_value(nums) min, sum = 0, 0 nums.each do |num| sum += num min = sum if sum < min end -min + 1 end
true
086fedf323436eb21f8d0e623e5d564173a2a00c
Ruby
JonClayton/phase-0
/week-5/nums-commas/my_solution.rb
UTF-8
4,204
4.71875
5
[ "MIT" ]
permissive
# Numbers to Commas Solo Challenge =begin # I spent 2 hours on this challenge. # Complete each step below according to the challenge directions and # include it in this file. Also make sure everything that isn't code # is commented in the file. # 0. Pseudocode # What is the input? A positive integer # What is the o...
true
e0a0c68b2866b0bd708408ba39c06cd3c63ffd2d
Ruby
jeanlazarou/jruby_curses
/lib/jruby_curses/screen_buffer.rb
UTF-8
971
2.84375
3
[ "MIT" ]
permissive
#encoding: utf-8 module JRubyCurses class ScreenBuffer def initialize @content_by_row = [] end def display_at row, col, str str = str.chomp if @content_by_row[row] if col > @content_by_row[row].length @content_by_row[row] << ' ' * (col...
true
f7cd0bc5df98783c1d9c85f7f208969e2d6a7eb9
Ruby
inspec/inspec-aws
/libraries/aws_api_gateway_v2_api.rb
UTF-8
961
2.546875
3
[ "Apache-2.0" ]
permissive
require "aws_backend" class AwsApiGatewayV2Api < AwsResourceBase name "aws_api_gateway_v2_api" desc "Gets information about the current ApiKey resource." example <<-EXAMPLE describe aws_api_gateway_v2_api(api_id: 'REST_API_ID') do it { should exist } end EXAMPLE def initialize(opts = {}) o...
true
c5e0fc8d11bae4ca0af2011103c8a9e9e996cc70
Ruby
masaedw/mirc.nb
/mirc_plugins/imihu.rb
EUC-JP
187
3.015625
3
[]
no_license
def imihu_desc "imihu>[msg]: 褯狼ʸФޤ" end def imihu(msg) if (rand(10) == 0) "''; #{msg}" else "'' #{msg}" end end
true
899b989c950d4259cd6eaa3a2768047a2810e521
Ruby
jdbbaugh/rspecPrac
/spec/all_matcher_spec.rb
UTF-8
483
2.546875
3
[]
no_license
RSpec.describe 'all matcher' do it 'allows aggregate checks' do #would work but not great # [5,7,9].each do |val| # expect(val).to be_odd # end expect([5,7,9, 13]).to all(be_odd) expect([4,6,8,10]).to all(be_even) expect([[], [], []]).to all(be_empty) expect([0, 0, 0, 0]).to all(be_...
true
cb9a3493660ae7603c692fda0ae2c79f993b5c95
Ruby
SimpleFinance/simple-metrics
/spec/metrics/healthcheck_spec.rb
UTF-8
1,402
2.625
3
[ "Apache-2.0" ]
permissive
require 'spec_helper' describe Simple::Metrics::Healthchecks do it "should register a new healthcheck" do class NurseRatched extend Simple::Metrics::Healthchecks class << self def status=(v) @status = v end def status @status end end s...
true
f1d0d807d69f723b61ed19feae2100ffd2ca6bff
Ruby
daglilley/odin-rails
/project_sinatra/caesar_cipher_reloaded/caesar_cipher.rb
UTF-8
933
3.109375
3
[]
no_license
require 'sinatra' def caesar_cipher(text, shift) code = text.each_char.map { |letter| letter = encode(letter, shift) } code.join end def encode(letter, shift) letter = if letter.between?("a", "z") then bounded_shift(letter, shift, "a", "z") elsif letter.between?("A", "Z") then bounded_shift(letter, shif...
true
127d34dd76cb549cc6d9947a78432707595d715d
Ruby
KhalidGit/Project_euler_solutions
/Ruby/Problem-3.rb
UTF-8
385
3.75
4
[]
no_license
#!/usr/bin/env Ruby # Problem 3 # https://github.com/KhalidGit/Project-Euler-solutions # The prime factors of 13195 are 5, 7, 13 and 29. # What is the largest prime factor of the number 600851475143? number = 600851475143 def get_prime(n) (2..n).each do |i| if i == n return n elsif n % i == 0 ...
true
55692b42eab5262ac96d950273b2fe08a36b2676
Ruby
wintonpc/abstractivator
/lib/abstractivator/cons.rb
UTF-8
801
3.171875
3
[ "MIT" ]
permissive
module Abstractivator module Cons Nil = Object.new def empty_list Nil end def cons(h, t) Cell.new(h, t) end def head(p) p.first end def tail(p) p.last end def list_to_enum(list) Enumerator.new do |y| while list != Nil y << he...
true
9e8c11c95a5369d8b4ea8f82b0c761cc69c4c1a2
Ruby
esugano/sports-odds-cli-app
/lib/sports_odds/scraper.rb
UTF-8
1,050
2.53125
3
[ "MIT" ]
permissive
class SportsOdds::Scraper def self.get_page Nokogiri::HTML(open("https://js.sbrfeeds.com/index.php/future?iframeid=iframe-odds-widget-5849247360332532&timezone=16&theme=future&markettypeid=311&odds-type=US&version=2.0&books=93,19,169,1096,999996,180,139&trackers=1518124627581.xml&event-id=3399565")) end def ...
true
2c9fa6ddb80822363c805e227d1d0f49bffbd69a
Ruby
alovak/pragauthor
/vendor/gems/money-3.7.1/spec/money/arithmetic_spec.rb
UTF-8
19,823
3.421875
3
[ "MIT" ]
permissive
# encoding: utf-8 require "spec_helper" describe Money do specify "#zero? returns whether the amount is 0" do Money.new(0, "USD").should be_zero Money.new(0, "EUR").should be_zero Money.new(1, "USD").should_not be_zero Money.new(10, "YEN").should_not be_zero Money.new(-1, "EUR").should_not be_ze...
true
df7f75e2955c446ded1ff19ba16903b43598efac
Ruby
krystian-wojtas/OCR
/aipo/3/report/listingi/rotating.rb
UTF-8
128
3.046875
3
[]
no_license
def rotating(i, j, kat) [ ( Math.cos(kat)*i-Math.sin(kat)*j ).to_i, ( Math.sin(kat)*i+Math.cos(kat)*j ).to_i, ] end
true
b17c89a1b46e6bae76db59d44a5ff0fe0c968e3f
Ruby
dansteele/ShoesCalculator
/BMI.rb
UTF-8
1,510
3.1875
3
[]
no_license
require 'pry' Shoes.app :title => "My Amazing Calculator", :width => 240, :height => 240 do stack :margin => 20 do @output = edit_line @output.text = "Enter your height" # How can we recreate this every time "m" or "inches" is pressed? stack :width => 80 do flow do button_array = %w(...
true
bc82a851a13e87961511fe4c15b8fef9c08dc0d5
Ruby
thegboat/phoenix_cartographer
/spec/coordinates_spec.rb
UTF-8
5,661
2.921875
3
[]
no_license
require 'spec_helper' describe PhoenixCartographer::Coordinates do describe "latitude=, longitude=" do it "should set latitude/longitude to nil or BigDecimal evaluation" do coords = PhoenixCartographer::Coordinates.new(nil,nil) coords.latitude.should eq(nil) coords.longitude.should eq(nil...
true
8728c907d9f751b2328f88b0044adbcdd8781b43
Ruby
qrkate/ruby
/Lesson6/route.rb
UTF-8
636
3.203125
3
[]
no_license
require_relative 'instance_counter.rb' require_relative 'validation.rb' class Route include Validation include InstanceCounter attr_accessor :stations, :start, :finish validate :start, :type, Station validate :finish, :type, Station def initialize(start, finish) @start, @finish = start, finish ...
true
d64e871e3f54afe1279e810658f6abe1027fda93
Ruby
onagorodniuk/hadoop-utils
/bin/hjoblist.rb
UTF-8
6,286
2.53125
3
[]
no_license
#!/usr/bin/env ruby # # Yet Another Hadoop Job(s) Listing script. # require 'rubygems' require 'trollop' require 'houdah' require 'time' require 'html/table' require 'net/smtp' include HTML # # command line options $options_used = ARGV.join(" ") $cmd_options = Trollop::options do banner 'Yet Another Hadoop Job List...
true
888ccc221667b65a88790cb525bec381a0a2ed20
Ruby
LyudmilaNevedomskaya/Jungle
/spec/models/product_spec.rb
UTF-8
1,372
2.515625
3
[]
no_license
require 'rails_helper' RSpec.describe Product, type: :model do describe 'Validations' do # validation tests/examples here it "is valid" do @furniture = Category.new @furniture.name = 'Sofa' @product = Product.new @product.name = 'Example' @product.price_cents = 123 @produc...
true
00bb65beac50c9c0c33ff5c16c0fc59c305646e7
Ruby
tobara/more_ruby_exercises
/command-query/kid/kid.rb
UTF-8
332
3.3125
3
[]
no_license
class Kid def initialize @sugar_intake = 0 @sugar_from_candy = 5 @hyperactive = false end def eat_candy @sugar_intake += @sugar_from_candy end def grams_of_sugar_eaten @sugar_intake end def hyperactive? unless @sugar_intake < 60 @hyperactive = true end @hyperactiv...
true
032753e920e3ef73adff451a3d24df6511c3b0ec
Ruby
jstrait/clawhammer
/clawhammer.rb
UTF-8
2,898
2.796875
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby # Copyright (c) 2008-2010, 2016-2018 Joel Strait # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, #...
true
e5ed577fbe43ff6f5082a0c8c35f1e9f0de9ac2a
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/bob/bd83c3efe517475bbe65547e5eefbd84.rb
UTF-8
456
3.53125
4
[]
no_license
class Bob attr_reader :sentence def hey(sentence) @sentence = sentence case when shouting? then 'Woah, chill out!' when question? then 'Sure.' when silence? then "Fine. Be that way!" else 'Whatever.' end end def shouting? (sentence.upcase == sentence) && (sentence =~ /[...
true
bc0354023dc69d75d6d48d8c65f03e31249bca6d
Ruby
kanalemon/furima-31170
/spec/models/user_spec.rb
UTF-8
5,101
2.609375
3
[]
no_license
require 'rails_helper' describe User do before do @user = FactoryBot.build(:user) end describe 'ユーザー新規登録' do context '新規登録がうまくいくとき' do it 'nicknameとemail、passwordとpassword_confirmation, family_name, last_name, family_name_kana, last_name_kana, birthdayが存在すれば登録できる' do expect(@user).to be_val...
true
f0734148fee6850f1855e4135d3328ecc6068a7e
Ruby
jakeland/code_examples
/wirecareAdmin API/test/controllers/api_product_test.rb
UTF-8
4,268
2.546875
3
[]
no_license
require 'test_helper' class Api::ProductsControllerTest < ActionController::TestCase def setup @prod = Product.all.third # all used to make sure we get the actual record. @prod_image_ids = @prod.product_images.pluck(:id).map(&:to_s) #string params because that's what we expect. end def teardown end...
true
d4bce79cf4837ff315f2e219b450a0dc0065954d
Ruby
RobertRodes/RB130
/blocks/reduce.rb
UTF-8
899
3.65625
4
[]
no_license
def reduce_old(arr, acc = nil) counter = acc.nil? ? 1 : 0 acc ||= arr[0] loop do acc = yield(acc, arr[counter]) counter += 1 break if counter == arr.size end acc end def reduce(arr, acc = nil) if acc.nil? counter = 1 acc = arr[0] else counter = 0 end loop do acc = yield(acc, a...
true
0e21adb7a6e9b302e101fd48be0f3aa8c176a475
Ruby
juani-garcia/POO_Ruby
/guias/tp10/ej1/format_text.rb
UTF-8
189
2.546875
3
[]
no_license
require_relative 'html_text' class FormatText include HTMLText def initialize raise 'Abstract class' end def source "<#{@letter}>#{@text.source}</#{@letter}>" end end
true
ceb09c8204459d6e822a19b8eb0afce6cd5a9ff3
Ruby
taggartj1985/Rock-Paper-Scissors
/models/game.rb
UTF-8
1,420
3.421875
3
[]
no_license
class Game # def initialize (player1, player2) # @player1 = player1 # @player2 = player2 # end # def check_win(player1, player2) # if player1 == "Rock" && player2 == "Scissors" # return "Player 1 Wins" # elsif player1 == "Scissors" && player2 == "Rock" # return "Player 2 Wins" # ...
true
493b130fc5e6df4d2f736c8e56db22d5c67b39d6
Ruby
SpeedETab/bypass
/lib/bypass/menu.rb
UTF-8
877
2.546875
3
[]
no_license
require_relative 'category_collection' module Bypass class Menu attr_reader :concession_id, :meta, :categories def initialize(opts = {}) @concession_id = opts.fetch(:concession_id) @meta = opts[:menu]["meta"] begin if opts[:menu].is_a?(String) parsed_menu = JSON.parse op...
true
03bc92895fd3d5a278c51c3d48be37b9f75eed3f
Ruby
konyan/learn-algo-daily
/ruby/got_1.rb
UTF-8
402
3.75
4
[]
no_license
def gameOfThrones(s) # {a, 1} my_map = {} count = 0 s.split("").each do |char| unless my_map.key?(char) my_map[char] = 1 else my_map[char] = my_map[char] + 1 end end my_map.each do |key, value| count += 1 if value.odd? end count > 1 ? "NO" : "YES" end # O(n) + O(n) # 20(n) # ...
true
bd1f22c11bd1ab1edbcbbdf8806c03c27f5e89f7
Ruby
JJavier98/Support
/2º/FIS/practicas/practica 5/decine_ruby/decine/lib/critica.rb
UTF-8
737
2.71875
3
[]
no_license
# encoding: UTF-8 # # Fundamentos de Ingenieria del Software # Grado en Ingeniería Informática # # 2014 © Copyleft - All Wrongs Reserved # # Ernesto Serrano <erseco@correo.ugr.es> # Carlos Garrancho # Pablo Martinez # module Decine class Critica def initialize(usuario, titulo, comentario) @usuario ...
true
5ed53a368d2546fca396ee0e32932202072d142d
Ruby
AndorChen/pandocfilters
/lib/pandocfilters/core_ext/string.rb
UTF-8
216
3.28125
3
[ "MIT" ]
permissive
class String # Strips off underscores in string, then capitalize each words. # # @return [String] Camelized string. def camelize string = self string.split('_').map(&:capitalize).join('') end end
true
5b1c827d28a5ad2bd0563dce6db40dde05bb0075
Ruby
andrestorresw/ruby
/17_rangos.rb
UTF-8
431
4.03125
4
[]
no_license
=begin numeros = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] numeros.each do |numero| puts numero end =end =begin numeros = (1..100).to_a #conviertes el rango a arreglo numeros.each do |numero| puts numero end puts numeros.class =end =begin numeros2 = (0..20).step(2).to_a numeros2.each do |numero| puts numero end puts numeros...
true
fc7528669c923ec07c007c3b552b1575259bbfc7
Ruby
coryb2424/code_snippets
/medium_posts_program/lib/controllers/posts_controller.rb
UTF-8
787
2.671875
3
[]
no_license
require_relative '../models/post' require_relative '../views/posts_view' require_relative '../modules/parse_module' require 'nokogiri' require 'open-uri' class PostsController include ParseModule MEDIUM_BASE_URL = 'http://medium.com/' def initialize(repo) @repo = repo end def list_all posts = @rep...
true
ee7fb88d69c0c0c8e0bd5f4cba9e75500b208f10
Ruby
mschl0ss/w2d5
/MyHashMap/lib/p02_hashing.rb
UTF-8
562
3.375
3
[]
no_license
class Integer # Integer#hash already implemented for you end class Array def hash result = 0 for i in (0...length-1) result += (length*2+(83*i))+self[i] end result end end class String def hash indices = 0 alpha = ("a".."z").to_a self.each_char do |char| if alpha.inclu...
true
e0ccae21326d56a4fdc9aa0649a50b6f697d1380
Ruby
pimenta53/AgroMarket
/app/models/talk.rb
UTF-8
3,359
2.578125
3
[ "MIT" ]
permissive
# == Schema Information # # Table name: talks # # id :integer not null, primary key # user_one :integer not null # user_two :integer not null # ad_id :integer # is_close :integer default(0) # created_at :datetime # updated_at :datetime # class Talk < Active...
true
50fef4275f308e1b91998479a102fade75e4657a
Ruby
NetsydeMiro/screp
/lib/screp/screp.rb
UTF-8
5,827
2.734375
3
[ "MIT" ]
permissive
require_relative 'text_utilities' require_relative 'http_utilities' require_relative 'general_utilities' require 'csv' module Screp class Screp include TextUtilities, HttpUtilities, GeneralUtilities # can take boolean value for option :silent # and IO options for options :out and :err def initiali...
true
5ed4b2434c4c92515384270b6ebb34c467e612c4
Ruby
J-Y/RubyQuiz
/ruby_quiz/quiz76_sols/solutions/Ryan Leavengood/scramble.rb
UTF-8
809
3.65625
4
[ "MIT" ]
permissive
class Array # Just to be different I'm going to use Stephen # Waits' shuffle from ruby-talk archives (Dec 2005) # instead of the usual sort_by {rand} def shuffle h = Hash.new self.each { |v| h[rand(1000000000)] = v } h.keys.sort.collect { |k| h[k] } end end class String def munge # Only mun...
true