text stringlengths 10 2.61M |
|---|
require 'rhodes_analytics/analytics_object'
module RhodesAnalytics
class Social < AnalyticsObject
HITTYPE = "social"
FIELD_MAPPING = {
action: "sa",
network: "sn",
target: "st"
}
end
end |
# encoding: UTF-8
module CDI
module V1
module LearningTracks
class RemoveAuthorService < BaseUpdateService
record_type ::LearningTrack
attr_reader :removed_moderators
def changed_attributes
return [] if fail?
[:moderators]
end
private
... |
module RubyConsoleLibrary
class LabelControl < ConsoleControl
def initialize(parent_window, pos, attrs={})
opts = { :hover => {:interior => :foreground_brightblue, :border => :none}, :default => {:interior => :none, :border => :none}, :show_border => false, :width => :auto, :height => 1, :text => "label"}.m... |
module Rmega
module NotInspectable
def inspect(attributes = {})
memaddr = (__send__(:object_id) << 1).to_s(16)
string = "#<#{self.class.name}:#{memaddr}"
attributes.each { |k, v| string << " #{k}=#{v}" }
string << ">"
end
end
end
|
module Poms
module Fields
# Module to retrieve media related information from poms items.
module Media
extend self
IMAGE_TYPE_PRIORITY = %w[PROMO_LANDSCAPE PICTURE].freeze
# Returns the images from the hash
def images(item)
item['images'].try(:sort_by) do |i|
image_... |
json.array!(@admin_commerces) do |admin_commerce|
json.extract! admin_commerce, :id, :content
json.url admin_commerce_url(admin_commerce, format: :json)
end
|
module Arithmetic
def +(other)
summed_amount = self.amount + other.convert_to(self.currency, false)
currency_precision(summed_amount, self.currency)
end
def -(other)
# Difference is only possible if first value is greater than second value
# Other condition like when second value is greater than ... |
json.array!(@exhibition_people) do |exhibition_person|
json.extract! exhibition_person, :id, :exhibition_id, :person_id, :old_lastname, :is_teacher, :is_staffteacher, :is_student, :is_postgrad, :details
json.url exhibition_person_url(exhibition_person, format: :json)
end
|
# frozen_string_literal: true
module OmniAuth
module BCrypt
# The gem's semantic version number.
#
# Given a version number MAJOR.MINOR.PATCH, increment the:
#
# 1. MAJOR version when you make incompatible API changes,
# 2. MINOR version when you add functionality in a backwards compatible ma... |
# WeeklyRateService class is responsible for adding new weekly rates.
class WeeklyRateService
def initialize(base_currency_id, start_date, period)
@base_currency_id = base_currency_id
@start_date = start_date.at_beginning_of_week
@period = period
@end_date = start_date.at_beginning_of_week - period.we... |
# frozen_string_literal: true
module Vedeu
module EscapeSequences
# Provides background colour related escape sequences.
#
# @api public
# See {file:docs/dsl/by_method/esc.md}
module Background
extend Forwardable
extend self
def_delegators Vedeu::EscapeSequences::Actions, :b... |
shared_examples "contactable" do
it { is_expected.to have_one(:contact) }
it { is_expected.to have_many(:addresses) }
it { is_expected.to have_many(:phones) }
it { is_expected.to have_many(:emails) }
it { is_expected.to have_many(:websites) }
end
|
name 'multi_mysql'
maintainer 'Peter Walz, (C) Regents of the University of Minnesota'
maintainer_email 'pnw@umn.edu'
license 'Apache 2.0'
description 'Installs/Configures multiple MySQL or MariaDB server instances'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))... |
class EARMMS::MembershipAdminImportController < EARMMS::MembershipAdminController
helpers EARMMS::MembershipAdminImportHelpers
get '/' do
next halt 404 unless logged_in?
next halt 404 unless has_role? 'admin:import'
@first_branch = EARMMS::Branch.order(Sequel.asc(:id)).first
unless @first_branch
... |
class FontPlemolJpNf < Formula
version "1.4.0"
sha256 "59f23d3795dae9dc62e3e356829cd496e0bdea8efefe8d7953a98ec5e85c6580"
url "https://github.com/yuru7/PlemolJP/releases/download/v#{version}/PlemolJP_NF_v#{version}.zip"
desc "PlemolJP NF"
desc "Japanese programming font synthesized from IBM Plex Mono and IBM P... |
module PrintInvoiceTable
extend ActiveSupport::Concern
include PrintTableGroup
include PrintTableLine
def invoice_table(invoice, pdf)
pdf.line_width(0.1)
ingroups = Mjbook::Ingroup.where(:invoice_id => invoice.id)
# pdf.bounding_box([0.mm, 180.mm], :width => 190.mm, :height => 140.mm) d... |
Fabricator(:currency) do
code { Money::Currency.new('EUR').iso_code }
name { Money::Currency.new('EUR').name }
end
|
class UsersControllerTest < ActionDispatch::IntegrationTest
def setup
@user = users(:manuel)
@user2 = users(:marion)
end
test "it should have an index page" do
get users_path
assert_response :success
assert_select "title", "All Users"
assert_select "h1", "All Users"
end
test "it should have a profi... |
class Customer < ApplicationRecord
has_many :orders
belongs_to :province, optional: true
validates :firstname, presence: true
validates :lastname, presence: true
validates :email, presence: true
validates :email, uniqueness: true
validates :password, presence: true
validates :phone, presence: true
va... |
class AddBeginsAtToHappyHours < ActiveRecord::Migration
def change
add_column :happy_hours, :begins_at, :time
end
end
|
# frozen_string_literal: true
FactoryBot.define do
factory :permission, class: 'Permissions::Permission' do
grantee_type 'PlaceHolder'
grantee_id
object_type 'Widget'
end
end
|
require 'spec_helper'
describe UsersController do
render_views
describe "POST 'create'" do
describe "echec" do
before(:each) do
@attr = { :nom => "", :email => "", :password => "",
:password_confirmation => "" }
end
it "ne devrait pas creer d'utilisateur" do
... |
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
def catch_all
if request.url != root_url
respond_to do |format|
format.html { redirect_to root_url }
... |
require 'chemistry/element'
Chemistry::Element.define "Phosphorus" do
symbol "P"
atomic_number 15
atomic_weight 30.973762
melting_point '317.45K'
end
|
class RemoveFinishDateFromChallenges < ActiveRecord::Migration[5.0]
def up
remove_column :challenges, :finish_date
end
def down
add_column :challenges, :finish_date, :date
end
end
|
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# latestのCentOSを指定(今だと6.9)
config.vm.box = "centos/6"
if Vagrant.has_plugin?("vagrant-proxyconf")
co... |
#お知らせ既読管理
class MessageReadsController < ApplicationController
include CommonModule
before_action :set_message_read, only: [:show, :edit, :update, :destroy]
before_action :sign_in_required
def index
if check_role(current_user)
@message_reads = MessageRead.where("user_id = '" +current_user.id.to_s + ... |
module CamaleonCms
module Admin
module BreadcrumbHelper
# draw the title for the admin admin panel according the breadcrumb
def cama_admin_title_draw
res = [t('camaleon_cms.admin.sidebar_top.admin_panel')]
breadcrumbs.reverse.slice(0, 2).reverse.each { |b| res << (b.is_a?(Hash) ? b[:na... |
class AddVisitsReportToProposals < ActiveRecord::Migration
def change
add_reference :proposals, :visits_report, index: true, foreign_key: true
end
end
|
require 'comment'
require 'trackback'
class Admin::FeedbackController < Admin::BaseController
def index
conditions = ['1 = 1', {}]
if params[:search]
conditions.first << ' and (url like :pattern or author like :pattern or title like :pattern or ip like :pattern or email like :pattern)'
conditio... |
class ChangeColumnsToPowerOrders < ActiveRecord::Migration[4.2]
def change
change_column_default :power_orders, :manufacturer, nil
change_column_default :power_orders, :model, nil
end
end
|
require "rails_helper"
require "support/helpers/login_helper.rb"
include LoginHelper
describe "User enters admin area" do
let(:login_and_enter) do
login_with("test@test.com", "12345", "Войти")
visit admin_root_path
end
context "when not authenticated" do
before do
visit admin_root_path
end... |
module BookKeeping
VERSION = 4 # Where the version number matches the one in the test.
end
class Complement
def self.of_dna(dna)
begin
dna.chars.collect{|strand| self.of_strand(strand)}.join('')
rescue ArgumentError
''
end
end
def self.of_strand(strand)
case strand
when 'A'
... |
require 'rails/generators/base'
require 'securerandom'
module CamaleonCms
module Generators
class InstallGenerator < Rails::Generators::Base
source_root File.expand_path('install_template', __dir__)
desc 'This generator create all basic Camaleon CMS structure.'
def create_initializer_file
... |
# frozen_string_literal: true
module Api
module V1
module JWT
module Decode
include Shared
EXPIRED_TOKEN = 'Your token has expired.'
INVALID_ISSUER = 'That token has an invalid issuer.'
INVALID_ACCESS_RESTRICTION = 'Your token does not have access to that action.'
... |
class Task < ActiveRecord::Base
belongs_to :project
has_many :comments, dependent: :destroy
def due_soon?
if self.due_date
true if self.due_date <= (Date.today + 7)
else
nil
end
end
paginates_per 10
validates :description, presence: true
def on_or_after
if due_date.present... |
class CreateLcClasses < ActiveRecord::Migration[5.2]
def change
create_table :lc_classes do |t|
t.integer :lc_comp_id
t.string :class_name
t.float :length
t.float :climb
t.integer :controls
t.string :course
t.string :filename
t.integer :file_id
t.integer :part... |
class CreateDeployHistories < ActiveRecord::Migration
def change
create_table :deploy_histories do |t|
t.string :ident_code,:unique=>true,:null => false
t.datetime :action_time,:null => false
t.integer :agent_id,:null => false
t.integer :portal_id,:null => false
t.integer :resonator_... |
# Let's practice creating an object hierarchy.
# Create a class called Greeting with a single instance method called greet that takes a string argument and prints that argument to the terminal.
# Now create two other classes that are derived from Greeting: one called Hello and one called Goodbye. The Hello class shou... |
# frozen_string_literal: true
module Vedeu
module Groups
# Interfaces can be configured to be part of a named group. Once
# an interface is a member of group, the group can be affected by
# other controls. For example, assuming the client application is
# a simple Git client, it may have a group ca... |
require 'common/indent'
require 'mendeley/cache'
module Mendeley
class Document
DOCUMENTS_TAGGED_LIMIT = 5
# Instance
#
def initialize long_json
@long_json = long_json
@debug = false
end
def hash
self.uuid.hash
end
# Instance
#
def == doc
return self.uuid == doc.uuid
end
# In... |
require 'openssl'
module OffsitePayments
module Integrations #:nodoc:
module Migs
# Overwrite this if you want to change the ANS production url
mattr_accessor :production_url
self.production_url = 'https://migs.mastercard.co.in/vpcpay'
HASH_ALGORITHM = 'SHA256'.freeze
def self.se... |
require "./file/backup_file"
class ListFilesService
def list_files(directory, applicable_time)
result = []
Dir.entries(directory).each do |fileName|
absolute_path = File.absolute_path(fileName, directory)
if File.file?(absolute_path)
result.push(
BackupFile.new(
... |
FactoryBot.define do
factory :task do
name "Wash сlothes"
slug "laundry"
state "in progress"
end
end
|
require 'wicked_pdf'
require_relative './htmlentities'
require_relative './helpers'
require_relative './sparql_queries'
module DocumentGenerator
class OfferDocument
include DocumentGenerator::Helpers
def initialize
@inline_css = ''
end
def generate(path, data)
coder = HTMLEntities.new
... |
class CreateCaststoneAssignments < ActiveRecord::Migration[4.2]
def up
create_table :refinery_caststone_assignments, if_not_exists: true do |t|
t.references :component_id, :photo_id
end
end
def down
if defined?(::Refinery::UserPlugin)
::Refinery::UserPlugin.destroy_all({name: "ref... |
# frozen_string_literal: true
RSpec.describe Api::V1::Admin::Users::UpdateAction do
let!(:current_user) { create(:user, :admin) }
let!(:user) { create(:user, first_name: first_name, last_name: last_name) }
let(:action) { described_class.new(context: {current_user: current_user}) }
let(:first_name) { FFaker::N... |
class ChangingDocNameFieldBackToId < ActiveRecord::Migration
def self.up
rename_column :docs, :name, :id
rename_column :list_items, :doc_name, :doc_id
rename_column :titles, :doc_name, :doc_id
end
def self.down
rename_column :docs, :id, :name
rename_column :list_items, :doc_id,... |
# ログインしてない場合にトップページに遷移するメソッド
module RedirectToTop
extend ActiveSupport::Concern
private
def redirect_to_top
redirect_to products_path if user_signed_in?
end
end |
require 'spec_helper'
describe Loc::Location do
it "can be created from an Array" do
location = described_class.from_array([1, 2])
expect(location.lat).to eq 1
expect(location.lng).to eq 2
end
it "can be created from array with [] syntax" do
location = described_class[1, 2]
expect(location.l... |
Recruiterbox.configure do |config|
config.api_key = ENV['RECRUITERBOX_KEY']
end
|
require "helper"
require "neovim/ruby_provider/buffer_ext"
module Neovim
RSpec.describe Buffer do
let!(:nvim) do
Support.persistent_client.tap do |client|
stub_const("::Vim", client)
end
end
describe ".current" do
it "returns the current buffer from the global Vim client" do
... |
require 'rails_helper'
RSpec.describe '新規登録ページ', type: :system do
describe 'アカウント作成' do
context '有効な値が入力された時' do
before do
visit signup_path
fill_in 'ユーザーネーム', with: 'test user'
fill_in 'メールアドレス', with: 'testuser@example.com'
fill_in 'パスワード', with: 'password'
fill_in... |
class ApplicationController < ActionController::Base
def after_sign_out_path_for(resource_or_scope)
cookies.signed[:toauth_fast] = nil
ToauthConnect.logout
# root_path
end
def after_sign_in_path_for(resource)
services_path
end
rescue_from CanCan::AccessDenied do |exception|
redirect_to r... |
class RemotePerson < ActiveRecord::Base
self.establish_connection :remote
def self.columns() @columns ||= []; end
def self.column(name, sql_type = nil, default = nil, null = true)
columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, sql_type.to_s, null)
end
column :case_id,... |
# frozen_string_literal: true
class Payee < ApplicationRecord
INITIAL_VALUE = 'Initial Value'
def self.initial_value
where(name: INITIAL_VALUE).first
end
end
|
ActiveAdmin.register Category do
filter :name
filter :created_at
filter :updated_at
permit_params :name
end
|
# -*- mode: ruby -*-
# vi: set ft=ruby :
box = "geerlingguy/ubuntu1604"
Vagrant.configure(2) do |config|
config.vm.box = box
config.vm.provider "virtualbox" do |vb|
vb.name = "isucon5-qualifier"
vb.memory = "4096"
vb.cpus = 4
end
config.vm.synced_folder "webapp", "/home/isucon/webapp", owner: "v... |
LOCAL_DIST = "#{node[:golang][:install]}/source.tar.gz"
directory node[:golang][:install] do
user node[:user]
group node[:user]
recursive true
mode 0755
end
directory node[:golang][:path] do
user node[:user]
group node[:user]
mode 0755
end
remote_file LOCAL_DIST do
source node[:go... |
module Sensors
module Payloads
class Dth < BinData::Record
endian :little
bit1 :adr_flag
bit3 :dr_flag
bit1 :snr_flag
bit3 :len_flag
int8 :snr
int8 :battery1
int8 :battery2
int8 :temp_units
int8 :temp_tenths
int8 :hum_units
int8 :hum_tenths... |
# http://www.careercup.com/question?id=5735540389314560
#
# Starting from the LSB, sum the two addends plus carries and concatenate
# onto the output string. Reverse it before returning
class Summer
def stringadd(first, second)
output = ''
# Left pad
if first.length < second.length
first =... |
#module R_dvr
class Episode
attr_accessor :title, :url, :img, :pubDate, :dcDate, :description, :season, :index
def initialize(title=nil, url=nil, img=nil, pubDate=nil, dcDate=nil, description=nil)
@title = title
@url = url
@img = img
@pubDate = pubDate
@dcDat... |
# frozen_string_literal: true
Rails.application.routes.draw do
namespace :api do
namespace :v1 do
resources :shop, only: %i[index]
end
end
get '*path', to: 'home#index' # redirect all routes to home#index
root 'home#index'
mount ShopifyApp::Engine, at: '/'
# For details on the DSL available... |
class Tag < ApplicationRecord
has_many :join_gossip_tags
has_many :gossips, through: :join_gossip_tags
has_many :users, through: :gossips
end
|
feature "Create a Gsa18F procurement" do
scenario "user not signed in" do
visit new_gsa18f_procurement_path
expect(page).to have_content("You need to sign in")
end
context "user signed in" do
scenario "saves a Proposal with the attributes" do
requester = create(:user, client_slug: "gsa18f")
... |
require 'test_helper'
class ProjectTest < ActiveSupport::TestCase
should "not allow a project without a title" do
project = Fabricate.build(:project, title: nil)
assert_not project.valid?
end
should "not allow a title of less than 5 characters" do
project = Fabricate.build(:project, title: "foo")
... |
class CreateDiscoveryMajorRecommendations < ActiveRecord::Migration
def change
create_table :discovery_major_recommendations do |t|
t.integer :major_id
t.integer :category_id
t.timestamps
end
end
end
|
class Giohang < ApplicationRecord
belongs_to :thanhvien
has_many :chitietgiohangs
end
|
module Geolocatable
extend ActiveSupport::Concern
DEFAULT_SEARCH_RANGE_IN_MILES = 25
included do
attribute :postcode
validates :location, location: true
attribute :radius, Integer, default: DEFAULT_SEARCH_RANGE_IN_MILES
end
def location
@location ||= Location.new(postcode)
end
end
|
class AddTypeToMale < ActiveRecord::Migration
def change
add_column :males, :type, :string
end
end
|
# encoding: ASCII-8BIT
require 'spec_helper'
describe ECDSA::Format::SignatureDerString do
let(:signature_der) do
"\x30\x45" \
"\x02\x21\x00" \
"\x83\x89\xdf\x45\xf0\x70\x3f\x39\xec\x8c\x1c\xc4\x2c\x13\x81\x0f" \
"\xfc\xae\x14\x99\x5b\xb6\x48\x34\x02\x19\xe3\x53\xb6\x3b\x53\xeb" \
"\x02\x20" \
... |
class House < ApplicationRecord
has_many :students
end
|
class Family < ApplicationRecord
has_many :trip_families
has_many :trips, through: :trip_families
validates :last_name, :capability, presence: true
def self.by_last_name
order("lower(last_name)")
end
def self.active
where(active: true)
end
def self.inactive
where(active: false)
end
... |
require 'get_address/config_methods'
module GetAddress
class Response
include GetAddress::ConfigMethods
attr_reader :httparty_response, :status, :request, :raw_body
def initialize(request, httparty_response)
@httparty_response = httparty_response
@status = httparty_response.code
... |
class NotificationController < ApplicationController
before_action :authenticate_user!
respond_to :json
# def index
# respond_to do |format|
# format.json { render json: Notification.paginate(page: params[:page], per_page: 2) }
# format.html
# end
# end
def index
respond_to do |forma... |
require 'rails_helper'
RSpec.describe 'Password recovery', type: :request do
let(:user) { User.create LauraSpecHelper.valid_user_params }
it 'request for recovery with invalid email', :skip_reqres do
get users_password_new_path, { email: 'invalid@email.com'}, LauraSpecHelper.ios_device
response_hash = JS... |
module Auth::Model::OauthUser::AlipayUser
extend ActiveSupport::Concern
included do
attribute :provider, :string, default: 'alipay'
before_save :sync_user_info, if: -> { auth_code_changed? }
end
def save_info(oauth_params)
self.access_token = oauth_params['access_token']
self.auth_code = oauth... |
class CreateStocks < ActiveRecord::Migration
def change
create_table :stocks do |t|
t.integer :drugstore_id
t.integer :medicament_id
t.integer :position
t.datetime :created_at
t.timestamps
end
end
end
|
class Admin::PanelsController < AdminsController
def index
@products = Product.all
end
end
|
class Article < ApplicationRecord
def published?
return false if published_at.nil?
published_at <= Date.today
end
end
|
Pod::Spec.new do |s|
s.name = "Datadog"
s.version = "1.0.0-beta1"
s.summary = "Datadog Swift SDK for iOS and macOS."
s.homepage = "https://www.datadoghq.com"
s.social_media_url = "https://twitter.com/datadoghq"
s.license = { :type => "Apache" }
s.authors = {... |
# frozen_string_literal: true
# Helper for case page, mostly the casw show page.
module CasesHelper
def embed(video_url)
if video_url.include? 'youtube.com'
youtube_id = video_url.to_s.split('=').last
content_tag(:iframe, nil, src: "//www.youtube.com/embed/#{youtube_id}")
elsif video_url.include?... |
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_action :configure_devise_permitted_parameters, if: :devise_controller?
rescue_from CanCan::AccessDenied d... |
require 'spec_helper'
feature 'Task display', :acceptance do
before(:each) { create_test_user }
before(:each) do
visit tasks_page
@task_ids = (1..3).map do |i|
create_task :type => :action, :objective => "Test task #{i}"
end
end
let(:tasks) { find('[widget=tasks]') }
scenario 'Displaying... |
# frozen_string_literal: true
require "kafka/protocol/message"
describe Kafka::Broker do
let(:logger) { LOGGER }
let(:connection) { FakeConnection.new }
let(:connection_builder) { double(:connection_builder) }
before do
allow(connection_builder).to receive(:build_connection) { connection }
end
let(:... |
require "application_system_test_case"
class Intervention2sTest < ApplicationSystemTestCase
setup do
@intervention2 = intervention2s(:one)
end
test "visiting the index" do
visit intervention2s_url
assert_selector "h1", text: "Intervention2s"
end
test "creating a Intervention2" do
visit inte... |
module Domain
class ArticlePublisher
def initialize(id, service)
@article_id = id
@service = service
end
def publish(time)
article = @service.fetch(@article_id)
if article_ok?(article)
@service.publish(@article_id, time)
article
else
article.set(:err... |
module LoyaltyConnect
module Model
class Activity < Struct.new(:cards, :transactions, :rewards)
class << self
def from_json_hash(json_hash)
data = json_hash || {}
Activity.new(
Card.from_paged_json(data["credit_cards"]),
Transaction.from_paged_json(data["t... |
class Customer < ActiveRecord::Base
has_many :projects, dependent: :destroy
accepts_nested_attributes_for :projects, allow_destroy: true
validates :name, presence: true
validates :address, presence: true
validates :phone, presence: true, numericality: true, length: { is: 10}
def phonenum(phone)
... |
# frozen_string_literal: true
module Redox
module Models
class PatientIdentifier < Redox::Model
redox_property :IDType
redox_property :ID
end
end
end
|
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'sepshortener_client'
require 'minitest/autorun'
class Object
def metaclass
class << self; self; end
end
def self.stub_method_chain(chain, &blk)
chain = chain.split('.') if chain.is_a? String
metaclass.instance_eval do
define_... |
dep 'existing db' do
setup {
requires "existing #{var(:db, :default => 'postgres')} db"
}
end
dep 'db gem' do
setup {
define_var :db, :choices => %w[postgres mysql]
requires var(:db) == 'postgres' ? 'pg.gem' : "#{var(:db)}.gem"
}
end
dep 'activerecord db migrated' do
requires_when_unmet 'benhosk... |
require 'em-xmpp'
require 'em-xmpp/namespaces'
require 'em-xmpp/evented'
require 'em-xmpp/jid'
require 'em-xmpp/component'
require 'em-xmpp/resolver'
require 'socket'
require 'openssl'
module EM::Xmpp
module NonEM
class Connection
include Namespaces
include Evented
attr_reader :jid, :pass, :... |
# Optional Statistics
# - number of processed events
# - speed/seconds
class Statistics
def initialize()
@processed = 0
reset_speed_session
end
def processed
@processed
end
def reset_speed_session
@start_time = Time.now
@session_count = 0
end
def speed
time = Time.now - @start_time
@session_co... |
class BooksGenresJoin < ActiveRecord::Migration
def change
create_table :books_genres, id: false do |t|
t.integer :book_id
t.integer :genre_id
end
end
end
|
# Modify the kebabize function so that it converts a camel case string into a kebab case.
#
# kebabize('camelsHaveThreeHumps') // camels-have-three-humps
# kebabize('camelsHave3Humps') // camels-have-humps
#
# Notes:
#
# the returned string should only contain lowercase letters
#
def kebabize(str)
gsubbed = str... |
require 'rails_helper'
RSpec.describe SelectedSub, type: :model do
it { should belong_to(:sub_request) }
it { should belong_to(:sendee) }
startdatetime = Faker::Time.forward(23, :morning)
enddatetime = Faker::Time.forward(23, :morning)
let!(:my_user) { User.create(staff_id_mb: 100000164, first_name: 'Jennif... |
class UserTask < ApplicationRecord
belongs_to :user
validates :due, presence: true
end
|
# frozen_string_literal: true
#
# Fluentd Kubernetes Metadata Filter Plugin - Enrich Fluentd events with
# Kubernetes metadata
#
# Copyright 2015 Red Hat, Inc.
#
# 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 ... |
require "open-uri"
class Malware < ActiveRecord::Base
before_create :delete_previous
# Inserting/deleting one entry at a time is painfully slow
# Inserting in batches of 100 entries reduces time to ~1 minute
@batch_size = 100
# Fetch changes from google servers and store them in the database
# Might ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.