hexsha stringlengths 40 40 | size int64 2 1.01M | content stringlengths 2 1.01M | avg_line_length float64 1.5 100 | max_line_length int64 2 1k | alphanum_fraction float64 0.25 1 |
|---|---|---|---|---|---|
0877c9dddec114d90f9636a5e03922337c66dee1 | 1,087 | # frozen_string_literal: true
module DiffViewer
module ServerSide
extend ActiveSupport::Concern
included do
self.collapse_limit = 1.megabyte
self.size_limit = 5.megabytes
end
def prepare!
diff_file.old_blob&.load_all_data!
diff_file.new_blob&.load_all_data!
end
def ... | 26.512195 | 79 | 0.698252 |
394d3dde79209b4f1fede6aeecc20ea4b646fd80 | 1,001 |
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "tencent_cloud_cos/version"
Gem::Specification.new do |spec|
spec.name = "tencent_cloud_cos"
spec.version = TencentCloudCos::VERSION
spec.authors = ["iamdbc"]
spec.email = ["... | 33.366667 | 74 | 0.651349 |
18e63b283f7bdf0f0b6958a9b71a75c87a1d9bae | 124 | module ProfitAndLoss
class CostEntry < ActiveRecord::Base
include DisplayablePrices
has_many :comments
end
end
| 15.5 | 38 | 0.766129 |
0358fd9976a44223c0e22c93aacf16dede67786b | 1,751 | require "abstract_unit"
require "action_controller/metal/strong_parameters"
class LogOnUnpermittedParamsTest < ActiveSupport::TestCase
def setup
ActionController::Parameters.action_on_unpermitted_parameters = :log
end
def teardown
ActionController::Parameters.action_on_unpermitted_parameters = false
e... | 25.376812 | 92 | 0.676185 |
01893d0cdac0d4144fa3742f232c6b1869b82d4c | 2,025 | require 'spec_helper'
RSpec.describe Hsquare::Device do
let(:client) { Hsquare.config.default_application.admin_client }
describe '.find_by_user_id' do
let(:user_id) { 123 }
let(:mock_response) { double(parsed_response: []) }
it { expect(client).to receive(:get).with('/v1/push/tokens', query: { uuid:... | 40.5 | 190 | 0.658272 |
21c7acc9a5060b423dacf97ab87bb2a5f5959088 | 1,249 | module Whiteprint
module Plugins
module HasAndBelongsToMany
extend ActiveSupport::Concern
class HasAndBelongsToManyModel
class << self
def setup(association: association)
include Whiteprint::Model
@join_table = association.join_table
whiteprint(a... | 27.152174 | 110 | 0.627702 |
6a3338989551f733d13cdbb8d58f4d9b928f9e09 | 9,864 | # frozen_string_literal: true
require 'spec_helper'
describe ProjectFeature do
using RSpec::Parameterized::TableSyntax
let(:project) { create(:project) }
let(:user) { create(:user) }
describe 'PRIVATE_FEATURES_MIN_ACCESS_LEVEL_FOR_PRIVATE_PROJECT' do
it 'has higher level than that of PRIVATE_FEATURES_MI... | 33.100671 | 124 | 0.69262 |
ff8956d8e487bd1072c452f42da60037f1cedded | 28,104 | module Import
module Helpers
module Colorectal
module Providers
module R0a
# Processing methods used by ManchesterHandlerColorectal
module R0aHelper
include Import::Helpers::Colorectal::Providers::R0a::R0aConstants
def split_multiplegenes_nondosage_map(_n... | 51.566972 | 123 | 0.568353 |
26567d9f8756ddfc24bbca8e6f1594e7a7b40dbe | 1,094 | # frozen_string_literal: true
module Polaris
class IconComponent < Polaris::NewComponent
COLOR_DEFAULT = :default
COLOR_MAPPINGS = {
COLOR_DEFAULT => "",
:base => "Polaris-Icon--colorBase",
:subdued => "Polaris-Icon--colorSubdued",
:critical => "Polaris-Icon--colorCritical",
:wa... | 29.567568 | 79 | 0.639854 |
1cd654efe611452d74816b7517290b2b611b7ed2 | 1,717 | require 'test_helper'
describe Cask::CLI do
it "supports setting the appdir" do
Cask::CLI.process_options %w{help --appdir=/some/path/foo}
Cask.appdir.must_equal Pathname('/some/path/foo')
end
it "supports setting the appdir from ENV" do
ENV['HOMEBREW_CASK_OPTS'] = "--appdir=/some/path/bar"
Ca... | 26.828125 | 82 | 0.701805 |
181a93e9eac1af729a3ddbd1a8a141fdba713f5f | 44,140 | # This module provides an interface to the vips image processing library
# via ruby-ffi.
#
# Author:: John Cupitt (mailto:jcupitt@gmail.com)
# License:: MIT
require 'ffi'
module Vips
private
attach_function :vips_image_new_matrix_from_array,
[:int, :int, :pointer, :int], :pointer
attach_function :... | 27.901391 | 98 | 0.619619 |
184b953ad3bea9f80eaa88b8117ccd758336c7ca | 344 | cask "font-marmelad" do
version :latest
sha256 :no_check
# github.com/google/fonts/ was verified as official when first introduced to the cask
url "https://github.com/google/fonts/raw/master/ofl/marmelad/Marmelad-Regular.ttf"
name "Marmelad"
homepage "https://fonts.google.com/specimen/Marmelad"
font "Ma... | 28.666667 | 87 | 0.755814 |
280e8219eb8287eb87b06e1082f070a7e5c0ac98 | 4,090 | #!/usr/bin/env ruby
require 'cgi'
module DText
def parse_inline(str, options = {})
str = str.gsub(/&/, "&")
str.gsub!(/</, "<")
str.gsub!(/>/, ">")
str.gsub!(/\[\[.+?\]\]/m) do |tag|
tag = tag[2..-3]
if tag =~ /^(.+?)\|(.+)$/
tag = $1
name = $2
'<a href=... | 24.058824 | 117 | 0.428117 |
21f906b452ae3cb6619564c9e93d6a92f2a7b55c | 292 | class CreateTestEngineDurations < ActiveRecord::Migration
def change
create_table :test_engine_durations do |t|
t.string :minutes
t.string :type
t.references :learning_journey, index: true
t.references :session, index: true
t.timestamps
end
end
end
| 22.461538 | 57 | 0.69863 |
035936b4ccc70dc7937fa446b1f55f173432defa | 713 | class ApplicationController < ActionController::Base
before_action :set_locale
protect_from_forgery with: :exception
helper_method :current_year, :current_user
private
def authorize
redirect_to login_url, alert: t('auth.notauth') if current_user.nil?
end
def current_year
Time.now.year
end
... | 22.28125 | 72 | 0.708275 |
7aaa1ab256a0743997a71e8e3103e3d9d81a77ea | 1,279 | module Lolipop
module Mc
module Starter
module Rails
module CheckItem
class EnvDatabase < Base
def check
config = @config.load
ssh_command = config['ssh']
if ssh_command == @config::NOCHECK
raise 'SSHコマンドの実行に失敗しました。SSH接続... | 37.617647 | 148 | 0.591869 |
fff7329491c9eeeaef4e7d1b2c5e58aa65d04800 | 8,046 | require 'spec_helper'
describe MergeRequests::MergeService, services: true do
let(:user) { create(:user) }
let(:user2) { create(:user) }
let(:merge_request) { create(:merge_request, assignee: user2) }
let(:project) { merge_request.project }
before do
project.team << [user, :master]
project.team << [... | 33.665272 | 118 | 0.668282 |
619adcb89712240fbbdc29ff7a6097897fb934cf | 1,159 | require "thor/group"
require "active_support/inflector"
module Corneal
module Generators
class ControllerGenerator < Thor::Group
include Thor::Actions
attr_reader :controller_name, :class_name, :file_name
desc "Generate an Controller with associated views"
argument :name, type: :string, ... | 30.5 | 97 | 0.669543 |
0326982ff1aca3bd715efb4ad1cb480abf46ca83 | 1,317 | require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)
describe "IO.try_convert" do
before :each do
@name = tmp("io_try_convert.txt")
@io = new_io @name
end
after :each do
@io.close unless @io.closed?
rm_r @name
end
it "returns t... | 26.34 | 76 | 0.687168 |
397da8abc7cada1f45ba5ae13b167e7f31a57c93 | 136 | # frozen_string_literal: true
module WaterDrop
# Namespace for all the contracts for config validations
module Contracts
end
end
| 17 | 58 | 0.794118 |
ff95cf3f7313f3435716e00a54c45457c235f3ba | 83 | class PostSerializer < ActiveModel::Serializer
attributes :id, :title, :body
end
| 20.75 | 46 | 0.771084 |
bf298dfb17aa65466a29bd5e79d3e0bb362e1ab3 | 3,453 | module HealthSeven::V2_5_1
class RdsO13 < ::HealthSeven::Message
attribute :msh, Msh, position: "MSH", require: true
attribute :sfts, Array[Sft], position: "SFT", multiple: true
attribute :ntes, Array[Nte], position: "NTE", multiple: true
class Patient < ::HealthSeven::SegmentGroup
attribute :pid, Pid, posi... | 53.953125 | 121 | 0.693021 |
d56efa10b5ec740aa9c5536767aea4804de483c4 | 7,069 | require 'repositories/service_usage_event_repository'
module VCAP::CloudController
class ServiceInstance < Sequel::Model
class InvalidServiceBinding < StandardError; end
ROUTE_SERVICE_WARNING = 'Support for route services is disabled. This service instance cannot be bound to a route.'.freeze
VOLUME_SERV... | 29.701681 | 127 | 0.666714 |
f772b9ee5828773453a4d94c57679fd88106a279 | 169 | require 'chef/provisioning/fog_driver/driver'
with_driver 'fog:AWS'
with_machine_options :bootstrap_options => {
:tags => {
'chef-provisioning-test' => ''
}
}
| 16.9 | 45 | 0.692308 |
e86546c351f7fee38fc647ca99a5b71b6b3f8663 | 93 | module TokyoMetro::Api::TrainTimetable::Info::StationTime::Info::TrainRelation::Following
end | 46.5 | 89 | 0.827957 |
9166999b4001d8b414899174cbfafedd964636e3 | 2,417 | # frozen_string_literal: true
module Resolvers
module Ci
class RunnerSetupResolver < BaseResolver
ACCESS_DENIED = 'User is not authorized to register a runner for the specified resource!'
type Types::Ci::RunnerSetupType, null: true
description 'Runner setup instructions.'
argument :plat... | 30.594937 | 107 | 0.62681 |
01efa009979bb237645238d06204e6de7267c4d8 | 13,690 | # encoding: utf-8
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
require 'azure_mgmt_subscriptions'
module Azure::Profiles::Latest
module Subscriptions
module Mgmt
SubscriptionDefinitionsOperationMe... | 53.476563 | 296 | 0.707597 |
5ded6563959c7c67ea0dc5292c178bf99407e698 | 359 | module FidorApi
module StandingOrder
autoload :Email, 'fidor_api/standing_order/email'
autoload :Phone, 'fidor_api/standing_order/phone'
autoload :Sepa, 'fidor_api/standing_order/sepa'
autoload :Base, 'fidor_api/standing_order/base'
autoload :Generic, 'fidor... | 35.9 | 63 | 0.679666 |
1ad2ef859079b254dbca6e9fa63a70482d4ea9f0 | 169 | require 'sinatra/base'
require 'json'
class Server < Sinatra::Base
post '/echo' do
payload = JSON.parse(request.body.read)
"Hello event #{payload}"
end
end
| 16.9 | 43 | 0.680473 |
211bb23ff87bf6ddf7be3e285367b1e6e2ae6dfd | 682 | require 'rails_helper'
describe Event do
describe '.new' do
it 'should create a new event with a valid date and type' do
event = Event.new(2.days.ago, 'CaseFile')
expect(event).to be_instance_of(Event)
expect(event).to be_valid
end
it 'should raise an error if the date is in the ... | 27.28 | 64 | 0.646628 |
e9a70bc06fc345afb821bd373db340f4c30f9585 | 2,095 | #
# Copyright (c) 2013, 2014, 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 ... | 29.507042 | 78 | 0.597613 |
6124429ab50b52b19ef4e45a47162cf7c673d3ae | 328 | module MicroServiceServer
class Engine < ::Rails::Engine
isolate_namespace MicroServiceServer
initializer :append_migrations do |app|
unless app.root.to_s.match(root.to_s)
config.paths["db/migrate"].expanded.each do |expanded_path|
app.config.paths["db/migrate"] << expanded_path
end
end
end
... | 23.428571 | 63 | 0.737805 |
21413e9ba01e08a2622dc437c9c4d74b6aab99b6 | 732 | class Wso2am300 < Formula
desc "WSO2 API Manager 3.0.0"
homepage "https://wso2.com/api-management/"
url "https://dl.bintray.com/wso2/binary/wso2am-3.0.0.zip"
sha256 "80dd6eaf9704eb77f2cba3805113aa40120500e3e31cd0592d89473a65ab0ab2"
bottle :unneeded
depends_on :java => "1.8"
def install
product = "w... | 29.28 | 80 | 0.678962 |
e819988efeee5cde0b176f07d33e20a0a48fca54 | 41 | module SimpleElo
VERSION = "0.0.1"
end
| 10.25 | 19 | 0.682927 |
11046b74321c5ab309af7d0b43bd653f2c74276c | 95 | require 'spree_core'
require 'spree_api_auth/controller_setup'
require 'spree_api_auth/engine'
| 23.75 | 41 | 0.852632 |
aca9d42869b7442497ea21d3f707412599ae3364 | 123 | require 'test_helper'
class UsedTokenTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 15.375 | 45 | 0.707317 |
79de26a2de3b061b92cb881949d1e003281e5223 | 167 | shared_examples 'collection::certbot' do
include_examples 'python::toolchain'
include_examples 'misc::letsencrypt'
include_examples 'certbot::layout'
end
| 23.857143 | 40 | 0.766467 |
f72c93b4435dc0514386c6f3ddde4e485ae1275a | 12,904 | # Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render invalid all existing
# confirmat... | 49.440613 | 154 | 0.752635 |
1ab8748773c7edfaecbfa86f7acb7e66c56bef65 | 1,922 | Pod::Spec.new do |s|
s.name = 'CocoaAsyncSocket'
s.version = '7.6.0'
s.license = { :type => 'public domain', :text => <<-LICENSE
Public Domain License
The CocoaAsyncSocket project is in the public domain.
The original TCP version (AsyncSocket) was created by Dustin Voss in January 2003.
Updated and mainta... | 48.05 | 136 | 0.679501 |
18f6ffb2ba6aa3cba132d23e5ba9a8f5d3eb912f | 33 | require 'flipper/adapters/consul' | 33 | 33 | 0.848485 |
6a9895c3dc24630231c9f2ec39d7b3c522737871 | 2,794 | #
# Cookbook Name:: omnibus
# Recipe:: _omnibus_toolchain
#
# Copyright 2015, Chef Software, 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 of the License at
#
# http://www.apache.org/licenses/LICENSE... | 34.493827 | 140 | 0.714746 |
5db5b1da971fd3c3f83a1fa2a94a592180c79889 | 1,118 | class ApplicationController < ActionController::Base
before_action :set_paper_trail_whodunnit
include ControllerHelper
include ActionView::Helpers::OutputSafetyHelper
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :null_se... | 31.055556 | 115 | 0.702147 |
e954ebb36f510b8ff0963fc22b92b20190cacf6c | 935 | # encoding: utf-8
# frozen_string_literal: true
module YandexSpeechApi
module MP3_Player
class Linux_MP3_Player < MP3_Player::Base # no-doc
private
# @return [String]
# Path to +mpg123+ application
attr_reader :path_to_executable
##
# Check requirements.
#
# @exception Application... | 22.261905 | 73 | 0.677005 |
62a40d5f4f712f73d7c95aed493c03857afa10e9 | 976 | # Copyright 2019 Google LLC
#
# 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 applicable law or agreed to in writing, ... | 28.705882 | 74 | 0.721311 |
285145f8fa399fae7d495b164c5ec068e71e010d | 358 | leslie = User.create(name: "Leslie", email: "leslie@leslie.org", password: "password1")
dave = User.create(name: "Dave", email: "dave@dave.edu", password: "password2")
leslie1 = leslie.stock_boxes.create(name: "Leslie1")
dave1 = dave.stock_boxes.create(name: "Dave1")
torso = leslie1.stocks.create(name: "torso")
snake... | 39.777778 | 87 | 0.72067 |
1d80c93cf830fb2f7fd7c366038ca8384b30de2e | 17,788 |
require_relative 'ui_skeleton_editor'
class SkeletonEditorDialog < Qt::Dialog
GREY_PEN = Qt::Pen.new(Qt::Brush.new(Qt::Color.new(128, 128, 128)), 2)
RED_PEN = Qt::Pen.new(Qt::Brush.new(Qt::Color.new(224, 16, 16)), 2)
GREEN_PEN = Qt::Pen.new(Qt::Brush.new(Qt::Color.new(16, 224, 16)), 2)
BLUE_PEN = Qt::Pen.new(... | 35.363817 | 149 | 0.703733 |
e23eb1b0e682cb57336c5a23209d324545035d23 | 1,177 | class Api::ConfirmationsController < ApplicationController
def create
@confirmation = Confirmation.new(confirmation_params)
@confirmation.user_id = current_user.id
@home = Home.find(confirmation_params[:home_id])
start_date = confirmation_params[:start_date].to_date
end_date = confirmation_params... | 23.54 | 68 | 0.686491 |
33a944b3e1e2d86f13dad622fb669e3742c13a63 | 781 | # frozen_string_literal: true
# Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 26.931034 | 74 | 0.731114 |
87660bba07e766b576e3433e71641c11168f5254 | 422 | class Filezilla < Cask
version '3.9.0.5'
sha256 '805e7a83faa13235d15eeab572eab06d6033901a196ba3ebcf753793f81219cd'
url "https://downloads.sourceforge.net/project/filezilla/FileZilla_Client/#{version}/FileZilla_#{version}_macosx-x86.app.tar.bz2"
homepage 'https://filezilla-project.org/'
app 'FileZilla.app'
... | 35.166667 | 131 | 0.767773 |
bf1036fc71bea7dbde642f11036eda1887b396f5 | 726 | class TicketCategoriesController < ApplicationController
before_action :set_ticket_category, only: :show
authorize_resource
# GET /ticket_categories
# GET /ticket_categories.json
def index
@ticket_categories = TicketCategory.all
end
# GET /ticket_categories/1
# GET /ticket_categories/1.json
def ... | 26.888889 | 88 | 0.750689 |
ab7d1b378a70e169b602d1714577b88134213ddf | 1,893 | module BootstrapPager
module PageScopeMethods
# Specify the <tt>per_page</tt> value for the preceding <tt>page</tt> scope
# Model.page(3).per(10)
def per(num)
if (n = num.to_i) <= 0
self
elsif max_per_page && max_per_page < n
limit(max_per_page).offset(offset_value / limit_va... | 26.661972 | 79 | 0.66561 |
185ddefcaab47269d82fda5c98fdfaf58894e1f4 | 1,313 | # By default Volt generates this controller for your Main component
module Main
class MainController < Volt::ModelController
def index
# Add code for when the index view is loaded
end
def about
# Add code for when the about view is loaded
end
private
def say_to_all
puts 's... | 29.177778 | 136 | 0.676314 |
1dc50f159f04edff2d2795b464e98e3c6886ac18 | 221 | module Devise
module Models
module AclManager
extend ActiveSupport::Concern
included do
include ::AclManager::Permissions
include ::AclManager::Relationships
end
end
end
end
| 17 | 43 | 0.660633 |
5d26d1e4f9cee2b4b53f59d14411e1cf1a73c579 | 7,782 | # 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 rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel... | 20.752 | 103 | 0.516705 |
f7292328d7186e2059aedc10b643905c010a99d0 | 401 | FactoryBot.define do
sequence :user_mail do |n|
"test#{n}@test.com.br"
end
factory :user do
email { generate(:user_mail) }
name { 'Teste da Silva' }
password { 'TesteSenha' }
password_confirmation { 'TesteSenha' }
creator { false }
admin { false }
factory :creator do
creato... | 17.434783 | 42 | 0.59601 |
e9f685fcb9f2f1b17c33de0b82756ca173e00169 | 2,268 | # encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative sou... | 32.4 | 86 | 0.685185 |
184e0c7d7d5e38135f5837165c83575d31de3348 | 346 | cask 'slicy' do
version :latest
sha256 :no_check
url 'https://macrabbit.com/slicy/get/'
appcast 'https://update.macrabbit.com/slicy/1.1.3.xml',
:checkpoint => '39d01f62bb6ab96fdee061a8077fd8cbffcafee6551d7be4bc0fe4dc20249e3d'
name 'Slicy'
homepage 'http://macrabbit.com/slicy/'
license :commerci... | 24.714286 | 91 | 0.722543 |
6aa414ba6b1eddfbcde8f1081e23150fc9d9052c | 10,994 | # frozen_string_literal: true
require "active_support/core_ext/module/attribute_accessors"
require "active_record/attribute_mutation_tracker"
module ActiveRecord
module AttributeMethods
module Dirty # :nodoc:
extend ActiveSupport::Concern
include ActiveModel::Dirty
included do
if self... | 32.916168 | 103 | 0.665272 |
4a3b059b1d9ebf7e644241532c5e634e689704ae | 1,348 | class Bartycrouch < Formula
desc "Incrementally update/translate your Strings files"
homepage "https://github.com/Flinesoft/BartyCrouch"
url "https://github.com/Flinesoft/BartyCrouch.git",
tag: "4.4.1",
revision: "d0ea3568044e2348e5fa87b9fdbc9254561039e2"
license "MIT"
head "https://github.co... | 29.955556 | 95 | 0.690653 |
91660e3688e838d32c0d35884f5baade39fbe06e | 561 | require 'spec_helper'
describe Talkable::API::Reward do
describe ".find" do
let(:visitor_uuid) { "8fdf75ac-92b4-479d-9974-2f9c64eb2e09" }
before do
stub_request(:get, %r{.*api/v2/rewards.*visitor_uuid=8fdf75ac-92b4-479d-9974-2f9c64eb2e09}).
to_return(body: '{"ok": true, "result": {"rewards": [... | 29.526316 | 98 | 0.652406 |
bfd74a02da2f151e8094bc6fd6f497a9bce1dc59 | 192 | Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
get '/base_categories' => 'base_categories#index'
end
| 32 | 101 | 0.770833 |
6126529bedabd5db5ece59fd64b74d7f560d9b2f | 550 | module ActiveAdmin
module Inputs
module Filters
class TextInput < ::Formtastic::Inputs::TextInput
include Base
include Base::SearchMethodSelect
def input_html_options
{
:cols => builder.default_text_area_width,
:rows => builder.default_text_area_hei... | 20.37037 | 57 | 0.578182 |
f8aea137c92c15e38365ee737af7e93327acde16 | 1,215 | # Copyright 2014, Greg Althaus
#
# 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 applicable law or agreed to in writing, s... | 25.3125 | 74 | 0.714403 |
abe5724a2c8c0a0ebc049ce3fa3f27c1e5fc90fe | 2,103 | # Copyright 2018 Twitter, Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# encoding: UTF-8
module Twitter
module TwitterText
class Configuration
require 'json'
PARSER_VERSION_CLASSIC = "v1"
PARSER_VERSION_WEIGHTED = "v2"
PARSER_VERSION... | 30.478261 | 152 | 0.65573 |
21ba31267aa94781ec46e7e2fce15e29708a9e69 | 429 | # frozen_string_literal: true
require_relative "../lib/tty-sparkline"
sparkline = TTY::Sparkline.new(left: 10, top: 10, height: 2, width: 40)
sparkline2 = TTY::Sparkline.new(left: 10, top: 14, height: 10, width: 40)
print sparkline.cursor.clear_screen
sparkline.cursor.invisible do
loop do
sparkline << rand(50)... | 23.833333 | 73 | 0.713287 |
ac7fe2876fda90d0c258f0964d22e79ee6e0018b | 901 | # frozen_string_literal: true
module AcaEntities
module Serializers
module Xml
module Fdsh
module Vlp
module H92
# Happymapper implementation for the root object of an ArrayOfSponsorshipData.
class ArrayOfSponsorshipData
include HappyMapper
... | 27.30303 | 90 | 0.581576 |
b95a3f80c070c9037aa21cb5c1fd93a4a21770ad | 35 | module WopiFilesContentsHelper
end
| 11.666667 | 30 | 0.914286 |
113e40eaf91f1403a207ff9414469b9bd4d48f99 | 187 | # coding: utf-8
class DummyWithDefaultCurrency
include Mongoid::Document
include Mongoid::MoneyField
field :description
money_field :price, default_currency: 'EUR'
end | 18.7 | 46 | 0.743316 |
e8296b60ca7e44009fec4cf727ddf3d39e2f8d49 | 1,010 | User.create!(name: "Example User",
email: "example@railstutorial.org",
password: "foobar",
password_confirmation: "foobar",
admin: true,
activated: true,
activated_at: Time.zone.now)
99.times do |n|
name = Faker... | 28.857143 | 65 | 0.586139 |
6aab665a4af9cac08c12c008ca219a178da76b72 | 886 | require 'spec_helper_acceptance'
describe 'rabbitmq user:' do
context "create user resource" do
it 'should run successfully' do
pp = <<-EOS
if $::osfamily == 'RedHat' {
class { 'erlang': epel_enable => true }
Class['erlang'] -> Class['::rabbitmq']
}
class { '::rabbitmq':... | 22.717949 | 55 | 0.544018 |
7a0e3f00a7089317ac7d2a8ad152d04908520c06 | 110 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'lastpass/cli'
require 'minitest/autorun'
| 22 | 58 | 0.745455 |
0804cd8e2efa358e58c18ca25ce02b6ed5a6b2a7 | 854 | def triangular_word?(word)
encoded_num = encode(word)
i = 0
while i < encoded_num
# p "encoded_num: #{encoded_num}"
# p "(i * (i + 1)) / 2: #{(i * (i + 1)) / 2}"
return true if encoded_num == (i * (i + 1)) / 2
i += 1
end
false
end
def encode(word)
alpha = ("a".."z").to_a
word.split("").i... | 25.117647 | 72 | 0.583138 |
33299bd72993010909f3cbe6fdadc71bfc8ce8eb | 901 | require 'dotenv'
require 'ringcentral'
RSpec.describe 'query params' do
describe 'single' do
it 'contain single query param' do
Dotenv.load
rc = RingCentral.new(ENV['RINGCENTRAL_CLIENT_ID'], ENV['RINGCENTRAL_CLIENT_SECRET'], ENV['RINGCENTRAL_SERVER_URL'])
rc.authorize(username: ENV['RINGCENTRAL... | 39.173913 | 137 | 0.678135 |
4a231c960801446147ebe6c1fecd3610576c9b86 | 125 | class AddImageToProperties < ActiveRecord::Migration[5.2]
def change
add_column :properties, :image, :string
end
end
| 20.833333 | 57 | 0.752 |
b90249d2e8be37dcbfc897a42e45d119b4ac2ac3 | 2,137 | # 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 rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Ch... | 79.148148 | 263 | 0.725316 |
e88e473acf4905b40cef70d2c5edffd6ee0e990d | 1,466 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'referencia/version'
Gem::Specification.new do |spec|
spec.name = "referencia"
spec.version = Referencia::VERSION
spec.authors = ["Orlandy Ariel"]
spec.email =... | 41.885714 | 156 | 0.687585 |
6a75f64e7bde7e1b10b232219b8f40a2dcaa94bf | 1,409 | require 'spec_helper'
describe Sorry::Api::Request do
# Placeholder access token.
let(:access_token) { Faker::Internet.password(128) }
# Mock the request object.
let(:request) { Sorry::Api::Request.new(Sorry::Api::Client.new(access_token: access_token)) }
describe 'error handling' do
it 'should reraise any ... | 27.627451 | 94 | 0.720369 |
b931de9c7d4549f243a94eb592a058cec897b2f8 | 1,080 | class PagesController < ApplicationController
skip_before_action :authenticate_user!, only: :home
def home
@CATEGORIES = [
{ name: "Coronavirus", filename: "coronavirus.jpg" },
{ name: "Hunger and Poverty", filename: "hunger-poverty.jpg" },
{ name: "Health", filename: "health.jpg" },
... | 40 | 159 | 0.673148 |
e96150bdb2d6bab021e15bea0b057f51ea8c8628 | 4,586 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Spree::Order, type: :model do
let(:order) { create(:order_with_line_items) }
context "#next!" do
context "when current state is confirm" do
before do
order.state = "confirm"
order.save!
end
context "when pa... | 28.484472 | 97 | 0.62102 |
ed7c22aa019c76c589eba4e12c893302d041d94e | 72 | require 'cocoapods_mangle/gem_version'
require 'cocoapods_mangle/hooks'
| 24 | 38 | 0.861111 |
21ce50566880224da5484e0b3b053489d8f0be6a | 2,685 | # coding: utf-8
# Copyright © 2011-2020 MUSC Foundation for Research Development
# All rights reserved.
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright n... | 47.105263 | 145 | 0.732588 |
87377280bac034480c43334e834f6a2df56c4148 | 675 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Role, type: :model do
describe 'Associations' do
it 'has_and_belongs_to_many news' do
association = described_class.reflect_on_association(:users)
expect(association.macro).to eq :has_and_belongs_to_many
end
end
describe 'V... | 24.107143 | 78 | 0.712593 |
38ef637410a461b5bdcb45aa1349dbedefeaf122 | 1,007 | class Findomain < Formula
desc "Cross-platform subdomain enumerator"
homepage "https://github.com/Findomain/findomain"
url "https://github.com/Findomain/findomain/archive/4.0.1.tar.gz"
sha256 "4ef2f88beb87d7af7f53470df77f556e6d00a0c8745da4066902e98c47e8451d"
license "GPL-3.0-or-later"
bottle do
sha256 ... | 40.28 | 122 | 0.787488 |
4a2e88cdc4c862277bd68eb5c8a1b7187ce0d888 | 1,969 | require 'test_helper'
class UsersLoginTest < ActionDispatch::IntegrationTest
def setup
@user = users(:michael)
end
test "login with invalid information" do
get login_path
assert_template 'sessions/new'
post login_path, params: { session: { email: "", password: "" } }
assert_template 'session... | 30.292308 | 69 | 0.672423 |
6aacdee4e7271dd661cd3060c5c24bf43119b0d9 | 867 | require 'rails_helper'
RSpec.describe Stocks::RetrieveDailyTimeSeriesEventsInteractor do
let(:stock_symbol) { 'IBM' }
let(:stock) { FactoryBot.build(:stock) }
subject(:context) { Stocks::RetrieveDailyTimeSeriesEventsInteractor.call(symbol: stock_symbol) }
context 'when given valid parameters' do
let(:re... | 32.111111 | 103 | 0.71857 |
e9576b4aa3a076a3ee5e47a361a5ab1f76b755cc | 971 | class Mighttpd2 < Formula
desc "HTTP server"
homepage "https://www.mew.org/~kazu/proj/mighttpd/en/"
url "https://hackage.haskell.org/package/mighttpd2-3.4.6/mighttpd2-3.4.6.tar.gz"
sha256 "fe14264ea0e45281591c86030cad2b349480f16540ad1d9e3a29657ddf62e471"
license "BSD-3-Clause"
revision 1
livecheck do
... | 27.742857 | 93 | 0.745623 |
b9eabbed3cc5100db12d66671d5b6284ced33283 | 4,018 | #-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2020 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork ... | 29.985075 | 91 | 0.687904 |
2681bbf699d24ab52597dec57c2e8982fff2c482 | 53 | class AmexTokenizationClient
VERSION = "0.3.0"
end
| 13.25 | 28 | 0.754717 |
7925d75f1d9140eed11c9f37ad50488d7a13778e | 535 | describe AvailabilityZoneController do
describe "#show" do
before do
EvmSpecHelper.create_guid_miq_server_zone
@zone = FactoryGirl.create(:availability_zone)
login_as FactoryGirl.create(:user_admin)
end
subject do
get :show, :params => {:id => @zone.id}
end
context "rende... | 23.26087 | 88 | 0.678505 |
913675eed23f1ce579dd9eb2363bbcf4e2f6350f | 2,375 | module AddImageInsidePdf
class TextReplaceProcessor < HexaPDF::Content::Processor
def initialize(page, to_hide_arr)
super()
@canvas = page.canvas(type: :overlay)
@to_hide_arr = to_hide_arr
@boxeslist = []
end
def show_text(str)
boxes = decode_text_with_positioning(str)
... | 25.815217 | 81 | 0.574737 |
1a35fcdad36befd82198cb8d56cab4504720f68c | 615 | def hourglass(matrix)
max_hourglass_sum = - 1.0/0
max_iteration_count = matrix.length - 2 # assuming this only works because matrix is even
row_base = 0
while row_base < max_iteration_count
max_iteration_count.times do |i|
row_one_sum = matrix[row_base][i..i + 2].sum
row_two_sum = matrix[row_ba... | 29.285714 | 91 | 0.691057 |
03eadd57982eb1e583a924f62c15b7ea24532255 | 612 | module Telegram
module Bot
module Types
class InlineQueryResultPhoto < Base
attribute :type, String, default: 'photo'
attribute :id, String
attribute :photo_url, String
attribute :thumb_url, String
attribute :photo_width, Integer
attribute :photo_height, Integ... | 29.142857 | 61 | 0.671569 |
4a41c66711c6ebf73532366672d943266f0c00ef | 9,555 | # frozen_string_literal: true
require "test_helper"
class EmailTypoTest < Minitest::Test # rubocop:disable Metrics/ClassLength
test "shows deprecation message" do
_, stderr = capture_io do
EmailTypo.fix("john@gmail.com")
end
assert_equal "EmailTypo.fix is deprecated; use EmailTypo.call instead.",... | 23.768657 | 79 | 0.624385 |
5d94998d9e7993c7eb059068bc627af1f5425d35 | 21,462 | # coding: utf-8
Rails.application.routes.draw do
namespace :mercury do
resources :images
end
mount Mercury::Engine => '/'
# The priority is based upon order of creation:
# first created -> highest priority.
get "/robots.txt" => RobotsGenerator
# URLs for sitemaps
#
# From Rails guide: By defa... | 41.754864 | 193 | 0.649706 |
f7d8ba90e19331d6e4c67fba0c22ad905ca2b015 | 2,486 | require "rails_helper"
describe :users, type: :request do
let(:user) { FactoryBot.create(:user) }
before do
login!(user: user)
end
describe "#index" do
it "shows index" do
get users_path
expect(response).to render_template("users/index")
expect(page).to have_text(user.name)
end
... | 28.574713 | 85 | 0.632341 |
ff5334877453b3658cb284d0824d11136b2d2f06 | 704 | $:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "pdf_renderer/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "pdf_renderer"
s.version = PdfRenderer::VERSION
s.authors = [""]
s.email = [""]
s.homepage ... | 28.16 | 85 | 0.634943 |
f774f3f21c93ecabb166f28ce49127523451cba8 | 245 | class CreateSettings < ActiveRecord::Migration[5.1]
def change
create_table :settings do |t|
t.string :name
t.string :slug
t.text :description
t.json :data
t.string :type
t.timestamps
end
end
end
| 17.5 | 51 | 0.620408 |
e96e0077f5ea097f7876b0048353d4640a3493ce | 1,345 | require 'test_helper'
class NewItemUsesControllerTest < ActionDispatch::IntegrationTest
setup do
@new_item_use = new_item_uses(:one)
end
test "should get index" do
get new_item_uses_url
assert_response :success
end
test "should get new" do
get new_new_item_use_url
assert_response :succe... | 27.44898 | 173 | 0.754647 |
edf3faccd3b17d531df9ba6bcd52dd4b24c3dd69 | 123 | require "test_helper"
class CharacterTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 15.375 | 45 | 0.707317 |
ffba2da05e5faabb33ff2972a18128e01d4ff5d8 | 248 | puts "Simple calculator - Division"
25.times { print "-" }
puts
puts "Enter the first number"
num_1 = gets.chomp
puts "Enter the second number"
num_2 = gets.chomp
puts "The first number divided by the second number is #{num_1.to_f / num_2.to_f}"
| 22.545455 | 82 | 0.729839 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.