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
062e4fe2adf67fb3b524d42c34cb2ddaf45a426e
Ruby
ryerayne/regex-lab-v-000
/lib/regex_lab.rb
UTF-8
473
3.109375
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def starts_with_a_vowel?(word) word.match(/^(?i)[aeiou]/) != nil end def words_starting_with_un_and_ending_with_ing(text) text.scan(/[u][n][a-z]*[i][n][g]/) end def words_five_letters_long(text) text.scan(/\b\w{5}\b/) end def first_word_capitalized_and_ends_with_punctuation?(text) text.match(/^[A-Z].+[!?.]$/...
true
1f6be7819279ac819e9e1b68e7238bc3ebf0735e
Ruby
astera/tecc
/citizen428/06/euler6.rb
UTF-8
286
3.546875
4
[]
no_license
def sum_of_squares(limit) (1..limit).inject(0) { |sum, num| sum += num ** 2 } end def square_of_sum(limit) ((1..limit).inject(0) { |sum, num| sum += num }) ** 2 end limit = 100 puts "Sum of squares - square of for 1 to #{limit}: #{square_of_sum(limit) - sum_of_squares(limit)}"
true
cc5596dbbdf259bdbdb35b3935082d396f23b0de
Ruby
CharleeW/AppAcademy
/Projects/monkey_patching_project/lib/array.rb
UTF-8
1,195
3.546875
4
[]
no_license
# Monkey-Patch Ruby's existing Array class to add your own custom methods class Array def span return nil if self.length < 1 return self.max - self.min end def average return nil if self.length < 1 return (self.sum * 1.0) / self.length end def median return nil if self.length < 1 so...
true
f2ab068ebea57b76d77283d05dc7f137132a6664
Ruby
postgres/postgres
/src/test/isolation/specs/horizons.spec
UTF-8
3,991
2.515625
3
[ "PostgreSQL" ]
permissive
# Test that pruning and vacuuming pay attention to concurrent sessions # in the right way. For normal relations that means that rows cannot # be pruned away if there's an older snapshot, in contrast to that # temporary tables should nearly always be prunable. # # NB: Think hard before adding a test showing that rows in...
true
d2e8ed4737b156b3e5fa6f300c260a39139401d5
Ruby
RavensKrag/ThoughtTrace
/lib/ThoughtTrace/queries/collision_manager.rb
UTF-8
1,226
2.921875
3
[]
no_license
require 'set' module ThoughtTrace module Queries class CollisionManager def initialization(space) @space = space @collision_handler = ThoughtTrace::Queries::CollisionHandler.new space @known_types = find_collision_types end def call @known_types = find_collision_types @known_types.delete Th...
true
3a4eded33ba18f2ab9b4084dd8840c719a6b545b
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/filtered-submissions/44fc0d9365ee4d94902d2a6c21ca25c1.rb
UTF-8
216
3.484375
3
[]
no_license
def compute(a, b) return 0 if a == b a = a[0..b.length-1] if a.length > b.length result = 0 a.chars.each_with_index do |e, i| result += 1 if e != b[i] end result end
true
7b849644d6ab98ab93fcc47ccdcfe56cbedfd1ce
Ruby
troystauffer/ruby-baseball-stats
/lib/bstats/player_batting_stat.rb
UTF-8
1,897
2.875
3
[]
no_license
require_relative '../../db/db_config' require 'csv' module BStats class PlayerBattingStat < ActiveRecord::Base belongs_to :player, :class_name => "Player", :foreign_key => 'external_id', :primary_key => 'external_id' validates :external_id, presence: true validates :games, :at_bats, :runs, :hits, :doubles, :tr...
true
a88e6fe7d7c4ee1461260cd97fa1d8d6b56f7354
Ruby
sbackus/calculating-pi
/euler.rb
UTF-8
302
3.40625
3
[]
no_license
# the sum of the reciprocals of the positive square integers is equal to pi squared divided by 6 # 1/1^2 + 1/2^2 + 1/3^2 + 1/4^2 + 1/5^2 ... = pi^2 / 6 n = 1000000 sum = 0 for i in 1..n sum += 1.0 / i ** 2 end pi = Math.sqrt(sum * 6) puts pi # https://www.youtube.com/watch?v=HrRMnzANHHs&t=243s
true
757be618f37a728c6ff020fa1944873529618a65
Ruby
masaedw/zugagaga
/src/test.rb
UTF-8
4,197
2.84375
3
[]
no_license
#!/usr/bin/ruby # last modified <2004/01/22 02:53:43 2004 JST> module State START_DATA = "START_DATA" MSG_HEAD = "MSG_HEAD" SERVER_EVENT = "SERVER_EVENT" SOA_SIZE = "SOA_SIZE" SEND_OBJECT = "SEND_OBJECT" SEND_PARAM = "SEND_PARAM" END_DATA = "END_DATA" ERROR_DATA = "ERROR_DATA" EXIT_PARSE = "EXIT_PARS...
true
487814f1a5ee748293cbf62ee9103983b0a979d3
Ruby
scottodea/javascript-practice
/binary.rb
UTF-8
272
3.03125
3
[]
no_license
def binary_converter(decimal) i=2 answer = [] until decimal == 0 if decimal - 2**i > 0 answer << 1 decimal = decimal - 2**i elsif decimal - 2**i < 0 answer << 0 end i -= 1 print i end answer end print binary_converter(7)
true
b6cab7816a3b57cb01b170be934894e996df3d46
Ruby
hase1031/ruby-shutterstock-api
/lib/client/images.rb
UTF-8
605
2.828125
3
[]
no_license
module ShutterstockAPI class Images < Array attr_reader :raw_data, :page, :total_count, :per_page, :search_id def initialize(raw_data) @raw_data = raw_data if raw_data.kind_of? Hash super(@raw_data["data"].map{ |image| Image.new(image) }) @total_count = raw_data["total_count"]....
true
fedc5d4e6c9ed71c931d6b54adac6bee76ac9748
Ruby
nah1222/ruby-enumerables-array-count-lab-nyc01-seng-ft-082420
/lib/array_count.rb
UTF-8
553
3.71875
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def count_strings(array) # Return the total number of strings in the provided array using the count enumerable count = 0 str = [] while count < array.length do if array[count].class == String i = array[count] str << i end count += 1 end str.length end def count_empty_strings(array) # Retu...
true
c98eb5eac1b843c2380c763368fa5568431f1b8b
Ruby
aliashafi/W4D5
/execute_time.rb
UTF-8
1,332
3.921875
4
[]
no_license
require "byebug" # my_min # Given a list of integers find the smallest number in the list. # Example: # def my_min(arr) min = arr.first (0...arr.length).each do |idx1| (idx1...arr.length).each do |idx2| if (idx2 != idx1) && (arr[idx1] < arr[idx2]) && (arr[idx1] < min) min = arr[idx1] ...
true
9822958c4d8aef03e520601d6533121a1a3b38ab
Ruby
tk0358/meta_programming_ruby2
/chapter4/28unbound_methods2.rb
UTF-8
253
2.984375
3
[]
no_license
class Foo def foo "foo" end end p m = Foo.instance_method(:foo) #=> #<UnboundMethod: Foo#foo> # FooのインスタンスをレシーバとするMethodオブジェクトを生成 p m.bind(Foo.new) #=> #<Method: Foo#foo>
true
ae503fdaa3a75da5c8d0a7ef5abf4e998f1d5f79
Ruby
phillipoertel/all_tweets_must_die
/lib/regex_based_handler.rb
UTF-8
369
2.921875
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
module AllTweetsMustDie class RegexBasedHandler def initialize(regex, block) @regex = regex @block = block end def handle_tweet!(tweet) @tweet = tweet @block.call(tweet.text.match(@regex), tweet) if should_run? end private def should_run? @...
true
1ea264643df58acbefe1b4b92a831e15cfd9882a
Ruby
myYearOfCode/LaunchAcademy_Ignition
/magical-creatures/spec/models/magical_creature_spec.rb
UTF-8
973
3.265625
3
[]
no_license
# FOR NON-CORE STORIES ONLY require 'pry' require "spec_helper" require_relative "../../models/magical_creature.rb" RSpec.describe MagicalCreature do let(:creature) { MagicalCreature.new('bunny','can eat some carrots. I guess', 1)} it "it should return an object of class MagicalCreature" do expect(creature).t...
true
3563e08c37addb2a371dfb713194d1b9e4437ece
Ruby
Sreejith9409/seat_layout
/app/controllers/seat_layouts_controller.rb
UTF-8
2,700
3.03125
3
[]
no_license
class SeatLayoutsController < ApplicationController def index end def construct_layout inp_arr = [] @seat_layout_str = '' if params[:no_of_pass].blank? params["layout"]["cols"].keys.each do |k| inp_arr << [params["layout"]["cols"][k].to_i, params["layout"]["rows"][k].to_i] end ...
true
1d96439418527c72ec2b16a28cf8714ea5aff9b5
Ruby
LloydWes/jour13_morpion
/lib/class/board_case.rb
UTF-8
208
3.125
3
[]
no_license
class BoardCase attr_reader :value def initialize @value = nil end def fill(symbol) @value = symbol end def is_full? @value != nil end def is_empty? return !is_full? end end
true
01823fc633617fca44cee82592ee51e032f7e5c4
Ruby
catlike/easy_connect
/app/models/user.rb
UTF-8
1,820
2.59375
3
[]
no_license
class User < ActiveRecord::Base attr_accessor :current_password # Max and min lengths for all fields SCREEN_NAME_MIN_LENGTH = 4 SCREEN_NAME_MAX_LENGTH = 20 PASSWORD_MIN_LENGTH = 4 PASSWORD_MAX_LENGTH = 40 EMAIL_MAX_LENGTH = 50 SCREEN_NAME_RANGE = SCREEN_NAME_MIN_LENGTH..SCREEN_N...
true
b41baca2b6d1da933c12bb66b1235132b66fcf67
Ruby
spookyvert/programming_languages-prework
/programming_languages.rb
UTF-8
918
2.703125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require "pry" def languages languages = { :oo => { :ruby => { :type => "interpreted" }, :javascript => { :type => "interpreted" }, :python => { :type => "interpreted" }, :java => { :type => "compiled" } }, :functional => { :clojure => { :type => "...
true
ae013fcf5a96e4117ad84d956961ae89885ba4aa
Ruby
ecopelli/rufregle
/test/test_rufregle.rb
UTF-8
1,604
2.765625
3
[ "MIT" ]
permissive
#!/bin/env ruby # encoding: utf-8 require 'test/unit' require './lib/rufregle.rb' require './lib/translators/free_google_translator.rb' class RufregleTest < Test::Unit::TestCase def test_english_to_portuguese_hello #given word = "Hello" expected = "Olá" #when result = Rufregle.new.translate(wo...
true
15a5084282f0803559670cba3eeee791e5dc23f0
Ruby
batasha/poker
/lib/deck.rb
UTF-8
492
3.5625
4
[]
no_license
require_relative "card" class Deck def self.all_cards cards = [] Card.suits.each do |suit| Card.values.each do |value| cards << Card.new(suit, value) end end cards end attr_reader :cards def initialize(cards = Deck.all_cards) @cards = cards end def size @ca...
true
30571516400f528341f4a59c230a1e36d4286a65
Ruby
mindreframer/webpack_integration
/lib/webpack_integration/store.rb
UTF-8
777
2.546875
3
[ "MIT" ]
permissive
module WebpackIntegration class Store # @example # Store.fuzzy_file_for('client.png') def self.fuzzy_file_for(file_pattern) alternatives = assets_keys.grep(Regexp.new(file_pattern)) raise "TOO MANY MATCHES for #{file_pattern}" if alternatives.size > 1 file_for(alternatives.first) ...
true
ff135dd34d85e5d51ef456ccfadc2215b29801d9
Ruby
toptal/chewy
/lib/chewy/index/settings.rb
UTF-8
2,890
2.515625
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
module Chewy class Index # Stores ElasticSearch index settings and resolves `analysis` # hash. At first, you need to store some analyzers or other # analysis options to the corresponding repository: # # @example # Chewy.analyzer :title_analyzer, type: 'custom', filter: %w(lowercase icu_foldi...
true
d82ce2cd4530c75532335d20045508e52b69c78c
Ruby
jwo/classroom
/spec/models/assignment_spec.rb
UTF-8
2,338
2.671875
3
[]
no_license
require 'rails_helper' RSpec.describe Assignment, type: :model do describe 'by_week' do xit 'lumps assignments by the week they are due in' do records = [ am_one = Assignment.new(title: 'foo-1', due_date: DateTime.now.beginning_of_week + 1.day), am_two = Assignment.new(title: 'foo-2', d...
true
168605cdbbbec9bd2a518f843c21c1d4d26812b9
Ruby
textarcana/loggers
/www/www.rb
UTF-8
825
3.109375
3
[]
no_license
# :title:WWW.rb # = Name # WWW.rb # = Synopsis # require 'www.rb' # log 1, "log.txt", lambda{`curl -s http://localhost`} # = Description # A specialized, minimal Web service framework in Ruby. require 'log-util.rb' # == logbot # # writes the result of fn to file # # log 1, "log.txt", lambda...
true
44b5576b7ce0741802c8d528dedcc05462a02759
Ruby
scorchmobile/da713914
/app/models/message.rb
UTF-8
681
2.5625
3
[]
no_license
class Message # the sauce include ActiveModel::Validations include ActiveModel::Conversion extend ActiveModel::Naming # Contact Fields attr_accessor :first_name, :last_name, :middle_name, :email, :phone, :street1, :street2, :zipcode, :member_type # Validation validates :first_name, :last_name, :email...
true
3f308375199372de4340a0c62567c028b1d13a77
Ruby
walski/cool2
/lib/cool2/tree/list.rb
UTF-8
871
2.640625
3
[]
no_license
module Cool2 module Tree class List < Object PATTERN = /^(\s*)- / def process(line, stack) @content = Array.new line = line.gsub(PATTERN, '') start_indentation = $1.size + 2 @content << Text.new(line) work_space = '' while line...
true
1035bad24fba7d6127c261beb4a38b49b9836feb
Ruby
adriandelarco/week2_ironhack
/Day4/ironweb/model/course.rb
UTF-8
152
2.640625
3
[]
no_license
# Define the courses class Course attr_reader :exp, :id, :name def initialize(exp, id, name) @exp = exp @id = id @name = name end end
true
dbb6109794cf164688287ee060b05e69a2cc3317
Ruby
juani-garcia/POO_Ruby
/guias/tp10/ej3/not_expression.rb
UTF-8
165
2.8125
3
[]
no_license
require_relative 'expression' class NotExpression include Expression def initialize(expr) @expr = expr end def evaluate !@expr.evaluate end end
true
8cfd73ceaac8ce83dbf26f81a72d2fd73972b861
Ruby
gniemira/embot
/lib/embot/messagehandler/fuck.rb
UTF-8
695
2.921875
3
[]
no_license
module Embot module MessageHandler class Fuck < Base def process(message) if message.body.nil? return nil else body = message.body.downcase if body.include? 'fuck' return speak(return_prudery) else return nil end ...
true
9e8d424e5f87c79beea491bd6d7403c22840e841
Ruby
tsrivishnu/fbBulk
/app/models/facebook_account.rb
UTF-8
2,779
2.53125
3
[]
no_license
class FacebookAccount < ActiveRecord::Base # Stubbed out! Does no (good) error checking! def authorize_url(callback_url = '') if self.oauth_authorize_url.blank? self.oauth_authorize_url = "https://graph.facebook.com/oauth/authorize?client_id=#{FACEBOOK_CLIENT_ID}&redirect_uri=#{callback_url}&scope=...
true
ec401efa1add37ad07e001b71dbef3ee38e86c75
Ruby
ynarasak-zz/crawler
/bin/crawler.rb
UTF-8
873
2.546875
3
[]
no_license
#! /usr/bin/env ruby require 'capybara' require 'capybara/poltergeist' require 'selenium-webdriver' require 'capybara/dsl' Capybara.current_driver = :selenium module Crowler class Google include Capybara::DSL def hit_num keyword session = Capybara::Session.new(:poltergeist) session.visit URI.e...
true
434213e33c6996d639d40a23d468b0aae8998606
Ruby
HewlettPackard/oneview-sdk-ruby
/lib/oneview-sdk/image_streamer.rb
UTF-8
2,986
2.515625
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# (c) Copyright 2020 Hewlett Packard Enterprise Development LP # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
true
4c4fa4876faf9835c650e53d2a47b7673d9a3f08
Ruby
Solncevbr/thinknetica
/lesson2/task 6.rb
UTF-8
1,152
3.59375
4
[]
no_license
cart = {} final_price = 0 loop do puts "Введите название товара: " name = gets.chomp break if name == "стоп" puts "Введите цену за единицу товара: " price = gets.to_f puts "Введите количество купленного товара" amount = gets.to_f cart[name] = { price: price, amount: amount } end # Заполнить и вывести н...
true
370bf619bc43100a81539ad3cc4871399bf61b98
Ruby
tafox/hackerrank
/lonely_integer.rb
UTF-8
348
3.4375
3
[]
no_license
#!/usr/bin/env ruby def lonelyinteger( a) c = Array.new(101) for i in 0...101 c[i] = 0 end for i in 0...a.length c[a[i]] += 1 end for i in 0...c.length if c[i] == 1 return i end end end a = gets.strip.to_i b = gets.strip.split(" ").map! {|i| i.t...
true
940185d7fc39dde3d789e90103d600e58f896b65
Ruby
directionless/graphviz-generator
/lib/graphviz/generator/procedure.rb
UTF-8
1,265
2.6875
3
[ "MIT" ]
permissive
module Graphviz class Generator class Procedure attr_reader :edges def to_s "Graphviz::Generator::Procedure(#{@name})" end def initialize(generator, graphviz, name, options = {}, node_options = {}) @generator = generator @graphviz = graphviz @name = name ...
true
bce27037dd176bffca51dbcfe3a5c78e5fb373bc
Ruby
akhanubis/scv_challenge
/prob2_b.rb
UTF-8
192
3.046875
3
[ "MIT" ]
permissive
normalizadas = ARGV.map do |str| str.downcase.chars.select { |l| l =~ /\w/ }.sort end pares = normalizadas.combination(2).select do |combo| combo.first == combo.last end puts pares.length
true
ce42bef89f27e7836f53060e4afb21990f416e7b
Ruby
ryanmanchester/school-domain-v-000
/lib/school.rb
UTF-8
393
3.5
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# code here! require 'pry' class School attr_accessor :roster def initialize(school_name) @school_name = school_name @roster = {} end def add_student(student_name, grade) roster[grade] ||= [] roster[grade] << student_name end def grade(student_name) roster[student_name] end def so...
true
2d19f133150cf8c97e82b5da36ca73ce6720d994
Ruby
veonik/optparsegen
/test/test_render.rb
UTF-8
719
2.5625
3
[ "MIT" ]
permissive
require 'minitest/autorun' require 'optparsegen' class RenderTest < Minitest::Test def test_render options = [ OptParseGen::Option.new('test', 't', 'A description.'), OptParseGen::Option.new('another', nil, 'Without a short parameter.') ] result = OptParseGen::Renderer.render(options) ...
true
4e051f0757586d5e55cbca664ba0dc6495363f49
Ruby
Alex-Joseph/ar-exercises
/exercises/exercise_4.rb
UTF-8
797
3.1875
3
[]
no_license
require_relative '../setup' require_relative './exercise_1' require_relative './exercise_2' require_relative './exercise_3' puts "Exercise 4" puts "----------" # Your code goes here ... Store.create!( name: "Surrey", annual_revenue: 224_000, mens_apparel: false, womens_apparel: true ) Store.create!( name: "W...
true
18a950e8117abd73651265cfee5a96b164fa54f8
Ruby
jamero102/rails-longest-word-game
/app/controllers/games_controller.rb
UTF-8
1,118
2.96875
3
[]
no_license
require 'open-uri' require 'json' class GamesController < ApplicationController def new alph = ('A'..'Z').to_a @letters = [] 10.times do @letters << alph.sample end end def score @word = params[:word] attempt = @word.upcase.chars grid = params[:letters] include = attempt.se...
true
810429020031e9363397439ff63a70926dde39e5
Ruby
evazquezt/cycling_clothing
/app/controllers/auto_controller.rb
UTF-8
1,609
2.5625
3
[]
no_license
require 'open-uri' class AutoController < ApplicationController def results @street_address = params[:user_street_address] url_safe_street_address = URI.encode(@street_address) # ========================================================================== # Your code goes below. # The street add...
true
47c66be8f7bdcf8e16bd1c68e8f7c0bac3cd68c3
Ruby
thiagossdev/ruby-101
/module_03/section_02/professional.rb
UTF-8
871
3.4375
3
[]
no_license
require_relative "person" class Job def initialize(name, description = nil) @name = name @description = description end def name @name end def name=(name) @name = name end def description @description end def description=(description) @description = description e...
true
837ee7d5800359c82fe5a5a480ce727a0ad74662
Ruby
nikivazou/OOPSLA18-artifact
/tests/DataList/Imported.spec
UTF-8
1,131
2.59375
3
[]
no_license
{-@ GHC.Base.errorWithoutStackTrace :: {v:_ | false} -> a @-} {-@ embed GHC.Integer.Type.Integer as Int @-} {-@ invariant {xs:[a] | 0 <= len xs } @-} {-@ (GHC.Num.-) :: Num a => x:a -> y:a -> {o:a | o == x-y } @-} {-@ GHCList.errorEmptyList :: {v:String | false } -> a @-} {-@ GHCList.scanr :: (a -> b -> b...
true
25836798b4dfa9418ce1867f0714dcbac7b5dd30
Ruby
nurratna/gojek-cli
/lib/models/order.rb
UTF-8
1,738
3.140625
3
[]
no_license
# TODO: Complete Order class require 'json' require 'time' module GoCLI class Order GORIDE_PER_KM = 1500 GOCAR_PER_KM = 2500 attr_accessor :timestamp, :origin, :destination, :est_price, :type, :driver def initialize(opts = {}) @timestamp = opts[:timestamp] || '' @origin = opts[:origin] || '...
true
8d848d7c2c5c47323cf763127d45176f53a42b1d
Ruby
bczorn/my-collect-online-web-sp-000
/lib/my_collect.rb
UTF-8
317
3.46875
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def my_collect(array) i = 0 collection = [] while i < array.length collection << yield(array[i]) i += 1 end collection end my_collect(['ruby', 'javascript', 'python', 'objective-c']) do |lang| lang.upcase end my_collect(["Tim Jones", "Tom Smith", "Jim Campagno"]) do |student| student.split(" ")....
true
c7f57bc5fafb31aaf2c565e719d29b6ab879c864
Ruby
neilslater/games_dice
/lib/games_dice/map_rule.rb
UTF-8
2,924
3.6875
4
[ "MIT" ]
permissive
# frozen_string_literal: true module GamesDice # This class models rules that convert numbers shown on a die to values used in a game. A # common use for this is to count "successes" - dice that score a certain number or higher. # # An object of the class represents a single rule, such as "count a die result o...
true
609a9ac2faf35302b1d878ade5cd0540e3677a13
Ruby
alxsanborn/reverse-each-word-001-prework-web
/reverse_each_word.rb
UTF-8
251
3.328125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def reverse_each_word(string) array = [] string.split.each {|x| array << x.reverse} return array.join(" ") end def reverse_each_word(string) array = [] string.split.collect {|x| array << x.reverse} return array.join(" ") end
true
ddfa610c09f805029b93eb1d4430e8e4fdfbe422
Ruby
pasha-bolokhov-cs/Udemy
/Ruby/temp_use.rb
UTF-8
83
2.625
3
[]
no_license
#!/usr/bin/env ruby # require './temperature.rb' puts(c2f(10)) puts(f2c(-40))
true
c5d18624cd13d60de0b0b484f15b35236c9a2035
Ruby
hubert/sesheta
/spec/prescription_spec.rb
UTF-8
1,631
2.53125
3
[ "MIT" ]
permissive
require 'spec_helper' module Sesheta describe Prescription do let(:now) { Time.now } let(:prescription) { Sesheta::Prescription.new( "Quantity"=>"", "Refills"=>"0", "RefillAsNeeded"=>false, "DOS"=> now, "FirstName"=>"mary", "LastName"=>"McPoppin", ...
true
4f01b78213cd4a3f3d9ba8fc3645fc67be1bf34f
Ruby
joonty/torkify-vim
/lib/torkify/vim/observer.rb
UTF-8
1,894
2.578125
3
[ "MIT" ]
permissive
require_relative "quickfix" require_relative "remote" require_relative "error_splitter" module Torkify::Vim class Observer attr_reader :quickfix, :split_errors, :split_error_threshold, :me def initialize(options = {}) @vimserver = options[:server] @me = "vim" @split_errors = !!options[:sp...
true
1de3a1c2de1c1defbf1e9f5ae1971351943ac71b
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/proverb/606087b5d75c41db8e3bb5f4425ebbf0.rb
UTF-8
659
3.421875
3
[]
no_license
class Proverb def initialize(*things, qualifier: nil) @things = things @qualifier = qualifier end def to_s @proverb ||= proverb end private def statement(desired, lost) "For want of a #{desired} the #{lost} was lost.\n" end def conclusion(thing) if @qualifier vanity_object = ...
true
ebb0bbf42033d5fb27c7f1834efd302ddd4988c4
Ruby
CharlesWarsh/ruby_projects
/acltc/w1tuesday/song.rb
UTF-8
174
2.84375
3
[]
no_license
class Song def play 'say doowopdoowopdoowop' end def self.create_two_songs Song.new Song.new end end class Dog def bark 'say barbark' end end
true
10f65c3d972f46dd5a72d6aa3ccdbfebc8695a92
Ruby
sigmavirus24/repl_fun
/repl.rb
UTF-8
402
3.25
3
[ "BSD-3-Clause" ]
permissive
require 'readline' puts "My Ruby REPL" loop do input = Readline.readline(">> ", true) break if input.nil? input.chomp! begin result = eval(input) puts "#{input} => #{result}" rescue => error message = [error.message] message << error.backtrace.select do |v| v =~ /^[^\/]/ end.map do...
true
7896245f2b45a87ca7972b92f3a88ed98abed097
Ruby
railsc0d0r/global8ball_game
/app/models/global8ball_game/configuration/ball_position.rb
UTF-8
3,456
2.921875
3
[ "MIT" ]
permissive
module Global8ballGame module Configuration # A static class to provide config-parameters for ball-positions depending # on a stage given class BallPosition # scalingFactor = 377.95 => @width = 2.54 @halfWidth = @width / 2 # 480px @quarterWidth = @halfWidth / 2 # 240px ...
true
57eb0e4f18542eef001b8fdee097bad17cc570fe
Ruby
delitescere/squealer
/lib/squealer/progress_bar.rb
UTF-8
1,964
3.046875
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
module Squealer class ProgressBar @@progress_bar = nil def self.new(*args) if @@progress_bar nil else @@progress_bar = super end end def initialize(total) @total = total @ticks = 0 @progress_bar_width = 50 @count_width = total.to_s.size ...
true
5011ad87ad5ba62b707d1710d41c3dc70ad2e83a
Ruby
notapatch/exercises_for_programmers
/ruby/44_product_search/lib/product_search/product_display.rb
UTF-8
267
3.25
3
[]
no_license
class ProductDisplay attr_reader :product def initialize(product) @product = product end def output puts "Name: #{product.name}\n" \ "Price: $#{format('%.2f', product.price)}\n" \ "Quantity on hand: #{product.quantity}\n" end end
true
a8367fa65126e3aeaf23f58d3d7572b29ea62847
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/hamming/b46adf056c8e492c9d8186a2cbfc4dd5.rb
UTF-8
245
3.4375
3
[]
no_license
class Hamming def self.compute strand1, strand2 iterations = [strand1.length, strand2.length].min distance = 0 iterations.times do |index| distance += 1 unless strand1[index] == strand2[index] end distance end end
true
5e472a9cbf3ff6eb43010be4cd54c7f77d2c9f79
Ruby
pramod-sharma/learning_tasks
/advanced_ruby/Dynamic_class_from_csv/dynamic_class.rb
UTF-8
1,296
3.03125
3
[]
no_license
require 'csv' class ClassCreator def self.create_class( class_name, csv_obj ) new_class = Class.new do def initialize args args.each do | key, value | self.instance_variable_set( "@#{ key }", value ) end end csv_obj.fields.each do |field| (class << self; self; end).instance_eval do de...
true
8026117ef4490cad80b21e7037bcfbea87007272
Ruby
KoKumagai/idioms-in-Ruby
/try_method.rb
UTF-8
290
3.25
3
[]
no_license
require 'active_support/all' class User attr_accessor :name def initialize(name) @name = name end end ko = User.new('Ko') unknown = nil # With try method p ko.try(:name) #=> "Ko" p unknown.try(:name) #=> nil # Without try method # p ko.name if ko # p unknown.name if unknown
true
0c9dfebae794f4e8eab4113ba27ecfdac18c9abf
Ruby
dcts/snake-ruby
/game.rb
UTF-8
1,433
3.265625
3
[]
no_license
require 'gosu' require 'date' require 'pry-byebug' require_relative 'snake' require_relative 'food' require_relative 'pos' class Game < Gosu::Window def initialize @snake = Snake.new(Pos.new(10, 10), 30, 20) # ( POS, gidsize, blocksize ) @food = Food.new(@snake) @count = 0 super @snake.blocksize * @...
true
50f78ee0ce7d09ef31b81ae72ae2e2fb1ec688ab
Ruby
jedbr/lunching
/bin/lunching
UTF-8
156
2.921875
3
[]
no_license
#!/usr/bin/env ruby require 'lunching' puts "What would you like to order?" answer = gets.chomp client = Lunching::Api::Client puts client.order(answer)
true
ab594aaaacabdfc7a22a15e7a777eb8c5659bb1d
Ruby
codemilan/old_stuff
/sbs1/sm_commons/lib/sm_commons/text_utils.rb
UTF-8
11,772
2.796875
3
[ "MIT" ]
permissive
require 'digest/md5' String.class_eval do def to_url_with_escape to_url_without_escape.gsub /[^a-z0-9_-]/, '' end alias_method_chain :to_url, :escape end class TextUtils RELAXED = { :elements => [ 'a', 'b', 'blockquote', 'br', 'caption', 'cite', 'code', 'col', 'colgroup', 'dd', 'dl', 'dt',...
true
5fd0cb7416150adcf30722cd006c1293b84a7a78
Ruby
leahriffell/world_cup
/lib/team.rb
UTF-8
598
3.4375
3
[]
no_license
class Team attr_reader :country, :players # attr_writer :eliminated # since we are instructed to only user attr_reader for mod1, the eliminated method turns it into a writable attribute def initialize(country, eliminated = false) @country = country @eliminated = eliminated @players = [] end de...
true
f3b4968a9129ab4f308a015b90efa5439f60149f
Ruby
tinybeauts/karmaville
/app/models/user.rb
UTF-8
1,152
2.65625
3
[]
no_license
class User < ActiveRecord::Base has_many :karma_points attr_accessible :first_name, :last_name, :email, :username validates :first_name, :presence => true validates :last_name, :presence => true validates :username, :presence => true, :length => {:minimum => 2, :maximum => 32}, ...
true
2f7aceb123c8023a0aca66cc939f20ed38897e9b
Ruby
srini91/euler-ruby
/prob20.rb
UTF-8
363
3.765625
4
[]
no_license
# n! means n*(n-1) ... 3 * 2 * 1 # For example, 10! = 10 * 9 ... 3 * 2 * 1 = 3628800, # and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27. # Find the sum of the digits in the number 100! beg = Time.now sum = 0 num = 1 (1..100).each{|x| num *= x} while (num > 0) sum += num % 10 ...
true
1ba65711d59d979e092b20a545936c9cb99926b4
Ruby
torresga/launch-school-code
/exercises/101-109_small_problems/medium_2/lettercase_percentage_ratio.rb
UTF-8
3,119
4.9375
5
[]
no_license
# Lettercase Percentage Ratio # In the easy exercises, we worked on a problem where we had to count the number of uppercase and lowercase characters, as well as characters that were neither of those two. Now we want to go one step further. # Write a method that takes a string, and then returns a hash that contains 3 e...
true
01e94bcb28cd5901ffe1757bb2c6a7c9af454471
Ruby
tartar1212/web-labs
/Лаба5/p2/test.rb
UTF-8
557
3.03125
3
[]
no_license
require 'minitest/autorun' require 'minitest/assertions' require_relative 'logic' class TestPart2 < Minitest::Test Chars = ('а'..'я').to_a def gen_word(hissing = false) word = (Chars.sample rand(1..6)).join '' word += (hissing ? 'щчшж' : 'крфнкстх').chars.sample word + 'онок' end def test_no_hiss...
true
51039404bb4c8dfae59ee7ccf3bc874c735877b3
Ruby
dhgrainger/ruby_files
/pry.rb
UTF-8
222
3.734375
4
[]
no_license
require 'pry' def sum(numbers) numbers.each do |number| if sum == 0 sum = number.to_i else sum += number.to_i end end sum end binding.pry numbers = [1,2,3,4,5,6,7,8] puts sum(numbers[0..numbers.length])
true
359d03ec79302da51eb4a252e16fba9f83409c93
Ruby
otobrglez/chains
/lib/chains/configuration.rb
UTF-8
5,419
2.65625
3
[ "MIT" ]
permissive
module Chains class Dapp class Configuration REQUIRED_ATTRIBUTES = %i( eth_networks contract_data_dir contract_names encrypted_key_file key_password_file contract_file_location ) OPTIONAL_ATTRIBUTES = %i( dev_node ropsten_node ...
true
55dc35f29fbcd0d459549914cdd6d5bf64ce6e17
Ruby
duke1swd/iotweb
/tests/timetest.rb
UTF-8
851
3
3
[]
no_license
# # This code verifies that the time broadcasts are happening # class Timetest def initialize @startTime = Time.new().to_i @endTime = @startTime + 121 @btime = 0 end def name return "Timetest" end def run(stateHash) if Time.new().to_i > @endTime print "TimeTest FAILED: no update within 2 minutes\n" return...
true
8d1d3ba3f5f7d46b673ed88ba3280e3e14d96967
Ruby
jgilberto1/cucumber_httparty
/features/step_definitions/json_placeholder.rb
UTF-8
752
2.671875
3
[]
no_license
require 'cucumber' require 'httparty' require 'rspec' Dado('que eu acesse a api json_placeholder') do @url = "https://jsonplaceholder.typicode.com/posts" end Quando('inserir as informações válidas') do @post = HTTParty.post(@url, :body => {"userId": 1, "id": 101, "title": "teste br...
true
c7f33e80781ebcaa161cbd8392085830e7fc4f04
Ruby
maxdougherty/Navigator
/spec/models/schedule_spec.rb
UTF-8
9,951
2.640625
3
[]
no_license
require 'spec_helper' describe Schedule do it "adds event to schedule" do firstNode = Schedule.new_node(800, 2400, 1600, 1, nil) itin = [firstNode] e = Schedule.new_event("sleep",800,1300,100,"2200 Durant") newItin = Schedule.sits(itin, e, 800) f1 = newItin[0].type == 0 f1e = newItin[0].endtime == 900 ...
true
920ddc5ec1a1b9fbb376daf10ab2b561a6c4798f
Ruby
pacorro2000/Ejercicios-Basicos
/inheritance.rb
UTF-8
220
3.609375
4
[]
no_license
require './animal.rb' class Rabbit < Animal def hop puts "Hopping is great fun" end end class Duck def swim puts "I'm quackers abour swimming!" end def say_hello "Quack! I'm a duck called #{@name}" end end
true
ae42fd4d4bcf2b599764fcc91e84b9f0663d8807
Ruby
nelyj/tensor_stream
/spec/tensor_stream/examples/hello_world_spec.rb
UTF-8
422
2.546875
3
[ "MIT" ]
permissive
require "spec_helper" require 'benchmark' require 'matrix' RSpec.describe "Hello world sample" do it "prints hello world" do # Simple hello world using TensorStream # Create a Constant op hello = TensorStream.constant('Hello, TensorStream!') # Start the TensorStream session sess = TensorStream....
true
885ead9154f10bd4b5719c794772fa8b0e4365e8
Ruby
cchandler/certificate_authority_cli
/lib/certificate_authority_cli.rb
UTF-8
5,299
2.625
3
[ "MIT" ]
permissive
$: << File.dirname(__FILE__) require "certificate_authority_cli/version" require 'certificate_authority' require 'thor' require 'yaml' require 'logger' require 'highline/import' Log = Logger.new(STDOUT) GENERIC_SUBJECT = {"cn" => "", "ou" => ""} NEW_ROOT_SETTINGS = {"subject" => GENERIC_SUBJECT, "modulus" => 2048, "c...
true
8a93a05a3deec9c0d82e2b2559cc3a9b828ac4d7
Ruby
osorubeki-fujita/odpt_tokyo_metro
/lib/tokyo_metro/static/train_type/custom/default_setting/info.rb
UTF-8
3,247
2.8125
3
[ "MIT" ]
permissive
# 個別の列車種別の情報を扱うクラス (default) class TokyoMetro::Static::TrainType::Custom::DefaultSetting::Info < TokyoMetro::Static::TrainType::Custom::OtherOperator::Info include ::TokyoMetro::ClassNameLibrary::Static::TrainType::Custom::DefaultSetting include ::TokyoMetro::Modules::ToFactory::Common::Generate::Info # @!group 種...
true
d22091ff849fa152dca1e9aac0df64a13e3c5086
Ruby
ollieh-m/ruby-exercises
/yamlprac.rb
UTF-8
179
2.546875
3
[]
no_license
require 'yaml' object = ['1',1,46,'ABC'] file = 'yamltestfile.txt' File.open file, 'w' do |f| f.write object.to_yaml end yaml_string = File.read file p YAML::load yaml_string
true
050213bb084b1164e0b2aeccbe1e2441ff3cabce
Ruby
emaust/binary-and-decimal
/lib/binary_to_decimal.rb
UTF-8
232
3.453125
3
[]
no_license
def binary_to_decimal(binary_array) exponent = binary_array.length - 1 decimal_value = 0 binary_array.each_with_index do |value, index| decimal_value += value * (2 ** exponent - index) end return decimal_value end
true
a6f179c8ee3e5a76388f4c1d074b980c11bc97fe
Ruby
yannycastrillon/gotfaker
/lib/gotfaker/character.rb
UTF-8
2,396
2.890625
3
[]
no_license
require 'nokogiri' require 'open-uri' module GOTFaker class Character noko = Nokogiri::HTML(open("http://awoiaf.westeros.org/index.php/List_of_characters")) @names = noko.search('#mw-content-text ul li a:first-child').map{|name| name.inner_text}.uniq def self.random_name @names.sample end ...
true
4a09814b230d18060166ddd3c4fc5d991a7c5703
Ruby
camsys/otp-buddy
/app/models/landmark.rb
UTF-8
2,830
2.6875
3
[]
no_license
class Landmark < ActiveRecord::Base serialize :types scope :has_address, -> { where.not(:address => nil) } scope :is_old, -> { where(:old => true) } scope :is_new, -> { where(:old => false) } scope :pois, -> { where(:landmark_type => 'POI') } scope :stops, -> { where(:landmark_type => 'STOP') } def se...
true
f1fa6cff98ef60114652596e564189257d115f14
Ruby
bradseefeld/rgviz_data_table
/lib/rgviz/data_table/column.rb
UTF-8
782
2.671875
3
[]
no_license
module Rgviz module DataTable class Column def self.factory(statement) statement = statement.strip col = nil if m = statement.match(/sum\((.*)\)/i) col = Rgviz::DataTable::SumColumn.new(m[1], statement) end if m = statement.match(/ma...
true
a39d7e0e6e60b2fb3054151ebf09c49b38e0f317
Ruby
declarativitydotnet/declarativity
/lincoln/ruby/lib/types/table/table_cat.rb
UTF-8
866
2.625
3
[]
no_license
require 'lib/types/table/table' require 'lib/types/table/catalog' require 'lib/types/table/index' class TableCat @table = nil @catalog = nil @index = nil attr_reader :table, :catalog, :index def init @table = Table.new @catalog = Catalog.new @index = Index::IndexTable.new register(catalog.n...
true
63621e7accc2e514cbad26459f89d16a821e5960
Ruby
elon/dotfiles
/bin/kbd
UTF-8
761
2.609375
3
[ "MIT" ]
permissive
#! /usr/bin/env ruby # NOTE: see model list and options at /usr/share/X11/xkb/rules/base.lst def help puts `setxkbmap -print -verbose 10` end # the quotes surrounding the options parameters made a sudden major difference def apple #`setxkbmap -model applealu_ansi -option "" -option grp:shift_caps_toggle -option...
true
c69c82b05f1f60572f3e5a648c339b515738e6a6
Ruby
reactormonk/Ruby-Hands-On
/lib/arrays.rb
UTF-8
538
2.921875
3
[]
no_license
# To not overload namespaces module Arrays # Add 2 to each element and return the new array. def add_2(array) end # Delete all smaller than 4 and sort it from lowest to highest def del_sort(array) end # Return all odd numbers within the given array def odd_numbers(array) end # Delete every second...
true
0fb6fa8b5b977f6c328d022e9b2961fa6248248c
Ruby
Faisal2017/ruby_project_moneytracker
/db/seeds.rb
UTF-8
1,083
2.53125
3
[]
no_license
require_relative('../models/merchant.rb') require_relative('../models/tag.rb') require_relative('../models/transaction.rb') require('pry-byebug') Transaction.delete_all Merchant.delete_all Tag.delete_all tag1 = Tag.new({ 'tag_name' => 'Education' }) tag1.save tag2 = Tag.new({ 'tag_name' => 'Groceries' }) t...
true
89f82d5342b52afbc6c9eb59e1d71a4dd0455b56
Ruby
markiz/amq-client
/lib/amq/client/mixins/anonymous_entity.rb
UTF-8
797
2.625
3
[ "MIT" ]
permissive
# encoding: utf-8 module AMQ module Client # Common behavior of AMQ entities that can be either client or server-named, for example, exchanges and queues. module AnonymousEntityMixin # @return [Boolean] true if this entity is anonymous (server-named) def anonymous? @name.nil? or @name.em...
true
29abb55c55cd22a0aabf604b34d7065458446f95
Ruby
MegOlson/fan_site
/app/models/book.rb
UTF-8
1,446
3.078125
3
[]
no_license
class Book < ActiveRecord::Base validates :name, :bio, :presence => true belongs_to :genres has_many :reviews scope :abc_sort, -> {order(name: :asc)} scope :oldest_first, -> { order(created_at: :asc)} scope :newest_first, -> { order(created_at: :desc)} def find_average ratings = Review.in_book(self....
true
8a85d46d54d24d2588acb35ff06424a2e4e0e478
Ruby
jvnill/unit_robot
/lib/unit_robot.rb
UTF-8
1,200
3.5
4
[]
no_license
class UnitRobot attr_reader :commands, :x, :y, :direction DIRECTIONS = %w[NORTH EAST SOUTH WEST] PLACE_REGEX = /PLACE (?<x>[0-4]),(?<y>[0-4]),(?<direction>(#{DIRECTIONS.join('|')}))/ MOVE_DIRECTION_MAPPING = { 'NORTH' => [0, 1], 'EAST' => [1, 0], 'WEST' => [-1, 0], 'SOUTH' => [0, -1] } ...
true
8ec195d69974d238ca0d9c330c1ce032dca646a4
Ruby
clockworm/exercises
/scri.rb
UTF-8
1,540
3.09375
3
[]
no_license
#encoding : utf-8 class Cour #str = "1 数学作业\n2 数学作业\n3 数学作业\n4 数学作业\n5 数学作业\n" def query texts = openCourse.readlines co = Hash.new texts.each do |text| text.chomp! arr_a = text.split(/\s+/) co[arr_a[0]] = arr_a[1] end return co end def select course = query course.each do |key,value| p...
true
6dfaee2882473928a3f1aa1c88afde4793773227
Ruby
evancarlsen/deli-counter-seattle-web-062419
/deli_counter.rb
UTF-8
574
3.65625
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
katz_deli = [] def line(deli) if deli.size == 0 puts "The line is currently empty." else order = "The line is currently:" deli.each_with_index { |name, place| order += " #{place+1}. #{name}" } puts order end end def take_a_number(deli, customer) deli...
true
ed128b05d2a2a397320d37f9b1a63a67e47c90c3
Ruby
kakuda/myfiles
/home/libs/ruby/ymchat.rb
EUC-JP
6,521
2.625
3
[]
no_license
#!/usr/bin/env ruby # ====================================================================== # ymc - ñYahoo!å󥸥㡼饤 # # 0.12 2002-01-12 # 0.13 2005-04-06 # ---------------------------------------------------------------------- require "net-im-yahooj" $DEBUG = 1 class MyClient < Net::IM::YahooJ::SimpleClient # # t...
true
9fc5e03955c12f3dfd9856f198d0087979fcdfe7
Ruby
jaosn/leedcode_ruby
/reverse_words_in_string.rb
UTF-8
366
4.15625
4
[]
no_license
# Given an input string, reverse the string word by word. # # For example, # Given s = "the sky is blue", # return "blue is sky the". def reverse_words(s) strs = s.split(" ") if strs.length == 0 return "" elsif strs.length == 1 return s else strs.reverse! return strs.join(" ") end end s = ...
true
c8b85eb577078873193820c3f653239cde2bdd85
Ruby
sheldonh/ipaddress
/spec/ip_v4_spec.rb
UTF-8
16,530
2.96875
3
[]
no_license
require 'spec_helper' describe "IP::V4" do describe "#new" do it "takes a CIDR string" do expect { IP::V4.new("192.168.0.0/24") }.to_not raise_error end it "takes an address/mask dotted quad string" do ip = IP::V4.new("192.168.0.0/255.255.255.0") ip.mask.should == IP::V4.new("192.168.0...
true
17c232d98dfc55459058ae856b672fc816b31307
Ruby
davegw/tula
/app/models/acquisition.rb
UTF-8
329
2.515625
3
[]
no_license
class Acquisition < ActiveRecord::Base attr_accessible :acquisition_date, :acquisition_price, :initial_date, :initial_price, :return, :year, :company def calc_return! self.return = (acquisition_price - initial_price)/initial_price self.save end def self.last_updated self.order('updated_at').last ...
true
be98d734fb2d35d3cbab2e064f8e11ce71dac90e
Ruby
sirinath/Terracotta
/dso/tags/3.5.1/code/base/buildscripts/download_util.rb
UTF-8
1,145
2.734375
3
[]
no_license
require 'fileutils' require 'uri' # Utility class for downloading remote resources, optionally caching them for # future reuse. # This class makes use of the global Registry object, so it must be used in a # context where the Registry has already been initialized. class DownloadUtil # Creates a new download utility...
true
4de72b03eae323ac31016e1adcbe8d292b8bef6c
Ruby
coinbase/salus
/lib/salus/scanners/language_version/ruby_version_scanner.rb
UTF-8
1,842
2.609375
3
[ "Apache-2.0" ]
permissive
require 'salus/scanners/language_version/base' module Salus::Scanners::LanguageVersion class RubyVersionScanner < Base def self.supported_languages %w[ruby] end private def run_version_scan? ruby_project? end def lang_version @lang_version ||= ruby_project? ? ruby_version...
true
26bef23bd15eb1f34c8382947e87f98967cf9a58
Ruby
pureslapps/Intro-to-Ruby
/main.rb
UTF-8
1,204
4.5
4
[]
no_license
# Introduction to Ruby # create variables just by giving them a name # no let const or var name = 'Jorge Bhagwandeen' score = 100 # to determine an objects data type use the ... # .class method name.class # String 'class types are always capital' score.class # Integer # Arrays look the same in most languages name...
true
ea3e8c85a02848d75a456e83746f423f57d769e7
Ruby
AlanBraut/C2
/lib/tasks/import_users.rake
UTF-8
2,113
2.515625
3
[ "CC0-1.0", "LicenseRef-scancode-public-domain" ]
permissive
def gsa18f_yaml_file(file_path) yaml = YAML.load_file(file_path) secret = yaml["private"] || {} find = lambda {|field_name| yaml.fetch(field_name, secret[field_name]) } user = User.for_email(find["email"]) user.update( first_name: find["first_name"], last_name: find["last_name"], ...
true