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
66999e2f2e0b4d8b29c19cbe7dc322a005533086
Ruby
lifeparticle/Bengali-Alphabet
/unicode/unicode.rb
UTF-8
719
2.78125
3
[ "MIT" ]
permissive
# Vowels (স্বরবর্ণ) [*2437..2443, *2447..2448, *2451..2452].map {|c| c.chr(Encoding::UTF_8)} # Numbers (সংখ্যা) [*2534..2543].map {|c| c.chr(Encoding::UTF_8)} # Consonants (ব্যঞ্জনবর্ণ) [*2453..2472, *2474..2480, 2482, *2486..2489, *2524..2525, 2527, 2510, *2433..2435].map {|c| c.chr(Encoding::UTF_8)} # Vowel Diacri...
true
1080da2e5df1b2c6bab28f0f60a0a27d1cece13c
Ruby
dalbinana/ironhack
/w2/MVC/todo_list/lib/todo_class.rb
UTF-8
1,786
3.0625
3
[]
no_license
require "yaml/store" class Task attr_reader :content, :id @@current_id = 1 def initialize(content) @content = content @id = @@current_id @@current_id += 1 @complete = false @created_at = Time.now.asctime end def created_at @created_at = Time.now.asc...
true
cb04c43ee00a5298410683f37ff980a3f591623c
Ruby
CodingMBA/ls_100
/ch1_the_basics/ch1_q3.rb
UTF-8
382
2.890625
3
[]
no_license
movie_years = { :one_flew_over_the_cuckoo_nest => 1975, :million_dollar_baby => 2004, :twelve_years_a_slave => 2013, :a_beautiful_mind => 2001, :chariots_of_fire => 1981 } puts movie_years[:one_flew_over_the_cuckoo_nest] puts movie_years[:million_dollar_baby] puts movie_years[:twelve_years_a_slave] puts movie...
true
fbf409da2bcb2d21223d35a8cad69d8d229c4132
Ruby
CruorVolt/mu_bbmap
/mutator/summarize_log.rb
UTF-8
607
2.796875
3
[ "Apache-2.0" ]
permissive
require 'optparse' live = 0 killed = 0 timeout = 0 File.open(ARGV[0], "r") do |input| lines = input.readlines for index in [0..lines.length] if lines[index].include? "time_out" timeout += 1 elsif lines[index].include? "test_addition_of_reads" and lines[index-1].include? "Fault exec...
true
dcfe9f6227c6fe8e6f18479b0f55f71a8078f2a8
Ruby
pengwynn/vedeu
/test/lib/vedeu/colours/background_test.rb
UTF-8
3,674
2.625
3
[ "MIT" ]
permissive
require 'test_helper' module Vedeu module Colours describe Background do let(:described) { Vedeu::Colours::Background } let(:instance) { described.new(colour) } let(:colour) {} before { Vedeu.background_colours.reset! } describe '#escape_sequence' do subject { insta...
true
da05c8a7151e27ec16f78d20f484190d81b4b382
Ruby
nworbiii/ruby
/participants.rb
UTF-8
813
3.421875
3
[]
no_license
class Politician attr_accessor :name, :party @@politicians = [] def initialize(name, party) @name = name @party = party @@politicians << self end def to_s "#{name} is a #{party}." end def self.all @@politicians end end class Person attr_accessor :name, :politics @@people...
true
00face9035748dc28d174fb9bcf071cd77034d74
Ruby
Akshaya-S18/Ruby-Files
/travelscal.rb
UTF-8
510
3.078125
3
[]
no_license
# Cars Travels details cars=100 space_in_a_car=4.0 drivers=30 passengers=90 cars_not_driven=cars-drivers cars_driven=drivers carpool_capacity=cars_driven*space_in_a_car average_passengers_per_car=passengers / cars_driven puts"There are #{cars} cars available." puts"There are only #{drivers} drivers availabl...
true
fa01646821adbf57515f2a19b5196bdaa1e47ccb
Ruby
jk1dd/classroom_exercises
/bubble_sort.rb
UTF-8
1,253
3.75
4
[]
no_license
require 'pry' class BubbleSort def sort(collection) # take an array # first element is assigned to previous, second is assigned to current # if current is less than previous, # current element is reassigned to previous element position # second element is assigned to current, third element is a...
true
f4063a3d21ac9c424a37c7d0bccf730b042b8955
Ruby
Sdcrouse/playlister-sinatra-v-000
/lib/library_parser.rb
UTF-8
1,908
3.359375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class LibraryParser def files data_path = File.join(File.dirname(__FILE__), '..', 'db', 'data') Dir.entries(data_path)[2..-1] end def self.parse self.new.call end def parse_filename(filename) artist_match = filename.match(/^(.*) -/) song_match = filename.match(/- (.*) \[/) genre_ma...
true
03ee31417c174fcf1748c55d30418cf1c6f6433a
Ruby
NUBIC/katas
/roman_numerals/roman_numerals.rb
UTF-8
435
3.390625
3
[]
no_license
class RomanNumeralError < StandardError ; end def to_roman_numeral(i) raise RomanNumeralError if i <= 0 [%w(1000 M), %w(900 CM), %w(500 D), %w(400 CD), %w(100 C), %w(90 XC), %w(50 L), %w(40 XL), %w(10 X), %w(9 IX), %w(5 V), %w(4 IV), %w(1 I)].map { |a, r| [a.to_i, r] }.inject(""...
true
7f94d937b8577df9a630710163761322cff15fa6
Ruby
dimiii/pingstat
/app/repository/redis.rb
UTF-8
1,839
2.828125
3
[]
no_license
require 'redis' require 'thread' require 'logger' require_relative '../domain' # Redis storage abstraction layer. class InRedis def initialize(driver, batch_size: 100) @driver = driver @results = Queue.new @batch_buffer = [] @batch_size = batch_size @logger = Logger.new(STDERR) @store_thread...
true
fc339ef09f999f7e951229792af13f7147fdc4a1
Ruby
cichlidx/ronco_et_al
/age_determination/ortholog_identification/src/add_mcc_tree_names.rb
UTF-8
786
2.890625
3
[]
no_license
# m_matschiner Mon Nov 19 17:06:55 CET 2018 # Get the command-line arguments. mcc_numbered_tree_file_name = ARGV[0] mcc_name_list_file_name = ARGV[1] mcc_named_tree_file_name = ARGV[2] # Read the mcc-tree file. mcc_tree_file = File.open(mcc_numbered_tree_file_name) mcc_tree_string = mcc_tree_file.read # Read the mcc...
true
a275ceb5c7fe537cbe11eb1af3ec0f6f9919cc5a
Ruby
jpenick/Odin
/GemSetter/learn_ruby/04_pig_latin/pig_latin.rb
UTF-8
473
3.34375
3
[]
no_license
def translate(phrase) vowels = "aeiou" phrase.split.map { |w| case w when /\A[aeiou]/ #vowel first w = w+"ay" when /\A[^aeiouq][aeiou]/ #con then vow w = w[1..w.length]+w[0]+"ay" when /\A[^aeiouq]{2}[aeiou]/, /\Aqu/ #2 cons or qu w = w[2..w.length]+w[0..1]+"ay" when /\A[^aeiouq]{3}/, /\A[^a...
true
2e4b1b17b8d7eab74a257ff304ec436cc66df762
Ruby
apiology/cs_refresh
/lib/cs_refresh/map.rb
UTF-8
596
2.859375
3
[]
no_license
require 'algorithms' # Code to refresh my memory of algorithms and data structures module CsRefresh SystemMap = Hash # My implementation of a hash table with separate chaining class HashTable def initialize(size) @arr = Array.new(size) @size = size end def bucket(key) key.hash % @...
true
ad1092fa2a46710ccbe8a72fa44b8195d3aa5eb9
Ruby
happymelonbox/prime-ruby
/prime.rb
UTF-8
1,340
3.359375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'benchmark' def prime?(int) if int < 2 return false else n = 2 while n < int return false if int % n == 0 n += 1 end true end end # def prime2?(int) # if int < 2 # return false # else # n = 2 # until n...
true
bf3f825d4a9f1fa3381f8460a0bf8ff1ce5f6233
Ruby
timrosenblatt/fun
/algorithms/markov/markovchain.rb
UTF-8
3,037
3.484375
3
[]
no_license
#!/usr/bin/env ruby -w args = Hash.new $*.each do |k, v| arg = k.split('=') args[arg[0]] = arg[1] end print args $minimum_size = args['minimum_size'] != nil ? args['minimum_size'].to_i : 10000 $order = args['order'] != nil ? args['order'].to_i : 4 def train(order) print "initializing training: o...
true
98e835bdfd97a67907c42538aa6451c8e5b889bb
Ruby
apopheny/RB100
/loops_2_08.rb
UTF-8
1,089
5
5
[]
no_license
# Only Even # Using next, modify the code below so that it only prints even numbers. number = 0 until number == 10 number += 1 if number.even? == true puts number else next #this is such a meaningless else end end =begin Solution number = 0 until number == 10 number += 1 next if number.odd? ...
true
5b083e6f4f1caf27f3665c1866594158a84e2c49
Ruby
luca-montaigut/Archives_THP
/2.2_exo_ruby/exo_19.rb
UTF-8
134
2.53125
3
[]
no_license
mails = [] 50.times do |i| mails += ["jean.dupont" + "#{"%02d" % (i+1)}" + "@email.fr"] if i % 2 != 0 puts mails[i] end end
true
55c3b5c19032180758bc5c9f54681c9a063fb8d5
Ruby
pyrmont/jekyll-tenji
/lib/tenji/config.rb
UTF-8
13,193
2.65625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# frozen_string_literal: true module Tenji # A store of the configuration options for Tenji # # @note This document describes the operation of the {Tenji::Config} class. # For information on how to configure Tenji, see {file:docs/Configuring.md}. # # {Tenji::Config} allows for transparent access to Tenj...
true
b1577d44190efa7dc4b6d0c82a92f89b39fa9d85
Ruby
dbcls/rdf-config
/lib/rdf-config/schema/chart/uri_node_generator.rb
UTF-8
5,785
2.578125
3
[ "MIT" ]
permissive
require 'rdf-config/schema/chart/constant' class RDFConfig class Schema class Chart class URINodeGenerator include Constant BEZIER_AREA = 8 BEZIER_CONTROL = 3.6 BEZIER_CONTROL_DIST = (BEZIER_AREA - BEZIER_CONTROL).round(1).freeze HLINE_WIDHT = (RECT_WIDTH - (BEZIER...
true
da3c321c4f55e847079bdcffad7e1966cb900303
Ruby
GemAWeek/episode1
/test/unit/business_test.rb
UTF-8
1,146
2.734375
3
[]
no_license
require 'test_helper' class BusinessTest < ActiveSupport::TestCase def setup @business = Business.new(name: "Google", street: "2400 Bayshore Parkway", city: "Mountain View", state: "CA", country: "United States") end test "should be valid with valid attributes" do assert @business.valid? end t...
true
7a9aa97ea35431e2719805a8f3d83bf66379b31b
Ruby
mharris717/netrunner_card_freq
/lib/cluster.rb
UTF-8
1,683
2.984375
3
[]
no_license
class CardCluster include FromHash attr_accessor :base_card fattr(:generic_breakdown) do CardBreakdown.new(faction: base_card.faction) end fattr(:specific_breakdown) do CardBreakdown.new(faction: base_card.faction, included_cards: [base_card]) end def make_comp(card) generic_perc = get_perc...
true
e10fd70b2a9151c3f1465529dc13c27c549458f9
Ruby
MarcusWalz/MakeRNAseq
/expirement/Rakefile
UTF-8
5,913
2.609375
3
[]
no_license
# TODO pull "exp_described.yml" to constant variable # # # For loading yaml parameter files require 'yaml' # Remotely Execute a command using slurm scheduler. def rSh(name, command, slurm_hash) salloc_commands = "" slurm_hash.each do |arg,val| salloc_commands << "--#{arg.to_s} #{val} " end myCommand = "sall...
true
5ef595e4a890a896db1457f8148a7348460e40c9
Ruby
Garland220/dices3
/dices3.rb
UTF-8
1,745
3.59375
4
[]
no_license
class Dices Dice = Struct.new( :count, :sides, :modifier ) Result = Struct.new( :rolls, :total ) Options = Struct.new( :multiMod, # Add modifier to for each dice rolled, instead of only once. :dropLowest, # Useful for quick character stats generation :dropHighest, # I d...
true
c56dd025e4cbc3739367ed263325e7a6e5d21e95
Ruby
muffatruffa/launch_school_ruby_challenges
/easy_1/sieve.rb
UTF-8
1,332
3.5625
4
[]
no_license
class Sieve def initialize(limit) @limit = limit end def primes # last index in array is the limit all_in_range = Array.new(@limit+1, true) prime = 2 while prime * prime <= @limit if all_in_range[prime] first_factor = prime while prime * first_factor <= @limit ...
true
140b5e1a62a0d3cd347ff771dbf5a3f7da964d33
Ruby
sneakin/CooCoo
/lib/coo-coo/trainer/batch_stats.rb
UTF-8
593
2.96875
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
module CooCoo module Trainer class BatchStats attr_reader :trainer attr_reader :batch attr_reader :batch_size attr_reader :total_time attr_reader :total_loss def initialize(trainer, batch, batch_size, total_time, total_loss) @trainer = trainer @batch = ba...
true
2a3af695e0a7d7b76f37d06789361072d5a300ca
Ruby
RRJ99/thanos
/lib/thanos/resources/character.rb
UTF-8
494
2.578125
3
[ "MIT" ]
permissive
module Thanos class Character attr_reader :id, :name, :description, :resource_uri, :urls, :thumbnail, :comics, :stories, :events, :series def initialize(args) @comics = args[:comics] @series = args[:series] @events = args[:events] @stories = args[:stories] @urls = args[:ur...
true
2ed8a83b122ff06cf8fc25e9b9126e6fef9d247a
Ruby
yamagh/atcoder.jp
/abc040/c/c.rb
UTF-8
355
3.09375
3
[]
no_license
#n=4 #a=[100, 150, 130, 120] #n=4 #a=[100, 125, 80, 110] #n=9 #a=[314, 159, 265, 358, 979, 323, 846, 264, 338] n=gets.to_i a=gets.split.map &:to_i MAX=1_000_000_000 mm=Array.new(n+2,MAX) mm[0]=0 (n-1).times do |i| mm[i+1] = [ mm[i+1], mm[i] + (a[i]-a[i+1]).abs ].min mm[i+2] = [ mm[i+2], mm[i] + (a[i]-a[i+2]).ab...
true
2a206c44b9400f4939ebfdf2f2a849de00946eb8
Ruby
lalalainexd/event-reporter
/command_parser.rb
UTF-8
1,774
3
3
[]
no_license
class CommandParser def self.parse args parts = args.chomp.split case parts[0] when 'load' then load_file :filename => parts[1] when 'help' then parts.length == 1 ? help : help( :commands => parts[1..-1] ) when 'find' then parts.length < 3 ? command_not_recognized : ( find part...
true
e7dce44a2e1608faadd2b184d161142a311368ff
Ruby
iwasaki-y/ruby-training
/Lesson6/month.rb
UTF-8
251
3.53125
4
[]
no_license
# -*- encoding: utf-8 -*- month = %w(Januarly February March April May June July August September October Novenber December) puts("月の数値で入力してください。") m = gets.to_i puts("#{m}月は英語で#{month[m - 1]}です。")
true
0108afafc7ae56d075f167a5f217417b1e0d79f1
Ruby
ColeW-Picaro/colebot
/Main.rb
UTF-8
3,278
3.3125
3
[]
no_license
=begin Filename: Main.rb Author: Cole Vohs Description: A script utilizing colebot.rb to maintain and utilize a markov chain dictionary with an authorized twitter account =end require_relative "colebot" require "optparse" def main # Process command line args # -u USER specifies a user # -d updates the u...
true
86ac4da4efb1dc275b593f018820e434ff3754a4
Ruby
alejodiaztorres/Hashes-y-APIs
/filtrando_un_hash.rb
UTF-8
330
2.96875
3
[]
no_license
ventas = { Octubre: 65000, Noviembre: 68000, Diciembre: 72000 } #=============Manera de filtrar ========= # ventas.map do |k,v| # puts v if v < 70000 # end # ======================================= # ============= CON METODO ================ def filtrando(ventas) ventas.group_by {|x| x.to_i > ...
true
f75072aa7e62b0dd2e0ab18a1aa558e3cb7719c0
Ruby
marissaorea/Rate-My-Teachers-App
/app/models/student.rb
UTF-8
3,539
2.90625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Student < ActiveRecord::Base belongs_to :school has_many :reviews has_many :teachers, through: :reviews def create_review teacher_choice = gets_teacher_choice(self.school_id) if teacher_choice.class == String teacher = Teacher.find_by(name: teacher_choice, school_id: self.school_id) w...
true
c4fd97e3fbf85c59be203be66d0d1ad37a1e92f9
Ruby
ayanko/watir-webdriver
/lib/watir-webdriver/elements/button.rb
UTF-8
1,610
2.765625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# encoding: utf-8 module Watir # # Class representing button elements. # # This class covers both <button> and <input type="submit|reset|image|button" /> elements. # class Button < HTMLElement # add the attributes from <input> attributes Watir::Input.typed_attributes VALID_TYPES = %w[button ...
true
7d7d0096876eeaf69fbd4ded112fa3c57cc31721
Ruby
Charlie64N7/d.atm
/datm/OWL_server/OWL.rb
UTF-8
1,717
2.765625
3
[ "MIT" ]
permissive
class OWL ARDUINO_CONNECTION_DELAY = 4 DISCARD_PORTS = ["/dev/tty.Bluetooth-Incoming-Port", "/dev/cu.Bluetooth-Incoming-Port", "/dev/cu.UEBOOM-LWACP", "/dev/tty.UEBOOM-LWACP", "/dev/tty.debug-console", "/dev/cu.debug-console", ...
true
d81e24f8064c2ccf851f7c78ac36060fbcb83c4c
Ruby
relentless/SevenLanguages
/Ruby/Day 2/self-study.rb
UTF-8
232
3.984375
4
[]
no_license
# Hash to array { :one => "one", :two => 2 }.to_a # Array to Hash myHash = Hash.new ["one", 2].each_with_index {|item, index| myHash[index] = item} puts myHash # Iterate a hash { :one => "one", :two => 2 }.each {|item| puts item}
true
6309bf4c89a2bc2e7cef202b3960e9858f9404ee
Ruby
peterbucci/MatchPuzzle
/player.rb
UTF-8
124
3.296875
3
[]
no_license
class Player def get_input(message = "Enter a position (e.g., 1,2)") puts "" puts message gets.chomp end end
true
781deecff2e645c91fd48114e1a56376255faa80
Ruby
CreativeHandle/bayonetta_tools
/lib/bayonetta/tools/pkz_extractor.rb
UTF-8
1,236
2.609375
3
[ "BSD-2-Clause" ]
permissive
require 'optparse' require 'zstd-ruby' require_relative '../../bayonetta' $options = { output: nil } OptionParser.new do |opts| opts.banner = <<EOF Usage: pkz_extractor [pkz_file [pkz_file2 ...]] EOF opts.on("-h", "--help", "Prints this help") do puts opts exit end opts.on("-o", "--output=dirname",...
true
1959b8ed08836c2b408749ffe00ab07136ae189a
Ruby
ChrisBrandhorst/adventofcode
/2018/12/main.rb
UTF-8
2,396
2.953125
3
[]
no_license
GROUP_SIZE = 5 data = File.readlines("input") pots = data[0].match(/[#.]+/)[0].split('') spread = data.slice(2...data.size).map{ |s| s.match(/([#.]+) => ([#.])/).captures }.inject({}){ |h,s| h[s.first] = s.last; h } def next_state(pots, spread, i) spread[pots.slice(i-2, GROUP_SIZE).join('')] || '.' end def next_ge...
true
8d4611ba2576f06b6a71f51ceb01adb515deacb5
Ruby
Kloadut/moulinette
/yunohost/ldap.rb
UTF-8
1,811
2.640625
3
[]
no_license
# encoding: UTF-8 require 'rubygems' require 'net/ldap' class YunoHostLDAP attr_accessor :ldap def initialize @ldap = Net::LDAP.new(:host => "localhost", :port => "389") @ldap.auth "cn=admin," + LDAPDOMAIN, LDAPPWD unless @ldap.bind puts ERROR + "" + @ldap.get_operation_result.message exit @ldap.ge...
true
7e1afdcb47de52209cbbcb9dfa81be3d22a752fe
Ruby
sheehan1102/game_of_life
/lib/cell.rb
UTF-8
452
3.1875
3
[]
no_license
class Cell attr_reader :coordinates attr_accessor :state, :live_neighbors REACTIONS = { 0 => 0, 1 => 0, 2 => 1, 3 => 1, 4 => 0, 5 => 0, 6 => 0, 7 => 0, 8 => 0 } def initialize(state, live_neighbors, coordinates = [0,0]) @state = state @live_neighbors = live_neighbors @coordinates = coordi...
true
ef55097d4d5e7b2aabfa8de4914d9110a83f5cdb
Ruby
Chytoudis/version2
/compare_strings.rb
UTF-8
477
2.875
3
[]
no_license
# /\ARuby/ Match "Ruby" at the start of a string def compare_strings(text) property :myString, String, :length => 1024 #property :forms, String, :length => 256 myString = text.to_s testString = String.new(myString) myString.each_char {|c| print c, '' } if myString.nil puts "Your " + text...
true
14ea3640e828bd0cfab66de608f1ef2fcc837086
Ruby
joannayhs/she-bnb-backend
/app/models/reservation.rb
UTF-8
773
2.59375
3
[]
no_license
class Reservation < ApplicationRecord belongs_to :user belongs_to :listing validates :start_date, :end_date, :num_of_guests, presence: true validate :start_date_in_the_past, :end_date_after_start_date, :too_many_guests def start_date_in_the_past if self.start_date < Date.today ...
true
59ce8ef86a64bfb347ddfbd786ead6f997067566
Ruby
robertmkhall/ruby-bootcamp
/tasks/conditional_statements_task3.rb
UTF-8
218
3.703125
4
[]
no_license
def fibonacciComputer fibSeq = [0,1] (1..98).each do |index| fib = fibSeq[index-1] + fibSeq[index] fibSeq << fib end fibSeq end puts "Fibonacci sequence for first 100 numbers: #{fibonacciComputer}"
true
e3fc7701c524d9f932147361cbadd2c9c066a0a6
Ruby
alainravet/fail_fast
/spec/_/support/stdout.rb
UTF-8
144
2.703125
3
[ "MIT" ]
permissive
class ExitTriggered < StandardError ; end module Kernel def exit(param=nil) raise ExitTriggered.new('Kernel.exit was called') end end
true
02c83715b0f9020c058374645350b83272b76f6b
Ruby
TimothyFell/backend_prework
/day_3/newStory.rb
UTF-8
3,001
4.03125
4
[]
no_license
puts "You walk into a room. There is a rack on the wall with a number of medieval weapons on it and a sign that says 'Pick Two'." puts "1. Longsword" puts "2. Spear" puts "3. Mace" puts "4. Shield" print "Choice #1: " weapon1 = $stdin.gets.chomp.to_i print "Choice #2: " weapon2 = $stdin.gets.chomp.to_i weapons = ["Lo...
true
b062d4add354ecbbc763c3b4345f800c73181f01
Ruby
Khadija-Asa/6-exo-ruby
/exo_6.rb
UTF-8
2,899
3.9375
4
[]
no_license
#exo 6 - Le chiffre est bon, consonne #Dans le cadre de son activité, la société de crédit *PAIETONPRET* a besoin de contrôler le numéro de SIRET des sociétés clientes de leur solution. #Pour cela, elle a, au moment de la saisie par un membre de l’équipe, besoin de contrôler que le membre a bien saisie le numéro de SIR...
true
4afb3b08966c3b51b773b77dd437a1ef71660082
Ruby
marcwright/WDI_ATL_1_Instructors
/REPO - DC - Students/w01/d03/Elaine/dirty_words.rb
UTF-8
415
3.359375
3
[]
no_license
dirty_words = ['pee', 'poop', 'she-dog', 'phallus', 'fornicate', 'frack'] puts "Go ahead, say your worst:" input = gets.chomp.downcase words = input.split(" ") publish = true words.each do |word| dirty_words.each do |dirty_word| if word == dirty_word publish = false end end end if publish == fals...
true
aca6a4c6dcb8b61cb90797701df70d86eb33dcb5
Ruby
wilg/lorraine
/lib/lorraine/command.rb
UTF-8
5,220
2.796875
3
[ "MIT" ]
permissive
module Lorraine require "thor" require "thin" class CommandLine < Thor desc "testpattern", "Display a test pattern." def testpattern say "nice to meet you", :red ask("What is your favorite Neopolitan flavor?", :limited_to => ["strawberry", "chocolate", "vanilla"]) puts...
true
35b488653c03968595b1468496953742cd5686df
Ruby
steven-hash/ruby_testing
/lib/04_simon_says.rb
UTF-8
1,437
4.03125
4
[]
no_license
# should echo, afficher le contenue du parametre hello def echo(hello) return hello end #should shout , mettre en majuscule les text entrer def shout (text) text = text.upcase return text end #should repeat , repeter def repeat(text , num=2) #text = text.chars val = "" i = 0 for i in (1...
true
638de8c23b8cfd39a81a2f8a95857e119d739a64
Ruby
destiny-index/refactoring-ruby
/src/change_value_to_reference.rb
UTF-8
1,270
3.375
3
[]
no_license
# class Customer # attr_reader :name # # def initialize(name) # @name = name # end # end # # class Order # def initialize(customer_name) # @customer = Customer.new(customer_name) # end # # def customer=(customer_name) # @customer = Customer.new(customer_name) # end # # def customer_name # ...
true
2e8d787874f54be069a0307a85c1cf8757fad289
Ruby
smartyjpark/coderbyte-with-ruby
/FirstFactorial.rb
UTF-8
248
3.203125
3
[]
no_license
def FirstFactorial(num) a = num while a>1 a = a-1 num = num*a end # code goes here return num end # keep this function call here # to see how to enter arguments in Ruby scroll down FirstFactorial(STDIN.gets)
true
45042df60ea5f9c7a95524d91b4bedddd04a91b7
Ruby
gsisson/ruby_lib
/lib/required.rb
UTF-8
1,781
2.734375
3
[]
no_license
# 'required' is like 'require', but prints out the essential useful # information when the required file can't be found (rather than just # throwing an exception with a stack trace). To do this, you need to # pass the name of the gem that the required file is from # example usage: # require 'required' # required ...
true
434eda7582f24ad68efa6323d82e091e58ea2ddb
Ruby
calvached/time_logger
/lib/database.rb
UTF-8
2,411
3.203125
3
[]
no_license
require 'parser' require 'employee' require 'admin' require 'client' class Database attr_reader :users_file, :clients_file, :pto_file, :billable_file, :non_billable_file def initialize(files) @users_file = files.fetch(:users_file) @clients_file = files.fetch(:clients_file) @pto_file = files.fetch(:pto...
true
16cb40cb0001edcf95eaf7b7625ec08e62927e90
Ruby
wallaby-rails/wallaby-active_record
/lib/adapters/wallaby/active_record/model_service_provider/querier/transformer.rb
UTF-8
4,135
2.609375
3
[ "MIT" ]
permissive
# frozen_string_literal: true module Wallaby class ActiveRecord class ModelServiceProvider class Querier # Build up query using the results class Transformer < Parslet::Transform SIMPLE_OPERATORS = { # :nodoc: ':' => :eq, ':=' => :eq, ':!' => :n...
true
833a675ef4b4cb26ab41f32fb63785c4d8582f01
Ruby
MLee21/Sales_Engine
/lib/item_repository.rb
UTF-8
2,631
3.015625
3
[]
no_license
require_relative 'parser' require_relative 'item' require 'pry' require 'bigdecimal' class ItemRepository attr_reader :items, :filename, :sales_engine def self.load_csvs(filename, sales_engine) repo = self.allocate() parser = Parser.new(filename) items = parser.parse.map d...
true
78239d4c553827e6c06fb980dfe97b0638e8e090
Ruby
SciRuby/gnuplotrb
/lib/gnuplotrb/animation.rb
UTF-8
4,088
2.71875
3
[ "MIT" ]
permissive
module GnuplotRB ## # Animation allows to create gif animation with given plots # as frames. Possible frames: Plot, Splot, Multiplot. # More about its usage in # {animation notebook}[http://nbviewer.ipython.org/github/dilcom/gnuplotrb/blob/master/notebooks/animated_plots.ipynb]. # # == Options # Animati...
true
a0f5b7e2f0a42c155bfb7b75e5d4eb67c25687d3
Ruby
ASUKA-1992/new_age
/app/controllers/members_controller.rb
UTF-8
11,725
2.578125
3
[]
no_license
class MembersController < ApplicationController def index login_required @members = Member.order("id") end def show login_required redirect_to action: 'index' end #公開データ取得 def get_show_csv(member_id, ret_file_name_flg) #退会済みメンバーの場合は、空文字を返却 member = Member.find(member_id) if me...
true
72a6ae285f4b20d65f3ce03574cdedd7f0e899ae
Ruby
samworrall/chitter-challenge
/spec/peep_spec.rb
UTF-8
1,078
2.75
3
[]
no_license
require 'peep' require 'pg' describe Peep, :peep do let(:peep) { Peep.new('Hello World!', 'Sam Worrall') } describe '#all' do it 'Returns an array of peep hashes' do connection = PG.connect(dbname: 'Chitter_test') connection.exec("INSERT INTO peeps (text, author) VALUES('Hello World!', 'Sam Worral...
true
ad882abc8068605ed5e75101fe236fd4def4a8fa
Ruby
Hkly/habitrack
/app/models/user.rb
UTF-8
2,138
2.546875
3
[]
no_license
# == Schema Information # # Table name: users # # id :integer not null, primary key # username :string(255) not null # email :string(255) not null # password_digest :string(255) not null # session_token :string(255) not null # created_at :datetime ...
true
91584828bb2284303327ab7caa0629e761e46d7d
Ruby
benbristow/agile-timer
/lib/participant.rb
UTF-8
318
3.09375
3
[ "MIT" ]
permissive
class Participant def initialize(name:) @name = name end def name @name end def speak_name_out_loud!(random_voice: false) if random_voice system("say -v #{Voice.random} 'Please can #{name} start driving'") else system("say 'Please can #{name} start driving'") end end end
true
b613cc4684b1d3cf59df3c9cba9fb9501ff9f0f7
Ruby
locky5/simple-blackjack-cli-nyc-web-051319
/lib/blackjack.rb
UTF-8
1,110
4.0625
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def welcome puts "Welcome to the Blackjack Table" end def deal_card rand(11)+1 end def display_card_total(card_total) puts "Your cards add up to #{card_total}" end def prompt_user puts "Type 'h' to hit or 's' to stay" end def get_user_input gets.chomp end def end_game(card_total) pu...
true
d102f45bcd043c61d26c725d16642a459fb4d108
Ruby
george2kra/rainfallcollection
/collectraindetails.rb
UTF-8
12,045
3.765625
4
[]
no_license
require 'csv' require 'terminal-table' require 'artii' =begin Rianfall collection challange: 1. Enter rainfalls for several months for different places. 2. Compare rainfalls between places for a particular month 3. Graph the rainfall as a bar chart The process: 1. view current rainfall entries from the C...
true
4fb6d56377a12c8e4c9252b907a13c8b4551ac0b
Ruby
kodekaren/elephant_journal_cli
/lib/elephant_journal_cli/cli.rb
UTF-8
917
3.453125
3
[ "MIT" ]
permissive
#my cli controller class ElephantJournalCli::CLI def call list_posts reader goodbye end def list_posts puts "Top 3 posts on Elephant Journal Today:" @posts = ElephantJournalCli::Post.today @posts.each.with_index(1) do |post, i| puts "#{i} - #{post.title} - Written by #{post.author...
true
30ed83e7ee66953db63f1ad1c059fc1efcc806e5
Ruby
ceddlyburge/dijkstra-ish
/network_topology_parser.rb
UTF-8
1,441
3.359375
3
[]
no_license
require_relative 'network_topology' class NetworkTopologyParser # expecting an array of "AB2" type strings here, where "A" is the from location, "B" is the to location and "2" is the distance # returns a NetworkTopology def parse(from_to_distances_as_single_chars) @from_to_distances_as_single_chars = from_to...
true
37bf4fdc888431492bce63d3bfd0610fcd39a5df
Ruby
xiz-kak/vvf
/app/models/concerns/number_formatter.rb
UTF-8
625
2.5625
3
[]
no_license
module NumberFormatter extend ActiveSupport::Concern # Add zeros at the tail def to_currency_z(val, currency=:usd) if currency == :usd ApplicationController.helpers.number_with_precision(val, precision: 2, separator: '.') else val en...
true
5861b956e693a4901a77606eb1bacec7fcb22872
Ruby
kulpreet/authlogic
/test/crypto_provider_test/sha256_test.rb
UTF-8
1,056
2.546875
3
[ "MIT" ]
permissive
require 'test_helper' module CryptoProviderTest class Sha256Test < ActiveSupport::TestCase def test_encrypt assert Authlogic::CryptoProviders::Sha256.encrypt("mypass") end def test_matches hash = Authlogic::CryptoProviders::Sha256.encrypt("mypass") assert Authlogic::CryptoProviders...
true
d251407193d59102636a61ed7d045f0e396f24a6
Ruby
psaikko/AdventOfCode2018
/8/root.rb
UTF-8
820
3.15625
3
[]
no_license
tree_arr = $<.gets.split.map(&:to_i) p tree_arr def parse(tree_arr, i) n_children = tree_arr[i] i += 1 n_meta = tree_arr[i] i += 1 child_values = [] p "#{n_children} #{n_meta}" for child in 1..n_children do i, v = parse(tree_arr, i) child_values << v end p "#{n_c...
true
cc5a5144e2d66f96faa14b6e5b9668c63798b90f
Ruby
skorks/hanoi
/lib/iterative_hanoi.rb
UTF-8
2,637
3.3125
3
[]
no_license
class IterativeHanoi include HanoiHelpers EVEN_PARITY = "even" ODD_PARITY = "odd" def initialize(options={:discs => 8}) @discs = options[:discs] @pegs = {:from => [], :to => [], :pivot => []} @peg_array = [@pegs[:from], @pegs[:to], @pegs[:pivot]] @discs.downto(1) do |num| @pegs[:from] <...
true
8bc42ec4e3fee2ede3a1b7393f9643317b4e0057
Ruby
heatherherrington/BankAccounts
/owner.rb
UTF-8
1,949
3.734375
4
[]
no_license
# require_relative 'account' require 'csv' module Bank class Owner attr_accessor attr_reader :id, :first_name, :last_name, :street_address, :city, :state attr_writer def initialize(owner_hash) @id = owner_hash[:id] @first_name = owner_hash[:first_name] @last_name = owner_hash[:last...
true
ddbb01473db50322e4e50da20463598ababdea34
Ruby
bradpsheehan/coffee-flopper
/spec/models/address_spec.rb
UTF-8
2,097
2.5625
3
[ "MIT" ]
permissive
require 'spec_helper' describe Address do before do Geocoder.configure(:lookup => :test) Geocoder::Lookup::Test.add_stub( "CO 80204", [ { 'latitude' => 40.7143528, 'longitude' => -74.0059731 } ] ) Geocoder::Lookup::Test.add_stub( "1062 Del...
true
cd4e1a9fb52526c13a49bddc626255c1ab5e8f4d
Ruby
nishacodes/todos
/todo16/todo16_spec.rb
UTF-8
222
2.609375
3
[]
no_license
require "./todo16" describe "#count" do it "should return a hash that counts each element" do test = ["hey", "hi", "hey", 1, 1, "bye"] count(test).should eq({"hey" => 2, "hi" => 1, 1 => 2, "bye" => 1}) end end
true
c84a213209904fe61aa4a1152c5bc832db63b8e8
Ruby
pennymac/velocify
/lib/velocify/response_reader.rb
UTF-8
1,814
2.953125
3
[ "MIT" ]
permissive
require 'active_support/core_ext/string/inflections' module Velocify class ResponseReader class << self # Convenience method to create a ResponseReader # # @param kind [Symbol] Choose from [:field] # @param response [Hash] The SOAP response received as returned by the other # Veloci...
true
1eca9fe9888812b4b2cfe287a5e077e6d2d158b9
Ruby
alakijaayo/Raindrops
/lib/factor.rb
UTF-8
329
3.625
4
[]
no_license
class Factor def check_number(n) output = "" output << "Pling" if pling?(n) output << "Plang" if plang?(n) output << "Plong" if plong?(n) output.empty? ? "#{n}" : output end private def pling?(n) n % 3 == 0 end def plang?(n) n % 5 == 0 end def plong?(n) n % 7 == 0 ...
true
fa15809e48a534473dac93dc1a12a6f269fef20d
Ruby
Sid-ah/hk-bc
/ruby-drill-enumerable-methods-challenge/working_with_enumerables.rb
UTF-8
1,356
3.5
4
[]
no_license
def containing_quotes(sentences) sentences_with_quotes = [] sentences.each do |sentence| sentences_with_quotes << sentence if contains_quote?(sentence) end sentences_with_quotes end def balance(expenses, starting_balance) remaining_balance = starting_balance expenses.each do |expense| remaining_...
true
310b8c8e0ded43ba055e83886ab1572c990a9e07
Ruby
NickyEXE/020121-Intro-to-Arrays-And-Iteration
/basics.rb
UTF-8
1,700
4.4375
4
[]
no_license
require 'pry' ### ARRAYS ### # What are arrays? # Ordered lists of objects # indexed with an integer # a built in data structure in Ruby # array construction empty_array = [] number_array = [ 1, 2, 3, 4 ] string_array = ["Monica", "Tina", "Rita", "Lou Bega"] random_array = ["Monica", 3, false, nil, [1, "ch...
true
f62f033fdb6bd987224bb4a1e9f1a245f327e10d
Ruby
billyacademy/ruby-practice
/uniques.rb
UTF-8
205
3.390625
3
[]
no_license
def uniques(string) array = string.split(',') arrayb = [] array.each do |num| if !arrayb.include?(num) arrayb << num end end p arrayb.join(',') end uniques('1,1,1,2,2,3,3,3,4,4')
true
b37f7ccfbd2878301a24b6c2c26ae08edcf4d16c
Ruby
marjaimate/bintree
/bintree.rb
UTF-8
1,999
4.25
4
[]
no_license
# Binary Serch Tree implementation in Ruby # * Insert # * Min # * Max # * Delete # * Storage and read class Node # Represent the left and right branches of the node attr_accessor :left, :right, :value # init the node with a single value def initialize(value) @value = value end def insert(new_node) ...
true
fbc0b25e5c6882b2a792a4d61325d4a8c546475f
Ruby
AjaAdams/practice_ruby
/store/main.rb
UTF-8
835
3.6875
4
[]
no_license
require "./shirt.rb" require "./food.rb" # shirt1 = { :type => "short-sleeve", :color => "black", :size => "small", :price => 15 } # shirt2 = { :type => "long-sleeve", :color => "grey", :size => "medium", :price => 20 } # shirt3 = { :type => "quarter-sleeve", :color => "red", :size => "large", :price => 30 } # puts "T...
true
06f1c62dbe259b64e814f8e2b523c9728094ba11
Ruby
mpoppy/ttt-game-status-online-web-sp-000
/lib/game_status.rb
UTF-8
2,083
4.09375
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# Helper Method #require 'pry' def position_taken?(board, index) !(board[index].nil? || board[index] == " ") end # Define your WIN_COMBINATIONS constant WIN_COMBINATIONS = [ [0,1,2], [3,4,5], [6,7,8], [0,3,6], [1,4,7], [2,5,8], [0,4,8], [2,4,6] ] board = [" ", " ", " ", " ", " ", " ", " ", " ", " "...
true
265a6f126a464c3134b71cc39b31d554ec6f8c1b
Ruby
SebaRaimondi/Facultad
/Ruby/Practica-03/P03E05.rb
UTF-8
471
3.5
4
[]
no_license
def expansor(str) def param?(str) raise 'La entrada no es un string' unless str.is_a? String raise 'El string es vacio' if str == '' raise 'El formato del string es incorrecto' unless str !~ /[^a-zA-Z]/i end # Creo un array con las letras arr = ('a'..'z').to_a # Creo un hash del estilo {'a' => 1...
true
f5c7f0ed5b9a863a245cce4cb51d2610537ead2f
Ruby
MrAaronOlsen/VoltSuite
/lib/contact/components/point.rb
UTF-8
212
2.765625
3
[]
no_license
module Volt module Contact class Point attr_reader :point def initialize(point) @point = point end def to_s "Point".blue + ": #{@point}" end end end end
true
aedef8a0e6b65dc42b22de06238d42f3922b58d2
Ruby
gbourdon/serverside-pool
/sender.rb
UTF-8
198
2.625
3
[]
no_license
require 'socket' require_relative "core.rb" test = Client.new loop do print "> " message = gets.chomp break if message == "|exit" test.send_message message unless message == "" end
true
0dd47ec6f5180c17552af0fb0932306ad189cd8f
Ruby
AZubovich/tournament
/app/services/service_tour.rb
UTF-8
3,001
2.671875
3
[]
no_license
module ServiceTour class << self def create_regular_games(tour) amount = tour.players.count - 1 players = tour.players.to_a (0...amount).each do |i| (i + 1..amount).each do |j| task = Task.offset(rand(Task.count)).first create_game(players[i].nick_name, players[j].nic...
true
46bfe067a0a19d0283a09e2e2dd626454ebd9b88
Ruby
Nouran96/Ruby_Labs
/Lab_1/complex.rb
UTF-8
2,147
4.28125
4
[]
no_license
#!/usr/bin/env ruby #### Script to add or multiply complex numbers class ComplexNumber attr_reader :real, :imag @@counts = { "add_count" => 0, "mult_count" => 0, "bulk_add_count" => 0, "bulk_mult_count" => 0 } def initialize(real, imag) @real = real @imag = imag end def +(cn) real_sum = self.re...
true
31b0a39e912a2796453c90acf409e6706ddebd9e
Ruby
myGrid/methodbox
/vendor/plugins/acts-as-taggable-on/spec/acts_as_taggable_on/tag_spec.rb
UTF-8
591
2.515625
3
[ "MIT", "BSD-3-Clause" ]
permissive
require File.dirname(__FILE__) + '/../spec_helper' describe Tag do before(:each) do @tag = Tag.new @user = TaggableModel.create(:name => "Pablo") end it "should require a name" do @tag.should have(1).errors_on(:name) @tag.name = "something" @tag.should have(0).errors_on(:name) end ...
true
08da24b77fdc4c88829b557dae549e87d20b95ed
Ruby
orocos-toolchain/utilrb
/test/test_kernel.rb
UTF-8
12,021
2.65625
3
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
require 'utilrb/test' require 'flexmock/minitest' require 'tempfile' require 'utilrb/kernel' class TC_Kernel < Minitest::Test # Do NOT move this block. Some tests are checking the error lines in the # backtraces DSL_EXEC_BLOCK = Proc.new do real_method if KnownConstant != 10 ra...
true
0a370eaba9a9f956b38f1180a4e429ed116a8d66
Ruby
jp/scripts
/threaded_uploader.rb
UTF-8
2,650
2.8125
3
[]
no_license
require 'fog' require 'thread' require 'optparse' options = {} OptionParser.new do |opts| opts.banner = "Usage: s3uploader.rb [options] [directories|files]" opts.on('-a', '--access-key ACCESS_KEY', 'Access key') { |v| options[:aws_access_key_id] = v } opts.on('-s', '--secret-key SECRET_KEY', 'Secret key') { |v|...
true
726139aa5d86dcd6d1d9440c86f7306f0cd0fd0a
Ruby
alexturek/conway-life
/conway-visualization.rb
UTF-8
745
2.546875
3
[ "MIT" ]
permissive
require 'sinatra' require 'sinatra-websocket' require 'json' set :server, 'thin' set :sockets, [] get '/' do erb :index end def send_all(msg) EM.next_tick { settings.sockets.each { |s| s.send(JSON.generate(msg)) } } end def redraw_board(w, h, cells={}) send_all( redraw: true, width: w.to_i, ...
true
3f865f5ec8b2903e715a3d2ba4ca4bc93f5ef8a3
Ruby
davidmorton0/chemistry_quiz
/lib/symbol_question.rb
UTF-8
1,311
3.40625
3
[]
no_license
class SymbolQuestion include ChemicalData ANSWERS = 4 def symbol_question(question_index) { prompt: "What is the chemical symbol for #{ELEMENT[question_index][:name]}?", correct_answer: ELEMENT[question_index][:symbol], answers: make_answers(ELEMENT[question_index][:name], ELEMENT[ques...
true
5645bf42bf12e2bc6f8ae5144e9a4d0d26c42158
Ruby
doumsdd/premiercommit
/exo_03.rb
UTF-8
287
3.953125
4
[]
no_license
#2.3. Un programme qui calcule des âges #Écris un programme exo_03.rb qui demande son année de naissance à l'utilisateur, puis qui ressort l'âge que l'utilisateur a eu en 2017. print " year birth " birth = gets.chomp.to_i 2017_age = 2017 - birth puts " you had #{2017_age} in 2017 "
true
ba121393a1c3ad313c3a520a02408b8774edcd4f
Ruby
ShujaatAzim/CoursesRailsApp
/db/seeds.rb
UTF-8
715
3
3
[]
no_license
print "Seeding..." student1 = Student.create(name: "Shu", age: 32) student2 = Student.create(name: "Arthur", age: 32) student3 = Student.create(name: "Omar", age: 31) course1 = Course.create(name: "Biology") course2 = Course.create(name: "Programming") course3 = Course.create(name: "History") course4 = Course.create(...
true
bd91f57079221ffb5cfd27b71ae62e950f8d6d67
Ruby
Mr-Noob117/Scripts-Ruby
/organizer.rb
UTF-8
535
2.5625
3
[]
no_license
arrBags = [] class Tours attr_accessor :filename, :title def initialize(filename, title) @filename = filename @title = title end end Dir.glob("versao-online/*.xml") do |filename| f = File.open(filename) /title="([^"]+)"/ =~ f.first arrBags << Tours.new(filename[14..(filename.size - 1)],$1) end superstri...
true
b1f4674a11a8f16e8c33395862d3203fc86e4a40
Ruby
mkenane/advanced-hashes-hashketball-dc-web-031218
/hashketball.rb
UTF-8
4,170
3.015625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require "pry" def game_hash games_hash = { :home => { :team_name => "Brooklyn Nets", :colors => ["Black", "White"], :players => { "Alan Anderson" => { :number => 0, :shoe => 16, :points => 22, :rebounds => 12, :assists => 12, :steals => 3, ...
true
a5b0cfacce18235a852e8da31a0602d869668099
Ruby
usamaeltmsah/Tic-Tac-Toe-AI
/lib/tic_tac_toe_node.rb
UTF-8
1,254
3.515625
4
[]
no_license
require_relative 'tic_tac_toe' class TicTacToeNode attr_reader :board, :next_mover_mark, :prev_move_pos def initialize(board, next_mover_mark, prev_move_pos = nil) @board = board @next_mover_mark = next_mover_mark @prev_move_pos = prev_move_pos end def win_childern?(mark) children.any? { |chil...
true
91441ae4c96e85267504864048597b6454afc0eb
Ruby
suhai/theFinal5wks
/wkof0605/w2d4/API/json/script.rb
UTF-8
130
2.671875
3
[]
no_license
require 'json' pets = File.open("pets.txt", "r") doc = "" pets.each do |line| doc << line end pets.close puts JSON.parse(doc)
true
6e344665d7cd15c72759b9aa8e0eb311cb664e74
Ruby
sethjeffery/church-on-rails
/app/models/setting.rb
UTF-8
1,500
3.015625
3
[]
no_license
# Handles all site settings with `fetch` and `store` convenience methods. # Settings can be stored in the database, but can also be defaulted # with ENV variables or in the config/application.yml file. # class Setting < ApplicationRecord validates_uniqueness_of :key # Stores a setting in the database. def self.s...
true
aab0228a935d708279cbe971e2d09d246c86db20
Ruby
tatums/geo
/app/models/session.rb
UTF-8
132
2.84375
3
[]
no_license
class Session attr_accessor :items def initialize @items = [] end def add(item) @items << item end end
true
054ce704224827897f56afe5f0db79db3837607e
Ruby
molit-korea/main
/Pages/2017 국토교통 빅데이터 해커톤 참가작/molit_HAB-master/elastic/logstash-5.5.2/vendor/bundle/jruby/1.9/gems/sequel-4.49.0/lib/sequel/sql.rb
UTF-8
78,314
3.09375
3
[ "Apache-2.0", "MIT" ]
permissive
# frozen-string-literal: true module Sequel if RUBY_VERSION < '1.9.0' # :nocov: # If on Ruby 1.8, create a <tt>Sequel::BasicObject</tt> class that is similar to the # the Ruby 1.9 +BasicObject+ class. This is used in a few places where proxy # objects are needed that respond to any method call. cl...
true
fd9a9baaca23ca2a8f665b4887f5033a3ca2a1d6
Ruby
Phoenix-GH/filmfans-cms
/app/queries/post_query.rb
UTF-8
571
2.546875
3
[]
no_license
class PostQuery < BaseQuery def initialize(source_owner, filters = {}) @source_owner = source_owner @filters = filters end def results prepare_query source_filter order_results('published_at', 'desc') @results end private def prepare_query if filters[:page] @results = @...
true