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
ea909bad0cd274b31f006769d978fd3e620b15f4
Ruby
yenisbel/cenit
/app/models/setup/transformation/with_options.rb
UTF-8
583
2.640625
3
[ "MIT" ]
permissive
module Setup module Transformation class WithOptions < Setup::Transformation::AbstractTransform def initialize(options) @options = options end def method_missing(symbol, *args) if args.length == 0 && value = @options[symbol] value else super ...
true
efae9db1d55d654a5c02f6a2a1154b9814377ab7
Ruby
lfcipriani/cheatorious
/lib/cheatorious/cli.rb
UTF-8
8,160
2.640625
3
[ "MIT" ]
permissive
# encoding: UTF-8 require 'thor' require 'yaml' module Cheatorious module DslExecutor def self.cheatsheet_for(name, &block) Cheatorious::CheatSheet.compile(name, @output, &block) end end class CLI < Thor include Thor::Actions desc "list", "lists the available cheatsheets. See 'import' com...
true
ee02bb34cb6c44c60e0267012505b1fa056d199f
Ruby
interestinall/nytimes_cli
/lib/article.rb
UTF-8
1,426
3.46875
3
[ "MIT" ]
permissive
class Article attr_accessor :title, :author, :url, :story @@articles = [] def initialize(title = nil, url = nil, author = nil, story = nil) @title = title @author = author @url = url @story = story end def self.create_articles_from_array(array) array.each do |article| title ...
true
da6d1afd0a875dc83540ce701de33d968b3fec5f
Ruby
egtaonline/egta_online
/lib/backend/flux/simulation_status_resolver.rb
UTF-8
655
2.6875
3
[]
no_license
class SimulationStatusResolver ERROR_LIMIT = 1024 def initialize(simulations_path) @simulations_path = simulations_path end def act_on_status(status, simulation_id) simulation = Simulation.find(simulation_id) rescue return case status when "R" simulation.start when "C", "", nil ...
true
b1a3ef885dfebecb4a571ee42f8e423ca599d82f
Ruby
marcmentis/ransack
/app/models/weekly_note.rb
UTF-8
2,069
2.6875
3
[]
no_license
class WeeklyNote < ActiveRecord::Base belongs_to :pat def self.get_pat_lists (params) # byebug # Create @all_done an @all_to_do dependent upon what date should be used: if params[:sPreviousMeetings] != "" chosen_date = params[:sPreviousMeetings] # Get all the Patients who have weekly notes fro...
true
4cac7c8744bea31ca857e018fdc8bfad2f4bd21d
Ruby
omedusyo/tajbrno
/app/models/user.rb
UTF-8
1,391
2.515625
3
[]
no_license
class User < ActiveRecord::Base has_secure_password has_many :articles has_many :menu_categories has_many :menus has_many :dishes has_many :reservations has_many :gallery_images auto_strip_attributes :username, :first_name, :last_name validates :username, presence: true, le...
true
a4845e3cf6ee625303a57bbf576430d80daaa6a7
Ruby
Whomps/rottenpotatoes-rails-intro
/app/helpers/movies_helper.rb
UTF-8
523
2.765625
3
[]
no_license
module MoviesHelper # Checks if a number is odd: def oddness(count) count.odd? ? "odd" : "even" end def hilite_helper(col_title) if(params[:sort].to_s == col_title) return 'hilite' else return nil end end def sort_table(column, title) # Sorting works for any column title ||= column.t...
true
d5f09a7778f78b000e15e4be2cd8f2bddc6ca541
Ruby
gaku/gpx
/test/distance_test.rb
UTF-8
738
3.015625
3
[]
no_license
require 'test_helper' require 'gpx/geopoint' require 'gpx/distance' class TestDistance < Test::Unit::TestCase def test_distance # the following page has similar code. Took their example # http://www.esawdust.com/blog/gps/files/HaversineFormulaInRuby.html a = GPX::GeoPoint.new(39.06546, -104.88544) ...
true
0ad98449a2360f9bc8be21947116546df6077b9f
Ruby
blvrd/project_euler
/problem010.rb
UTF-8
189
3.34375
3
[]
no_license
#Problem 10 #The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. #Find the sum of all the primes below two million. require 'prime' answer = Prime.each(2_000_000).inject(:+) puts answer
true
f55f9dd7b33b9dc920b82cdde7e6e5a7e1dd4108
Ruby
gnwankwo/my-select-001-prework-web
/lib/my_select.rb
UTF-8
253
3.265625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def my_select(collection) counter=0 new_collection=[] while (counter<collection.size) item= yield collection[counter] if item!=false new_collection.push(collection[counter]) end counter+=1 end return new_collection end
true
6854deb3a884945579a0872cfda6c5046a34c538
Ruby
Ji-Yuhang/pat_cpp
/b1001/b1001.rb
UTF-8
189
3.140625
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby n = gets.to_i #puts n count = 0 while n > 1 do if n % 2 == 0 n = n / 2 else n = (3*n+1) / 2 end count += 1 #puts n #break if n == 1 end puts count
true
170c26917f38543c40c6760731379631a403625e
Ruby
SilverPhoenix99/rbell
/lib/rbell/grammar.rb
UTF-8
11,624
2.828125
3
[]
no_license
require 'set' module Rbell class GrammarNotLLError < StandardError; end class FirstFollowConflict < StandardError; end class FirstFirstConflict < StandardError; end class Grammar attr_reader :productions def initialize @productions = {} @terminals = {} @end_of_input = Terminal.new(...
true
b9e5543449f4edc0bf550d68786bf409f70f9422
Ruby
KurisuLim/ruby_udemy_lessons
/the_concat_method_on_an_array.rb
UTF-8
326
3.765625
4
[]
no_license
nums = [1, 2, 3] p nums nums.concat([4, 5, 6]) p nums p [1, 2, 3] + [4, 5] p [1, 2, 3].concat([4,5]) puts puts a = [1,2,3] b = [4,5, 6] def custom_concat(arr1, arr2) # Return arr1 with all of the elemts from arr2 # added to the end of it # arr1 + arr2 arr2.each { |elem| arr1 << elem} arr1 end p custom_concat...
true
112a71e8b44fcbcb02ffbd54d9bd4ebee529d89e
Ruby
wfro/sales_engine
/lib/invoice_repository.rb
UTF-8
2,182
3
3
[]
no_license
require_relative 'invoice' require 'time' class InvoiceRepository attr_reader :invoices, :engine def initialize(filename, engine) @filename = filename @engine = engine from_csv(filename) end def from_csv(filename) rows = CSV.open(filename, headers: true, header_converters: :sy...
true
ba9605f8870ce8dffd7db93baf38bfbb7846d950
Ruby
danbooru/danbooru
/app/logical/custom_css.rb
UTF-8
257
2.59375
3
[ "BSD-2-Clause-Views" ]
permissive
class CustomCss attr_reader :css def initialize(css) @css = css end def valid? css.blank? || parsed_css.none? { |node| node[:node] == :error } end def parsed_css @parsed_css ||= Crass.parse(css, preserve_comments: true) end end
true
b7cdfe900348f7e1ca42e7571dad4f0d701f246e
Ruby
kamyu104/effrb
/exceptions/strings_test.rb
UTF-8
3,442
2.9375
3
[ "BSD-3-Clause" ]
permissive
################################################################################ # This file is part of the package effrb. It is subject to the license # terms in the LICENSE.md file found in the top-level directory of # this distribution and at https://github.com/pjones/effrb. No part of # the effrb package, including...
true
ce01c0047b6ac857ab8f880eed982bf2c00670a4
Ruby
grinchrb/grinch
/lib/cinch/isupport.rb
UTF-8
2,844
2.515625
3
[ "MIT" ]
permissive
# frozen_string_literal: true module Cinch # This class exposes parsed ISUPPORT information of the IRC network. class ISupport < Hash @@mappings = { %w[PREFIX] => lambda { |v| modes, prefixes = v.match(/^\((.+)\)(.+)$/)[1..2] h = {} modes.split("").each_with_index do |c, i| ...
true
444011db4253ed27edcecca55662ae59df4537ab
Ruby
bnzene/student-directory
/directory9.rb
UTF-8
3,390
3.90625
4
[]
no_license
@students = [] def interactive_menu loop do print_menu process(gets.chomp) end end def print_menu puts "Option 1: Input student details." puts "Option 2: Show student details." puts "Option 9: Exit" end def process(selection) case selection when "1" input_students when "2" pri...
true
f8868ea9d968a4bc3b1246c7cac0b7c096a43bcc
Ruby
gorsuch/redismq
/lib/redismq/client.rb
UTF-8
1,234
2.734375
3
[ "MIT" ]
permissive
require 'json' require 'redis' require 'uri' module RedisMQ class Client attr_accessor :redis def bind(topic, queue) redis.sadd(topic_key(topic), queue_key(queue)) end def bpop(queue, timeout=0) (queue, message) = redis.blpop(queue_key(queue), timeout) parse_json(message) en...
true
dff21f8b4b5c2933d4644f58a5b15702ec6df47f
Ruby
dustinur/ShopApp
/store.rb
UTF-8
436
3.84375
4
[]
no_license
# I wanted to create a hash or array for both store items and cart items but I wasn't sure how to use a class to do it class Store attr_accessor :item, :in_stock def initialize(name, price) @in_stock = [{name: 'apple', price: 2}] @new_item = {name: item, price: price } end def add_inventory @in_s...
true
bf3b64e035eab059d590f1929dcae6933267e5b7
Ruby
michaelsharpe/ruby_fundamentals2
/exercise5.rb
UTF-8
213
3.90625
4
[]
no_license
def temp_converter puts "Please input the temperature in Fahrenheit you would like convert into Celcius." f = gets.chomp.to_i p "#{f} degrees Fahrenheit is #{(f-32) * 5/9} degrees Celcius." end temp_converter
true
33261bca8d569aec8c6adbd80fe0501af2e6b34f
Ruby
gilbertek/maroon
/test/context_test.rb
UTF-8
3,543
2.703125
3
[ "MIT" ]
permissive
require_relative './test_helper' class MaroonInternal end #Context::generate_files_in = '.' # class ContextTest < Test::Unit::TestCase class ContextTest < Minitest::Test def test_role_method_call name = :MyContextRoleMethodCall role_name = :rolx Context.define name do def padding 0 ...
true
39bc56a5bb4395b7757439d9dd7b3d3e511795c7
Ruby
steve-alex/ruby-collaborating-objects-lab-london-web-082619
/lib/artist.rb
UTF-8
648
3.4375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require_relative "./song" require 'pry' class Artist @@all = [] attr_accessor :name, :song def initialize(name) @name = name @@all << self end def self.all @@all end def songs Song.all.filter{|song| song.artist == self} end def add_song(song) ...
true
0e2a0e4dc9f61079278bac28ae7211599650db00
Ruby
bertt1t11/Ruby
/Ruby Set 1/FXRubyTest3.rb
UTF-8
2,420
2.703125
3
[ "Apache-2.0" ]
permissive
require 'fox16' include Fox NUMBERS = (1..9).to_a ALPHABET_LOWER = ("a".."z").to_a ALPHABET_UPPER = ("A".."Z").to_a ALL_POSSIBLE_CHARS = (33..126).map{|a| a.chr} class PasswordGenerator < FXMainWindow def initialize(app, charSets) super(app, "Password generator", :width => 400, :height => 200) @c...
true
0cb0043ed9ea4bae718fbfabff3d6f613d6c3cfe
Ruby
RNDcpp/patio-checker
/lib/scraping_twilog.rb
UTF-8
1,852
2.734375
3
[]
no_license
# coding: utf-8 require 'open-uri' require 'nokogiri' require 'natto' require 'sqlite3' db = SQLite3::Database.new("../db/#{ARGV[0]}.db") nat = Natto::MeCab.new module TwilogParser class << self def get_status_list(screen_name,limit) posts = Array.new limit.times do |i| begin html = open...
true
8781df1f256bf6ccb2b0f98ab42aaa72bed20523
Ruby
404nofound/one-month-course
/Ruby Course/strings.rb
UTF-8
458
3.703125
4
[ "MIT" ]
permissive
# Strings are text surrounded by quotes # Both single ('') and double ("") are used # examples: "dinosaurs", '2112', "I'm lovin' it!" kanye_quote = "My greatest pain in life is that I will never be able to see myself perform live." hamilton_quote = 'Well, the word got around, they said, "This kid is insane, man"' ham...
true
945e7038de7da126b0adc4b77d60db6a1e7c6ef0
Ruby
ForeverZer0/rgss
/lib/rgss/sprite.rb
UTF-8
1,236
2.703125
3
[ "MIT" ]
permissive
module RGSS class SpriteAtlas < Sprite attr_reader :region attr_reader :columns attr_reader :rows attr_reader :cx attr_reader :cy def initialize(*args, **opts) @region = opts[:region] @columns = opts[:columns] || 0 @rows = opts[:rows]...
true
92d4afc2c1ac4e8c2cd9c65cb05815a147e1d141
Ruby
buff-rat-from-ratatouille/test
/twitter_sandbox.rb
UTF-8
1,280
2.59375
3
[]
no_license
require 'twitter' require 'yaml' class Twitter_Scraper def initialize $client = Twitter::REST::Client.new do |config| config.consumer_key = "EE00gnUP1WcuqPHfuw9b1QCMt" config.consumer_secret = "WSI4ik3vaGpeH2XS64N93sGkl9ltMuP19MLyWymmMKP88nN0Ct" config.access_token = "890575433229639682-SURFyElx...
true
dd8d9f9bb366e8a53a8d8a1ad19a6972770fa491
Ruby
hiimchinh/ruby_book
/Excercies/16.rb
UTF-8
243
2.71875
3
[]
no_license
contact_data = ["joe@email.com", "123 Main st.", "555-123-4567"] contacts = {"Joe Smith" => {}} data_keys = [:email, :address, :phone] contacts.each do |name, value| data_keys.each do |key| value[key] = contact_data.shift end end puts contacts
true
dc74822636d472c7abcdc8ca545ed4f1634470e4
Ruby
UberMouse/ruby-challenge-app
/eval.rb
UTF-8
469
3.25
3
[ "MIT" ]
permissive
class Eval # Evals input in a separate thread with $SAFE set to 4 # @param [String] input # @return [String] eval'd input def eval_safe(input) execution_limit = 2 @answer = '' eval_thread = Thread.new { @answer = eval(input) } start_time = Time.now while eval_thread.alive? and T...
true
aba6b48de83ec1bb11ff339dba4c1289de3cebe8
Ruby
hansnery/connect_four
/spec/connect_four_spec.rb
UTF-8
3,761
3.078125
3
[]
no_license
# frozen_string_literal: true require './lib/board.rb' require './lib/player.rb' describe Board do describe '#initialize' do it 'board initialized' do board = Board.new expected_array = Array.new(6, board.empty_tile) expect(board.column1).to eql expected_array expect(board.column2).to eq...
true
c5ef9fb982da8135c7f9198ffe7171692dc4662f
Ruby
criszelaya24/AppScore
/app/controllers/selector_controller.rb
UTF-8
798
2.65625
3
[]
no_license
require 'pry' require 'rest-client' class SelectorController < ApplicationController URL = "https://api.football-data.org/v2/competitions/" def index @data = RestClient.get(URL, headers= {accept: :json,'X-Auth-Token' => ENV['API_TOKEN']}) @leagues = JSON.parse(@data) end def get_teams @league = par...
true
47f35afe0f4902e65da209811fd78100fec950f3
Ruby
copiousfreetime/tbar
/lib/tbar/entry.rb
UTF-8
1,396
3.046875
3
[ "ISC" ]
permissive
require 'money' module Tbar # Private: Entry is one item of a Transaction. It represents one of the # Credit or Debit entries in a Transaction. The Entry should never be # instantiated directly. It should be instantiated as either a Credit or # Debit. class Entry # The Account this entry is for attr_r...
true
7fd3d6bf412b84540330521809f491823c57fe25
Ruby
krakoviak/sjarqe
/lib/sjarqe.rb
UTF-8
5,693
2.90625
3
[]
no_license
NIL_VOWEL = {:nil => 5} SHORT_VOWELS = {:a => 6, :ya => 3, :e => 5, :ye => 2, :u => 6, :i => 3, :o => 7, :yo => 2} LONG_VOWELS = {:aa => 0, :ee => 0, :uu => 0, :ii => 0, :oo => 0} DIPHTONGS = {:ai => 3, :ei => 3, :yei => 1, :oi => 2, :ou => 2, :au => 2} VOWELS = NIL_VOWEL.merge(SHORT_VOWELS).merge(LONG_VOWE...
true
45feedacd3f8a0c03d6266411cbf91ae473a658a
Ruby
jotengine/coletivo
/test/models/person_test.rb
UTF-8
771
2.59375
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'helper' require 'models_helper' class PersonTest < Test::Unit::TestCase def setup super @person = User.create(:name => 'Uber Geek') end should "be able to rate an object" do movie = Movie.create(:name => 'Lovely Movie') @person.rate!(movie, 1) assert_equal 1, ratings_container.all...
true
10c63c3b8ebdaffffc58ec4602c74637fe4451d4
Ruby
cfritsch5/app_academy_work
/algorithms/array_solution/single_in_sorted.rb
UTF-8
434
3
3
[]
no_license
def single_in_sorted(arr) # binary search but check if lenght of each side is odd # or even the odd side contains the mid = (arr.length) / 2 left = arr[0 .. mid] right = arr[ mid + 1 .. -1] if arr.last == arr[-2] end # [1,1,2,2,4,5,5,6,6,7,7,9,9] # length = 13 # length - 1 / 2 = 6 # length will always be odd # and ...
true
7369419fe1e32418b75f891989d91ef88633a809
Ruby
NicolePell/backgammon
/lib/dice.rb
UTF-8
354
3.34375
3
[]
no_license
class Dice attr_reader :dice_count def initialize @dice_count = [] end def roll 2.times { dice_count << ( rand(6) + 1 ) } dice_count end def roll_total if dice_count[0] == dice_count[1] dice_count.inject { |sum, dice| (sum + dice) * 2 } else dice_count.inject { |sum, dice...
true
bec5f0e945b2c0b2f4499e39d386103a08c3b865
Ruby
ericraio/faye
/lib/scraper/go_go_anime.rb
UTF-8
1,807
2.671875
3
[]
no_license
require 'mechanize' $mech = Mechanize.new $mech.user_agent_alias = 'Mac Safari' class Scraper::GoGoAnime def initialize(url, options={}) @mech = $mech.get(url) @anime_id = options[:id] @series = options[:series] @episode = options[:episode] end def fetch_anime begin desc = @mech.sea...
true
5ef8cab2ef3a81b12db710150eb6827a633cca32
Ruby
EthilVan/Web
/app/views/partials/discussion/pager.rb
UTF-8
1,587
2.640625
3
[]
no_license
module EthilVan::App::Views module Partials::Discussion class Pager < Partial AROUND = 4 TOTAL = 2 * AROUND + 1 def initialize(discussion_urls, discussion, page) @discussion_urls = discussion_urls @discussion = discussion @last_message = discus...
true
2afb02db6096506c20be063a0c73ee2eba9534dd
Ruby
kirkokada/cobra_khan_academy
/spec/models/topic_spec.rb
UTF-8
2,718
2.578125
3
[]
no_license
require 'rails_helper' RSpec.describe Topic, type: :model do subject(:topic) { Topic.new name: "topic", description: "description" } it { should respond_to :description } it { should respond_to :name } it { should respond_to :parent } it { should respond_to :priority } describe "name" do it "sh...
true
978d2885717e4a08b36dc23c6f952ccca43108af
Ruby
jamelablack/tealeaf
/2ndCourse/Pre-course/SQL/SQLRightJoin.rb
UTF-8
2,049
3.015625
3
[]
no_license
SQL RIGHT JOIN Keyword The RIGHT JOIN keyword returns all rows from the right table (table2), with the matching rows in the left table (table1). The result is NULL in the left side when there is no match. SQL RIGHT JOIN Syntax SELECT column_name(s) FROM table1 RIGHT JOIN table2 ON table1.column_name=table2.column_nam...
true
4b29569946f752c8f41028df2670ec21f8fcaee8
Ruby
quinqu/hash-practice
/lib/exercises.rb
UTF-8
1,389
3.84375
4
[]
no_license
# This method will return an array of arrays. # Each subarray will have strings which are anagrams of each other # Time Complexity: O(m + n + nlog(n)) # Space Complexity: O(n) def grouped_anagrams(strings) grouped = {} strings.each do |e| current_sorted = e.split("").sort.join("") if !grouped["#{current_...
true
66131b04565270a496082bdc3bb8455c7408967c
Ruby
gregorymostizky/twitter_spy
/spy.rb
UTF-8
2,649
2.53125
3
[]
no_license
unless ARGV.size == 4 puts "Usage: consumer_token consumer_secret access_token access_secret" exit end require 'twitterstream' require 'couchrest' require 'cgi' require 'time' #db = CouchRest.database!("http://127.0.0.1:5984/twilitr") db_tags = CouchRest.database!("http://127.0.0.1:5984/hashtags") db_links = CouchR...
true
73d4c4d767bf08d123a2e765698c5fa34e87d166
Ruby
vacationlabs/activerecord-postgres-array
/lib/activerecord-postgres-array/parser.rb
UTF-8
3,681
3.34375
3
[ "ISC" ]
permissive
class ActiveRecordPostgresArray < Rails::Railtie # PostgreSQL array parser that handles all types of input. # # This parser is very simple and unoptimized, but should still # be O(n) where n is the length of the input string. class Parser ARRAY = "ARRAY".freeze DOUBLE_COLON = '::'.freeze EMPTY_BRA...
true
837613c62317f7ce3e96a40ad549ad109e1a81a7
Ruby
Evgeniy-github-acc/thinknetica
/Lesson1/equation.rb
UTF-8
861
3.546875
4
[]
no_license
print "Введите коэфициент a уравнения: " a = gets.chomp.to_f print "Введите коэфициент b уравнения: " b = gets.chomp.to_f print "Введите коэфициент c уравнения: " c = gets.chomp.to_f d = (b**2) - (4*a*c) x_first = 0 x_second = 0 if d < 0 puts "Дискриминант равен #{d}, уравнение не имеет корней" elsif d == 0 ...
true
d9acef3a113546915c2ae9f1f6a9278b8277ef9e
Ruby
mmkserver1/mmk
/app/models/measurements/temperature.rb
UTF-8
653
3.203125
3
[]
no_license
class Measurements::Temperature < ActiveRecord::Base include Measurements::Base UNITS = %w(C F) attr_accessible :value, :units after_initialize :init validates :value, :numericality => true validates :units, :inclusion => UNITS, :allow_nil => true def value_in(convert_to = :F) if uni...
true
ffce3ffc59fa7fb814c945fecc87325761e666c2
Ruby
satyasinha94/OO-mini-project-nyc-web-111918
/app/models/User.rb
UTF-8
900
3.109375
3
[]
no_license
require 'pry' class User @@all =[] def self.all @@all end attr_reader :name, :allergens def initialize(name) #recipes = []) @name = name #@allergen = allergen #@recipes = recipes @@all << self end def add_recipe_card(recipe, date, rating) RecipeCard.new(date, rating, self, recipe)...
true
241d427f5d8112408b20ac40d1637ca1e9f06953
Ruby
averybroderick/collections_practice-v-000
/collections_practice.rb
UTF-8
784
3.796875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def sort_array_asc(arr) arr.sort end def sort_array_desc(arr) arr.sort do |a, b| b <=> a end end def sort_array_char_count(arr) arr.sort do |a, b| a.length <=> b.length end end def swap_elements(arr) second = arr[1] third = arr[2] arr[2] = second arr[1] = third arr end def swap_elements_...
true
495e4920573f561cbb1e4e852cd4fc53c63c8663
Ruby
etdev/algorithms
/0_code_wars/tip_calculator.rb
UTF-8
305
3.28125
3
[ "MIT" ]
permissive
# http://www.codewars.com/kata/56598d8076ee7a0759000087 # --- iteration 1 --- def calculate_tip(amount, rating) ratings = Hash[(%w(terrible poor good great excellent).zip([0.0, 0.05, 0.1, 0.15, 0.2]))] ratings[rating.downcase] ? (ratings[rating.downcase] * amount).ceil : "Rating not recognised" end
true
8a317a7e0c7376b848f0e6d903dbce27659b9e12
Ruby
aughr/rack-mount
/lib/rack/mount/vendor/reginald/reginald/collection.rb
UTF-8
758
2.875
3
[ "MIT" ]
permissive
module Reginald class Collection < Array def to_regexp Regexp.compile("\\A#{to_s(true)}\\Z", flags) end def match(char) to_regexp.match(char) end def include?(char) any? { |e| e.include?(char) } end def ==(other) #:nodoc: case other when String othe...
true
f87ff98c38390224454ac0c1586ffabef4c8478f
Ruby
yadulagithub/Ruby
/uniquenames.rb
UTF-8
575
3.9375
4
[]
no_license
def unique_names(names1, names2) names3 = [] i = 0 names1.each do |a| if !names3.include?( a) names3 << a end end puts "Came here - First pass" puts "#{names3}" names2.each do |a| # in rails if variable.exclude?("something") # in ruby if !variable.include?("something") ...
true
2c165ef233157eb363077b87310e0fb71819eeff
Ruby
ChanitaIvanova/test_creator_ruby
/lib/questions.rb
UTF-8
1,181
3.203125
3
[]
no_license
class OpenQuestion attr_reader :question, :answers def initialize(question,answers) @question = question @answers = answers end def self.read(string) if(string =~ /Q O: (.*?) :QOEND/m) then question = $1 end if(string =~ /A O: (.*?) :AOEND/m) then answers_part = $1 end return nil if(!quest...
true
cc265513c2e3301d6482d0d8034c49e920d7a0c3
Ruby
MorganFujimaka/bitmap
/lib/commands/f.rb
UTF-8
564
3.0625
3
[]
no_license
require_relative 'base' # X Y C - Flood Fill module Commands class F < Base def run validate_bitmap_presence validate_args bitmap.flood_fill(*args) bitmap end private def validate_args raise ArgumentError, error_message('3 arguments required: X Y C') unless args.coun...
true
aa08e61362d5a90d430e2f567f809fda3bb124e1
Ruby
Mia-J-Russell/LaunchSchool
/RB101/small_problems/easy_4/num_to_string.rb
UTF-8
947
3.90625
4
[]
no_license
def integer_to_string(num) array = num.digits newarr = [] array.each do |x| if x == 0 newarr << '0' elsif x == 1 newarr << '1' elsif x == 2 newarr << '2' elsif x == 3 newarr << '3' elsif x == 4 newarr << '4' elsif x == 5 newarr << '5' elsif x == 6 ...
true
1dd63a015e21a45707ee4b03c5e5a4318f5a2401
Ruby
didanagung/Diajar
/ruby_lesson/sololearn/array.rb
UTF-8
639
3.828125
4
[]
no_license
# array di dalam ruby sama seperti bahasa yang lain [1,2,3] arr = ["Didan", 16, true] # menambahkan data kedalam array arr << 8 #menambahkan di akhir arr.push("Agung") #menambahkan di akhir array arr.insert(3, "Sergia") #menambahkan parameter pertama diisi dengan mau di index ke berapa array di tambahkan dan parameter...
true
01519497cef3e9e087fccb2bef6d0ebc4b2a40d3
Ruby
eakmotion/RubyPracticeProblems
/length_of_missing_array.rb
UTF-8
883
3.40625
3
[]
no_license
# You have to write a method, that return the length of the missing array. require 'spec_helper' def getLengthOfMissingArray(a) a.any?(&:empty?)?0:(x=a.map(&:size);(Range.new(*x.minmax).to_a-x).first)rescue 0 end describe "getLengthOfMissingArray" do it "Example cases" do expect(getLengthOfMissingArray([ [ 1...
true
0e3bab799ffd9301597cdd51f3d26d38ea360d60
Ruby
mezdef/marcziani.com
/_plugins/filters.rb
UTF-8
3,734
2.5625
3
[]
no_license
require 'nokogiri' module Jekyll module MarkdownConstruction def headline(input) doc = Nokogiri::HTML.fragment(input) doc.css("h2").each_with_index do |headline, index| headline.replace(Nokogiri.make("<h2><span>#{headline.inner_text}</span></h2>")) end doc.to_html end de...
true
6eea29d293e7da3ab55a52f6e4f6e40fad8a8795
Ruby
Mtmackenzie/ls101
/101.3/medium.1.2.rb
UTF-8
487
4.6875
5
[]
no_license
# The result of the following statement will be an error: # puts "the value of 40 + 2 is " + (40 + 2) # Why is this and what are two possible ways to fix this? # TypeError - can't combine string with integer. One way is to save value of # numbers and turn them into a string. Other way is to add .to_s to end of nums....
true
0015dc3d2f030a0bdf361127855ecc0266c61364
Ruby
fafafariba/Chess
/knight.rb
UTF-8
313
2.65625
3
[]
no_license
require_relative 'step_piece_mod' require_relative 'piece' require_relative 'board' require_relative 'display' class Knight < Piece include SteppingPiece def initialize(color, position, board) @value = "\u265E" @position = position @color = :blue @board = board # super(color) end end
true
82f6de7d121f3b20d0df8852603ff434c1b1374c
Ruby
skorks/partner
/lib/partner/token_matcher/short_option_with_value.rb
UTF-8
588
2.609375
3
[ "MIT" ]
permissive
require "partner/token_matcher/base" require "partner/option_utils" module Partner module TokenMatcher class ShortOptionWithValue < Base def matches?(token) /^-[a-zA-Z0-9]{1}[a-zA-Z0-9_-]+$/.match(token) && valid_short_options?(OptionUtils.split_into_short_options(token)[0..0]) && ...
true
7ae0b9cbd8e2cfc4c0eeb1f27e82fc8a9c1d8938
Ruby
Crossroadsman/generalSoftwareDevelopment
/Ruby/self.rb
UTF-8
819
4.1875
4
[]
no_license
# Uses of self #The following snippet is from #http://rubymonk.com/learning/books/4-ruby-primer-ascent/chapters/45-more-classes/lessons/113-class-variables # This simple class shows how we can reference the object name in the class definition. class Item def initialize(item_name) @item_name = item_name end def...
true
ab486bf735947481ad8da898ff29fa22d2ed02fb
Ruby
wangxx1412/jungle-rails
/spec/models/user_spec.rb
UTF-8
2,274
2.59375
3
[]
no_license
require 'rails_helper' require 'database_cleaner/active_record' DatabaseCleaner.strategy = :truncation RSpec.describe User, type: :model do subject { described_class.new(firstname: "joe", lastname:"doe", email:"test@test.com", password: ...
true
c14f9909765b61e205f4b91a66c1d53e33ac1665
Ruby
peter-grainger/GROK-ruby
/lib/challenges/exceptions.rb
UTF-8
189
2.71875
3
[ "MIT" ]
permissive
def execute_block(file, &block) yield block # rescue on StandardError # rescue on ZeroDivisionError # return "File Contents" if no errors happened # close the file whatever happens end
true
05e3586e535db3f6da407fbab23be1a1df3e2fe9
Ruby
m-kallstrom/phase-0-tracks
/ruby/shout.rb
UTF-8
1,221
4.03125
4
[]
no_license
#Declare module for emphasizing text #declare method for angry emphasis #declare method for happy emphasis module Shout def yell_angrily(words) words + "!!!" + " >:(" end def yell_happily(words) words + "!!!" + " :D!" end end #Add a class that would use the shout module angrily class Jerk incl...
true
6b7dd8a5ad1ff43b88aa7b99593a8a939e6cd0ec
Ruby
chen445/AA-Classworks
/W4D1/Knight's Travails/Knight's Travails.rb
UTF-8
1,652
3.828125
4
[]
no_license
require_relative "./00_tree_node.rb" class KnightPathFinder attr_reader :considered_positions , :root_node def initialize(pos) @root_node = PolyTreeNode.new(pos) @considered_positions =[pos] end def self.valid_moves(pos) x, y = pos possible_move=[[x+2,y+1],[x+2,y-1],[x+...
true
604d506b7a1cd3f7f80f4d2ae84a766d19c11a40
Ruby
CTC-PCOEdeSignage/PCOE-de-Signage-Rails
/app/services/event/limits.rb
UTF-8
857
2.890625
3
[]
no_license
class Event class Limits # Limit reservations X days in the future # Site-wide configurable default (e.g. 14 days) # Per-user configurable (overrides default) # Limit X number of events in the future # Site-wide configurable default (e.g. 1 event) # Per-user configurable (overrides default) ...
true
9caf9332f5b9140870237e965fc9b7b0650bcb53
Ruby
Avahey/summer_of_rails_2014
/week_2/person.rb
UTF-8
783
4.28125
4
[]
no_license
class Person attr_accessor :first_name, :last_name, :age def initialize(starting_first_name, starting_last_name, starting_age) @first_name = starting_first_name @last_name = starting_last_name @age = starting_age end # def first_name # @first_name #the @ sign means that it's a instance variable. #end ...
true
a1fe2f35d1aa2cd9e77d97fcba990d1e3550ff7a
Ruby
Bcdirito/algorithm_problems
/math/power_of_three/basic.rb
UTF-8
248
3.171875
3
[]
no_license
def is_power_of_three(n) prod = 1 power = 0 while prod <= n exp = 3**power if exp == n return true else prod = exp power += 1 end end return false end
true
b438df4c905376315ddd58fba832cfd169b7e2bd
Ruby
Bayonnaise/Design-Patterns
/2-strategy-pattern/lib/report.rb
UTF-8
660
3.109375
3
[]
no_license
class Report attr_accessor :formatter attr_reader :title, :text def initialize(&formatter) @title = 'Monthly report' @text = ['This month we', 'lost a shitload of cash.'] @formatter = formatter end def output_report @formatter.call(self) end HTML_FORMATTER = lambda do |context| puts '<html>' puts ...
true
8729a842f6f1375645e49a601d340dc4ea25f491
Ruby
TheMaxta/Ruby-From-Novice-To-Professional
/more_evals.rb
UTF-8
90
3.21875
3
[]
no_license
class MyClass def initialize @my_variable = "Hello, World!" end end obj = MyClass.new
true
a48e8ea92aa64ac7f6ade3db3d0206abf66786b7
Ruby
hspazio/dependency-breaking-in-ruby
/adapt_parameter.rb
UTF-8
1,496
3.21875
3
[]
no_license
# Use Adapt Parameter when you can't use Extract Interface on a parameter's # class or when a parameter is difficult to fake - M. Feathers # # In Ruby Extract Interface does not really apply due to dynamic typing. # Adapt Parameter is very similar to Extract Interface # original snippet. We would like to change 'par...
true
5debae938604af38d24fdac54466bc6873c2dbf5
Ruby
sattelbergerp/oo-banking-cb-000
/lib/transfer.rb
UTF-8
685
3.3125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Transfer attr_reader :sender, :receiver, :amount, :status def initialize(sender, receiver, amount) @sender = sender @receiver = receiver @amount = amount @status = "pending" end def valid? @sender.valid? && @receiver.valid? end def execute_transaction if !@sender.valid? || @sender.balance < ...
true
a7ac1df708455cae66a25db610b59b210044fa24
Ruby
ppjk1/chris-pines-learn-to-program
/ch06_deaf_gramma_01.rb
UTF-8
224
3.453125
3
[]
no_license
input = "" while input != "BYE" input = gets.chomp upcase_input = input.upcase if input != upcase_input puts "HUH?! SPEAK UP, SONNY!" elsif input != "BYE" puts "NO, NOT SINCE #{rand(1930..1950)}!" end end
true
af816ac67de0072d3096953dd70b338aedeafdad
Ruby
tarynsauer/sinatra_ttt
/spec/web_board_spec.rb
UTF-8
699
2.5625
3
[]
no_license
require 'spec_helper' describe 'WebBoard' do before :each do @board = WebBoard.new(3) @board.all_cells = {"1A"=>nil, "2A"=>'X', "3A"=>nil, "1B"=>nil, "2B"=>nil, "3B"=>nil, "1C"=>nil, "2C"=>nil, "3C"=>nil} end describe '#print_active_board' do it 'pr...
true
65149a5cc52834d8dc354ce178fbf7e753181c78
Ruby
kguerra96/programming-univbasics-nds-nested-arrays-iteration-lab-part-1-nyc01-seng-ft-100520
/lib/iteration_with_loops.rb
UTF-8
473
3.5
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def find_even_values(array_of_arrays) # Given an Array of Arrays of Integers ( [ [10, 11], [99, 50, 3, 4], [23, 41] ] ): # # Output all even values in each nested array count = 0 while count < array_of_arrays.length do inner_count = 0 while inner_count < array_of_arrays[count].length do if array...
true
a244a9eadcb390f435ca448611e4401a7ab381ba
Ruby
diana2341/ruby-enumerables-generalized-map-and-reduce-lab-nyc-web-021720
/lib/my_code.rb
UTF-8
300
3
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def map(array) new=[] i = 0 while i < array.length new << yield(array[i]) i+= 1 end new end def reduce(arr,starting_value=nil) if starting_value sum=starting_value i=0 else sum=arr[0] i=1 end while i < arr.length sum= yield(sum,arr[i]) i+= 1 end sum end ###NEED MORE PRACTICE
true
f05583d583cf5a6ce932e9fc343e1b00e95ac772
Ruby
FayeKeegan/w3d2
/question_like.rb
UTF-8
2,052
2.609375
3
[]
no_license
class QuestionLike attr_reader :id, :question_id, :author_id TABLE_NAME = "question_likes" extend Recordable include Recordable def self.find_by_id(id) query = QuestionsDatabase.instance.execute(<<-SQL, id) SELECT * FROM question_likes WHERE question_likes.id = ...
true
14439c0d93c8a17ef94d6d1b5d8cc975c91e152c
Ruby
spencerdcarlson/206
/06/LinkedList.rb
UTF-8
3,006
3.96875
4
[]
no_license
class Node attr_reader :data attr_reader :prev attr_reader :next attr_writer :next attr_writer :prev def initialize(data) @data = data end def self.dump(node) puts "===== #{self} =====" puts "Data: #{node.data}" if node.data puts "Prev: #{node.prev.data}" if node.prev put...
true
5e5d8719118371dc0f179caf5f5283990ce45dae
Ruby
anukhambete/RAILS_JS_PROJ
/app/helpers/itineraries_helper.rb
UTF-8
210
2.515625
3
[]
no_license
module ItinerariesHelper def current_user_likes_itins(user, itinerary) arr =[] user.likes.each do |like| arr << like.itinerary_id arr end arr.include?(itinerary.id) ? true : false end end
true
50369757d1466d6bd91cd2421284e881a2cc2a0e
Ruby
johnmcconnell/commaparty
/spec/commaparty/destructure_element_spec.rb
UTF-8
2,007
2.84375
3
[ "MIT" ]
permissive
require 'rspec' require 'commaparty/destructure_element' describe CommaParty::DestructureElement do describe 'Normalizing elements' do it 'destructures an element with tag only' do tag, attributes, body = described_class.new([:lol]).call expect(tag).to eq(:lol_) expect(attributes).to eq({}) ...
true
b7f9a41c8235c9cb02d1db2a104ff4ba3b705d2d
Ruby
gjtorikian/jekyll-config-variables
/_site/lib/configurer.rb
UTF-8
667
2.78125
3
[]
no_license
# encoding: UTF-8 def iterate(h, variables) h.each do |k, v| # If v is nil, an array is being iterated and the value is k. # If v is not nil, a hash is being iterated and the value is v. # value = v || k if value.is_a?(Hash) || value.is_a?(Array) iterate(value, variables) else va...
true
524eba8838bcccb673dbccf72fa0b41b2ec8c0ab
Ruby
luisplaz/phase-0
/week-5/group-research-methods/my_solution.rb
UTF-8
2,997
4.0625
4
[ "MIT" ]
permissive
#Research Methods # I spent [] hours on this challenge. i_want_pets = ["I", "want", 3, "pets", "but", "only", "have", 2] my_family_pets_ages = {"Evi" => 6, "Ditto" => 3, "Hoobie" => 3, "George" => 12, "Bogart" => 4, "Poly" => 4, "Annabelle" => 0} # Person 1's solution def my_array_finding_method(source, thing_to_fi...
true
16cb10b4fc92834bd3735292f0d49c2f5019c2d5
Ruby
jcreiff/exercisms
/ruby/space_age.rb
UTF-8
402
3.25
3
[]
no_license
class SpaceAge attr_reader :seconds, :on_earth def initialize(seconds) @seconds=seconds @on_earth=seconds/31557600.0 end def method_missing(planet) on_earth/ORBIT_LENGTHS[planet] end ORBIT_LENGTHS = {:on_mercury=>0.2408467, :on_venus=>0.61519726, :on_mars=>1.8808158, :on_jupiter=>11.86261...
true
a6bfe727170e3f982c238637bb18f0928f00950b
Ruby
bal360/reverse-each-word-denver-web-career-042219
/reverse_each_word1.rb
UTF-8
169
3.484375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def reverse_each_word(str) arr = str.split arr_reversed = [] arr.collect do |w| arr_reversed << w.reverse end arr_reversed.join (" ") end
true
d31b1890b352e8b53bab6a80437ebf906ed54810
Ruby
Rayxan/Programming_UNB
/Software Engeneer/Time.rb
UTF-8
942
3.71875
4
[]
no_license
# Note: Time.now returns current time as seconds since epoch class Fixnum def seconds ; self ; end def minutes ; self * 60 ; end def hours ; self * 60 * 60 ; end def ago ; Time.now - self ; end def from_now ; Time.now + self ; end end puts Time.now puts 5.minutes.ago puts 5.minutes - 4.minutes p...
true
85887f4689090958b83a1867bdc05195035c5190
Ruby
noroach/Ruby-Search-Engine-
/noroach-final/Word.rb
UTF-8
535
3.1875
3
[]
no_license
#Nolan Roach require 'fast-stemmer' class Word #attr_reader : attr_reader :word attr_reader :stem attr_reader :docFrequency attr_reader :docPositions #initializer def initialize(string) @word = string stemWord() @docFrequency = 1.0 @docPositions = Array.new end def stemWord(...
true
ac419e2c9af438b03b3ab64f885964327f2f84d9
Ruby
siva-prasad1960/ruby_book
/hashes_chapter7/specific_value_hash.rb
UTF-8
207
3.1875
3
[]
no_license
details = {name: "Siva", age: "30", height: "6ft", hobby: "coding"} if details.has_value?("Siva") puts "Value is present" else puts "Value is not present in hash" end
true
764f18de62a358d5939c86d3183bf62e909f9428
Ruby
timpbrenner/org_roles
/spec/models/role_spec.rb
UTF-8
984
2.53125
3
[]
no_license
require_relative '../../lib/models/role' require_relative '../../lib/models/user' describe Role do let(:user) { User.new } let(:admin_role) { Role.new user, Role::ADMIN } let(:user_role) { Role.new user, Role::USER } let(:denied_role) { Role.new user, Role::DENIED } describe '#new' do it 'populates user...
true
13c2a2afb037fc5487f2bf502f9c8e30c6be4cf2
Ruby
daukantas/jekyll-foundation-building-blocks
/lib/jekyll-foundation-building-blocks/kits.rb
UTF-8
832
2.546875
3
[ "MIT" ]
permissive
require 'jekyll-foundation-building-blocks/util' require 'colorator' require 'jekyll-foundation-building-blocks/blocks' module JekyllFoundationBuildingBlocks KITS_JSON_URL = "#{BLOCKS_ROOT}data/kits.json" module Kits def self.list Util.fetch_json(KITS_JSON_URL).each_with_index do |pair, i| key =...
true
1806b286559f2106f63dcd138258b3f3966fdc68
Ruby
nguyentrithuc/Guessing_letters
/admin.rb
UTF-8
1,505
3.859375
4
[]
no_license
class Admin private def password @password = "cavangxinhdep" end public def wrongpass return "Wrong password, the game has been exit automatically. Run the game again and try another password!" end def signin(input_password) if input_password == password puts "Sign in ...
true
08d07199ec80d6122be4fc0e0f70867172ac0f41
Ruby
bunnrf/ProjectEuler
/lib/47_distinct_primes_factors.rb
UTF-8
280
2.90625
3
[]
no_license
require 'prime' def distinct_primes_factors i = 647 found = false until found j = 0 while i.prime_division.length > 3 return i - 3 if j > 2 j+=1 i+=1 end i+=1 end end p distinct_primes_factors
true
44d9faee0dddda32073b7448eb4482f1dd7a40ac
Ruby
zhupeijun/Algorithm
/project_euler/009.rb
UTF-8
215
3.34375
3
[]
no_license
def solve for b in 0..1000 for a in 0...b c = 1000 - a - b break if a + b > 1000 or c <= b if a**2 + b **2 == c**2 return a * b * c end end end return -1 end puts solve
true
b873ad1c959b21d498c70e0b2c41148cbf99d2d9
Ruby
mark-kohrman/git_files
/whiteboarding.rb
UTF-8
1,191
4.15625
4
[]
no_license
# input1 = [1,2,4,6] # input2 = [5, 9, 8, 12] # output = [1,2,4,6, 5, 9, 8, 12] # iterate through first array and add each element to new empty array. iterate through 2nd array and do the same. # return the new array # def combine_arrays(array1, array2) # new_array = [] # array1.each do |number| # new_array ...
true
82d47a3bf86420486ede6950c38fb5485561b07e
Ruby
wardymate/codewars-kata
/count_the_likes/spec/liker_spec.rb
UTF-8
1,143
2.703125
3
[]
no_license
require 'liker' describe Liker do it "returns true for ['today','was','so','like','awesome']" do input = ['today','was','so','like','awesome'] expect(subject.eval_likes(input)).to eq true end it "returns false for ['yesterday','was','even','ummm','better']" do input = ['yesterday','was','even','umm...
true
5ed08d5d53a28c066e4a97b6123ccd992a383d3f
Ruby
maclarensg/challenge
/005-firstnonrepeating/firstnonrepeating_others.rb
UTF-8
151
3.328125
3
[]
no_license
def firstNotRepeatingCharacter(s) s.chars.uniq.each { |c| return c if s.chars.count(c) == 1} '_' end p firstNotRepeatingCharacter("abacabaabaaba")
true
fed430ebaf30e3111e4d9adaec1641516f39ca0d
Ruby
HighFibreDiet/doctors_office
/doctor_office.rb
UTF-8
6,708
3.375
3
[]
no_license
require './lib/doctor' require './lib/patient' require './lib/specialty' require './lib/insurance' require 'rspec' require 'pg' DB = PG.connect(:dbname => 'doctors_office') @current_patient @current_doctor @current_insurance @current_specialty def main_menu puts "****** Welcome to the Doctor's Office ******* " p...
true
c3e451eb67c14d6c6c79cdf8f05713b3f8b36b7f
Ruby
pablobm/kiva-loans
/lib/kiva_loans/loan.rb
UTF-8
515
2.875
3
[ "LicenseRef-scancode-public-domain" ]
permissive
class Loan attr_reader :lender_id, :lender_name, :lender_location, :borrower_name, :borrower_town, :borrower_country def initialize(data) @lender_id = data['lender']['lender_id'] @lender_name = data['lender']['name'] @lender_location = data['lender']['whereabouts'] @borrower_name = d...
true
184b76f5d738b14c9cb56e05f833f1122b2fa71d
Ruby
kiyanad/badges-and-schedules-dumbo-web-111918
/conference_badges.rb
UTF-8
516
3.859375
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def badge_maker(name) "Hello, my name is #{name}." end def batch_badge_creator(attendes) array = [] # a.each {|x| print x, " -- " } # attendes.each {|name| array << badge_maker(name)} array end def assign_rooms (attendes) room = [] attendes.each_with_index do |name, index| room << "Hello, #{name}! You'll...
true
2d5410d8d34631ff309981ce3edcdbcf0b3ddf78
Ruby
abdalkalk/my-first-cli-gem
/lib/cline.rb
UTF-8
1,244
3.703125
4
[]
no_license
require_relative "./city.rb" require_relative "./hotel.rb" require_relative "./scrap.rb" require 'colorize' class Cline CITY=["baghdad","erbil"] def start puts "+-----------------------------------+".yellow puts "| Welcome To Iraqi Hotels !!! |".yellow puts "+-----------------------------------+".yellow puts""...
true
c4fd2cec501c64a715ffff9107658508e8178d8d
Ruby
fevsantos/quizzical
/app/helpers/navigation_helper.rb
UTF-8
447
2.671875
3
[ "MIT" ]
permissive
module NavigationHelper def user_greeting if logged_in? "Good #{colloquial_time_of_day}, #{current_user.first_name}" else "" end end def colloquial_time_of_day case Time.now.strftime("%H").to_i when 1..11 "Morning" when ...
true