text
stringlengths
10
2.61M
require 'sinatra' require 'google/cloud/storage' require 'digest' require 'logger' require 'json' storage = Google::Cloud::Storage.new(project_id: 'cs291-f19') bucket = storage.bucket 'cs291_project2', skip_lookup: true logger = Logger.new $stdout logger.level = Logger::INFO Google::Apis.logger = logger get '/' do ...
module ConditionsHelper def format_temperature_for(condition) '%.1f' % condition.temperature end def google_maps_javascript_include_tag javascript_include_tag google_maps_source end def google_maps_source 'https://maps.googleapis.com/maps/api/js?key=%s&sensor=true' % google_maps_api_key end ...
# frozen_string_literal: true require 'spec_helper' require 'facter/util/globus' describe 'globus_info Fact' do before :each do Facter.clear allow(Facter.fact(:kernel)).to receive(:value).and_return('Linux') end it 'returns Globus info' do allow(Facter::Util::Globus).to receive(:read_info).and_retu...
class Question attr_reader(:correct_answer) # new question is generated for each turn # by picking two numbers between 1 and 20 def initialize @first_number = rand(1..20) @second_number = rand(1..20) # simple math addition problems @correct_answer = @first_nu...
module GreenByPhone class Gateway API_URL = 'https://www.greenbyphone.com/eCheck.asmx' def initialize(options = {}) @login = options[:login] @password = options[:password] end def one_time_draft(options = {}) post = {} add_customer(post, options) add_check(post, options...
# frozen_string_literal: true require 'spec_helper' describe 'influxdb', type: :class do on_supported_os.each do |os, facts| context "on #{os} " do let :facts do facts end it do is_expected.to compile.with_all_deps is_expected.to contain_class('influxdb') is_ex...
# $Id$ module TabsHelper # For tabs with contents already rendered in main page def link_to_tab(name) link_to_function(name.humanize.capitalize, "tabselect($('#{name}_tab')); paneselect($('#{name}_pane'))") end # For tabs that dynamically load contents def link_to_ajax_tab(name, ajax_url) link_to_...
Then /^data should be loaded into the development database$/ do # end Then /^the "(.*?)" database should include a friend named "(.*?)"$/ do |env, name| names = `RAILS_ENV=#{env} bundle exec rails runner 'puts Friend.all.map(&:name)'` names.should include name end
class Project < ApplicationRecord has_many :groups, dependent: :destroy has_many :tasks, :through => :groups has_many :memberships, dependent: :destroy has_many :users, :through => :memberships end
# frozen_string_literal: true require 'rails_helper' RSpec.describe PressuresController, type: :controller do before do @user = FactoryBot.create :user, email: 'joao@example.org' sign_in @user @existing_profile = FactoryBot.create :profile, email: 'joao@example.org', user: @user end after do si...
require 'rails_helper' describe 'navigate' do let(:lecturer) { FactoryBot.create(:lecturer) } let(:user) { FactoryBot.create(:user) } let(:userpost) { FactoryBot.create(:user_post, user_id: user.id)} before do login_as(lecturer, :scope => :user) end describe 'index' do before do FactoryBot...
# frozen_string_literal: true #= Controller for course functionality class ExploreController < ApplicationController respond_to :html def index # 'cohort' is the old name for campaign. We accept 'cohort' as an alternative # parameter to keep old incoming links from breaking. campaign = params[:campaign...
class ItemDetail < ApplicationRecord extend ActiveHash::Associations::ActiveRecordExtensions belongs_to_active_hash :condition belongs_to_active_hash :size belongs_to :item with_options presence: true do validates :condition # ToDo brand,sizeは実装したらバリデーションを加える # validates :size # validates :br...
# frozen_string_literal: true require 'test_helper' class OrderItemTest < ActiveSupport::TestCase test 'order item is valid' do order_item = OrderItem.new( order: orders(:car), price: MIN_PRICE, count: 10_000, product_item: product_items(:black_car) ) assert order_item.valid? e...
module Kaigara class Package # # The base project files and directories # METADATA_FILE_NAME = 'metadata.rb' VAGRANT_FILE_NAME = 'Vagrantfile' OPERATIONS_DIR_NAME = 'operations' RESOURCES_DIR_NAME = 'resources' # Project directory attr_accessor :work_dir # metadata.rb path ...
# -*- mode: ruby -*- # vi: set ft=ruby : VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = "ubuntu14" config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-web-cloudimg-amd64-vagrant-disk1.box" config.ssh.forward_agent = true con...
class CreateReservas < ActiveRecord::Migration def change create_table :reservas do |t| t.integer :cliente_id t.integer :local_id t.date :fecha_emision t.time :hora_inicio t.time :hora_final t.boolean :estado t.integer :validez_pre_reserva t.integer :total t....
class AddDefaultColumnsToEasyQuerySettings < ActiveRecord::Migration def self.up EasySetting.create(:name => 'easy_budget_sheet_query_list_default_columns', :value => ['spent_on', 'user', 'activity', 'issue', 'hours']) EasySetting.create(:name => 'easy_budget_sheet_query_grouped_by', :value => 'project') en...
module Helpers def self.get_env(key) #Automatically try to be case insensitive return ENV[key] || ENV[key.downcase] || ENV[key.upcase] end end
module Kilomeasure class InputsFormatter < ObjectBase fattrs :inputs, :measure boolean_attr_accessor :strict boolean_attr_accessor :add_defaults def initialize(*) super raise ArgumentError, :inputs unless inputs raise ArgumentError, :measure unless measure @inputs ...
class MakeHistoricalEventPolymorphic < ActiveRecord::Migration[6.1] def change change_table :historical_events do |t| t.string :trackable_id t.string :trackable_type end add_index :historical_events, [:trackable_type, :trackable_id] HistoricalEvent.all.each do |event| event.update_c...
class SessionsController < Devise::SessionsController def create if request.xhr? resource = warden.authenticate!( scope: resource_name, recall: "#{controller_path}#failure" ) sign_in_and_redirect(resource_name, resource) else super end end def sign_in_and_redir...
SeoApp.configure do |config| # Postgress config config.db_host = 'localhost' config.db_port = '5432' config.db_name = 'sinatra' config.db_user = 'ruby' config.db_password = 'noway' config.db_url = 'postgres://ruby:noway@localhost/sinatra' config.adapter = 'sequel' end
class TemplateRepo < ActiveRecord::Base DEFAULT_PROVIDER_NAME = 'Github Public' belongs_to :template_repo_provider after_create :reload_templates after_destroy :purge_templates after_initialize :set_default_provider validates :name, presence: true, uniqueness: true def set_default_provider self.t...
module TrafficSpy class PayloadParser attr_reader :params def initialize(params) @params = params end def p_pams JSON.parse(params["payload"]) end def ua UserAgent.parse(p_pams["userAgent"]) end def resolution Resolution.find_or_create_by(dimension: "#{p_pam...
require 'rails_helper' RSpec.describe DropdownSelectionHelper, type: :helper do describe '.chosen_period' do context 'when period value is present' do it 'returns the period value from request parameters' do controller.params[:metric] = { period: 5 } expect(helper.chosen_period).to eq(5) ...
# # Copyright 2009 Huygens Instituut for the History of the Netherlands, Den Haag, The Netherlands. # # This file is part of New Women Writers. # # New Women Writers is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundat...
require "digest" require "lita" module Lita module Handlers # Provides Travis CI webhooks for Lita. class Travis < Handler config :token, type: String, required: true config :repos, type: Hash, default: {} config :default_rooms, type: [Array, String] http.post "/travis", :receive ...
class Gym attr_reader :name @@all = [ ] def initialize(name) @name = name @@all << self end def self.all @@all end def memberships #1Get a list of all memberships at a specific gym Membership.all.select do |membership| membership.gym == self end end def lifters #2Ge...
class AddTimestampsToAccountTransactions < ActiveRecord::Migration[6.0] def change add_timestamps :account_transactions end end
class AuthController < ApplicationController skip_after_action :verify_policy_scoped def index render json: current_user.as_json(only: [ :id, :name, :email, :image, ]) end def destroy sign_out current_user head :ok end end
class AddIndexToUsersEmail < ActiveRecord::Migration[5.1] def change # This ensures that we also have uniqueness in the DB level, not just in the model. add_index :users, :email, unique: true end end
class AddTemplateToSettings < ActiveRecord::Migration[5.2] def change add_column :settings, :template, :string, default: nil , after: :archiver_program end end
class MessageSerializer < ActiveModel::Serializer attributes :id, :title, :text, :sent_on, :received_on, :opened_on, :answered_on, :rejected_on, :picture has_one :recipient has_one :sender def picture object.picture.url end def recipient # return ...
# # Copyright (c) 2013, 2021, Oracle and/or its affiliates. # # 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 applicabl...
class Admin::EssayAwardsController < AdminController def new @essay_award = EssayAward.new(essay: essay) end def create @essay_award = EssayAward.new(params.require(:essay_award).permit(:award_id, :placement)) @essay_award.essay = essay if @essay_award.save flash[:success] = "Award \"#{@es...
FactoryBot.define do factory :item do title { 'コート' } text { 'コートです' } category_id { 2 } status_id { 2 } shipping_id { 2 } prefecture_id { 2 } day_id { 2 } price { 114_514 } user end end
require 'test_helper' class ScholarshipTest < ActiveSupport::TestCase test 'unexpired returns unexpired scholarships' do nil_date = create :scholarship, close_time: nil active_date = create :scholarship, close_time: 3.days.from_now assert_equal Scholarship.unexpired, [nil_date, active_date] end tes...
# @param {String} text # @return {String} def arrange_words(text) text.split(/ /).sort_by{|word| word.length}.join(' ').capitalize end
class AddDteInvoiceUntaxedStartNumberToInvoice < ActiveRecord::Migration def change add_column :accounts, :dte_invoice_untaxed_start_number, :integer end end
class AddRememberTokenToAdministrators < ActiveRecord::Migration def change add_column :administrators, :remember_token, :string add_index :administrators, :remember_token end end
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2020-2022, by Samuel Williams. def sample_progress_bar require_relative 'lib/console' progress = Console.logger.progress("Progress Bar", 10) 10.times do |i| sleep 1 progress.increment end end
# frozen_string_literal: true require "rails_helper" describe "Membership concern" do fixtures :all let(:participant) { participants(:participant1) } describe "before_validation" do context "updating a membership" do it "ensure_display_name_for_social_arms ensures display name exists for social group...
class User < ApplicationRecord validates :User_name, uniqueness: true, :presence => true validates_format_of :Email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i validates :Password, :presence => true, :confirmation => true, :length => {:within => 6..8} validates_co...
require "test_helper" class CoderTest < ActiveSupport::TestCase test "serializes globalid objects with text column" do notification = Notification.create!(recipient: user, type: "Example", params: {user: user}) assert_equal({user: user}, notification.params) end test "serializes globalid objects with js...
# ## Schema Information # # Table name: `activities` # # ### Columns # # Name | Type | Attributes # ----------------- | ------------------ | --------------------------- # **`id`** | `integer` | `not null, primary key` # **`created_at`** | `datetime` | `not null` # *...
require 'rails_helper' RSpec.describe Locacao, type: :model do describe "validations" do it { is_expected.to validate_presence_of(:pessoa_id) } it { is_expected.to validate_presence_of(:automovel_id) } it { is_expected.to validate_presence_of(:valor) } it { is_expected.to validate_presence_of(:data_...
require File.dirname(__FILE__) + '/../spec_helper' require File.dirname(__FILE__) + '/fixtures/classes' describe "Invoking events" do before :each do @helper = EventHandlerHelper.new @method = @helper.method(:foo) @lambda = lambda { |s, count| @helper[:lambda] += count } @proc = proc { |s, count| @he...
require 'dist_server/server/base_server' require 'dist_server/util/log' require 'dist_server/logic_server/center_server_proxy' require 'dist_server/logic_server/gate_server_proxy' class LogicServer < BaseServer def initialize(server_info) super(server_info) @center_server = nil @gate_list = [] @services = s...
# -*- encoding : utf-8 -*- module RedisModelExtension # == Class Autoincrement Id # get last id # generate autoincrement key module ClassAutoincrementId # get last id from redis def get_last_id Database.redis {|r| r.get generate_autoincrement_key } end #generate autoincrement key de...
require 'migration_helpers' class SellersUsers < ActiveRecord::Migration extend MigrationHelpers def self.up create_table :sellers_users, :id => false do |t| t.column :seller_id, :integer, :null => false t.column :user_id, :integer, :null => false end foreign_key(:sellers_us...
class ChangeTotalInPlayers < ActiveRecord::Migration def change change_column :players, :total, :integer, limit: 2 end end
class Award < ApplicationRecord has_many :picks belongs_to :league validates :name, uniqueness: { scope: [:league_id], case_sensitive: false }, presence: true def full_name "#{name} - #{description}" end end
#!/usr/bin/env ruby # encoding : utf-8 # Given an epub file, will create an mkd file version require 'fileutils' if `which ebook-convert` == '' puts "Unable to find ebook-convert, please install calibre" exit end # Loop on each file ARGV.each do |file| epubFile = File.expand_path(file) ext = File.extname(epubFile...
#!/usr/bin/env ruby $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'codebreaker' def generate_secret_code options =%w[1 2 3 4 5 6] (1..4).map { options.delete_at(rand(options.length))}.join end game = Codebreaker::Game.new(STDOUT) secret_code = generate_secret_code puts "\e[H\e[2J" at_exit ...
require 'module_extensions' # == Synopsis # Various extensions to the Numeric class # Note, uses the Module.my_extension method to only add the method if # it doesn't already exist. class Numeric my_extension("elapsed_time_s") do # == Synopsis # return String formated as "HH:MM:SS" def elapsed_time_s ...
class PulseMailer < ActionMailer::Base def red_over_one_day_notification(projects, options = {}) from("Pivotal Pulse <devnull+pulse-ci@pivotallabs.com>") recipients(RED_NOTIFICATION_EMAILS) subject("Projects RED for over one day!") multipart("red_over_one_day_notification", :projects => projects) e...
require 'hydramata/works/conversions/exceptions' module Hydramata module Works module Conversions private def ViewPathFragment(input) return input.to_view_path_fragment.to_s.downcase.gsub(/\W+/, '_') if input.respond_to?(:to_view_path_fragment) case input when String, Symbol ...
# # Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. # # 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 ...
class Loan < ApplicationRecord belongs_to :company, inverse_of: :loan has_many :payments, inverse_of: :loan, :dependent => :destroy accepts_nested_attributes_for :payments, reject_if: proc { |a| a[:status].blank? } after_create :calculate_overdrive def income_percent total_overdrive/sum/time*12 end ...
module Adminpanel module Facebook extend ActiveSupport::Concern included do attr_accessor :fb_page_access_key, :fb_message end def share_link 'http://www.google.com' end # if return any other thing than nil, it'll send it as the picture_thumb # whenever it's posted. def s...
class FileFormatProfilesContentTypesJoin < ApplicationRecord belongs_to :file_format_profile belongs_to :content_type end
class ComprobantesController < ApplicationController before_action :set_comprobante, only: [:show, :edit, :update, :destroy] # GET /comprobantes # GET /comprobantes.json def index @comprobantes = Comprobante.all end # GET /comprobantes/1 # GET /comprobantes/1.json def show end # GET /comproba...
class UsuariosController < ApplicationController def index @data =Time.now.strftime("%d/%m/%Y") @usuarios = Usuario.all end def show @usuario = Usuario.find(params[:id]) end def new @usuario = Usuario.new end def create @usuario = Usuario.new(params[:usuario]) ...
require "rails_helper" describe "Category management" do let(:user) { FactoryGirl.create(:user) } let!(:category) { FactoryGirl.create(:category_with_user, user: user) } let!(:category_two) { FactoryGirl.create(:category_with_user, user: user) } describe "show all categories" do before do get "/cate...
class PostsController < ApplicationController before_action :set_post, only: [:show, :edit, :update, :destroy] load_and_authorize_resource # GET /posts # GET /posts.json def index @posts = Post.all.order('updated_at DESC') @posts = @posts.select { |p| p.title.include?(params[:title]) } unless params[...
module TimecopConsole module MainHelper def time_travel_to(date) unless date.respond_to?(:year) && date.respond_to?(:month) && date.respond_to?(:day) raise ArgumentError, "Argument must be a Date object" end update_path = timecop_console.update_path(timecop: { 'current_time(1i)'...
# ApplicationController is the super class for all controller classes # Application controller wide functionality can be placed here class ApplicationController < ActionController::Base protect_from_forgery with: :exception before_action :authenticate_user! add_flash_types :success, :danger VALID_WISC_EMAIL_R...
Given(/the following JSON schema:$/) do |schema| @schema = schema end When(/^I run the JSON data generator$/) do @output = JsonTestData.generate!(@schema) end Then(/^the JSON output should be:$/) do |json| expect(@output).to eq json end
# Create huge lang files from the :en: snippets cluttered along the app module Translator class Translator def initialize(from=:en, dir=nil) @source = from.to_sym self.dir = dir if dir end def dir=(dir); create_dir(dir); @dir = dir; end def create_dir(dir); FileUtils.mkdir_p(dir)...
#!/usr/bin/env ruby require 'optparse' require 'highline/import' require 'shipit-ios' options = {} OptionParser.new do |opts| opts.banner = "Usage: shipit-ios [ --workspace workspacename | --project projectname ] --scheme schemename --configuration configurationname [options]" opts.on("-w", "--workspace workspac...
FactoryGirl.define do factory :article_list do name "article list" end end
class ChangeDefaultValueImage < ActiveRecord::Migration[5.1] def change change_column :tutorials, :image, :string, default: "default_image.png" end end
json.array!(@tour_times) do |tour_time| json.extract! tour_time, :id, :tour_id, :duration, :departure_date json.url tour_time_url(tour_time, format: :json) end
require 'vizier/argument-decorators/base' module Vizier #Indicated that the name of the argument has to appear on the command line #before it will be recognized. Useful for optional or alternating arguments class Named < ArgumentDecoration register_as "named" def state_consume(state, subject) term...
class TagsController < ApplicationController def show begin stem = params[:stem] pos = params[:pos] freqs = Session.all.sort{ |a,b| a.date <=> b.date }.collect do |s| sw = s.session_words.detect{ |w| w.stem == stem && w.pos == pos } if sw [s.date, sw.count] els...
class RandomPlayer def initialize(cakes) end # Decide who move first - player or opponent (return true if player) def firstmove(cakes) true # I want to move first end # Decide your next move (return 1, 2 or 3) def move(cakes, last) allow = [1,2,3].reject { |i| i == last } move = allow.sample ...
# :nocov: module SessionsDoc extend ActiveSupport::Concern included do swagger_controller :sessions, 'Sessions' swagger_api :create do summary 'Sign in' notes 'Use this method in order to sign in' param :query, 'api_user[email]', :string, :required, 'E-mail' param :query, 'api_user...
class Turn attr_reader :turn_player, :game def initialize(player, game) @turn_player = player @game = game end def pick_a_card_to_ask_for game.pass_question_to_player(turn_player, 'pick card') end def pick_a_player_to_ask game.pass_question_to_player(turn_player, 'pick player') end d...
# == Schema Information # # Table name: assigned_bid_categories # # id :integer not null, primary key # project_id :integer # category_id :integer # created_at :datetime # updated_at :datetime # company_id :integer # winning_bid_id :integer # # Read about factories at htt...
module JobsHelper def set_rowspan(object) if object.is_a? Job rowspan = 0 object.applicants.each do |applicant| rowspan += set_rowspan(applicant) end rowspan else if object.skills.any? object.skills.size else 1 end end end def first_applicant(job) job.applicants[0] end ...
FactoryGirl.define do factory :user_transaction do net_amount "9.99" fees "9.99" recipient nil exchange_rate "9.99" currency_iso_from nil currency_iso_to nil end end
class Order < ApplicationRecord belongs_to :client has_many :answers, through: :feedbacks end
require 'finite_field_element.rb' require 'infinity_point.rb' class CurvePoint attr_reader :x, :y, :curve def initialize(x, y, curve) @curve = curve @field = curve.field if x.is_a?(Fixnum) && y.is_a?(Fixnum) @x = x.in(@field) @y = y.in(@field) elsif x.is_a?(FiniteFieldElement) && y.is_a?(FiniteFieldEl...
require 'rails_helper' RSpec.describe Page, type: :model do describe "validations" do it "requires something in the url" do p = Page.new FactoryGirl.attributes_for(:page).merge({url: nil}) expect(p).to be_invalid end end end
require 'eventmachine' require 'rb_tuntap' require 'rbnacl/libsodium' require 'rbnacl' require 'digest/sha2' require 'cjdns/version' require 'cjdns/identity' require 'cjdns/util/base32' class Cjdns attr_reader :identity def initialize(identity) @identity = identity # @router, @switch = Router.new(ident...
# frozen_string_literal: true require "ffi" require "pry" require_relative "yara/version" require_relative "yara/ffi" # TBD module Yara class Error < StandardError; end CALLBACK_MSG_RULE_MATCHING = 1 CALLBACK_MSG_RULE_NOT_MATCHING = 2 CALLBACK_MSG_SCAN_FINISHED = 3 RULE_IDENTIFIER = 1 def self....
class AuthorsController < ApiController before_action :set_model, only: %i[ show update destroy ] before_action :doorkeeper_authorize!, only: %i[ create update destroy ] # GET /author def index @models = Author.all render json: @models, status: :ok end # GET /author/:id...
# Array Drills zombie_apocalypse_supplies = ["hatchet", "rations", "water jug", "binoculars", "shotgun", "compass", "CB radio", "batteries"] # 1. Iterate through the zombie_apocalypse_supplies array, # printing each item in the array separated by an asterisk # ---- def zombie_asterik(ar...
class AddColumnsToBondLettersDetail < ActiveRecord::Migration def change add_column :bond_letter_details, :document, :string add_column :bond_letter_details, :document_file_name, :string add_column :bond_letter_details, :document_content_type, :string add_column :bond_letter_details, :document_file_si...
# Copyright (c) 2015 Vault12, Inc. # MIT License https://opensource.org/licenses/MIT require 'errors/zax_error' # Session handshake token expired for the given request_id or # wasn't created in the first place. Client should start a new handshake module Errors class ExpiredError < ZAXError def http_fail s...
class CreateTvRageSyncs < ActiveRecord::Migration def change create_table :tv_rage_syncs do |t| t.string :data_type t.integer :summary_hash, limit: 8 t.datetime :created_at end create_first_sync_records unless reverting? end private def create_first_sync_records shows = So...
require 'spec_helper' describe Stockfighter do describe '#heartbeat' do it 'should return a hash with the keys ok and error' do allow(subject.client).to receive(:heartbeat).and_return({'ok' => false, 'error' => 'No actual API was called' }) expect(subject.heartbeat).to eq({'ok' => false, 'error' => '...
class AddErrorCountToWeixinMediaNews < ActiveRecord::Migration[5.1] def change add_column :weixin_media_news, :error_count, :integer end end
Dado('que eu acesse o endereço {string}') do |url| visit url end Quando('pesquiso por {string}') do |texto| rastreamento = RastreamentoCorreiosPage.new rastreamento.informaCodigoRastreamentoEPesquisa(texto) end Então('é exibido o código {string} da encomenda no título') do |codTitul...
class ImdbLoader def self.load(id) new(id).load end def self.enqueue(id) ImdbLoadWorker.perform_async(id) end attr_reader :movie def initialize(id) @movie = Movie.find(id) end def load return unless movie.imdb_id data = Imdb::Movie.new(movie.imdb_id.gsub(/tt/, '')) return unl...
class AddDefaultToCatalogs < ActiveRecord::Migration def change change_column_default :catalogs, :description, "" end end
class CreateRates < ActiveRecord::Migration[5.1] def change create_table :rates do |t| t.string :currency, limit: 3 t.decimal :rate, :precision => 10, :scale => 5 t.date :date t.timestamps end end end
require 'lame' class OpenJtalk::Mp3FileWriter def initialize(io, bit_rate = 128) @io = io @bit_rate = bit_rate end def write(header, data) encoder = LAME::Encoder.new encoder.configure do |config| config.bitrate = @bit_rate config.mode = :mono if header['number_of_channels'] == 1 ...
require 'open-uri' require 'pry' class Scraper def self.scrape_index_page(index_url) html = File.read("./fixtures/student-site/index.html") learn_students = Nokogiri::HTML(html) students = learn_students.css("div.student-card").collect do |student| {:name => student.css("div.card-text-container h...