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
96419a06213368ffb409ae507f4bdc6804028205
Ruby
gmalkas/dcpu16-ruby-emulator
/dcpu16-ruby-emulator.rb
UTF-8
363
2.921875
3
[ "MIT" ]
permissive
#! /usr/bin/env ruby # DCPU-16 Ruby Emulator require_relative './dcpu16/emulator' if ARGV.size != 2 puts "Format: dcpu16-ruby-emulator filename number_of_instructions" exit false end filename, number_of_instructions = *ARGV emulator = DCPU16::Emulator.new filename emulator.run number_of_instructions.to_i p emul...
true
00a65d6488c2014b7b1ed8458504b46197946bbc
Ruby
davidbalbert/text_analysis
/most_used_words.rb
UTF-8
529
3.828125
4
[]
no_license
# prints 20 most used words with number of times used file = 'anna_k_p1c1.txt' text = File.readlines(file) string = text.join("").downcase.gsub(/-/, "X") # puts text into a lowercase string, but - replaced by X string = string.gsub(/[[:punct:]]/, "") # removes punctuation list = string.split(/\s+|X+/) # puts ...
true
e9f18a7b9b399e44d1a8df1abb622a982d59eb4c
Ruby
AnDrJuX/Black-Jack
/player.rb
UTF-8
881
3.75
4
[]
no_license
class Player attr_accessor :name, :bank, :hold_cards, :sum BANK = 100 def initialize(name) @name = name @bank = BANK @bank_win = 0 @hold_cards = [] @sum = sum end def bank_player @bank end def bank_player_win @bank + @bank_win end def bank_pull @bank -= 10 @ba...
true
5eaf785842c2c5e5651106772a9a16ebc740ee66
Ruby
rafahg/chitter-challenge
/lib/peep.rb
UTF-8
811
2.828125
3
[]
no_license
require 'pg' require_relative 'new_peep' class Peep def self.posted_peeps connection = PG.connect(dbname: 'chitter') if ENV['ENVIROMENT'] == 'test' connection = PG.connect(dbname: 'chitter_test') else connection = PG.connect(dbname: 'chitter') end result = connection.exec("SE...
true
e6777561a93505bce0fa3c6e9cc533394c2bbbf9
Ruby
Murphydbuffalo/Learn_To_Program
/Ch7/grandma.rb
UTF-8
548
3.421875
3
[]
no_license
byecount = 0 puts 'ELLO LOVE!' while true say = gets.chomp if say != say.upcase byecount = 0 puts 'EH?! SPEAK UP!' elsif say == say.upcase && say != 'BYE' byecount = 0 puts 'NO, NOT SINCE '+(1920+rand(31)).to_s+'.' end if byecount <2 && say == 'BYE' byecount = (byecount + 1) put...
true
2b1e4a792a6a7119127163ed72cb5a4ebb279ca7
Ruby
shaunhk/course_work
/week_2/day_4/enum_practice.rb
UTF-8
1,461
3.953125
4
[]
no_license
pets = [ { name: "Sir Percy", pet_type: :cat, breed: "British Shorthair", price: 500 }, { name: "King Bagdemagus", pet_type: :cat, breed: "British Shorthair", price: 500 }, { name: "Sir Lancelot", pet_type: :dog, breed: "Pomsky", price: 1000, }, { name: "Arthur", ...
true
adf6e6f93591fae210e9251751002877414c0efe
Ruby
Anmolbhati30/makersbnb-b-n-c
/spec/room_spec.rb
UTF-8
1,581
2.6875
3
[]
no_license
require "room" describe Room do describe ".all" do it "returns all rooms" do add_rooms_to_test_database rooms = Room.all expect(rooms[0].name).to eq "Room 1" expect(rooms[0].description).to eq "This is a room." expect(rooms[1].name).to eq "Room 2" expect(rooms[1].description)...
true
0bcef5e2cf0a846ba1c2464541b25a1a1c221997
Ruby
olenderhub/ruby-script-app
/lib/position.rb
UTF-8
1,152
3.859375
4
[]
no_license
class Position FACINGS = %w(EAST NORTH SOUTH WEST) attr_reader :table, :x, :y, :facing def initialize(table, x, y, facing) @table = table @x = x @y = y @facing = facing end def is_valid? table.width >= x && table.height >= y && FACINGS.include?(facing) end def output ...
true
9f2faddec82c3408168eadcbd17fd35e37de06a6
Ruby
santosh-1987/CommunicationForum
/lib/jobs/images.rb
UTF-8
892
2.578125
3
[]
no_license
module Jobs class Images extend Jobs::Base def self.generate_user_thumbnails(user_id) user = User.find(user_id) if user.has_avatar? generate_thumbnails(user, user.avatar) end end def self.generate_group_thumbnails(group_id) group = Group.find(group_id) if group....
true
4da701b6511309f47777e23f02d1a08d8872ec8f
Ruby
sahhin/Ruby
/A5/A5-SoSe2019 RekursiveGrafik/Vegetation.rb
UTF-8
2,900
3.78125
4
[]
no_license
require "tk" require "./Turtle" require "./Point" class Vegetation BAUM = 1 RANKE = 2 BAUM_LAENGE = 64 RANKE_LAENGE = 32 BAUM_BREITE = 2 RANKE_BREITE = BAUM_BREITE BAUM_WINKEL = 22 RANKE_WINKEL = 28 C0 = "#808000" # Olive C1 = "#3CB371" # MediumSeaGreen C2 = "#66CDAA" # MediumAquamarine C3 = "...
true
1c85a948a6eea85b7dc0154f9d12d600a1e3e2a1
Ruby
entry-point/performance-tips-gijutushoten-2018
/app/controllers/search_user_of_index_controller.rb
UTF-8
2,190
2.515625
3
[ "Apache-2.0" ]
permissive
# ユーザをテーブルから検索する。 # Indexが有効か、そうでないかの差を確認できるようにするためのもの class SearchUserOfIndexController < ApplicationController after_action :assign_params # 100回検索を行う def show @elapsed_time_of_sum = 0 @elapsed_time_of_one_hundlred = [] @row_count = 20 start_time = Time.now 100.times do @users = if us...
true
ab049577c2f72bbef3e2f51910b4f05b0c032c25
Ruby
mmabraham/Games
/tic-tac-toe_to_be_replaced/lib/board.rb
UTF-8
1,564
3.46875
3
[]
no_license
class Board attr_accessor :grid def initialize(grid = nil, size = 3) @grid = grid || Array.new(size) { Array.new(size) } @size = size end def [](pos) row, col = pos @grid[row][col] end def []=(pos, mark) row, col = pos @grid[row][col] = mark end def place_mark(pos, mark) e...
true
69317b78240cc2fee8a8f45aa977f40d3a792be4
Ruby
eysi09/buzzwords_app
/lib/word_count_utils.rb
UTF-8
3,521
2.8125
3
[]
no_license
module WordCountUtils # Methods expect mp and ga to be Active Record models, party to be a string # and opts[:general_assemblies] to be an array of general assembly ids # e.g. mp = MemberOfParliament.where(id: 2).first # e.g. ga = GeneralAssembly.where(id: 143).first # e.g. party = 'Vg' def self.get_word_...
true
36d2818739869fe5384f00ae601267d1e0c4626c
Ruby
christhede/LaunchSchool
/101_ProgrammingFoundations/Lesson_2/stringy.rb
UTF-8
398
3.8125
4
[]
no_license
def stringy(number) string = "" loop do if number == 0 break elsif string.empty? string << "1" elsif string.end_with?("0") string << "1" elsif string.end_with?("1") string << "0" end number -= 1 end string end puts stringy(6) == "101010" puts str...
true
15d15e3df9e7e6db6393eeac1fa0d134b573d79c
Ruby
anumahmad/kwk-l1-currency-conversion-kwk-students-l1-phil-072318
/currency.rb
UTF-8
1,618
4.21875
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
# Write your code here def usd_to_eur puts "How many USD do you have?" usd = gets.chomp puts "Your Euro ammount is #{usd.to_f * 0.86}" end #usd_to_eur # def eur_to_usd # puts "How many Euros do you have?" # eur = gets.chomp # puts "Your dollar amount is #{eur.to_f * 1.17}" # end # eur_to_usd def con...
true
8f8300671ce4db23fd531777cb9752a8cbd81961
Ruby
clouby/horrbot
/handler.rb
UTF-8
2,184
3.09375
3
[]
no_license
load "vendor/bundle/bundler/setup.rb" require 'twilio-ruby' require 'firebase' require 'uri/query_params' # Utils def next_response(data: nil) { statusCode: 200, headers: { 'Content-Type': 'text/xml' }, body: data } end def get_params(params = '') params = params.split('+', 2) { action:...
true
653d08cc172cd0bdf2bc6a5debd4ae47bf562fd0
Ruby
betagouv/monstage
/app/components/internship_agreements/button_component.rb
UTF-8
3,152
2.59375
3
[ "MIT" ]
permissive
module InternshipAgreements class ButtonComponent < BaseComponent attr_reader :internship_agreement, :current_user, :label, :second_label def initialize(internship_agreement:, current_user:, label: {status: 'enabled', text: 'Editer'}, second_label: {st...
true
f262a329a6a03df6af184d6983210426a907044a
Ruby
Andreas-AS/W2D4
/anagrams.rb
UTF-8
916
3.875
4
[]
no_license
# anagram?("gizmo", "sally") #=> false # anagram?("elvis", "lives") #=> true def first_anagrams(string1, string2) anagrams = [] array = string1.split("").permutation.to_a array.each { |stringed_array| anagrams << stringed_array.join("") } anagrams.include?(string2) end def second...
true
b88581eb7347bfb4a5fd9f25093f8673b351d191
Ruby
PanYuer/appAcademy
/AdvancedProblems/most_vowels.rb
UTF-8
637
4.65625
5
[]
no_license
# Write a method most_vowels that takes in a sentence string # and returns the word of the sentence that contains the most vowels. def most_vowels(sentence) counts = {} words = sentence.split(" ") words.each { |word| counts[word] = count_vowels(word) } # {"what"=> 1, "a"=> 1, "wonderful"=> 3, "life"=> 2} sor...
true
628389a44a0d515432077d6d73bbc24e89967cf7
Ruby
mkrogh/lnl-tf2stats
/lib/steam/log_parser.rb
UTF-8
840
2.671875
3
[]
no_license
require "steam/user" module Steam class LogParser attr_reader :actions, :users def initialize() @actions = {} @users = {} end def entry(pattern, &block) @actions[pattern] = block end def handle_line(line) user = nil @actions.each do |pattern, block| if m...
true
770ef86e5292d5e33dcb7957e3c1e6a110e5b078
Ruby
bertiewooster/tutorial
/hello.rb
UTF-8
786
2.625
3
[]
no_license
require 'sinatra' require 'rack/handler' Rack::Handler::WEBrick = Rack::Handler.get(:puma) get '/' do 'Hello, world! Hello, Elmo!' end # :x is required for matching # Try /x/testing # Will not match /x because no trailing slash provided # Will not match /x/ because :x param is missing get '/x/:x' do "x is #{param...
true
889a1cb081f081279196b9d515b6c3e3216ba6c1
Ruby
britg/playforgecraft.com
/app/models/hero.rb
UTF-8
2,337
2.703125
3
[]
no_license
class Hero < ActiveRecord::Base belongs_to :player belongs_to :job, :class_name => "HeroClass", :foreign_key => "hero_class_id" has_many :slots, :class_name => "HeroSlot" validates_presence_of :name validates_presence_of :job validates_presence_of :player before_create :default_stats after_create :cr...
true
eadcc79e8e0df4ef1d9fac0fe3c066f05b24475f
Ruby
tdeo/advent_of_code
/2021/lib/03_binary_diagnostic.rb
UTF-8
1,223
3.375
3
[]
no_license
# frozen_string_literal: true class BinaryDiagnostic def initialize(input) @input = input @lines = @input.split("\n") end def gamma_rate digit = '' (0...@lines.first.size).each do |i| digit += @lines.map { _1[i] }.tally.max_by(&:last).first end digit.to_i(2) end def epsilon_...
true
92e62964c305162cead457a53e19c11e5faa178e
Ruby
LauraKirby/aspera-ibm-analytics-api
/analytics-api-demo/get_organization.rb
UTF-8
1,517
2.84375
3
[]
no_license
require 'restclient' require 'json' require './authentication.rb' require './constants.rb' include Authentication # --------------------------------------------------- # To run this script first complete the following: # --------------------------------------------------- # 1) "Configuring Your Local System and Aspe...
true
585cc479e0af5d3a5d7b18e8f05a0ba81a5ecf8c
Ruby
max-codeware/FFcas
/FFsystem/FFoverload.rb
UTF-8
3,214
3.8125
4
[ "MIT" ]
permissive
#! /usr/bin/env ruby ## # Overload of String class # # # Author:: Massimiliano Dal Mas (mailto:max.codeware@gmail.com) # License:: Distributed under MIT license class String # Checks if the string contains at least a character of the given one. # # * **argument**: string for the checking # * **returns**: +tru...
true
bdca3f86f6c37343ace2673413bb8b9e876bde58
Ruby
jaquelinecamarda/estudo-ruby
/projeto_biblioteca/library.rb
UTF-8
882
3.8125
4
[]
no_license
require_relative 'user.rb' # método para acessar dentro de uma mesma pasta outro arquivo utilizado neste código class Library def initialize @books = [] @users = [] end def add_user(user) @users << user end def list_users @users.each do |user| # não é necessário que se chame us...
true
4171b72d692b4e44bfa28952e5e7fb90e41a9621
Ruby
tomas-stefano/restfulie
/lib/restfulie/common/representation/json/keys_as_methods.rb
UTF-8
2,018
2.796875
3
[ "Apache-2.0" ]
permissive
module Restfulie module Common module Representation class Json module KeysAsMethods def self.extended(base) [:type, :id].each { |m| base.__free_method__(m) } end def [](key) __normalize__(super(key)) end ...
true
13aefd151cd8a53bd0dfc625fe3775ae0de20495
Ruby
kevin-klein/rubyrep
/lib/rubyrep/actors/tregistry.rb
UTF-8
145
2.59375
3
[ "MIT" ]
permissive
class TRegistry def self.[](name) actor = Celluloid[name] while actor.dead? actor = Celluloid[name] end actor end end
true
81f912604f8862393f810eb9a08cb2489125b693
Ruby
SpencerCDixon/LaunchAcademy
/Student/Week1/comet/fibonacci/lib/fibonacci.rb
UTF-8
101
3.171875
3
[]
no_license
def fibonacci(num) return num if (0..1).include?(num) fibonacci(num - 1) + fibonacci(num -2) end
true
d96ad1bd5b68b19b5ecf88050898d9ad8f0ceb2d
Ruby
perryqh/mortgage-buddy
/lib/mortgage_buddy/payment_plan.rb
UTF-8
1,864
2.859375
3
[ "MIT" ]
permissive
module MortgageBuddy class PaymentPlan class << self def build(params) new(params).payments end end def initialize(params) @loan_amount = params[:loan_amount] @monthly_payment = params[:monthly_payment] @monthly_interest_rate = params[:...
true
46a337cacab392df3e79af06fc9c525ed0a57f8c
Ruby
wackyapples/streamctrl
/streamctrl.rb
UTF-8
2,586
2.515625
3
[ "MIT" ]
permissive
require 'sinatra' require 'haml' configure do ## Configure these ## # The name of the station being streamed set :station, 'Sinatra Radio' # The url of icecast/shoutcast server's status page. set :server_status_page, 'http://example.com:8000/server_status' ## Don't mess with these unless you know what you...
true
cf54e3c76760a6ae7d50cde2a52963f3598a9641
Ruby
eugenenelou/objective-progress
/fullstack_1/backend/level_4/main.rb
UTF-8
5,557
2.671875
3
[]
no_license
require 'json' require 'date' def getFormattedInputData() file = File.read('data/input.json') data = JSON.parse(file) objectives = {} progress_records = [] data['objectives'].each do |objective| begin objective['start_date'] = Date.parse(objective['start_date']) objective['end_date'] = Date.p...
true
826a88769bf1a07aa8066720f58e1fbcd31eb322
Ruby
timn3/Ruby
/encoder_hexa_v_4.rb
UTF-8
576
3.328125
3
[]
no_license
require 'csv' encoding_array = CSV.open("data/char_list.csv").read() letters_to_encode = gets.chomp.split("") def encode(letter, csv_array) letter_and_encodings_array = csv_array.select { |l_a_e| letter == l_a_e[0] } letter_and_encoding = letter_and_encodings_array.first encoding = letter_and_encoding[1...
true
42132d085682815293096c05c9d41d5c48fe1e74
Ruby
tulibraries/cdm_batch
/lib/cdm_batch/failed_etd_writer.rb
UTF-8
839
2.53125
3
[]
no_license
module CdmBatch class FailedETDWriter def initialize(filename=nil) @filename = filename || "could_not_be_uploaded.tsv" @write_options = {:col_sep => "\t"} @read_options = {:headers => :first_row, :col_sep => "\t", :quote_char => "|"} end def add_to_failed_upload_tsv(original_etds_...
true
f1077f86ac64dcc8a4539eba9f33d55381db25c9
Ruby
nvhoang1503/babygift
/app/models/shared_methods.rb
UTF-8
340
3.078125
3
[]
no_license
module SharedMethods module Parser def self.Boolean(string) string = string.to_s return true if string== true || string =~ (/(true|t|yes|y|1)$/i) return false if string== false || string.nil? || string =~ (/(false|f|no|n|0)$/i) raise ArgumentError.new("invalid value for Boolean: #{string}"...
true
a6e5834f37bdaf2bd944be2db3496b5639e5c0e8
Ruby
estebanmh95/makeit_2019
/poo.rb
UTF-8
1,897
4.34375
4
[]
no_license
# Clase class Person attr_accessor :name #Get Set #attr_reader :name #Get #attr_writter :name #Set def initialize(name) # Se ejecuta siempre al momento de instanciar o crear un nuevo objeto @name = name #Variable de instancia o atributo de clase end def saludar_dos(otro_nombre) "Hola #{otro...
true
c51e78fe9ee529c69fa6df16ac21289b395fad15
Ruby
Caro407/EventBrite
/app/helpers/events_helper.rb
UTF-8
792
2.921875
3
[]
no_license
module EventsHelper def crop_title(event) shorten_title = "" count = 0 event.title.each_char do |letter| if count < 14 shorten_title << letter count += 1 end end shorten_title = shorten_title + " [...]" return shorten_title end def crop_description(event) ...
true
1c409c8c81946ec22e247f90fcb1a1aacbc05ca8
Ruby
stephanetesta/https-github.com-gCKn-rubyCourse
/Lecture/Section 5/Les modules/main.rb
UTF-8
1,135
4.3125
4
[]
no_license
module Homeworkable def homework(object) "#{object} has to do his/her homework" end end class Father include Homeworkable attr_accessor :name, :email, :age, :sexe def initialize(name, email, age, sexe) @name = name @email = email @age = age @sexe = sexe end def shout puts "I'm the f...
true
abef8be48b1676ef5916d1c904d7ac822316478f
Ruby
sas2job/Ruby-Is-For-Fun
/code/app41.rb
UTF-8
809
3.96875
4
[]
no_license
print 'Ваш возраст: ' age = gets.to_i if age < 18 puts 'Сожалеем, но вам нет 18' exit end balance = 20 loop do puts 'Нажмите Enter, чтобы дернуть ручку...' gets x = rand(0..5) y = rand(0..5) z = rand(0..5) puts "Результат: #{x} #{y} #{z}" if x == 0 && y == 0 && z == 0 balance = 0 puts 'Ваш б...
true
b4d9f1ad90cc86d38d5180b76be7fe3d12debb10
Ruby
sofer/icify
/app/models/import.rb
UTF-8
2,849
2.703125
3
[]
no_license
require 'csv' require 'erb' class Import < ActiveRecord::Base belongs_to :company before_save :preview_first def csv_file=(csv_file) parse_csv(csv_file) @preview_first = true end private def preview_first @preview_first ||= false end def erb_conversion(regex) regex.gsub!(/\{...
true
3f3639c501b5821022398fc88c46fe2902833f75
Ruby
will-gant/lrthw
/ex19/studydrill.rb
UTF-8
1,396
4.71875
5
[]
no_license
# creates a function/method named cheese_and_crackers, which takes who arguments, cheese_count and boxes_of_crackers. # Those two arguments are interpolated into various strings, ending with a new line escape \n, and 'end' def cheese_and_crackers(cheese_count, boxes_of_crackers) puts "You have #{cheese_count} chee...
true
e7e258765a802902658b5172bd33665651193030
Ruby
diegoffnogueira/ruby-iniciante
/modulos.rb
UTF-8
415
3.109375
3
[]
no_license
module Compartilhado def imprime_texto puts "Texto compartilhado!!!" end end class Carro_comp include Compartilhado def metodo_do_carro puts "Carro!!" end end carro_comp = Carro_comp.new carro_comp.imprime_texto carro_comp.metodo_do_carro module Fabrica class Carro def metodo_de_carro p...
true
f56904ec128ecbeda9d01a7eb81908d3ae79211e
Ruby
dan-manges/unit-record
/test/unit_record/column_test.rb
UTF-8
1,131
2.75
3
[ "MIT" ]
permissive
require File.dirname(__FILE__) + "/../test_helper" functional_tests do test "instantiating" do person = Person.new :first_name => "Dan", :last_name => "Manges" assert_equal "Dan", person.first_name assert_equal "Manges", person.last_name end test "using model with column with a default" do rec...
true
e409b7f6f38554da77193af06e4f7111eeba436b
Ruby
doches/Categorizer
/lib/Joel.rb
UTF-8
1,943
3.0625
3
[]
no_license
require 'lib/Vectors' require 'legacy/ncosine' # require 'progressbar' class JoelSpace # Get a list of words in this space attr_accessor :nouns # Load a JoelSpace from files in the given +dir+ def initialize(dir) nouns = IO.readlines(File.join(dir,"selected_nouns")).map { |x| x.strip.split(";")[1] } ...
true
2bf7cd494d19b7f54317d8a1a47f25b6f30e85af
Ruby
patmaddox/21-day-challenge
/2_adventures/001/sbartek/07/questionnaire_spec.rb
UTF-8
2,979
3.03125
3
[]
no_license
require 'minitest/autorun' require_relative 'questionnaire' describe Questionnaire do describe '#initialize' do describe 'with no args' do before do @questionnaire = Questionnaire.new end it "must respond to title" do @questionnaire.must_respond_to(:title) end ...
true
2a6ccaa45f3cbb53371469ac488c82431cf18cfe
Ruby
marinacor1/headcount
/lib/economic_profile.rb
UTF-8
2,713
3.34375
3
[]
no_license
require 'pry' require_relative 'custom_errors' class EconomicProfile attr_reader :name, :data def initialize(data= {}) @data = data @name = data[:name].upcase if data.has_key?(:name) end def median_household_income data.fetch(:median_household_income) end def median_household_income_in_year(...
true
9c221018c04021b4c26fce76fa60e64c60b72538
Ruby
xsoameix/p2p-chat-room
/server.rb
UTF-8
5,665
2.921875
3
[]
no_license
require 'digest/sha1' require 'socket' class Node < Struct.new(:id, :ip, :port) end class Server attr_reader :successor, :predecessor, :finger, :max_nodes def id return @this_node.id end def initialize(host, port, cb, args) # constructor @cb = cb @args = args @host = host # 16-bit i...
true
3c17ec6cab7e9ac630c714f8e43c825f73bbdbbd
Ruby
joshuajhun/mastermind
/master_mind.rb
UTF-8
2,966
3.546875
4
[]
no_license
def start_game puts"Welcome to MASTERMIND Would you like to (p)lay, read the (i)nstructions, or (q)uit" # => nil @user_answer = gets.chomp.downcase.chars # ~> NoMethodError: undefined method `chomp' for nil:NilClass end ...
true
8224f2ed528bf97bb2bc6211e769038d5e8c17d7
Ruby
Mattlk13/rbitter
/lib/rbitter/console.rb
UTF-8
2,485
2.59375
3
[ "MIT" ]
permissive
# encoding: utf-8 # # Rbitter Archive Access console (irb) require "xmlrpc/client" require "rbitter/version" require "ripl" module Rbitter class Console def initialize puts "Rbitter console #{Rbitter::VERSION}" help end def help puts "Predefined methods:" puts "ar - shortcut to ...
true
9eadb18b3c53f74c97028ad1277660efb031dba4
Ruby
kruzel/parknpay-server
/app/controllers/cities_controller.rb
UTF-8
3,764
2.546875
3
[]
no_license
class CitiesController < ApplicationController before_filter :authenticate_user! load_and_authorize_resource layout 'owner' # GET /cities # GET /cities.json def index @cities = City.all respond_to do |format| format.html # index.html.erb format.json { render json: @cities } ...
true
48e4e912f60b526db3e7a938209781580fc28d9d
Ruby
wolox-training/dv-rails
/app/services/open_library_service.rb
UTF-8
777
2.6875
3
[]
no_license
class OpenLibraryService include HTTParty base_uri 'openlibrary.org/api/books' FORMAT = 'json'.freeze JSCMD = 'data'.freeze def initialize(isbn) @isbn = isbn @options = { query: { bibkeys: @isbn, format: FORMAT, jscmd: JSCMD } } end def book_info resp...
true
50bbc615e81101a51a2bf3da7d053f7bc871e60c
Ruby
EricRicketts/LaunchSchool
/exercises/Ruby/small_problems/easy/seven/fourth_exercise.rb
UTF-8
1,515
4.15625
4
[]
no_license
=begin Swap Case Write a method that takes a string as an argument and returns a new string in which every uppercase letter is replaced by its lowercase version, and every lowercase letter by its uppercase version. All other characters should be unchanged. You may not use String#swapcase; write your own version of th...
true
393cd78589b8e90345377445e454243bf1d5bfc7
Ruby
ericdunham/top-four
/sorts.rb
UTF-8
2,019
3.296875
3
[ "MIT" ]
permissive
# frozen_string_literal: true require 'benchmark/ips' def test_array Array.new(100) { rand 1000 } end def insertsort!(ary) (1..(ary.length - 1)).each do |i| value = ary[i] j = i - 1 while j >= 0 && ary[j] > value ary[j + 1] = ary[j] j -= 1 end ary[j + 1] = value end end def ins...
true
c4970e0b841fe64e2d99a54c1c73cec32f6c55d1
Ruby
cjbrock/building-cli-022221
/lib/cli.rb
UTF-8
1,355
3.625
4
[]
no_license
class CLI def run # Greet out user puts "Welcome to the Star Wars Character Lister" # Tell them what to do puts "Please choose a Character" # Call our scrape character method API.load_characters # Call a list characters method list_characters ...
true
4155be5ce5dda8b413ef43f055de95c80980f0ae
Ruby
jumpinlabs/rrule_parser
/lib/rrule_parser/computable_rule.rb
UTF-8
1,868
2.96875
3
[ "MIT" ]
permissive
require 'active_support/all' module RRuleParser class ComputableRule < Rule attr_accessor :start, :finish, :duration, :rule, :dates WEEKDAYS = { sunday: 0, monday: 1, tuesday: 2, wednesday: 3, thursday: 4, friday: 5, saturday: 6 } def initialize(start, fini...
true
e0c01ea5ceef3ed93b516fa0e3af604d083247f2
Ruby
dfop02/Challenges
/ruby/Challenge_1/challenge.rb
UTF-8
863
3.328125
3
[ "MIT" ]
permissive
require "rspec/autorun" class Challenge def first_letter_not_repeated(word) # Do the challenge here end end # Do not change here describe Challenge, ".first_letter_not_repeated" do let(:challenge) { Challenge.new } it "it returns first letter that non repeat" do expect(challenge.first_letter_not_repe...
true
123533d5c1c8806d51c76517bbca0c28a9e2d493
Ruby
MitchyBAwesome/unblock
/bin/unblock
UTF-8
973
2.890625
3
[]
no_license
#!/usr/bin/env ruby require 'open-uri' require 'optparse' options = {} option_parser = OptionParser.new do |opts| opts.banner = "Usage: unblock [options]" # Create flag for email address opts.on("-e EMAIL", "Specifiy the email address associated with you unblock-us account") do | email | options[:email] = emai...
true
f0babc6dc47dafdf614295e4e5c5356b3568823a
Ruby
run-after/chess
/lib/game.rb
UTF-8
6,752
3.796875
4
[]
no_license
require "yaml" require_relative "./piece.rb" require_relative "./board.rb" require_relative "./empty.rb" require_relative "./king.rb" require_relative "./knight.rb" require_relative "./pawn.rb" require_relative "./queen.rb" require_relative "./rook.rb" require_relative "./bishop.rb" class Game attr_reader :round, :b...
true
571b529c33b99e9f5757c0b1645954c3097b3052
Ruby
khelll/r_project
/lib/r_indexer/description_extractor.rb
UTF-8
1,063
2.84375
3
[]
no_license
require 'rubygems/package' require 'zlib' module RIndexer # Extracts the version description from a .tar.gz file. class DescriptionExtractor attr_accessor :data def self.perform(data) new(data).perform end def initialize(data) self.data = data end def perform with_tmp_f...
true
ec9d2d044913441e528c6359b1a9ee4013fbf6f2
Ruby
alexblackie/yokunai
/lib/yokunai/config.rb
UTF-8
2,285
2.84375
3
[ "BSD-3-Clause" ]
permissive
module Yokunai # A centralized way to get configuration options. Reads values out of # `config.yml` (or whatever name is passed to `populate`). class Config # Any key in this hash can be overridden in your app's `config/*.yml`. DEFAULT_CONFIGURATION = { "template_dir" => "web/views", "asset_d...
true
2fd96ad3c60d7a1b1ef19668253ced671eb5d04d
Ruby
albertintech/ruby_basics
/docs1/ex3.rb
UTF-8
216
3.265625
3
[]
no_license
# Title: Return Value of while # Using the ruby documentation, determine what value a while loop returns. # According to the documentation: The result of a while loop is nil unless break is used to supply a value.
true
648f20846af14f043fb7ca869a08c23366cc3ac6
Ruby
Adjoa/badges-and-schedules-v-000
/conference_badges.rb
UTF-8
565
3.734375
4
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
def badge_maker(attendee) return "Hello, my name is #{attendee}." end def batch_badge_creator(attendees) attendees.collect do |attendee| badge_maker(attendee) end end def assign_rooms(attendees) room_assignments = attendees.each_with_index.collect do |attendee, room| "Hello, #{attendee}! You'll be assi...
true
aa708ba2506019b79f6611ec1534355b75c6f087
Ruby
kpearson/sales_engine
/lib/item.rb
UTF-8
1,088
2.9375
3
[]
no_license
class Item attr_reader :id, :name, :description, :unit_price, :merchant_id, :created_at, :updated_at def initialize(data, repository) @id = data[:id].to_i @name = data[:name] @description = data[:descrip...
true
484ec4ded21630d55bc27091db1921bd0a37a8d1
Ruby
WBojarski/ruby-oo-relationships-practice-blood-oath-exercise-london-web-010620
/tools/console.rb
UTF-8
1,180
3.0625
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
require_relative '../config/environment.rb' def reload load 'config/environment.rb' end # Insert code here to run before hitting the binding.pry # This is a convenient place to define variables and/or set up new object instances, # so they will be available to test and play around with in your console cult_a = Cul...
true
22249893eb822b72cac527fa98a51acaf4af13c2
Ruby
udayyatham/dashboard
/app/beans/time_bean.rb
UTF-8
189
2.84375
3
[]
no_license
class TimeBean attr_reader :startTime,:endTime,:totalTime def initialize(startTime,endTime,totalTime) @startTime=startTime; @endTime=endTime; @totalTime=totalTime; end end
true
c1bcf1e0de1d67c162da1ef26bb431c35a8592d4
Ruby
bigcartel/multi-statsd
/lib/multi-statsd/backends/hottie.rb
UTF-8
2,657
2.546875
3
[ "MIT" ]
permissive
require 'redis' # Hottie backend # Hottie is a redis-based short-term backend to enable real-time visibility into application behavior. # It is specifically designed to enable real-time heatmap/histogram visualizations from timer data. class MultiStatsd::Backend::Hottie < MultiStatsd::Backend::Base attr_reader :seco...
true
1439c5a67163e324662e34f443b3de5452268ca6
Ruby
weizheng1910/ruby-lang-ex-links
/exercises.rb
UTF-8
2,025
3.625
4
[]
no_license
def solveMeFirst (a, b) return a + b end def simpleArraySum(ar) return ar.reduce(:+) end def simpleArraySum(ar) return ar.reduce(0) { |sum, num| sum + num } end def aVeryBigSum(ar) lines_array = ar.split("\n") array_to_be_summed = lines_array[1].split(" ") int_array_to_be_summed = array_to...
true
1fd0c1d79ab67e8a39cded2c4206d8f631339b5a
Ruby
u-n-mi/book_store
/db/seeds.rb
UTF-8
2,360
2.65625
3
[]
no_license
require "open-uri" puts "Cleaning the DB" Book.destroy_all User.destroy_all Order.destroy_all puts "Creating a user" user = User.create(email: "jeff@bezos.com", password: "123456") puts "creating some books" url_array = ["https://img.bertrand.pt/images/the-moravian-night-peter-handke/NDV8MjA3NDUxMzF8MTY1OTkxNTh8MT...
true
593e50a9dc7fee6cd0f10d4f2afd3c63e539c093
Ruby
ShiLi007/rails-amusement-park-v-000
/app/models/ride.rb
UTF-8
1,134
2.703125
3
[ "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
class Ride < ActiveRecord::Base belongs_to :user belongs_to :attraction @message = "" def go_for_a_ride new_tickets = self.user.tickets - self.attraction.tickets new_happiness = self.user.happiness + self.attraction.happiness_rating new_nausea = self.user.nausea + self.attraction.nausea_rating ...
true
4ed5c450b7adf3ed713622edc476b6a98d561859
Ruby
Viktorkosandyak/clothes
/lib/wardrob.rb
UTF-8
648
3.4375
3
[]
no_license
class Wardrob attr_reader :collection def initialize(collection = []) @collection = collection end def self.from_dir(clothing, file_dir) collection = [] file_dir.each do |file_path| collection << clothing.from_file(file_path) end new(collection) end def get_suitable_clothing(tem...
true
ec3c71b3cd3c528597952547070820648af92d6c
Ruby
eva-barczykowska/Ruby
/methods/The_Zip_Method_on_an_Array.rb
UTF-8
922
3.890625
4
[]
no_license
names = ["Ewa", "Jenny", "Weronika"] registrations = [true, false, false] #p names #p registrations names.zip(registrations) puts def custom_zip(arr1, arr2) new_arr = [] arr3 = arr1[0].to_s + arr2[0].to_s arr4 = arr1[1].to_s + arr2[1].to_s arr5 = arr1[2].to_s + arr2[2].to_s arr3.insert(3, " ") arr4.insert...
true
33a13ccfb290d1dfe6e04a875b80a9b6dd3a9c97
Ruby
tufts-digital-collections-archives/aspace-cuid-plugin
/migrations/001_cuids.rb
UTF-8
4,163
2.609375
3
[]
no_license
require 'db/migrations/utils' require 'json' require 'securerandom' Sequel.migration do up do puts "=" * 100 puts "aspace-cuid-plugin: Adding the CUID column to the archival_objects table." puts "We will put in a default unique ID here to ensure the database intergrity." puts "This will follow a ba...
true
109b14908d9bdaff2ac542fb9ada5120f053cb6c
Ruby
kfdm/dotfiles
/bin/weather
UTF-8
538
2.828125
3
[ "MIT" ]
permissive
#!/usr/bin/env ruby require 'rubygems' require 'yahoo-weather' @client = YahooWeather::Client.new response = @client.lookup_by_woeid(12797160,YahooWeather::Units::CELSIUS) print <<edoc #{response.title} Now - #{response.condition.text}. #{response.condition.temp} #{response.forecasts[0].day} - #{response.forecasts[0...
true
3fcb84784e0891fc96164b452794821d8c02939a
Ruby
adityavs/AdventOfCode2019
/solutions/day01/main.rb
UTF-8
404
3.375
3
[]
no_license
DATA = File.read('data.txt').split.map(&:to_i) def fuel_req m m / 3 - 2 end def fuel_req_ex m sum = fuel_req m add = sum while add > 0 add = [fuel_req(add), 0].max sum += add end sum end PART1 = DATA.map{ |n| fuel_req n }.sum PART2 = DAT...
true
78e26be5bf2e36d870b963cda0b06fbb5f406490
Ruby
ronakvsoni/ruby-enumerables-cartoon-collections-lab-part-2-sea01-seng-ft-060120
/cartoon_collections.rb
UTF-8
1,307
3.734375
4
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
arrays = [1,2,3,4,5] def square_array(array) # Use an Enumerable to square every element in the passed in array # Return a new array of the results array.map{|num| num * num} end p square_array(arrays) calls = ["earth", "wind", "fire", "water", "heart"] def summon_captain_planet(planeteer_calls) # Use an Enumer...
true
c82990d20aaf1ea893f6f7aaa7a915a678817249
Ruby
zynxhealth/zaws
/lib/zaws/helper/option.rb
UTF-8
578
2.828125
3
[ "Apache-2.0" ]
permissive
module ZAWS module Helper class Option def self.exists?(optarr, opt_hash) optarr.all? { |opt| opt_hash[opt] } end def self.absent(optarr, opt_hash) optarr.inject([]) { |missing, opt| opt_hash[opt] ? missing : missing << opt } end def self.exclusive?(optarr, opt_has...
true
6f5f73c5b6c91f1319c75654c11354376a38a07b
Ruby
jbristow/RubyEuler
/euler027.rb
UTF-8
1,199
3.390625
3
[]
no_license
class Integer def prime? return false if self <= 1 return false if self % 2 == 0 c = 3 while c < self do return false if self % c == 0 return true if c*c > self c+=2 end return true end def prime_filtered?(primes) possible = self return true if primes.length == 0...
true
c848250e9d38ddf973cc5e70bad90e0a7cfe19e4
Ruby
sunyounghwang/top_apps
/lib/top_apps/cli.rb
UTF-8
2,097
3.09375
3
[ "MIT" ]
permissive
class TopApps::CLI def self.run create_apps greeting display_apps end def self.create_apps index_array = TopApps::Scraper.scrape_index("https://www.apple.com/itunes/charts/") TopApps::App.create_apps_from_index(index_array) end def self.add_attributes(app) profile_hash = TopApps::Scr...
true
45137861335015321fffacb5188f9287d3783132
Ruby
shahpriyesh2005/CAD_Project
/test/models/order_test.rb
UTF-8
10,294
2.546875
3
[]
no_license
require 'test_helper' class OrderTest < ActiveSupport::TestCase # test "the truth" do # assert true # end test "do not save order when any of the mandatory parameter is missing" do order = Order.new(guest_first_name: "Priyesh") puts order.attributes assert_equal(false, order.save, "saved the ord...
true
8e80e82e4fa9af3c47bdb46e43f21447bda0b472
Ruby
mferrier/rubylife
/lib/life/board.rb
UTF-8
2,123
3.125
3
[]
no_license
module Life class Board attr_reader :width, :height, :generation, :columns, :saved_columns def initialize(width, height) @width, @height = width, height @generation = 0 @columns = [] @saved_columns = [] (0..width-1).each do |x| column = [] ...
true
69b25039342593a0a14b530f7cb913ee734d96de
Ruby
lbvf50mobile/til
/20180413_Friday/20180413.rb
UTF-8
371
2.78125
3
[]
no_license
# Two ways to create lambda require "minitest/autorun" describe "Two ways of generating lambda" do it "shoud be the same" do a = ->{"boom"} b = lambda{"boom"} assert_equal a.call,b.call assert_equal Proc, a.class assert_equal Proc, b.class assert_equal true, a.lambda...
true
6bea24fab0e7caebfaf0ee2fc40f1023346f0f78
Ruby
TG9541/EvilVM
/server/evil_help.rb
UTF-8
1,886
2.984375
3
[ "MIT" ]
permissive
def print_help() help = <<-eos EvilVM Server Help ------------------ The EvilVM server provides an environment where you can receive connections from EvilVM agents and interact with them. The prompt works differently depending on your current context. Initially, EvilVM server does nothing until an agent...
true
ade4e4cbb7af07b6d92ce7152426afca737f4859
Ruby
mohammeda6429/oo-final-project
/code.rb
UTF-8
501
3.84375
4
[]
no_license
class Car def initialize(color) @color = color @speed = 0 @speed_arr = [@speed] end def color @color end def speed @speed end def drive(speed) for i in 1..speed @speed = @speed+10 @speed_arr.push(@speed) end end end bugatti = Car.new("black") honda = Car.new("...
true
85bb77965e177dd609523b2397ceeadcec25ad11
Ruby
emilkjer/mex-pilot-instructor
/app/models/group_record.rb
UTF-8
2,246
2.96875
3
[]
no_license
#begin #CODE #rescue # puts "Error #{$!}" # puts "#END#" #end class GroupRecord < ActiveRecord::Base attr_accessible :student_records, :group_id, :reg_date has_many :student_records has_many :students, :through => :student_records, :source => :group_student def self.get_group_students(group_id) self.whe...
true
48bfc4e33c3fdc8efbc6fabf1c98a5f03b1de867
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/bob/6729702fbd304163bbc3328c28cf59d3.rb
UTF-8
371
3.765625
4
[]
no_license
class Bob def hey(input) @input = input if silence 'Fine. Be that way!' elsif shouting 'Woah, chill out!' elsif question 'Sure.' else 'Whatever.' end end def silence @input.strip! @input.length == 0 end def shouting @input == @input.upcase end ...
true
6ab30d6859e5772c868678d58c4fa943d83b6d79
Ruby
jrdrew/ruby-inquisiton
/spec/models/question_spec.rb
UTF-8
777
2.546875
3
[]
no_license
require 'spec_helper' describe Question do before(:each) do end describe "feed" do it "with no questions should return an empty list" do end it "with one question return an array of 1" do @question = Question.create @questions = Question.feed(Time.now) (@ques...
true
5103a859f303196a2c42dcdb82cb3b56c093a72d
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/src/1261.rb
UTF-8
223
3.0625
3
[]
no_license
def compute(strand_1 ,strand_2) length = [strand_1.length, strand_2.length].min diff_count = 0 0.upto(length - 1) do |i| diff_count += 1 if strand_1[i] != strand_2[i] end diff_count end
true
bb651f308ed202d01f8949cea4d8b964b55f3962
Ruby
badogan/ruby-oo-relationships-practice-boating-school-exercise-london-web-111819
/app/models/instructor.rb
UTF-8
1,263
3.171875
3
[]
no_license
class Instructor attr_accessor :name @@all = [] def initialize(name:) @name = name save end def save @@all << self end def self.all @@all end def pass_student(student_instance:,testname:) pass_or_fail_student(test_result_to_assign:"passed...
true
538f2c3becb57c0152da71069b4545592dd5a54e
Ruby
appriss/climax
/lib/climax/application.rb
UTF-8
6,838
2.578125
3
[]
no_license
require "pry" require "slop" require "logger" require "pry-remote" require "climax/version" require "climax/control_drb" module Climax module Application def initialize(args=[]) @args = args.dup options do on :d, :daemon, "Fork application and run in background" on :log_level=, ...
true
3d43fff7bcf783f3a01aa90035c78e6b6bd1f368
Ruby
ensconced/101-programming-foundations
/small_problems/easy 8/double_char.rb
UTF-8
184
3.515625
4
[]
no_license
CONSONANTS = 'bcdfghjklmnpqrstvwxyz' def repeater(str) str.chars.map do |char| if CONSONANTS.include? char.downcase char * 2 else char end end.join end
true
9c8758ec39b2ec4cd81e136e680ffbb61175fb8d
Ruby
RodelioT/kaori-music
/app/controllers/carts_controller.rb
UTF-8
1,698
2.515625
3
[]
no_license
class CartsController < ApplicationController before_action :initialize_session before_action :load_shopping_cart before_action :load_subtotal def index @categories = Category.all insert_quantities end # aka the Checkout section def show @categories = Category.all @provinces = Province....
true
775aebcb9f6ae49619eb6b755bbf05a102b957f2
Ruby
Alexand/pry-shell
/lib/pry/shell/io/output.rb
UTF-8
607
2.546875
3
[ "MIT" ]
permissive
# frozen_string_literal: true class Pry class Shell module IO class Output < Base def puts(data) wait_until_current object.puts data end def print(data) wait_until_current object.print data end def printf(data) wa...
true
c15e874b014a3fd0a5e671b0b1d2cc9760ed1c81
Ruby
kedanco/crowdapp
/app/services/import_service.rb
UTF-8
10,188
2.75
3
[]
no_license
require 'csv' require 'pp' require 'json' require 'bigdecimal' class ImportService @district_names = [] @district_codes = [] @area_districts = {} @area_coordinates = {} @exceptions = [] @district_coordinates = [] @timeTracker = {} def self.initArea puts "Initiating Areas..." @area_coordinat...
true
2b381d9359f2588ce1db2362d91231c01050d516
Ruby
Estevenson1994/gilded_rose
/lib/conjured_item.rb
UTF-8
546
3
3
[]
no_license
module ConjuredItem def update_conjured_item(item) remove_two_from_quality(item) if quality_is_greater_than_0(item) remove_two_from_quality(item) if quality_is_greater_than_0(item) && item_has_expired(item) quality_is_0(item) if quality_is_less_than_0(item) end private def remove_two_from_qua...
true
35c03df74edda9f7490529edef4cf4c3758ac744
Ruby
dcamp314/fogbubble
/fogbubble/curses.rb
UTF-8
1,594
2.515625
3
[]
no_license
# xterm-acs-brightbg|dcamp:\ # :ac=l\332m\300k\277j\331u\264t\303v\301w\302q\304x\263n\305`^Da\260f\370g\361~\371.^Y-^Xh\261i^U0\333y\363z\362:\ # :mb=\E[5m:\ # :tc=xterm: # # cap_mkdb -f /usr/share/misc/termcap /etc/termcap require 'curses'; include Curses # add some methods to Curses::Window...
true
8acb3ed5471d7c3f2542b37c2ea0a686f0966fe1
Ruby
parryjos1/sei35-homework
/harry-patrick/week4/calculator/bmi.rb
UTF-8
303
4.0625
4
[]
no_license
require 'pry' # debuuger puts "Please enter your weight and height" print "Weight: " weight = gets.chomp.to_i print "Height: " height = gets.chomp.to_f def bmi (x, y) result = x / (y * y) return result.round(2) end # Formula: weight (kg) / [height (m)]2 puts "Your BMI is #{bmi weight, height}"
true
8c72b8b5cc22fc969e9b4f1979937efda916199c
Ruby
Junya-Takaesu/saba-sand
/main.rb
UTF-8
2,469
2.796875
3
[]
no_license
require "erb" class ViewGenerator def initialize(template_file) @template = File.read template_file @result_file_name = (template_file.split(".").select {|a| a != "erb"}).join("."); end def exec menu_list = [ {name_en: "THE SABA SAND", name_jp: "サバサンド", price: 555, description: "焼き立てほやほやのサバ、新...
true
9e36396474267215f9a00d9cb71fe455323498ab
Ruby
rngtng/whoami
/app/models/annotation.rb
UTF-8
7,394
2.828125
3
[]
no_license
#################### # # $LastChangedDate:2007-08-07 15:37:28 +0200 (Tue, 07 Aug 2007) $ # $Rev:94 $ # by $Author:bielohla $ # Class representing an universal annotation class Annotation < ActiveRecord::Base serialize :data # if speed becomes an issue, you could remove these validations and rescue the AR inde...
true
5d29cdf31fc762a83809f68f74d2154abc7ff24d
Ruby
cgsimmons/quiz1
/question9.rb
UTF-8
471
3.796875
4
[]
no_license
class Book attr_accessor :title, :chapters def initialize @title = "" @chapters = [] end def add_chapter(title) @chapters.push(title) end def chapters puts "Your book: #{@title} has #{@chapters.length} chapters" @chapters.each_index {|i| puts "#{i+1}. #{@chapters[i]} "} end end # b...
true
78229a06f0a1bdc9c9a913ba75ad4be2b1b7efc1
Ruby
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/ruby/gigasecond/6f0b98c42d304c1d8f1fc29f6f52f603.rb
UTF-8
189
2.6875
3
[]
no_license
class Gigasecond def self.from(time) current_secs=time.to_i; secs_after_gs=current_secs+10**9; time_after_gs=Time.at(secs_after_gs) return time_after_gs; end end
true