text
stringlengths
10
2.61M
=begin #Rakam API Documentation #An analytics platform API that lets you create your own analytics services. OpenAPI spec version: 0.5 Contact: contact@rakam.io Generated by: https://github.com/swagger-api/swagger-codegen.git Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file e...
class ContactUsMailer < ActionMailer::Base default to: "BeerOn2012@gmail.com" def contact_me(inquiry) @inquiry = inquiry @url = 'http://beeron.herokuapp.com' mail(:from => inquiry.email, :subject => 'User Feedback') end end
class CreateResourceFeatured < ActiveRecord::Migration def change create_table :resource_featured do |t| t.timestamps t.belongs_to :resource, polymorphic: true, null: false t.belongs_to :user, index: true, null: false end add_foreign_key :resource_featured, :users, on_delete: :cascade ...
class TrainCar attr_accessor :current_train, :current_number #вагон знает о том, куда он прицеплен, и под каким номером (начиная с 0) def init_car @current_train = nil end def get_common_description if @current_train.nil? str = 'Не прицеплен к поезду. ' else str = "Номер #{@current_n...
# -*- mode: ruby -*- # vi: set ft=ruby : VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.provider "virtualbox" do |vb| vb.memory = 4096 vb.cpus =2 end # sfmdocker VM config.vm.define "sfmdocker" do |sfmdocker| sfmdocker.vm.hostname = "sfmdocker" s...
describe 'count with increment method' do context "hanis solution" do class Counter def count_with_increment(start, inc) first_time = true lambda do if first_time first_time = false return start else return start = start + inc ...
class Api::FlavorsController < ApplicationController before_action :set_flavor, only: [:show, :update, :destroy] def index @flavors = Flavor.all render json: @flavors.select(:id, :name), status: 200 end def show render json: @flavor, status: 200 end def create @flavor ...
class MadeGameInstancesController < ApplicationController before_filter :find_made_game before_filter :find_made_game_instance, :only => [:show] def new @made_game_instance = @made_game.made_game_instances.build end def create @made_game_instance = @made_game.made_game_instances.build(made_game_inst...
class City < ApplicationRecord validates :name, :image_url, presence: true has_many :events end
class Bike < ActiveRecord::Base belongs_to :user has_many :components, dependent: :destroy before_create :set_values_from_strava after_create :components_load include StravaAccount def strava_refresh! set_values_from_strava self.save end def distance_in_miles ((distance / 1000) * 0.6213...
CUCUMBERS = INPUT.split("\n").map(&:chars).freeze HEIGHT = CUCUMBERS.size WIDTH = CUCUMBERS[0].size HERDS = %w[> v].freeze EMPTY = ".".freeze MOVEMENTS = {">" => [1, 0], "v" => [0, 1]}.freeze def step(cucumbers) HERDS.each_with_object(Array.new(HEIGHT) { Array.new(WIDTH) { "." } }) do |herd, updated| cucumbers....
require 'config_parser/utils' class ConfigParser # Represents a boolean flag-style option. Flag handles the parsing of # specific flags, and provides hooks for processing the various types of # options (Switch, Option, List). class Flag include Utils # The config key. attr_reader :key # The ...
require 'web_game_presenter' require 'ttt/three_by_three' require 'ttt/four_by_four' require 'ttt/three_by_three_by_three' describe WebGamePresenter do def show_board(presenter) string = presenter.show_board.scan(/<td|<tr|>[xo0-9]+</).join string.delete! "><" string end def presenter_for(klass, upda...
Rails.application.routes.draw do devise_for :users, path: 'authors' root to: 'blog/posts#index' get 'about' => 'blog/authors#about' get 'portfolios' => 'blog/authors#portfolio' namespace :authors do get '/' => 'posts#index' get 'profile' => 'profiles#edit' put 'profile/info' => 'profiles#update'...
module ParseRedom class Parser def at(node, attr) n = node.at(attr).try(:content) end def get_attr(node, attr, options={}) value = node[attr] value_type = options[:type] if value_type && value value = case value_type when :datetime then DateTime.parse(va...
# frozen_string_literal: true RSpec.describe 'Item Search Request', type: :request do subject(:search!) { get "/api/items/search?q=#{query}", params: params } include_context 'with json response' include_context 'with branch location' include_context 'with user token' let(:billy_goat_gear) { build(:item, n...
class AddDiscountModeToFinanceFeeCollections < ActiveRecord::Migration def self.up add_column :finance_fee_collections, :discount_mode, :string, :default => "OLD_DISCOUNT" end def self.down remove_column :finance_fee_collections, :discount_mode end end
# write a program that prompts the user for two positive integers # and then prints the reuslts of the following operations # on those two numbers: # addition, subtraction, prodcut, quotient, remaineder, and power # do not worry about input validation # Example: # ==> Enter the first number: # 23 # ==> Enter the se...
require_relative "test_helper" class InputTest < Minitest::Test def test_input_format_stderr assert_index_file "queries.log" end def test_input_format_csv assert_index_file "queries.csv" end def test_input_format_json assert_index_file "queries.json" end def test_input_format_sql asser...
require "heroku/api" require "redis" require "rack/streaming_proxy" require "uuid" require "scrolls" module Sokoban class Error < StandardError attr_reader :response def initialize(response) @response = response end end class Proxy include Scrolls def initialize @uuid = UUID.ne...
class OverseasTripsController < ApplicationController before_action :set_overseas_trip, only: [:show, :edit, :update, :destroy] before_action :authenticate_user! layout 'general' # GET /overseas_trips # GET /overseas_trips.json def index @overseas_trips = OverseasTrip.all end # GET /overseas_t...
class RenameUserIdToStudentIdInClassesStudents < ActiveRecord::Migration[6.0] def change rename_column :classes_students, :user_id, :student_id end end
require 'spec_helper' describe PagesHelper do before(:each) do @page = Page.create!(:title => 'Page title') @part = PagePart.create!(:title => 'Part', :body => "PART BODY") @snippet_before = Snippet.create!(:title => 'Before title', :body => "BEFORE BODY") @snippet_after = Snippet.create!(:title => ...
class ContentsController < ApplicationController def index @templates = current_user.templates #@template = current_user.templates @signatures = current_user.signatures @signatures_map = @signatures.map{|s| ["#{s.name} <#{s.email}>", s.email] } @contacts = current_user.contacts.tagged_with(p...
class AddSubscriptionIndexes < ActiveRecord::Migration[4.2] def change add_index :subscriptions, [:feed_id, :category_id, :user_id], :unique => true add_index :entries, [:newsitem_id, :subscription_id], :unique => true add_index :entries, :unread, :where => 'unread' end end
ActiveAdmin.register Standard do config.sort_order = "code_asc" menu parent: I18n.t('admin.recipes'), priority: 20 actions :all, except: [:destroy] index do column :code column :property column 'Min' do |row| blank_when_zero row.min_tolerance end column 'Below Min' do |row| ro...
module TwineFileDSL def build_twine_file(*languages) @currently_built_twine_file = Twine::TwineFile.new @currently_built_twine_file.language_codes.concat languages yield result = @currently_built_twine_file @currently_built_twine_file = nil return result end def add_section(name) retu...
class Api::V1::BaseController < ApplicationController before_action :doorkeeper_authorize! respond_to :json protected def current_resource_owner @current_resource_owner ||= User.find(doorkeeper_token.resource_owner_id) if doorkeeper_token end def current_ability @ability ||= Ability.new(current_resource_...
module TaxCalculator class TaxApplier EXEMPT_CATEGORIES = %i[books food medical] BASIC_TAX_PERCENTAGE = 0.1 IMPORTED_DUTY_TAX_PERCENTAGE = 0.05 private_constant :EXEMPT_CATEGORIES, :BASIC_TAX_PERCENTAGE, :IMPORTED_DUTY_TAX_PERCENTAGE def initialize(product) @product = product end ...
require 'test_helper' class UserTest < ActiveSupport::TestCase # test "the truth" do # assert true # end def setup @user = User.new(name: "Example User", email: "example@e.mail", password: "abcabc", password_confirmation: "abcabc") end test "name should not be too long" do @user.name = "a"*51 ...
require 'rails_helper' RSpec.describe "ユーザーログイン機能", type: :system do it 'ログインしていない状態でトップページにアクセスした場合、サインインページに移動する' do #visit to top page visit root_path #if you didn't logged in, make sure you are on the signin page expect(current_path).to eq new_user_session_path end it 'ログインに成功し、トップページに遷移する'...
#!/usr/bin/env ruby require 'csv' require 'optparse' require 'active_record' options = {} OptionParser.new do |opts| opts.banner = "Usage: ./table_generator.rb [OPTIONS]" opts.on( "-e", "--email EMAIL", "This is the email address of the player" ) do |e| options[:email] = e end opts.on( "-d", "--db FIL...
module CassandraObject module Types class DateType < BaseType FORMAT = '%Y-%m-%d' REGEX = /\A\d{4}-\d{2}-\d{2}\Z/ def encode(value) raise ArgumentError.new("#{value.inspect} is not a Date") unless value.kind_of?(Date) value.strftime(FORMAT) end def decode(str) ...
class Article < ApplicationRecord validates :title,presence:true,length: {minimum: 6, maximum: 100} validates :description, presence:true,lenght: {minimum: 300, maximum: 400} end
# this is used to track ingested zotero export files. The ZoteroDirectoryWatcher (script/background/zotero_directory_watcher.rb) deamon kicks off the processes. class ZoteroIngest < ActiveRecord::Base attr_accessor :inprocess_directory attr_accessor :out_directory attr_accessor :error_directory attr_accessor ...
FactoryGirl.define do factory :balance do |b| b.association :account, :factory => :detail_account b.evaluated_at 1.day.ago b.balance 100.00 end end
require "test_helper" class TeamQuizTest < ActiveSupport::TestCase # Matchers should belong_to(:team) should belong_to(:quiz) should validate_numericality_of(:raw_score).only_integer.allow_nil should validate_numericality_of(:team_points).is_greater_than_or_equal_to(0).only_integer.allow_nil should valida...
# Simple Blog ## 1. new # - get '/' => erb :index, # - <form>을 통해 제목(title), 내용(content) 입력 ## 2. Create # - get 'write' => erb :write, # - File.open을 통해 내용 쓰기 ## 3. Read # - get 'show' => erb :show # - File.open을 통해 모든 블로그 내용 읽기 require 'sinatra' get '/' do erb :index end get '/write' do @title = params["ti...
require 'spec_helper' describe 'default recipe on Debian 9' do cached(:chef_run) do runner = ChefSpec::ServerRunner.new(platform: 'debian', version: '9') runner.converge('mcelog::default') end it 'installs mcelog' do expect(chef_run).to install_package('mcelog') end it 'creates /etc/mcelog' do ...
feature 'Hit points' do scenario 'displays both players hit points' do sign_in_and_play expect(page).to have_content 'Ed HP100' && 'HP100 Alex' end scenario 'Player 2 loses 10 hit points when attacked' do sign_in_and_play attack_once expect(page).to have_content 'HP90 Alex' end scenario ...
module ArchivedConcern extend ActiveSupport::Concern included do scope :archived, -> { where.not(:archived_on => nil) } scope :active, -> { where(:archived_on => nil) } end def archived? !active? end def active? archived_on.nil? end end
# Specifies the `worker_timeout` threshold that Puma will use to wait before # terminating a worker in development environments. # worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development" pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } workers Integer(ENV['WEB_CONCURRENCY'] || 2) threads_c...
Given /^I have no subscriptions$/ do Subscription.delete_all end Then /^I should have ([0-9]+) subscriptions?$/ do |count| Subscription.count.should == count.to_i end Given /^I have a subscription from "([^"]*) ([^"]*)" with email "([^\"]*)"$/ do |given_name, family_name, email| Subscription.create(:given_name ...
# # Podfile for CloudMine SDK on iOS # source 'https://github.com/CocoaPods/Specs.git' # # Supporting iOS 8 and above # platform :ios, '8.0' # # Define the workspace we had before Cocoapods # workspace 'cm-ios' # # Define the XCode project file we already had before Cocoapods # project 'ios/cloudmine-ios.xcodeproj/' ...
class SaveShelfAddTray prepend SimpleCommand def initialize( facility_id, room_id, row_id, shelf_id) @facility_id = facility_id @room_id = room_id @row_id = row_id @shelf_id = shelf_id end def call save_record end pri...
#!/usr/bin/env ruby #coding: utf-8 require 'rubygems' require 'thor' require_relative './google_image_scraper' require_relative './image_net_url_scraper' # Scrape google images by using `keyword` # # [Usage] # Scrape images from google # ./scrape/scrape.rb -k keyword -n number # # Scrape ImageNet's image paths # ./scr...
require "rails_helper" describe "As an authorized user" do describe "when I click on a kids name from index" do it "should show one kid and their events" do user = create(:user) kid = create(:kid) user.kids << kid event_1, event_2 = create_list(:event, 2, kid: kid) allow_any_instan...
class Station attr_reader :name, :trains def initialize(name) @name = name @trains = [] end def arrive(train) @trains << train end def depart(train) @trains.delete(train) end def trains_by_type result_hash = Hash.new(0) trains.each { |train| result_hash[train.type] += 1 } ...
require File.join(File.dirname(__FILE__), '/spec_helper') require 'webistrano_controller' require 'host' require 'deployment' describe WebistranoController, "when notified of loaded hosts" do before do @controller = WebistranoController.new @host = Host.new end it "should notify of all hosts being load...
# frozen_string_literal: true require 'spec_helper' describe 'tag category' do describe 'Viewing the tag category' do before(:each) do @site = Factory(:site) Factory(:post_with_tags, site: @site) post = Factory(:post, title: 'Future post', published_at: ...
class Notifier < ActionMailer::Base def signup_info( user ) # Email header info MUST be added here @recipients = user.email @from = "no-reply@thoughtbag.com" @subject = "ThoughtBag activation info" # Email body substitutions go here @body["username"] = user.username @body["key"] = use...
class PageController < ApplicationController require 'we_transfer_client' def root end def upload Retryable.retryable(tries: :infinite) do client = WeTransferClient.new(api_key: ENV.fetch('WT_API_KEY')) transfer = client.create_transfer(name: "My wonderful transfer", description: "I'm so excit...
Pod::Spec.new do |s| s.name = 'PROJECT' s.version = '1.0.0' s.license = 'MIT' s.summary = 'SUMMARY' s.homepage = 'https://github.com/jessesquires/PROJECT' s.documentation_url = 'https://jessesquires.github.io/PROJECT' s.social_media_url = 'https://twitter.com/jesse_squires' s.author = 'Jesse Sq...
require "simplecov" SimpleCov.start do add_filter "/spec/" end require "bundler/setup" require "asciidoctor" require "metanorma-nist" require "asciidoctor/nist" require "isodoc/nist/html_convert" require "isodoc/nist/word_convert" require "asciidoctor/standoc/converter" require "rspec/matchers" require "equivalent-x...
class CoveragesController < ApplicationController before_action :authenticate_user! before_action :set_rider, only: [:index, :new, :show, :edit, :create, :update, :destroy] before_action :set_coverage, only: [:show, :edit, :update, :destroy, :show_master, :edit_master, :upda...
# frozen_string_literal: true class TeachersController < ApplicationController def index @teachers = Teacher.all end end
describe 'Class Methods' do context "can be created with self" do class Dave def self.say_hello "Hi" end end it "should be called without an instance" do expect(Dave.say_hello).to eq "Hi" end end context "can be created with class << self when declaring more than one meth...
class Api::V1::AnswersController < Api::V1::BaseController before_action :load_question, only: %i[index create] before_action :load_answer, only: %i[show update destroy] def index @answers = @question.answers authorize! :read, @answers render json: @answers end def show authorize! :read, @an...
require 'rails_helper' feature 'user wants to log in, check clients, and log out, so they', :js do let(:user_full_name) { 'Tesfalem Medhanie' } let(:user_email) { 'me@example.com' } let(:user_password) { 'paassswoord' } let(:existing_user) { create :user, full_name: user_full_name, email: user_email, password:...
class Product < ApplicationRecord belongs_to :user has_many :likes, dependent: :destroy has_many :iine_users, through: :likes, source: :user has_one_attached :image validates :image, file_size: { in: 1.kilobytes..1.megabyte }, file_content_type: { allow: ['image/jpeg', 'image/png'] } def like_user(user_id)...
class Location < ActiveRecord::Base validates_presence_of :place_id, :lat, :lng, :name end
require 'carrierwave-activerecord-store-in-model' require 'spec_helper' ActiveRecord::Base.establish_connection( :adapter => "sqlite3", :database => "db/database.db" ) # added this to test quickly ActiveRecord::Migration.drop_table :apartments if ActiveRecord::Base.connection.table_exists? 'apartments' Activ...
class AddUsernameAndUserPermalinkToAlerts < ActiveRecord::Migration[5.1] def change add_column :alerts, :username, :string add_column :alerts, :user_permalink, :string end end
# frozen_string_literal: true class CallBacks def before_validation(object) puts "Validating #{object.class} #{object.name}" end def after_validation(object) if object.valid? puts "Valid #{object.class}" elsif !object.valid? puts "Invalid #{object.class}" end end # def before_sa...
# Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do factory :team do sequence(:name) { |n| "random team #{n}" } sequence(:tag) { |n| "#{n}" } description "another random team" end end
class Sale < ActiveRecord::Base has_many :sales_items has_many :items, through: :sales_items has_many :carts_sales scope :active, -> { where(active: true)} scope :by_discount_type, -> {order(:discount_type)} def self.by_discount_type order(:discount_type) end def item_ids sales_items.pluck(:i...
class AddColumnsToProductions < ActiveRecord::Migration[6.0] def change add_column :productions, :start_date, :datetime add_column :productions, :end_date, :datetime end end
require 'dictionary' class RfiRecipientCoordinator attr_reader :sender_id, :recipient_ids, :latitude, :longitude, :distance, :key_words, :body, :messages, :matches def initialize(sender_id, body, latitude, longitude, distance = nil) @recipient_ids = Set.new @sender_id = sender_id @body = body @lati...
# encoding: utf-8 # frozen_string_literal: true module Mail class MessageIdsElement include Mail::Utilities def initialize(string) raise Mail::Field::ParseError.new(Mail::MessageIdsElement, string, 'nil is invalid') if string.nil? @message_ids = Mail::Parsers::MessageIdsParser.new.parse(string)....
require 'spec_helper' describe Office do it { should have_many(:employees) } it { should validate_presence_of(:company_id) } it { should belong_to(:company) } subject do FactoryGirl.create(:office, :company => FactoryGirl.create(:company, ...
module Campaigns module Show module Charts module Daily class BackersEvolutionPresenter < BasePresenter def daily_backers_evolution_data @data end private def build_data @data = if campaign_presenter.can_display_pledges_data? ...
require 'rails_helper' describe "editing races" do let(:race) {Race.create(name: "La Mision")} it "allows a user to edit a race title" do visit edit_race_path(race) fill_in "Name", with: "El Tetra" click_on("Update Race") visit races_path expect(page).to have_content("El Tetra") end end
class AddFlagToTasks < ActiveRecord::Migration[5.1] def change add_column :tasks, :flag, :int, default:0 add_column :tasks, :user_id, :int end end
class BookingsController < ApplicationController respond_to :html, :xml, :json before_action :find_<%=resource_name_underscore.singularize%> def index @bookings = Booking.where("<%=resource_name.singularize%>_id = ? AND end_time >= ?", @<%=resource_name.singularize%>.id, Time.now).order(:start_time) r...
class PagesController < ApplicationController before_action :authenticate_user! def dashboard authorize! :dashboard, @post, current_user.admin? @users = User.all end end
# Be sure to restart your server when you modify this file. # Define an application-wide content security policy # For further information see the following documentation # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy Rails.application.config.content_security_policy do |policy| ...
require 'planet/fido' require 'planet/log' require 'html5' require 'html5/sanitizer' module Planet def Planet.sift node, fido unique = {} node.elements.each do |child| next unless child.namespace == 'http://www.w3.org/2005/Atom' child.name = child.name # remove prefix # remove, merge, or ...
module Admins class CampaignsController < BaseController before_action :require_open, only: [:edit, :update, :add_user, :remove_users, :close, :send_reminder] before_action :execute, except: [:index, :create, :multiple_destroy, :show] def index respond_to do |format| format.html { @result =...
class PreorderInformation < ApplicationRecord has_paper_trail self.table_name = 'preorder_information' belongs_to :school belongs_to :school_contact, optional: true validates :status, presence: true before_save :check_and_update_status_if_necessary after_touch :refresh_status! enum status: { ne...
module Refunge class Stack def initialize(*args) @stack = Array.new(args) @string_mode = false end def <<(value) stack << (string_mode? ? value.ord : value) end def concat(other) @stack = Stack.new(*stack.concat(other)) end def pop(*args) stack.pop(*args) ...
require 'rubygems' # Set up gems listed in the Gemfile. gemfile = File.expand_path('../../Gemfile', __FILE__) begin ENV['BUNDLE_GEMFILE'] = gemfile require 'bundler' Bundler.setup class Sinatrails def self.root File.expand_path('../../', __FILE__) end def self.public File.expand_path(...
class ChangeLatLongColumnsToDecimal < ActiveRecord::Migration[4.2] def self.up change_column :shows, :latitude, :decimal change_column :shows, :longitude, :decimal end def self.down change_column :shows, :latitude, :float change_column :shows, :longitude, :float end end
class LinkSerializer < ActiveModel::Serializer attributes :id, :slug, :clicks, :active attribute :given_url, key: :url attribute :created_at, key: :date_created attribute :updated_at, key: :date_updated end
# == Schema Information # # Table name: cities # # id :integer not null, primary key # image_url :string(255) # name :string(255) # slug :string(255) # created_at :datetime # updated_at :datetime # # Indexes # # index_cities_on_slug (slug) UNIQUE # class City < ActiveRecord::Base ...
require "spec_helper" describe "practicingruby::_nginx" do let(:nginx_dir) { "/etc/nginx" } let(:domain_name) { "practicingruby.local" } it "installs Nginx" do expect(package "nginx").to be_installed end it "configures Nginx" do config_file = file "#{nginx_dir}/nginx.conf" expect(config_file).t...
require './astar.rb' class Maze attr_reader :portals def initialize(mazearr) @portals = [] @maze = mazearr.each_with_index.map do |row,y| row.each_with_index.map do |mazeitem,x| case mazeitem when '#' Wall.new(x,y) when '.' Void.new(x,y) else ...
puts "Parte 2:" puts "Escreva um programa que pergunte o nome e a idade do usuário." puts "Escreva também uma função que calcula a quantidade de batimentos cardíacos (uma estimativa) baseado na quantidade de dias que o usuário viveu." # Considere uma média de 80 batimentos por minuto. Essa função deve receber a idade ...
require 'singleton' module MacoRb class Config include Singleton DEFAULT_LOOKUP_PATHS = ['/proc/bus/usb', '/dev/bus/usb'] def paths @paths || DEFAULT_LOOKUP_PATHS end end CONFIG = Config.instance end
#!/usr/bin/env ruby # (c) Copyright 2016 Thoughtgang <http://www.thoughtgang.org> # Utility for adding content without an origin require 'plan-r/application/cli' require 'plan-r/repo' require 'plan-r/document' class App < PlanR::CliApplication def handle_options(args) @options.repo = nil @options.node_typ...
class Usuario < ActiveRecord::Base has_many :fotos, :dependent => :destroy has_many :albums, :dependent => :destroy validates_presence_of :nombre, :apellido, :usuario, :password validates_confirmation_of :password before_create :assign_api_key def self.login(nombreUsuario, password) usuario = self...
class LandlordsController < ApplicationController before_action :set_landlord, only: [:show, :edit, :update, :destroy] skip_before_action :authorize, only: [:new, :create] def index @landlords = current_landlord end def show @properties = Property.all end def new @landlord = Landlord.new ...
# Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do sequence :email do |n| "test#{n}@test.com" end factory :student do full_name "Test McTester" email age 34 favorite_ice_cream_flavor 'Phish Food' password '12345678' password_confirmation ...
class TeacherKlassesController < ApplicationController def index @teacherklasses = TeacherKlass.all render json: @teacherklasses end end
require 'spec_helper' $LOAD_PATH.unshift(File.join(__dir__, '../../app/workers')) require 'oj' require 'elasticsearch' describe ElasticsearchRasi do def test_count @rasi_es.mention.count( query: { filtered: { filter: { term: { resource: 'zpravy.idnes' ...
require 'json' require 'pry' class MonthlyCalculator def initialize sample = IO.read("/media/dilum/96648732-125e-4b47-aa00-74d25da99130/Data/Posts.json") hash = JSON.parse(sample) calculation = calculate_monthly(hash) File.write('/media/dilum/96648732-125e-4b47-aa00-74d25da99130/Data/monthly.json', JSON.pr...
class FormInstance < ActiveRecord::Base belongs_to :user #Uses column user_id belongs_to :doctor #Uses column doctor_id belongs_to :patient #Uses column patient_id belongs_to :form_type #Uses column form_type_id belongs_to :form_data, :polymorphic => true, :dependent => :destroy #(, :extend => ....
class ProceduresController < ApplicationController before_action :load_service_category, only: [:show] def index @service_categories = ServiceCategory.order(:tail) @clinics_show = Clinic.where("rang = 'Показать'").first(3) end def show @service_category = ServiceCategory.friendly.find(params[:ser...
class Goal < ApplicationRecord has_many :links, :dependent => :delete_all belongs_to :user end
#-- # Ruby Whois # # An intelligent pure Ruby WHOIS client and parser. # # Copyright (c) 2009-2013 Simone Carletti <weppos@weppos.net> #++ require 'whois/record/parser/base' require 'whois/record/scanners/whois.nic-se.se.rb' module Whois class Record class Parser # Parser for the whois.nic-se.se server....
module TaxCloud # Tax Codes. class TaxCodes # Administrative # Administrative: Gift Card/Certificate GIFT_CARD_CERTIFICATE = 10005 # Administrative: Charges by the seller for any services necessary to complete the sale other than delivery and installation CHARGES_BY_THE_SELLER_FOR_ANY_SERVICES_...