text stringlengths 10 2.61M |
|---|
require 'sinatra/base'
require 'slack-ruby-client'
require 'mongo'
require 'nokogiri'
require 'uri'
require 'json'
require 'buffer'
require_relative 'helpers'
# Fly me to the moon, let me dance among the stars...
class Events < Sinatra::Base
# This function contains code common to all endpoints: JSON extraction, se... |
# frozen_string_literal: true
class RepresentationPresenterBuilder
attr_reader :model, :citi_uid
def initialize(params)
@model = params.fetch(:model, nil)
@citi_uid = params.fetch(:citi_uid, nil)
end
def call
return unless model && citi_uid && model_class && presenter && resource
presenter.new... |
require "byebug"
array = ['fish', 'fiiish', 'fiiiiish', 'fiiiish', 'fffish', 'ffiiiiisshh', 'fsh', 'fiiiissshhhhhh']
# O(n2) time
def sluggish_octopus(array)
sorted = false
until sorted
sorted = true
array.each_index do |i|
next if array[i+1].nil?
if array[i].length > array[i+1].length
... |
class Meeting < ActiveRecord::Base
acts_as_paranoid
belongs_to :message
belongs_to :account
belongs_to :user_contact
attr_accessible :alt_email, :alt_phone, :contract_value, :lost_reason_code, :meeting_date, :meeting_state, :message_id, :notes, :pipeline_state, :won_lost_date, :account_id, :user_contact_id,... |
class ApplicationController < ActionController::Base
before_action :configure_permitted_parameters, if: :devise_controller?
def current_user
@current_user ||= begin
devise_session_key = session['warden.user.user.key']
devise_user = User.find(devise_session_key[0][0]) if devise_session_key
dev... |
class WordsController < ApplicationController
before_action :render_layout_if_html
def index
@words = Word.all
render json: @words
end
def create
render json: Word.create(params.require(:word).permit(:name, :description))
end
def show
end
def update
end
def destroy
end
private
def render_la... |
Rails.application.routes.draw do
root 'menu_page#home'
get 'about' => 'menu_page#about'
get 'contact' => 'menu_page#contact'
get 'help' => 'menu_page#help'
get 'signup' => 'users#new'
get 'login' => 'sessions#new'
post 'login' => 'sessions#create'
delete 'logout' => 'session... |
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'directors_database'
# Find a way to accumulate the :worldwide_grosses and return that Integer
# using director_data as input
def gross_for_director(director_data)
total_gross = 0
title_index = 0
while title_index < director_data[:movies].length do
total_g... |
RSpec::Matchers.define :exist do |_expected|
match do |actual|
File.exist?(actual)
end
end
|
class Ride
attr_reader :passenger, :driver, :distance
@@all = []
def initialize(passenger, driver, distance)
@passenger = passenger
@driver = driver
@distance = distance.to_f #.to_f is converting distance to float
@@all << self
end
def self.all
@@all
... |
class Favorite < ActiveRecord::Base
validates :user_id, :favorable_id, :favorable_type, presence: true
belongs_to :favorable, polymorphic: true
belongs_to :user
end
|
require 'oauth2'
require 'sinatra'
enable :sessions
CALLBACK_URL = 'http://localhost:9292/callback'
# Assumes that you have set OHLOH_KEY and OHLOH_SECRET environment
# variables to values from your API keys page.
before do
@client = OAuth2::Client.new(ENV['OHLOH_KEY'], ENV['OHLOH_SECRET'],
... |
class Blocklist < ApplicationRecord
belongs_to :user
belongs_to :userblock, class_name: 'User', foreign_key: :userblock_id
end
|
class AddStartTimeAndEndTimeToCourses < ActiveRecord::Migration
def change
add_column :courses, :start_time, :integer
add_column :courses, :end_time, :integer
end
end
|
require 'spec_helper'
describe 'slapd_version' do
before :each do
Facter.clear
end
context 'slapd command exists' do
it 'returns the correct version of slapd' do
Facter::Core::Execution.stubs(:which).with('slapd').returns('/sbin/slapd')
Facter::Core::Execution.stubs(:execute).with('/sbin/sla... |
class CreateTashvighs < ActiveRecord::Migration
def change
create_table :tashvighs do |t|
t.references :ppl, index: true, foreign_key: true
t.integer :amount
t.integer :mode, default: 0
t.string :reason
t.timestamps null: false
end
end
end
|
class BrickOwlGetSetValueJob < ActiveJob::Base
queue_as :brick_owl
def perform set_id
get_brick_owl_values_for_set(set_id)
end
def get_brick_owl_values_for_set set_id
s = LegoSet.find(set_id)
unless s.nil?
begin
brick_owl_values = BrickOwlService.get_values_for_set(s)
if... |
# frozen_string_literal: true
require 'stannum'
module Stannum
# Provides a DSL for validating method parameters.
#
# Use the .validate_parameters method to define parameter validation for an
# instance method of the class or module.
#
# Ruby does not distinguish between an explicit nil versus an undefine... |
class ApplicationController < ActionController::Base
protect_from_forgery
# must add the method to a hash and append it to the helper method module or you can just add this to the helpers folder appliaction module.
helper_method :temporary_user
# the helper class inherits from the module class so it makes it av... |
class MentorsController < ApplicationController
before_filter :find_mentor, :only => [:show, :edit, :update, :destroy]
def index
@mentors = Mentor.all
end
def new
@mentor = Mentor.new
end
def create
@mentor = Mentor.new(params[:mentor])
if @mentor.save
flash[:notice] = "Mentor has been ... |
require 'spec_helper'
describe Locomotive::Liquid::Tags::Filter do
it 'has a valid syntax' do
markup = "contents.entries fields: [type, rum, rum.type, featured, favorite]"
lambda do
Locomotive::Liquid::Tags::Filter.new('filter', markup, ["{% endfilter %}"], {})
end.should_not raise_error
end
i... |
# frozen_string_literal: true
#
# @author Kivanio Barbosa
module Brcobranca
# Métodos auxiliares de cálculos
module Calculo
# Calcula módulo 10 segundo a BACEN.
#
# @return [Integer]
# @raise [ArgumentError] Caso não seja um número inteiro.
def modulo10
raise ArgumentError, 'Número invál... |
class Checkouts::Kwk::LineItemsController < Checkouts::KwkController
before_action :set_line_item
def destroy
if @line_item
@line_item.destroy
flash.now[:success] = 'This kap has been removed from your kart.'
else
flash.now[:error] = 'Could not remove this kap from your kart, it may ha... |
class DescriptionsController < ApplicationController
layout 'new_space'
before_action :authenticate_user!
before_action :check_current_user, only: [:edit, :update]
before_action :set_description, only: [:edit, :update]
def new
@space_id = params[:space_id]
@description = Description.new
end
def... |
class Event < ActiveRecord::Base
skip_time_zone_conversion_for_attributes = :tracked_at
normalize_attributes :entry_page, :exit_page, :with => :true_or_null
belongs_to :session
belongs_to :redirect
before_save :update_label
before_save :check_page_view
before_save :ap... |
require "formula"
class RexsterConsole < Formula
homepage "https://github.com/tinkerpop/rexster/wiki"
url "http://tinkerpop.com/downloads/rexster/rexster-console-2.5.0.zip"
sha1 "0243908c0ab65baea4b8092bb2b818c597622187"
# Upstream in next release:
# https://github.com/tinkerpop/rexster/commit/ac1d51c37b0bd... |
class RecentProjectsController < ApplicationController
before_action :authenticate_user!
before_action :set_recent_project, only: [:show, :edit, :update, :destroy]
before_action :check_voucher_admin_and_superadmin
# GET /recent_projects
# GET /recent_projects.json
layout 'adminpanel_tables'
def index
... |
def roll_call_dwarves(dwarves)
dwarves.each.with_index(1) do |value, index|
puts "#{index}. #{value}"
end
end
def summon_captain_planet(planeteer_calls)
planeteer_calls.map do |calls|
calls.capitalize + "!"
end
end
def long_planeteer_calls(calls)
calls.any? do |word|
word.length > 4
end
end... |
require "rails_helper"
RSpec.describe Survey::QuestionsController, :type => :routing do
describe "routing" do
it "routes to #index" do
expect(:get => "/survey/questions").to route_to("survey/questions#index")
end
it "routes to #new" do
expect(:get => "/survey/questions/new").to route_to("su... |
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'img_cloud'
require 'rexml/parsers/ultralightparser'
RSpec.configure do |config|
# Use color in STDOUT
config.color = true
# Use color not only in STDOUT but also in pagers and files
config.tty = true
# Use the specified formatter
config.... |
# Prints string 'Breakfast', but not string 'Dinner'
def meal
return 'Breakfast'
'Dinner'
end
puts meal |
require 'rails_helper'
RSpec.describe Vote, type: :model do
it { should validate_presence_of (:user_id) }
it { should validate_presence_of (:post_id) }
end
|
Clearance.configure do |config|
config.routes = false
config.mailer_sender = "admin@aeroform.co"
config.rotate_csrf_on_sign_in = true
config.sign_in_guards = [ConfirmedUserGuard]
end |
class GameHoldersController < ApplicationController
def new
@game_holder = GameHolder.new
end
def play
@game_holder = GameHolder.find(params[:id])
end
def index
@game_holder = GameHolder.all
end
def show
@game_holder = GameHolder.find(params[:id])
@game_holder.makeGame()
igame = @game_holder.igame... |
class MakeBundleContentIntoMediumtext < ActiveRecord::Migration
def self.up
change_column "bundles", :content, :text, :limit => 16777215 # 16MB
change_column "socks", :value, :text, :limit => 2097151 # 2 MB *** changed after the fact
end
def self.down
change_column "bundles", :content, :text
chan... |
feature 'HistoricAssetsController' do
let!(:user){ create(:user) }
let!(:historic_asset_audios_1){create(:historic_asset, :audio, created_at: Time.zone.now, number: "21")}
let!(:historic_asset_audios_2){create(:historic_asset, :audio, created_at: Time.zone.now + 1.minute, number: "22")}
let!(:historic_asse... |
class AdvartismentsController < ApplicationController
before_action :set_advartisment, only: [:show, :edit, :update, :destroy]
# GET /advartisments
# GET /advartisments.json
def index
@advartisments = Advartisment.all
end
# GET /advartisments/1
# GET /advartisments/1.json
def show
end
# GET /... |
module Rightboat
module Imports
module Importers
class Yatco < ImporterBase
def self.data_mappings
@data_mappings ||= SourceBoat::SPEC_ATTRS.inject({}) {|h, attr| h[attr.to_s] = attr; h}.merge(
'vessel_id' => :source_id,
'vessel_type' => :boat_type,
... |
class EmployeesController < ApplicationController
before_action :set_employee, only: [:show, :edit, :update, :destroy]
before_action :authenticate_user!, except: [:index, :show]
def index
@employees = Employee.all
end
def show
end
def new
@employee = current_user.employees.build
end
de... |
class Admissions::SystemAvatarsController < Admissions::AdmissionsController
before_filter :set_system_avatar, except: [:index, :new, :create]
load_resource find_by: :permalink
authorize_resource
def index
@system_avatars = SystemAvatar.ordered.paginate page: params[:page], per_page: @per_page
end
def... |
require 'collins/api'
require 'collins/asset_client'
require 'httparty'
module Collins
# Primary interface for interacting with collins
#
# @example
# client = Collins::Client.new :host => '...', :username => '...', :password => '...'
# client.get 'asset_tag'
class Client
# @see Collins::Api#head... |
# класс обьекта вывода информации
class ChoiceHelper
attr_reader :directors
# конструктор объекта вывода информации
# с инстанс переменными: коллекцией фильмов
# и коллекцией режиссеров
def initialize(films)
@films = films
@directors = @films.map { |film| film.director }.uniq
end
# метод выбирае... |
require 'rubygems'
require 'open-uri'
require 'nokogiri'
require 'cgi'
require_relative 'helpers'
module CraigslistCrawler
class Crawler
def initialize(options = {})
@user_id = options.delete(:user_id) { raise ArgumentError.new("You need to pass in a user id") }
@location = options.delete(:location)... |
class AddFinancialQuarterAndYearToPlannedDisbursements < ActiveRecord::Migration[6.0]
def change
add_column :planned_disbursements, :financial_quarter, :integer, index: true
add_column :planned_disbursements, :financial_year, :integer, index: true
reversible do |change|
change.up do
planned... |
module Carquery
class << self
# Returns trim data for models meeting specified criteria.
# Optional params:
# @make - Make code
# @model - Model Name
# @body - Coupe, Sedan, SUV, Pickup, Crossover, Minivan, etc.
# @doors - number of doors... |
module Spree
class GlobalCollectCheckout < ActiveRecord::Base
has_one :payment, class_name: 'Spree::Payment', as: :source
scope :with_payment_profile, -> { where('profile_token IS NOT NULL') }
scope :valid, -> { where('expiry_date > ?', Time.now.beginning_of_day) }
def actions
%... |
class ApplicationController < ActionController::API
# include ActionController::RequestForgeryProtection
# before_action :skip_session
# protect_from_forgery with: :exception
# protect_from_forgery unless: -> { request.format.json? }
# , unless: -> { request.format.json? }
# helper_method :curre... |
class CreatePassagemServico < ActiveRecord::Migration[6.0]
def change
create_table :administrativo_passagem_servicos do |t|
t.string :status
t.text :observacoes
t.integer :user_entrou_id
t.integer :user_saiu_id
t.timestamps
end
end
end
|
FactoryBot.define do
factory :respondent do
name { "Respondent Name" }
address
association :work_address, factory: :address
trait :default do
name { 'Respondent Name' }
contact { 'Respondent Contact Name' }
association :address,
factory: :address,
building: '108',
... |
ENV['RAILS_ENV'] ||= 'test'
require 'spec_helper'
require File.expand_path('../../config/environment', __FILE__)
require 'rspec/rails'
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
ActiveRecord::Migration.maintain_test_schema!
RSpec.configure do |config|
config.fixture_path = "#{::Rails.root}... |
class AddCanvasyToSlots < ActiveRecord::Migration[5.1]
def change
add_column :slots, :canvasy, :integer
end
end
|
require 'test/unit'
require_relative 'palindrome-number'
class MyTest < Test::Unit::TestCase
def test_
result = is_palindrome(121)
assert result
end
def test_negative_number
result = is_palindrome(-123)
assert !result
end
end |
class PeopleController < ApplicationController
def index
@people = []
params[:count].to_i.times do
@people << People.new(
name: Faker::Name.name,
age: Faker::Number.number(2),
city: Faker::Address.city,
state: Faker::Address.state
)
end
@peop... |
require 'bel/evidence_model'
require 'bel/language'
require 'rexml/document'
require 'rexml/streamlistener'
module BEL::Extension::Format
class FormatXBEL
include Formatter
ID = :xbel
MEDIA_TYPES = %i(application/xml)
EXTENSIONS = %i(xml xbel)
def id
ID
end
def media_t... |
require "./rom"
def parse_midi in_file
midi = ROM.from_file in_file
head = midi.read_str(4)
chksize = midi.read_u32_be
raise "Not a MIDI file" unless head == 'MThd' && chksize == 6
format, track_count, ppqn = [midi.read_u16_be, midi.read_u16_be, midi.read_u16_be]
puts "Format: #{format}"
puts "Track... |
class Blab < ActiveRecord::Base
belongs_to :user
validates_presence_of :content
end
|
require 'logger'
require 'yaml'
require 'pathname'
module KPM
class Sha1Checker
def self.from_file(sha1_file, logger=nil)
Sha1Checker.new(sha1_file, logger)
end
def initialize(sha1_file, logger=nil)
@sha1_file = sha1_file
init!
if logger.nil?
@logger = Logger.new(... |
class CreateSalesCommissions < ActiveRecord::Migration
def change
create_table :sales_commissions do |t|
t.integer :company_id
t.integer :user_id
t.string :type
t.integer :commissionable_id
t.string :commissionable_type
t.float :commission_rate
t.string :commission_t... |
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# ... |
class App::Api::BookingsController < App::Api::BaseController
protect_from_forgery except: [:create, :cancel]
def index
customer_id = current_user.company.lega_customer_id
occasions = LegaOnline::GetOccasions.new.send_request(customer_id)
# Lega's API requires us to fetch each participants number indi... |
class Book < ActiveRecord::Base
has_many :users, through: :user_books
has_many :user_books
has_many :authors, through: :book_authors
has_many :book_authors
has_many :categories, through: :book_categories
has_many :book_categories
accepts_nested_attributes_for :authors
accepts_nested_attributes_for :categories
e... |
require 'rubygems'
require 'mechanize'
require 'hpricot'
require 'bankjob'
# Later versions of Mechanize no longer use Hpricot by default
# but have an attribute we can set to use it
begin
Mechanize.html_parser = Hpricot
# For some reason something tries to sort an Hpricot::Elem[] which
# fails because Hpricot:... |
require "swagger_helper"
describe "Import v4 API", swagger_doc: "v4/import.json" do
before { Flipper.enable(:imports_api) }
before { FactoryBot.create(:facility) }
path "/import" do
let(:facility) { Facility.first }
let(:facility_identifier) do
create(:facility_business_identifier, facility: facili... |
class Sieve
attr_accessor :limit
attr_accessor :numbers
attr_accessor :marked
def initialize(given_limit)
@limit = given_limit
@numbers = 2.upto(limit).to_a
@marked = []
end
def primes
@primes ||= begin
2.upto(limit).each do |n|
numbers.each do |number|
next if mark... |
class CreateProducts < ActiveRecord::Migration[5.0]
def change
create_table :products do |t|
t.string :pname
t.integer :puchase_kg
t.integer :release_kg
t.integer :stock_kg
t.integer :predict
t.integer :month_avg
t.string :memo
t.references :inventory, foreign_key: ... |
class Docente < ActiveRecord::Base
belongs_to :colegio
before_save :default_values
cattr_accessor :current_usuario
def default_values
self.creado_by ||= Docente.current_usuario.usuario
end
end
|
class RenameOptionIdColumnInAnswers < ActiveRecord::Migration
def change
rename_column :answers, :option_id, :trivia_option_id
end
end
|
feature 'testing infrastructure' do
scenario 'can check that page visible and working' do
visit ('/')
expect(page).to have_content("Battleships")
end
end
|
describe iptables do
it "Should not allow input on tcp ports 60000 - 60100" do
should_not have_rule('-A INPUT -p tcp -m multiport --dports 60000:60100 -m comment --comment "030 input tcp new related established 60000-60100 iptables 1.0" -m conntrack --ctstate NEW,RELATED,ESTABLISHED -j ACCEPT')
end
end
describ... |
require_relative "boot"
require "rails"
require "active_record/railtie"
require "action_controller/railtie"
Bundler.require(*Rails.groups)
module DoorKeeper
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 6.0
# Onl... |
require 'net/http'
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
module Integrations #:nodoc:
module Alipay
class Notification < ActiveMerchant::Billing::Integrations::Notification
include PostsData
include Sign
def complete?
["TRADE_FINISHED", "T... |
FactoryGirl.define do
factory :user do
sequence(:email) {|n| "email#{n}@mail.com"}
password "morethan8characters"
password_confirmation "morethan8characters"
end
factory :moment do
sentence 'any old string'
day Date.today
user
end
factory :art do
user
moment
tra... |
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :draw do
english "MyString"
chinese "MyString"
end
end
|
require 'socket'
require 'pry'
class MyAmazingBrowser
attr_accessor :host, :port
def initialize(port = 80)
@port = port
end
def connect(request, &block)
socket = TCPSocket.open(host, port)
socket.puts(request)
block.call socket.read
socket.close
end
def get(url, &block)
self.host... |
class InterTeamTradeGroupsController < ApplicationController
before_action :authenticate_user!
skip_before_action :verify_authenticity_token
before_action :set_fpl_team,
:set_fpl_team_list,
:set_new_trade_group
before_action :set_inter_team_trade_group, only: [:show, :update, :de... |
class Comment < ActiveRecord::Base
<<<<<<< Local Changes
validates :body, presence: true
belongs_to :commentable, polymorphic: true
=======
>>>>>>> External Changes
end
|
class ChangeStatusToStringToSubscriptions < ActiveRecord::Migration[5.1]
def up
change_column :subscriptions, :status, :string
end
def down
change_column :subscriptions, :status, :integer
end
end
|
require 'rails_helper'
require 'csv'
RSpec.describe ItemTypeImport, type: :model do
let(:account) { create :account }
let(:headers) { 'type,dish_type,price,price2,price3' }
let(:item_type_import) { ItemTypeImport.new account }
describe '#import' do
it 'skips existing types' do
item_type = create :it... |
module Clarity
class TableMetricReport
attr_reader :maximum
attr_reader :rows
attr_reader :interval
attr_reader :timezone
def initialize(tablename, params={})
@timezone = (params[:timezone] or 'Pacific Time (US & Canada)')
# convert start at to the correct time zone
# start_at "2009-12-03" in pac... |
class ProductDetail < ActiveRecord::Base
belongs_to :product_type
validates :item_code, presence: true,
:format => {:with => ConfigCenter::GeneralValidations::ITEM_CODE_FORMAT_REG_EXP}
validates :color, presence: true,
:format => {:with => ConfigCenter::GeneralValidations::COLOR_FORMAT_REG_EXP}
validates... |
# module Maintenance
# WHEELS = 6
# def change_tires
# "Changing #{Vehicle::WHEELS} tires."
# end
# end
# class Vehicle
# WHEELS = 4
# end
# class Car < Vehicle
# include Maintenance
# end
# a_car = Car.new
# p a_car.change_tires
# class Animal
# @@total_animals = 0
# def self.total_animals
# ... |
class UserMailer < ApplicationMailer
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.user_mailer.registration_notification.subject
#
default :from => 'info@vieclam3s.com'
def registration_notification(user)
@user = user
mail subject: 'Hoàn tấ... |
require '' # 웹 페이지 open에 필요
require '' # JSON을 Hash로 변환하는데 필요
# lotto_hash에 이번주 로또 정보 가져오기.
# p lotto_hash로 우리가 뽑아야할 부분이 어딘지 파악하기. (로또번호, 보너스 번호)
lotto_hash = # 당신은 한줄에 빡! 가져오고싶다!
# 이번 주 추첨 번호를 저장할 drw_numbers 배열 생성.
# 배열을 생성하는 방법은 다양함. (ex, drw_numbers = [])
# p drw_numbers 해보자.
# 보너스 번호를 제외한 번호 ... |
Rails.application.routes.draw do
resources :contacts, except:[:index, :edit, :update, :delete]
resources :questions, except:[:index, :edit, :update, :delete]
resources :contracts, except:[:index, :edit, :update, :delete]
root to: 'home#index'
# For details on the DSL available within this file, see https://gu... |
class BillingInfo < ApplicationRecord
belongs_to :user
has_many :adress_for_carts
has_many :carts, through: :adress_for_carts
has_many :orders
end
|
class CommentsController < ApplicationController
before_action :authenticate_user!
respond_to :html, :js
def create
@post = Post.find(params[:post_id])
@comment = @post.comments.new(comment_params)
@comment.user = current_user
@comment.save
@comments = @post.comments.order('created_at DESC').paginate(:p... |
class FixGoogleAnalyticsCampaignNameTypo < ActiveRecord::Migration[5.0]
def change
rename_column :campaign_channels, :google_analytcs_campaign_name, :google_analytics_campaign_name
end
end
|
module TrialListHelpers
def displaying_multiple_trials(count)
t("will_paginate.page_entries_info.single_page_html.other", count: count)
end
def am_patient_field
t("helpers.search_filter.am_patient")
end
def apply_search_filter
click_button t("trials.search_filter.submit")
end
def displaying... |
class Post < ActiveRecord::Base
attr_accessible :con, :title
validates :title, :con, :presence => true
validates :title, :length => {:minimum =>2}, :allow_blank => true
validates :title, :uniqueness => { :message => 'already taken!!!'}
end
|
require_relative "base"
# EventHub module
module EventHub
# Processor2 class
class Processor2
include Helper
SIGNALS_FOR_TERMINATION = [:INT, :TERM, :QUIT]
SIGNALS_FOR_RELOAD_CONFIG = [:HUP]
ALL_SIGNALS = SIGNALS_FOR_TERMINATION + SIGNALS_FOR_RELOAD_CONFIG
attr_reader :started_at, :statistics... |
module CryptoGost3410
# DigitalSignature
#
# @author vblazhnovgit
class Generator
attr_reader :group
def initialize(group)
@group = group
end
def sign(hash, private_key, rand_val)
@hash = hash
@private_key = private_key
@rnd = rand_val
@r = r_func
s = s_func... |
class Category < ApplicationRecord
has_many :places, dependent: :destroy
validates :name, presence: true, length: {maximum: 50}
end
|
require 'active_support'
require 'active_support/core_ext/array/conversions.rb' # so we can use to_sentence
module Cybersourcery
class Profile
include ActiveModel::Validations
VALID_ENDPOINTS = {
standard: '/silent/pay',
create_payment_token: '/silent/token/create',
update_payment_token: '... |
class HomeController < ApplicationController
def index
unless @today = Gymday.find_by(gym_date: Date.today)
if @today = Gymday.last
flash.now[:error] = "There is no workout recorded for today.
Showing most recent recorded workout instead (#{@today.gym_date.to_s})."
... |
module Adapter
class GitHub
attr_accessor :repo
def initialize(repo)
@client ||= Octokit::Client.new(access_token: ENV["GITHUB_TOKEN"]
@repo = repo
end
def repo_issues
@client.issues("#{repo.user.github_username}/#{repo.name}")
end
def create_repo_webhook
@client.cr... |
class Album
include DataMapper::Resource
VALUE_METHODS = { "most_listened" => :play_count, "most_popular" => :total_score }
property :id, Serial
property :artist, String, :length => 200
property :name, String, :length => 200
has n, :songs
has n, :nominations
default_scope(:default).update :o... |
class Room < ApplicationRecord
extend FriendlyId
belongs_to :user
has_many :reviews, dependent: :destroy
# has_many :reviewed_rooms, through: :reviews, source: :room
scope :most_recent, -> { order('created_at DESC') }
validates_presence_of :title
validates_presence_of :slug
mount_uploader :picture, ... |
class InterviewReferencesController < ApplicationController
def index
@interview_references = InterviewReference.all
render json: @interview_references
end
def show
@interview_reference = InterviewReference.find(params[:id])
render json: @interview_reference
end
def create
... |
# frozen_string_literal: true
describe Facts::Solaris::Ruby::Sitedir do
describe '#call_the_resolver' do
subject(:fact) { Facts::Solaris::Ruby::Sitedir.new }
let(:value) { '/opt/puppetlabs/puppet/lib/ruby/site_ruby/2.5.0' }
before do
allow(Facter::Resolvers::Ruby).to receive(:resolve).with(:sited... |
=begin
#BombBomb
#We make it easy to build relationships using simple videos.
OpenAPI spec version: 2.0.831
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.3.1
=end
module BombBomb
VERSION = "2.0.25798"
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.