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
daaa5ca25a98b0287ce276cb0f53a96f91a0f7fa
Ruby
Seonghoegu/coderbyte
/LetterCapitalize.rb
UTF-8
323
3.4375
3
[]
no_license
def LetterCapitalize(str) array = str.split flag = 0 while flag < array.length array[flag].capitalize! flag += 1 end # code goes here return array.join(" ") end # keep this function call here # to see how to enter arguments in Ruby scroll down LetterCapitalize(STDIN.gets) ...
true
a1971c4440fd983f8bd26d446f55e580618a6a06
Ruby
seanlilmateus/browser
/app/controllers/browser_delegate.rb
UTF-8
4,700
2.78125
3
[ "BSD-3-Clause" ]
permissive
class BrowserDelegate2 TITLES = ["Class Methods", "Instance Methods"] NUMBER_OF_COLUMNS = 3 def rootItemForBrowser(browser) @collection ||= begin klasses = Module.constants.reject { |c| c.to_s =~ /^[A-Z]+$/ || c.to_s[0..3] =~ /^[A-Z]+$/ } .select {|c| Module.const_get(c).is_a...
true
5c8ef57d0e2ec8c91c2363627ba8366ea80812ab
Ruby
CTAnthny/Launch-Academy
/Phase3 - Hashes & Data Structs/space-jams/album.rb
UTF-8
1,616
3.6875
4
[]
no_license
# object state: Album.new(track[:album_id], track[:album_name], track[:artists]) # CSV format: album_id,track_id,title,track_number,duration_ms,album_name,artists class Album attr_accessor :album_id, :album_title, :album_artists, :tracks, :tracks_duration, :duration_min def initialize(album_id = nil, album_title ...
true
818c5f4065d91d0b38740a6d7f42a4a3c4daff5a
Ruby
notalex/experiments
/ruby/design_patterns/decorator_problem.rb
UTF-8
554
3.234375
3
[]
no_license
class EnhancedWriter def initialize(path) @file = File.open(path, 'w') @line_number = 1 end def write_line(line) @file.print(line) @file.print("\n") end def timestamping_write_line(data) write_line("#{ Time.new }: #{ data }") end def numbering_write_line(data) write_line("#@lin...
true
5536bc3d51e47c57f1a5bb261056cfefac2081aa
Ruby
ministryofjustice/cloud-platform-helloworld-ruby-app
/app.rb
UTF-8
139
2.515625
3
[ "LicenseRef-scancode-proprietary-license", "MIT" ]
permissive
#!/usr/bin/env ruby require 'sinatra' require 'sinatra/base' class App < Sinatra::Base get '/' do '<h1>Hello, World!</h1>' end end
true
76888e69e588049aa47c7e73ada823db55b26ddb
Ruby
Lykos/SquirrelDB
/lib/compiler/type_annotator.rb
UTF-8
8,651
2.953125
3
[]
no_license
require 'ast/sql/from_clause' require 'ast/common/scoped_variable' require 'ast/common/variable' require 'ast/common/column' require 'ast/common/pre_linked_table' require 'ast/common/renaming' require 'ast/common/expression' require 'ast/sql/values' require 'ast/iterators/dummy_iterator' require 'ast/visitors/transform...
true
9a5c5170710e2f79e804a76e36111d9ff6d1c01f
Ruby
jonathonnordquist/basic-compression
/basic_compression
UTF-8
1,277
3.671875
4
[]
no_license
#!/usr/bin/ruby class BasicCompression def build_compressed_string(input_str) raise(ArgumentError, "Input must be of type 'String'") unless input_str.class == String raise(ArgumentError, "Input must consist of only lower case letters") if input_str =~ /[^a-z]/ output = '' pointer = 0 while poin...
true
d98a635b31a0c9f735c978e8e6f7abc1d282f2ae
Ruby
linkenneth/code-jam
/2013/qual/b/b.rb
UTF-8
716
3.46875
3
[]
no_license
def check(lawn, h, x, y) possible = true $m.times do |x0| possible &&= h >= lawn[y][x0] end return possible if possible possible = true $n.times do |y0| possible &&= h >= lawn[y0][x] end return possible end T = gets.chomp.to_i T.times do |t| $n, $m = gets.chomp.split.map &:to_i lawn = Ar...
true
1efb3259b4e6268d9b5bed9a43f13c4ad87143b2
Ruby
dougsko/projecteuler.net
/294/solution.rb
UTF-8
949
3.515625
4
[]
no_license
#!/usr/bin/env ruby # # projecteuler.net # problem 294 # # For a positive integer k, define d(k) as the sum of the digits of k in # its usual decimal representation. Thus d(42) = 4+2 = 6. # # For a positive integer n, define S(n) as the number of positive # integers k < 10^n with the following properties : # # k is div...
true
70426fb63a969c7050feba7cbeba963c3210c0c0
Ruby
doskaf/sinatra-basic-routes-lab-online-web-ft-090919
/app.rb
UTF-8
294
2.53125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require_relative 'config/environment' class App < Sinatra::Base get '/name' do "My name is Dominique" end get '/hometown' do "My hometown is El Paso, TX" end get '/favorite-song' do "My favorite song is 1999 Wildfire - BROCKHAMPTON" end end
true
d098fb5b81de551832171bc9b0bf2ff818fc5788
Ruby
marcwright/WDI_ATL_1_Instructors
/REPO - DC - Students/w02/d03/Gabe/water_bottle/lib/water_bottle.rb
UTF-8
295
3.21875
3
[]
no_license
class WaterBottle def initialize @is_empty = true @drinks_containing = 0 end def is_empty? return @is_empty end def fill if @is_empty == true @drinks_containing = 3 @is_empty = false return "filled!" else false end end def dispense return "Water" end end
true
0f8afc23f3bb066822884ea41ab7f60200b7690f
Ruby
TheJhyde/advent_2018
/day17/day17.rb
UTF-8
1,278
3.203125
3
[]
no_license
input = File.read("test_input.txt" ).scan(/([xy])\=(\d+), [xy]\=(\d+)\.{2}(\d+)/) clay = [] input.each do |line| (line[2]..line[3]).to_a.map do |i| c = line[0] == "x" ? [line[1].to_i, i.to_i] : [i.to_i, line[1].to_i] clay << c end end p clay lowest_point = clay.max_by {|c| c[1]}[1] p lowest_point def pr...
true
f19cb07702ed920faeb210441716220d1cadbc59
Ruby
Timcev1/ttt-with-ai-project-v-000
/bin/tictactoe.rb
UTF-8
1,046
3.375
3
[]
no_license
#!/usr/bin/env ruby require 'pry' require_relative '../config/environment' puts "Welcome to TicTacToe" puts "Please select game mode Enter 0 for Computer vs Computer Enter 1 for Player vs Computer enter 2 for Player vs Player" input = gets.strip if input == "0" puts "Computer vs Computer" game = Game.new(Players::...
true
0605e6c744122727f184e65a225a68561eff7a5e
Ruby
dimanyc/github-markup-preview
/app.rb
UTF-8
3,155
2.671875
3
[ "MIT" ]
permissive
require 'sinatra' require 'sinatra/assetpack' require 'github/markup' require 'redcarpet/compat' module Preview class WordpressReadmeParser HEADERS = { 'contributors'=>'Contributors', 'donate_link'=>'Donate link', 'tags'=>'Tags', 'requires_at_least'=>'Requires at least', 'tested_...
true
f8a012539b9099e0c79bcf28ba28f826c6ac46b1
Ruby
RicciFlowing/NaiveText
/lib/NaiveText/ExamplesGroup.rb
UTF-8
704
3.171875
3
[ "MIT" ]
permissive
class ExamplesGroup def initialize(args) @examples = args[:examples].to_a || [] @language_model = args[:language_model] || ->(str) { str } load_text split_text_into_words format_words fail 'Empty_Trainingsdata' if @words.length == 0 end def count(word) @words.count(@language_mod...
true
966ddb41e54e844a8f74b0fdc8b38c6fd42b1ef3
Ruby
mario21ic/POO
/Ruby/Transacciones/tests.rb
UTF-8
1,042
2.703125
3
[]
no_license
require_relative "Empresa" require "test/unit" class TestCalcularPago < Test::Unit::TestCase def setup @empresa = Empresa.new("UPC", "333666777") end def test_calcular_pagos_500 @empresa.registrar_pasos(1) assert_equal(500.0, @empresa.calcular_pago()) @empresa.registrar_...
true
73504b3cadab3ecc79b756a05068a1fcc5ee6a92
Ruby
chad/rubinius
/mspec/spec/runner/example_spec.rb
UTF-8
2,672
2.59375
3
[ "MIT" ]
permissive
require File.dirname(__FILE__) + '/../spec_helper' require 'mspec/matchers/base' require 'mspec/runner/mspec' require 'mspec/mocks/mock' require 'mspec/runner/example' describe ExampleState do it "is initialized with the describe and it strings" do ExampleState.new("This", "does").should be_kind_of(ExampleState)...
true
716e23894a19191eafaebfbcc639db70947aebb1
Ruby
lukebri/citadel
/lib/match_seeder/common.rb
UTF-8
982
2.6875
3
[ "MIT" ]
permissive
module MatchSeeder module Common extend self def get_roster_pool(target) rosters = target.approved_rosters rosters << nil if rosters.size.odd? rosters.to_a end def create_match_for(home_team, away_team, options) # Swap home and away team to spread out home/away matches ...
true
de71c924c3314bac8e4aa218ca658131d6ba137f
Ruby
DouglasDDo/Data-Structures-and-Algorithms
/practice_problems/strings/ruby/caesar_cypher.rb
UTF-8
935
4.46875
4
[]
no_license
# Objective: Given a str and a positive integer n, construct a Caesar cipher # that shifts any letters in the string by n spaces in the alphabet. Retain case # for any letter-chars and do not alter any non-letter chars, including spaces. def caesar_cypher(str, n) # Use ranges to build arrays of lower and upper case ...
true
bbae32d95038d11c6968cf5744fae16ba23f6f38
Ruby
doulighan/ttt-8-turn-bootcamp-prep-000
/lib/turn.rb
UTF-8
719
4.25
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def display_board(board) puts " #{board[0]} | #{board[1]} | #{board[2]} " puts "-----------" puts " #{board[3]} | #{board[4]} | #{board[5]} " puts "-----------" puts " #{board[6]} | #{board[7]} | #{board[8]} " end def valid_move?(board, i) (position_taken?(board, i) || i < 0 || i > 8) ? false : true ...
true
9d43cdaa6d966bbaa50830674e3aaafe1b552d8d
Ruby
aust-store/aust-platform
/lib/store/company_statistics.rb
UTF-8
182
2.546875
3
[]
no_license
module Store class CompanyStatistics def initialize(company) @company = company end def statistics { total_items: @company.items.count } end end end
true
0a27778c9cd5e135ad86c40ae0a1e2c8ccf8fa5c
Ruby
rails/rails
/actionview/lib/action_view/helpers/capture_helper.rb
UTF-8
8,349
3.203125
3
[ "MIT", "Ruby" ]
permissive
# frozen_string_literal: true require "active_support/core_ext/string/output_safety" module ActionView module Helpers # :nodoc: # = Action View Capture \Helpers # # \CaptureHelper exposes methods to let you extract generated markup which # can be used in other parts of a template or layout file. ...
true
fdf260915577fdf1c879072bfd78c3ecba27f0a9
Ruby
dgokman/blackjack
/blackjack.rb
UTF-8
3,227
4.1875
4
[]
no_license
require 'pry' class Card attr_reader :value, :suit def initialize(value, suit) @value = value @suit = suit end def create_card "#{@value}#{@suit}" end end class Deck attr_reader :cards def initialize @cards = [] ['A','2','3','4','5','6','7','8','9','10','J','Q','K'].each do |valu...
true
0685626834216a9a11c681f173d2e69f3aad3d2c
Ruby
johnson/graph
/test/base_test.rb
UTF-8
2,089
3
3
[ "MIT" ]
permissive
require 'test_helper' require 'graph/base' class TestBase < Test::Unit::TestCase def setup @gr = Graph::Base.new @gr.add_edge("1", "2", 7) @gr.add_edge("1", "3", 9) @gr.add_edge("1", "6", 14) @gr.add_edge("2", "3", 10) @gr.add_edge("2", "4", 15) @gr.add_edge("3", "4", 11) @gr.add_ed...
true
f344b8ce0ac4f13bdd331d30e92cc004ebfb624b
Ruby
mblack/gitimmersion
/lib/hello.rb
UTF-8
140
3.203125
3
[]
no_license
require 'greeter' # Author: mtb (mtblack@alum.mit.edu) # Default is "World" name = ARGV.first || "World" greeter = Greeter.new(name) puts greeter.greet
true
d7618546bff738c6e03497c2037f80616de12b59
Ruby
kevinmarvin/d.rb-cell-demo
/reeler.rb
UTF-8
2,193
2.65625
3
[ "MIT" ]
permissive
require 'reel' require 'lib/testier' require 'websocket_parser' require 'json' require 'symboltable' class Socketeer include Celluloid def initialize(socket, neighbors) @remote_ip = socket.remote_ip @testier = Testier.new @neighbors = neighbors @socket = socket @neighbors[@remote_ip] = @s...
true
b5b09ce0f678fdcaa6008de71dd522f48d11d05c
Ruby
paologianrossi/chivas
/spec/cpu_spec.rb
UTF-8
2,514
2.515625
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') require 'highline/simulate' describe "Cpu" do let(:memory) { mock(Memory) } let(:cpu) { Cpu.new } let(:io) { mock(HighLine) } describe "execute" do it "should add with code 0" do memory.should_receive(:read).and_return(30) cpu.ra...
true
7fbe9dd3ac44984c207235971a7954238209effb
Ruby
xababafr/RubyPFE
/tests/semaine1/a-parser.rb
UTF-8
119
3.171875
3
[ "MIT" ]
permissive
class Animal attr_accessor :nom def initialize(nom) @nom = nom end def parler puts "je suis #{nom}" end end
true
c2ff282bed86f545e03487d4525941dc3aefd147
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/bob/fe37429c67ca417c9e829124486d8ad2.rb
UTF-8
534
3.765625
4
[]
no_license
class Bob def hey(message) inquirer = MessageInquirer.new(message) if inquirer.shouting? 'Woah, chill out!' elsif inquirer.question? 'Sure.' elsif inquirer.blank? 'Fine. Be that way.' else 'Whatever.' end end class MessageInquirer def initialize(message) ...
true
193ef66cfc004ec693287850a9f1eaaceeef8a77
Ruby
dtomasiewicz/rbrowse
/r_browse/form.rb
UTF-8
2,803
2.8125
3
[]
no_license
module RBrowse class Form attr_accessor :method, :action def initialize(page, form_node) @page = page @method = (form_node['method'] || 'GET').upcase @action = form_node['action'] || page.uri # fields are stored as an array to preserve form ordering @fields = [] ...
true
7018ec53e572a570fc06bff25f4df21ce7905a32
Ruby
UpAndAtThem/practice_kata
/isogram.rb
UTF-8
181
2.96875
3
[]
no_license
# Isogram class class Isogram def self.isogram?(test_string) word_chars_only = test_string.gsub(/\W/, '').downcase.chars word_chars_only.uniq == word_chars_only end end
true
f6edbce6451c06d5d0993694dcc5b8776221814f
Ruby
UmbertoMoioli/Lesson_1
/TicTacToe.rb
UTF-8
2,284
4.1875
4
[]
no_license
# 1. Bisogna comprendere le specifiche del programma, capire la portata del programma # 2. Quindi serve la logica dell'applicazione, la sequenza di azioni che vanno prese # 3. Quindi tradurre questi passi in codice # 4. Testare il programma per verificare la logica # Passaggi # 1. Draw a board # 2. Assign Player "X" ...
true
b2a958f9e2b906f31e4a83eea1c9da4ac42a9cee
Ruby
robbles/RainbowXMPP
/vendor/drb_scripts/basic_receive.rb
UTF-8
1,194
2.671875
3
[]
no_license
#!/bin/env ruby ## # Simple IM client that receives a message. require 'rubygems' require 'xmpp4r' require 'yaml' # Jabber::debug = true config = YAML.load_file('config.yml') username = config['from']['jid'] password = config['from']['password'] ######### jid = Jabber::JID.new(username) client = Jabber::Clie...
true
11906aec8205496f4758c0ed8be771ea9ac1ad70
Ruby
BarbaraPruz/activerecord-validations-lab-v-000
/app/models/post.rb
UTF-8
833
3
3
[]
no_license
require 'pry' class Post < ActiveRecord::Base validates :title, presence: true validates :content, { :length => { minimum: 250 } } validates :summary, { :length => { maximum: 250 } } validates :category, inclusion: ['Fiction', 'Non-Fiction'] validate :is_clickbait? # def is_clickbait? # if...
true
75453f7d5ef25297465b78e8049ea1f63b6d120b
Ruby
kwojc/Ruby-Implementations-Performance-Test
/app/classes/my_math.rb
UTF-8
216
3.671875
4
[ "MIT" ]
permissive
class MyMath def self.fibonacci(n) return n if (0..1).include? n (self.fibonacci(n - 1) + self.fibonacci(n - 2)) end def self.factorial(n) return 1 if n <= 1 n * self.factorial(n - 1) end end
true
33004c2fa9a81a2aa2c26357a6fc3eed3f9baa0f
Ruby
caelum/patternie
/patternie.rb
UTF-8
2,707
3.21875
3
[]
no_license
require 'hashie' # TODO use a simpler version instead of hashie module Patternie def fields(*fields) @pattern = fields fields.each do |f| self.send :attr_accessor, f end end def [](*args) # todo: change to () PatternieMatcher.new(args, @pattern, self) end end class MatchBlock def initi...
true
e37ba3f46ae5dddaa64dd0d7db3a7f061ca31d9d
Ruby
davidqhr/gezi_craft
/heros/david.rb
UTF-8
1,514
2.9375
3
[]
no_license
# coding: utf-8 require 'set' class David < Programmer def initialize @name = "David" @skill_name = "又改需求啦?/恐吓" @skill_description = "对方产品经理 3回合不能移动" super end # def skill player # opponent = player.opponent # game = player.game # pms = opponent.heros.select { |id, h| h.is_a? PM } ...
true
76c3ca3dce6ab9aff8a61b35e99ac3f02727d776
Ruby
johnkim97/Restaurant
/app/models/review.rb
UTF-8
644
2.578125
3
[]
no_license
class Review < ActiveRecord::Base belongs_to :user belongs_to :item validates :user_id, :item_id, :presence => true validate :user_can_only_review_once_per_item, :user_can_only_review_two_times def user_can_only_review_once_per_item matched_reviews = Review.where(:user_id => self.user_id, :item_id => self.item...
true
3e4d9bacbd2faa8247100cedfba3cd159303ae2e
Ruby
Dhrubajyotic/athena_csv
/lib/athena_csv/output.rb
UTF-8
467
2.6875
3
[ "MIT" ]
permissive
require 'csv' module AthenaCsv; class Output; attr_reader :query, :file_path def initialize(query, file_path) @query = query @file_path = file_path end def query_results @query_result_rows ||= Client.new.run(query) end def values(row) row.data.map {|cell| cell.var_char_value} end def ...
true
b0b7174f87f6300a914e5b2b195419b444a6d8a8
Ruby
DanWizard/ruby_dec_2018
/first_vagrant_box/fundementals/basic123.rb
UTF-8
1,010
3.84375
4
[]
no_license
def to255 1.upto(255) {|i| print i, " "} end def oddIn255 p (1..255).select {|a| a%2 != 0} end def countAndSum sum = 0 a = 1.upto(255) do |i| sum += i p "count: #{i} sum: #{sum}", " " end end def eachElement arr arr.each {|e| print e, " "} end def maxElement arr p arr.max end def avgElement arr sum =...
true
922d4b16377e3832230d33d8e9f6d8a1633a7cc0
Ruby
heedwiner1106/baitapRuby
/Array/bai2.rb
UTF-8
277
3.3125
3
[]
no_license
def sumInput interger = true arr = [] while(interger) input = gets.chomp if (input == "0" || input.to_i != 0) arr.push(input.to_i) else interger = false end end p sum = arr.sum end p "Sum: #{sumInput}"
true
beffd99ffcff666a03770e80e05fb7ae3248fec6
Ruby
mgarriss/scrapes
/lib/scrapes/crawler.rb
UTF-8
3,794
2.59375
3
[ "MIT" ]
permissive
################################################################################ # # Copyright (C) 2006 Peter J Jones (pjones@pmade.com) # Copyright (C) 2010 Michael D Garriss (mgarriss@gmail.com) # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated document...
true
eb40a1a82f43f49f251ffe22624f5d35aca02b1d
Ruby
Meowcenary/Codewars
/iterative_fibonacci_sum.rb
UTF-8
271
3.28125
3
[]
no_license
def perimeter(n) 4*fib(n+1, {}).values.sum end # iteratation avoids recursion which stops the stack from blowing up def fib(end_key, sequence) (0..end_key).each do |i| i < 2 ? sequence[i] = i : (sequence[i] = sequence[i-1] + sequence[i-2]) end sequence end
true
aab70ddfb3475c4dd9505adebd760464d5e6f595
Ruby
baloi/morpheus
/app.rb
UTF-8
563
2.671875
3
[]
no_license
require 'sinatra' require './model' get '/' do "hello world" end get '/therapists' do #therapists = Therapist.find(:all) #ret = "" #therapists.each do |t| # ret += "Welcome #{t.name}<br/>" #end # #ret end #post '/therapist' do # name = "#{params[:therapist_name].strip}" # # @therapist = Therapi...
true
38a227330b13f14703d8f8f6dcf566b7d4a8c01e
Ruby
phamtoanthang/ruby
/openfile.rb
UTF-8
107
2.65625
3
[]
no_license
filename = ARGV.first txt = open(filename) puts "you just open a file named #{filename}" puts txt.read
true
1830a33dd2a315f89ba72637abc2da2a6cfa0dd2
Ruby
sandagolcea/makers-reboot
/w1-airport/spec/airport_spec.rb
UTF-8
906
3.015625
3
[]
no_license
require 'airport' MAX_CAPACITY = 20 class Planes; def land; end; end describe Airport do let(:airport) { Airport.new(MAX_CAPACITY) } let(:plane) { double(:plane) } before(:each) do allow(airport).to receive(:good_weather?).and_return(true) end it 'should have no planes to begin with' do expect(airp...
true
52ce1b59e4afbb558c0c1d39aee06de3cd8680a3
Ruby
sebrose/mutation-web-service
/client-ruby/lib/checkout/cli.rb
UTF-8
2,102
2.65625
3
[]
no_license
module Checkout # CLI client class CLI include Concord.new(:client, :arguments) ACTIONS = %w(requirements score register advance) # Run cli # # @return [self] # # @api private # def run unless arguments.length == 1 usage_error end argument = arguments...
true
65b06136cec2d6d23082bbebc0c7c8b8afb482eb
Ruby
ayjlee/grocery-store
/specs/customer_spec.rb
UTF-8
2,791
2.8125
3
[]
no_license
require 'minitest/autorun' require 'minitest/reporters' require 'minitest/skip_dsl' require_relative '../lib/customer' describe "Customer" do describe "#initialize" do it "Takes an ID, email and address info" do id = 5 email = "testemail.com" address = "Drury Lane" customer = Grocery::C...
true
8e87b7d3bec62df9e3990f978939f7c76aedf63f
Ruby
wheeskers/gp_edu_experiments
/generate_test_data.rb
UTF-8
689
2.9375
3
[ "MIT" ]
permissive
#!/usr/bin/ruby require 'time' data_files = [ 'some_data0.csv', 'some_data1.csv', 'some_data2.csv', 'some_data3.csv', 'some_data4.csv' ] time_stamp = Time::new time_stamp_start = Time::parse("2016-10-20 08:15:30") time_stamp_stop = Time::parse("2016...
true
6fe356db786f9ea8d1a2e2f7ce8e2b8eba8bf28c
Ruby
jgnagy/rffdb
/lib/rffdb/index.rb
UTF-8
2,089
2.5625
3
[ "MIT" ]
permissive
module RubyFFDB class Index def initialize(type, column) @type = type @column = column FileUtils.mkdir_p(File.dirname(file_path)) GDBM.open(file_path, 0664, GDBM::WRCREAT) do # Index initialized end end def file_path File.join( DB_DATA, @type.to...
true
a206e66e7e9049df7450d941a849f7b80985d136
Ruby
toshimaru/Study
/10-problems/7.rb
UTF-8
1,493
3.515625
4
[]
no_license
# frozen_string_literal: true def slow_gas_station(gas, cost) traversed_i = gas.size.times.find { |i| can_traverse?(gas, cost, i) } traversed_i || -1 end def my_gas_station(gas, cost) return - 1 if cost.sum > gas.sum i, n = 0, gas.size while i <= n remaining = 0 gas.size.times.with_index(1) do |j,...
true
dbbf47c9225e3c1dd81fa2db91ade364a77226be
Ruby
nassersala/binary-clock
/binary_clock.rb
UTF-8
2,510
3.625
4
[]
no_license
class Clock def convert_time(time) time_strings = [time.hour, time.min, time.sec].map(&:to_s) ###### #time_strings = ["10", "1", "59"] ##### prepended_zero = prepend_zero_for(time_strings) whole_time = '' prepended_zero.each do |time_part| #h m s whole_time << convert_first_digit(t...
true
44f5cacd83687d8258a806a310c7c2d7f67c659c
Ruby
BranLiang/project_cli_blackjack
/lib/player.rb
UTF-8
120
2.609375
3
[]
no_license
class Player < Human attr_accessor :bank, :bet def initialize super @bank = 2000 @bet = 100 end end
true
cb8e887a9d6d7ba9e1009a4157c543fe423923c5
Ruby
darren9897/programming-univbasics-4-array-simple-array-manipulations-part-1-nyc04-seng-ft-041920
/lib/intro_to_simple_array_manipulations.rb
UTF-8
378
3.578125
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def using_push(array, string) array.push(string) end def using_unshift(array, string) array.unshift(string) end def using_pop(array) woah = array.pop return woah end def pop_with_args(array) yup = array.pop(2) return yup end def using_shift(array) love = array.shift return love end def shift_wi...
true
335dfcb2f24797bce3d3acdd097fac8927889fc0
Ruby
caioandrademota/Misc_Codes
/rubyzão/desafio4.rb
UTF-8
1,502
4.03125
4
[]
no_license
result = ' ' loop do puts result puts "---CALCULADORA---" puts 'selecione a opção desejada: ' puts '1 - Adição.' puts '2 - Subtração.' puts '3 - Multiplicação.' puts '4 - Divisão.' puts '0 - Sair do programa.' puts 'Opção: ' option = gets.chomp.to_i if option == 1 ...
true
c42390c7476665186a55d937e281fceba1e7e3f5
Ruby
ufeanei/challenges
/robotsim.rb
UTF-8
2,197
4.15625
4
[]
no_license
require 'pry' class Robot attr_accessor :xcor, :ycor, :orientation def at(x,y) @xcor = x @ycor = y end def orient(direction) if [:north, :east, :west, :south].include?(direction.to_sym) @orientation = direction.to_sym else raise "Drection must be east, west, south, north" end ...
true
1d6cb4d179d61d61b869abb2e9aba4dced4f56f5
Ruby
cyclingzealot/vovi
/lpPerBeds.rb
UTF-8
1,247
2.890625
3
[ "Unlicense" ]
permissive
#!/usr/bin/ruby require 'nokogiri' require 'open-uri' require 'uri' require 'byebug' require 'set' #require 'getoptlong' dataPath=ARGV[0] doc = Nokogiri::HTML(open(dataPath)) tbodies = doc.xpath("//tr") puts tbodies.count listings = {} tbodies.each { |tbodyNode| tdNodes = tbodyNode.xpath("./td") dat...
true
ce4fcc0f7df835f36ba64a7f4e3feb333116470f
Ruby
MadBomber/experiments
/system_v_ipc_shm/worker.rb
UTF-8
2,150
3.15625
3
[]
no_license
require 'SysVIPC' require 'debug_me' include DebugMe # All IPC objects are identified by a key. SysVIPC includes a # convenience function for mapping file names and integer IDs into a # key: key = SysVIPC.ftok(ARGV.shift, 0) # Get (create if necessary) a message queue: mq = SysVIPC::MessageQueue.new(key, SysVIPC:...
true
af1d347fd45db2fc4bc327bcdb18f10fe0df92d8
Ruby
dapi/courier-notifier
/lib/courier/template/base.rb
UTF-8
1,143
2.671875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- class Courier::Template::Base AvailableValues = [:on, :off, :disabled] attr_accessor :name, :defaults def initialize(args) self.name = args[:name].to_sym or raise 'no template name defined' self.defaults={} end def get_text(service, args) args[:scope]=[:courier, :servic...
true
0d7d04237eeeaefbe03e15b1d089c48290f11dbf
Ruby
lovecosma/my_all-onl01-seng-ft-052620
/lib/my_all.rb
UTF-8
282
3.21875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require 'pry' def my_all?(collection) if collection.length > 0 i = 0 new_collection = [] while i < collection.length new_collection << yield(collection[i]) i+=1 end if new_collection.include?(false) return false else return true end else puts "nothing in array" end end
true
70de2817b56ae904cec0637f59268ce3d7e1446c
Ruby
cenit-io/cenit
/lib/cenit/liquidfier.rb
UTF-8
897
2.625
3
[ "MIT" ]
permissive
require 'liquid/drop' module Cenit module Liquidfier def to_liquid @cenit_liquid_drop ||= Cenit::Liquidfier::Drop.new(self) end class Drop < Liquid::Drop def initialize(object) @object = object end def invoke_drop(method_or_key) if Capataz.instance_response_to?(...
true
dad5a097bf38e4c9adacdba167679b60b33d74ab
Ruby
hfaulds/adventofcode2020
/day-17b.rb
UTF-8
1,366
3.578125
4
[]
no_license
require 'pry' string = "...#..#. #..#...# .....### ##....## ......## ........ .#...... ##...#.." state = string.split("\n").map(&:strip).map(&:chars).reverse.each_with_index.reduce({}) do |h, (row, y)| row.each_with_index do |cell, x| h[[x,y,0,0]] = true if cell == "#" end h end def nearby_count(state,x,y,...
true
f9a9756696bd2420d1d218709ab941b7391395ad
Ruby
Zirak/YuelaBot
/commands/source_command.rb
UTF-8
1,044
2.71875
3
[]
no_license
module Commands class SourceCommand class << self def name :source end def attributes { max_args: 1, min_args: 1, description: "Show the source for a command", usage: "source <command>" } end def command(e, *args) ...
true
855ef91f9985bd483cfeb121e6a386ce5b8afe21
Ruby
doridoridoriand/twitter-F-3
/helper/validator.rb
UTF-8
382
2.9375
3
[]
no_license
module Validator # @param contents # @return boolean def less_than_140? unless self.length.to_i <= 140 false else true end end def has_problems? false end def only_character match = Regexp.new(ALPHABET_INTEGER_MATCHER) result = match =~ self if result === 0 ...
true
d22b254f9f421915be5f12a3df9da140384977d5
Ruby
ewintram/learn-to-program
/chap-10/ex5.rb
UTF-8
1,800
4.28125
4
[]
no_license
# Ninety-nine bottles of beer def english_number(number) numString = "" onesPlace = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine"] teenagers = ["eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"] tensPlace = ["ten", "twenty", "thirty", ...
true
6ea39248e950a841c8f85fd378b4ecbba8f1cf69
Ruby
wwood/finishm
/lib/assembly/coverage_based_graph_filter.rb
UTF-8
2,594
2.828125
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
require 'set' module Bio::AssemblyGraphAlgorithms class CoverageBasedGraphFilter include Bio::FinishM::Logging # Remove all nodes from the graph that do not have sufficient coverage # (i.e. possibly are sequencing error artefacts) # # Options: # :whitelisted_sequences: provide an enumerable ...
true
ff9bce44cf11c8c7ae6771bedb1a1cf34a0c362f
Ruby
digideskio/infoboxer
/lib/infoboxer/parser/inline.rb
UTF-8
4,699
2.734375
3
[ "MIT" ]
permissive
# encoding: utf-8 module Infoboxer class Parser module Inline include Tree def inline(until_pattern = nil) start = @context.lineno nodes = Nodes[] guarded_loop do chunk = @context.scan_until(re.inline_until_cache[until_pattern]) nodes << chunk br...
true
710eb0bb3c24aa1d0717488399aae17f28612356
Ruby
rvedotrc/advent-of-code-2019
/lib/arcade_game.rb
UTF-8
1,423
3.46875
3
[]
no_license
require 'machine' class ArcadeGame RENDERED = [' ', '#', '.', '=', 'o'] def initialize @grid = {} end def run(program) buffer = [] on_output = proc do |n| buffer << n if buffer.count == 3 x, y, type = buffer @grid[ [x, y] ] = RENDERED[type] buffer = [] e...
true
c97b388b3a13c0977b3703852d496c333e8e6b38
Ruby
andrewn/bbcboxbot
/rb/twitter_helpers.rb
UTF-8
7,178
3.046875
3
[]
no_license
# Get the latest post for the user's # timeline in the account credentials # given. # def get_latest_post_from_twitter(un, pw) # Create the twitter object twit = Twitter::Base.new(un, pw) # What's the last message posted to the box's timeline? timeline = twit.timeline(:user) if timeline.empty? return ...
true
2b9fd7df91b43befecf5aeae0ce0af5de6ada38e
Ruby
landroide13/Ruby-Exce
/hash.rb
UTF-8
223
3.546875
4
[]
no_license
putos={"name"=>"fofo","age"=>18,[]=>"array"} puts putos puts putos[[]] staff={name:"fofo",age:"18",profesion:"putito"} puts staff puts staff[:profesion] staff.each do |sing,value| puts "On #{sing} is #{value}" end
true
53730fe82341765a4673734a9afd818e613d77a6
Ruby
zmack/ruby-things
/meta-4.rb
UTF-8
197
3.296875
3
[]
no_license
class Foo attr_accessor :bar end def pick p self end def moo puts @bar puts self end bar = lambda do @bar end a = Foo.new a.bar = 10 method(:moo).unbind.bind(a) a.send(:moo) p self
true
0a7bbf8348bf443c09fe9db5e1788ac5a7335df1
Ruby
mstolbov/robotanks_bot
/s_server.rb
UTF-8
718
2.65625
3
[ "MIT" ]
permissive
require 'em-websocket' class MainServer attr_accessor :data, :connect def initialize(host, port) @connect = TCPSocket.new host, port end end EventMachine::WebSocket.start(:host => "0.0.0.0", :port => 5555) do |ws| server = nil ws.onopen do |handshake| server = MainServer.new("192.168.30.188", 4...
true
03d42ca252e99427960ad830d802a8bab2f2757c
Ruby
bootstraponline/page_object_stubs
/lib/page_object_stubs/page_object_stubs.rb
UTF-8
3,241
2.578125
3
[ "Apache-2.0" ]
permissive
module PageObjectStubs class << self # Creates stubs from target Ruby files in output folder with the format # target_filename_stub.rb # # Note the output folder is **DELETED** each time stubs are generated. # # ```ruby # targets = Dir.glob(File.join(__dir__, '..', 'page', '*_page.rb')) ...
true
cd72112f4574e8e8ad736a0e495897a35db0d00b
Ruby
tondol/DivaDotNet
/sample.rb
UTF-8
660
2.921875
3
[]
no_license
#!/usr/local/bin/ruby # -*- encoding: utf-8 -*- require 'kconv' require 'divadotnet' ACCESS_CODE = "YOUR_ACCESS_CODE" PASSWORD = "YOUR_PASSWORD" # get instance and login diva = DivaDotNet.login(ACCESS_CODE, PASSWORD) sleep 1 # get user data puts "get user data..." user = diva.get_user puts user.to_s.t...
true
49913da2bb7f0af036cd92941876c9c0f8a8f7f4
Ruby
rinostar/video-store-api
/test/models/customer_test.rb
UTF-8
1,631
2.609375
3
[]
no_license
require "test_helper" describe Customer do before do @valid_customer = customers(:customer1) end describe "validation" do it "is avlid when all fields are present" do result = @valid_customer.valid? expect(result).must_equal true end it "is invalid without a name" do @valid_c...
true
b9de747fa6aea9b90bd1bc3db86d569860aef83f
Ruby
jxandery/cc-histogram
/test/histogram_test.rb
UTF-8
1,791
3.015625
3
[]
no_license
require 'minitest/autorun' require 'minitest/pride' require './lib/histogram' class HistogramTest < Minitest::Test def test_it_exists assert Histogram end def test_hash_setup example = Histogram.new([3,1]) assert_equal [], example.rectangles[2] end def test_adjacent_one_column example = Hi...
true
aaa69e52566cdfc48e9cf19135cb5d9739711c70
Ruby
kdtestaccount/ruby-intro-to-hashes-lab-v-000
/intro_to_ruby_hashes_lab.rb
UTF-8
1,620
3.078125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def new_hash empty_hash = { } end def actor actor = {:name => "Dwayne The Rock Johnson"} end def monopoly monopoly = {:railroads => {}} end def monopoly_with_second_tier monopoly = {:railroads => {:pieces => 4, :names=> {}, :rent_in_dollars=> {} }} end def monopoly_with_third_tier monopoly = {:railroa...
true
9f048728215eadfcadd267dd68e9eedb538e4623
Ruby
Acidknight/array-CRUD-lab-onl01-seng-pt-090820
/lib/array_crud.rb
UTF-8
1,152
3.671875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def create_an_empty_array [] end def create_an_array video_game_character = ["Link", "Samus", "Mario", "Luigi"] end def add_element_to_end_of_array(array, element) video_game_character = ["Link", "Samus", "Mario", "Luigi"] video_game_character << "arrays!" end def add_element_to_start_of_array(array, element...
true
f2ef045ea71f7570b004dc2243a47c26165c8be3
Ruby
chendo/mongoid
/lib/mongoid/associations.rb
UTF-8
3,401
2.765625
3
[ "MIT" ]
permissive
require "mongoid/associations/decorator" require "mongoid/associations/accessor" require "mongoid/associations/belongs_to" require "mongoid/associations/has_many" require "mongoid/associations/has_one" module Mongoid # :nodoc: module Associations #:nodoc: def self.included(base) base.class_eval do ...
true
2f15ce86e77ef80177b3f67df09aac80028b6ef5
Ruby
djoverbeatz29/ruby-oo-relationships-practice-art-gallery-exercise-chicago-web-021720
/app/models/gallery.rb
UTF-8
530
3.171875
3
[]
no_license
class Gallery attr_reader :name, :city @@all = [] def self.all @@all end def most_expensive_painting self.paintings.max_by { |pa| pa.price } end def initialize(name, city) @name = name @city = city @@all << self end def paintings ...
true
8d7eb10c65853a2a7bf1562606cc17b0e4c63663
Ruby
falyhery/mini_jeu_POO
/app_2.rb
UTF-8
1,969
3.8125
4
[]
no_license
require 'bundler' Bundler.require require_relative 'lib/game' require_relative 'lib/player' #------------------------------------------------ #Bienvenue sur 'POO POO POO POO POOOOOO' ! | #Last player standing takes it all ! Good luck !| #------------------------------------------------ #Initialisation du joueur...
true
d5bfd086cb1b7e109dc8b2b4b0335c1b17071a4a
Ruby
mrobock/ruby_rspec_day4
/anniversary.rb
UTF-8
1,226
3.6875
4
[]
no_license
require_relative 'date_task' class Anniversary < Task def initialize(title, year, month, day) super(title) @year = year @month = month @day = day #if the supplied date is equal to or later than today then it's set. Otherwise we add a year to the date, representing the next instance of your anniv...
true
afe259956a350ca5786ce4bd6a005d5d8924027b
Ruby
TacOnTac/KarelRTuesday
/tasks/tris.rb
UTF-8
1,684
3.984375
4
[]
no_license
def tri_bulles(matrice) len = matrice.length i = 0 j = 1 tmp = 0 while i < len j = 1 while j < (len - i) if matrice[j-1] > matrice[j] tmp = matrice[j] matrice[j] = matrice[j-1] matrice[j-1] = tmp end j = j + 1 end i = i+1 end return matrice end def tri_selection(matrice) l...
true
22b56a08010dc9d2d29c8ffddae573215eae5a18
Ruby
MastersAcademy/ruby-course-2018
/objects/session/objects/1.rb
UTF-8
295
3.546875
4
[]
no_license
class Fish attr_accessor :speed end Fish.class_eval do def time(distance) "#{distance/speed} seconds" end end a = Fish.new a.instance_eval do def time(distance) "#{distance/speed} hours" end end a.speed=5 puts a.time(500)
true
92fd7254789899ea51dc40c9a41fd03d4c0b403f
Ruby
Mikeyheu/durham-2014-march
/house/lib/house.rb
UTF-8
640
3.5625
4
[]
no_license
class House attr_reader :song_parts def initialize song_parts @song_parts = song_parts end def verse number "This is " + song_parts.last(number).join(" ") + ".\n\n" end def sing song_parts.length.times.map {|number| verse(number+1)}.join end end class HouseRandom < House def initialize ...
true
7032dd1bacba41594507ff5a58f979ae3905f383
Ruby
Jowits/OO-Art-Gallery-london-web-051319
/tools/console.rb
UTF-8
567
2.625
3
[]
no_license
require_relative '../config/environment.rb' artist1 = Artist.new("Artist1", 2) artist2 = Artist.new("Artist2", 5) artist3 = Artist.new("Artist3", 23) gallery1 = Gallery.new("Gallery1", "London") gallery2 = Gallery.new("Gallery2", "Paris") gallery3 = Gallery.new("Gallery3", "London") painting1 = Painting.new("Painti...
true
eed6644de673a706086f498bc143d6ef1f4c309c
Ruby
Tkam13/atcoder-problems
/abc030/b.rb
UTF-8
116
2.640625
3
[]
no_license
n,m = gets.chomp.split.map(&:to_i) n -= 12 if n >= 12 rad = (n * 30 + 0.5 * m - m * 6).abs puts [rad,360 - rad].min
true
ce90644bc565132084ff9e00b3c57b8eb9ae6ec2
Ruby
walshification/tolarian_registry
/lib/tolarian_registry.rb
UTF-8
2,286
2.828125
3
[ "MIT" ]
permissive
require "tolarian_registry/version" require 'unirest' module TolarianRegistry class Card attr_accessor :multiverse_id, :card_name, :editions, :text, :flavor, :colors, :mana_cost, :converted_mana_cost, :card_set_name, :card_type, :card_subtype, :power, :toughness, :loyalty, :rarity, :artist, :card_set_id, :image_...
true
22b805d257b99780f1bfd259c4d1aaab769d2aaa
Ruby
DeclanBU/OOP2-Project-2014
/vendor/bundle/ruby/2.3.0/gems/attic-0.5.3/try/X2_extending.rb
UTF-8
389
3.171875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
$:.unshift './lib' require 'attic' class A extend Attic attic :andy end class B < A attic :size end class C extend Attic attic :third end a, b, c = A.new, B.new, C.new a.andy, b.andy = 1, 2 p [a.respond_to?(:andy), b.respond_to?(:andy)] # true, true p [a.andy, b.andy] # 1, 2...
true
3c441b0a38a6b80c918a2382c3200c244b9e3fb0
Ruby
saumyamehta17/algorithm_and_system_design
/linkedlist/flatten_multilevel_linkedlist.rb
UTF-8
1,101
3.578125
4
[]
no_license
def flatten_using_queue(head) q = Queue.new q.enq(head) while(!q.empty?) curr = q.deq while(!curr.nil?) print "#{curr.data} --> " q.enq(curr.child) if !curr.child.nil? curr = curr.next end end end def flatten(head) tail = head while(!tail.next.nil?) tail = tail.ne...
true
8235db6e3672d50bfc2d661a9425b0dbfdbf3c75
Ruby
ferambot/phase-0
/week-5/nums-commas/my_solution.rb
UTF-8
1,846
4.40625
4
[ "MIT" ]
permissive
# Numbers to Commas Solo Challenge # I spent [] 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? # What is the output? (i.e. What should ...
true
211e9bba5f8bf705337f21b81fe3315ec89e0680
Ruby
kanglicheng/tutoring_work
/oddball_sum.rb
UTF-8
404
3.921875
4
[]
no_license
def oddball_sum(array) i = 0 odds = [] while i < array.length if array[i]%2 != 0 odds.push(array[i]) end i +=1 end if odds.length > 0 j = 0 summed = 0 while j < odds.length summed = summed + odds[j] j +=1 end end if odds == [] return 0 end return summed end puts oddball_sum([1, 2, ...
true
54eaeefa73abc954917c2f17e3f841b0b6c8b86a
Ruby
thestokkan/RB100
/exercises_ruby_basics/debugging/confucius_says.rb
UTF-8
2,253
4.71875
5
[]
no_license
# # Confucius Says # # You want to have a small script delivering motivational quotes, but with the following code you run into a very common error message: no implicit conversion of nil into String (TypeError). What is the problem and how can you fix it? # # def get_quote(person) # if person == 'Yoda' # 'Do. Or ...
true
1729b583b2d29aeb2853cb76753072a1a277a8ad
Ruby
pabco84/Arreglos
/filtro_procesos.rb
UTF-8
248
2.734375
3
[]
no_license
filter = ARGV[0].to_i input = File.open('./procesos.data.txt','r') #lee eñ archivo output = File.open('procesos_filtrados.data', 'w') #escribe el archivo input.each do |i| output.puts(i.to_i) if i.to_i > filter end input.close output.close
true
9aad93cd3582c88a2d08658ee616c3666a054206
Ruby
p-eduardo-medina/Programacion_en_Ruby_y_Python
/P21.rb
UTF-8
4,288
3.25
3
[]
no_license
def mystery_func(str) s = "" (str.length()/2).times do |index| ((str[2*index+1]).to_i).times do |dindex| s += str[2*index] end end return s end def numbers_sum(arr) v = 0 arr.each {|element| if element.is_a? Integer v+=element end } return v end # p numbers_sum([1, 2, "13", "4", "...
true
50de42d977221d1a9320bc7e73c8ee52d1feac6d
Ruby
pogin503/online-judge
/aizu-online-judge/ruby/10002.rb
UTF-8
223
3.140625
3
[]
no_license
# -*- coding: utf-8 -*- #解法1 str = STDIN.gets.split(" ") # p str a = str[0].to_i;b = str[1].to_i puts "#{a*b} #{a*2 + b*2}" #解法2 STDIN.gets.split.map(&:to_i).tap { |i| a = i[0];b = i[1];puts "#{a*b} #{a*2 + b*2}" }
true
c8bec5688ee3711e58468b107c5c0e3f61c19172
Ruby
SilverMaiden/Udacity-Nanodegree
/Nanodegree/CheckProfanity/check_profanity_rb/check_profanity.rb
UTF-8
591
3.078125
3
[]
no_license
require 'net/http' require 'json' def read_text() movie_quotes = File.read('/Volumes/Macintosh HD/Users/SilverMaiden/Downloads/movie_quotes.txt') check_profanity(movie_quotes) end def check_profanity(text_to_check) query = "select *" url = "http://www.purgomalum.com/service/containsprofanity?text=" + text_t...
true
6141c4cbeb2bc45841aef15ff829729a7a0cdfac
Ruby
calacademy-research/antcat
/app/services/taxt/cleanup.rb
UTF-8
608
2.53125
3
[]
no_license
# frozen_string_literal: true module Taxt class Cleanup include Service attr_private_initialize :taxt def call return if taxt.nil? raise unless taxt.is_a?(String) taxt. gsub(/ +:/, ': '). # Spaces before colons. gsub(/:(?!= )/, ': '). # Colons not followed by a sp...
true
3e55ac1acee5820aeb1f469213e62e98c4bd9209
Ruby
alicht9/hangar_door_notifier
/garage.rb
UTF-8
2,005
2.9375
3
[]
no_license
#!/usr/bin/ruby # # Copyright (c) Adam Licht alicht@gmail.com 2013 # All rights resereved # # require 'pi_piper' require 'mail' require 'yaml' require 'time' include PiPiper class Garage def initialize config @config_file=config raise "You have to give me a config yml" unless @config_file @config = YAML.loa...
true
e71a6be29c4f56ac5a0c1c957dbd2f3d5d2b4c0e
Ruby
YaoZhang0916/Ruby
/oop/hash.rb
UTF-8
352
2.921875
3
[]
no_license
user = {first_name: "Coding", last_name: "Dojo"} puts user[:first_name] puts user[:last_name] user.delete :last_name puts user user1 = {first_name: "Coding", last_name: "Dojo"} puts user1.has_key? :first_name user2 = {first_name: "Coding", last_name: "Dojo"} puts user2.has_value? "Coding" ...
true