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 |
|---|---|---|---|---|---|
1a173484a00fdde88bb261aebf1f9449b6b86e52 | 1,748 | # encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Resources::Mgmt::V2018_02_01
module Models
#
# Tag information.
#
class TagValue
include MsRestAzure
# @return... | 24.619718 | 70 | 0.474256 |
1aed53715ca0d40ee56f741573414220147328b2 | 1,954 | # frozen_string_literal: true
require "rom/elasticsearch/relation"
RSpec.describe ROM::Elasticsearch::Relation, "#create_index" do
subject(:relation) { relations[:users] }
include_context "setup"
context "when custom :index is configured" do
after do
relation.delete_index
end
context "with ... | 24.734177 | 81 | 0.576766 |
918b945ba701a527bb0575a4c31e1e82d03a015e | 167 | class Cat < ApplicationRecord
validates :name, presence: true
validates :age, presence: true
validates :sex, presence: true
validates :bio, presence: true
end
| 23.857143 | 33 | 0.748503 |
bf5c2db9aa3b8598d1e8761c43ea8222696c9603 | 1,798 | class Basket < ApplicationRecord
belongs_to :user, optional: true
has_many :line_items, dependent: :destroy
has_many :products, through: :line_items
paginates_per 10
def self.custom_sort(args)
category = args.fetch(:sortCategory, "sort_date")
desc = args.fetch(:desc, "true")
direction = desc == "... | 31.54386 | 117 | 0.700779 |
4a1d0809696931258e49687a70a8866f51306ed9 | 527 | require 'spec_helper'
require 'active_support/testing/time_helpers'
describe DogStatsd do
def send_metric(payload={})
ActiveSupport::Notifications.instrument('process_action.action_controller.duration', payload)
end
context 'with no configuration' do
subject { described_class }
context 'with base p... | 25.095238 | 97 | 0.73055 |
ab56a973c83b344238fc55a2aaf14aeb0a12bb1a | 2,568 | # frozen_string_literal: true
require 'spec_helper'
module Spree
describe Api::ZonesController, type: :request do
let!(:attributes) { [:id, :name, :zone_members] }
let!(:zone) { create(:zone, name: 'Europe') }
before do
stub_authentication!
end
it "gets list of zones" do
get spree... | 28.21978 | 78 | 0.591121 |
21cce5a8bb214ef44305c5346a98469aeb01cc96 | 351 | module SmartAnswer
module Question
class Salary < Base
def parse_input(raw_input)
SmartAnswer::Salary.new(raw_input)
end
def to_response(input)
salary = parse_input(input)
{
amount: salary.amount,
period: salary.period
}
rescue
n... | 17.55 | 42 | 0.566952 |
392ed9a707f7ab9d9e2023ef58ad2fc71bf44fc7 | 1,426 | require 'rack'
module CartoDB
module Importer2
module UrlTranslator
class OSM
URL_REGEX = %r{openstreetmap.org.*lat.*}
TRANSLATED_URL_REGEX = /api.openstreetmap.org/
URL_TEMPLATE = 'http://api.openstreetmap.org/api/0.6/map?bbox='
DEFW = 1200.0/2.0
D... | 26.407407 | 72 | 0.493689 |
113d4015da97c3aa2a73aa48c10de6357d2e5553 | 900 | # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "omniauth-odnoklassniki/version"
Gem::Specification.new do |s|
s.name = "omniauth-odnoklassniki"
s.version = Omniauth::Odnoklassniki::VERSION
s.authors = ["Alexander Logvinov"]
s.email = ["avl@logvinov.com"]
s... | 37.5 | 83 | 0.656667 |
7ae763416e626e405baa0e8d716b2c782385db58 | 1,652 | # frozen_string_literal: true
namespace :patients do
get "mdms/:scope", to: "mdms#show", as: :mdms
resources :primary_care_physicians
resources :practices, only: [] do
collection do
get :search
end
resources :primary_care_physicians,
only: :index,
controller: "practi... | 32.392157 | 84 | 0.702179 |
f890c08c0f621c1224206fdce59242da2ed151f2 | 7,831 | #!/usr/bin/env ruby
class Builder
def initialize
@env = Environment.new()
@worker = CompositeWorker.new([Logger.new(), Executer.new()])
end
def makeRelease
createWorkingDirectories
downloadSource
copySource
buildModules
signFrameworks "er... | 37.113744 | 208 | 0.592389 |
d5ee2b10d104a41a0c4106b80742539a7875b6e2 | 13,690 | # 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... | 48.892857 | 108 | 0.65851 |
abada4ce54eb08d5e365a6714ea98098776bfa52 | 1,935 | #
# Be sure to run `pod lib lint PublicModule.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'YQSPub... | 32.79661 | 110 | 0.637209 |
4af65c5cb3c2dede29381280defcae67ab259d6c | 683 | class Atdtool < Formula
desc "Command-line interface for After the Deadline language checker"
homepage "https://github.com/lpenz/atdtool"
url "https://github.com/lpenz/atdtool/archive/upstream/1.3.tar.gz"
sha256 "eb634fd9e8a57d5d5e4d8d2ca0dd9692610aa952e28fdf24909fd678a8f39155"
depends_on "txt2tags" => :buil... | 32.52381 | 75 | 0.720351 |
ff83ca30fdd7531aa5782b3d5fb667a95a5c8680 | 2,406 | # frozen_string_literal: true
begin
require 'irb/color'
module IRB
module Color
DIM = 2 unless defined? DIM
end
end
require "irb/color_printer"
rescue LoadError
warn "DEBUGGER: can not load newer irb for coloring. Write 'gem \"debug\" in your Gemfile."
end
module DEBUGGER__
module Color
... | 21.105263 | 93 | 0.595179 |
f7057b1058357e3e989ab6e8480610318da37c88 | 415 | require 'ffi'
module FFI
module Mapscript
extend FFI::Library
class SymbolSetObj < FFI::Struct
layout :file_name, :string,
:image_cache_size, :int,
:num_symbols, :int,
:max_symbols, :int,
:ref_count, :int,
:symbol, :pointer, # array of SymbolObj
:map, MapObj... | 20.75 | 49 | 0.612048 |
03d6815293d9b69ba2894c80697574bc71636b78 | 110 | class Stack < ApplicationRecord
has_many :project_stacks
has_many :projects, through: :project_stacks
end
| 22 | 46 | 0.809091 |
79a9ec31d7d7c3b5f06ed3433a7a742ea716df90 | 2,292 | require 'java'
require 'observer'
java.lang.System.setProperty('org.jpedal.jai', 'true')
require_relative './jars/jpedal_lgpl.jar'
java_import javax.imageio.ImageIO
java_import java.awt.image.BufferedImage
java_import java.awt.Image
java_import org.jpedal.PdfDecoder
java_import org.jpedal.fonts.FontMappings
class A... | 28.296296 | 111 | 0.681501 |
26888d2c6fd39c9acdfb1916d1a6ebacb134c637 | 1,127 | class Nodebrew < Formula
desc "Node.js version manager"
homepage "https://github.com/hokaccha/nodebrew"
url "https://github.com/hokaccha/nodebrew/archive/v1.1.0.tar.gz"
sha256 "b2046d97392ed971254bee2026cfcf8fb59225f51b566ec4b77e9355a861c8a7"
license "MIT"
head "https://github.com/hokaccha/nodebrew.git"
... | 30.459459 | 138 | 0.734694 |
f797339ea6ab21e68020827dfc37199869d0c79d | 1,181 | module Autopilot
class Resource
class << self
attr_accessor :record_key, :plural_key
attr_writer :singleton_resource
def singleton_resource?
!!@singleton_resource
end
end
undef :id if method_defined?(:id)
attr_reader :attributes
private :attributes
def initia... | 20.719298 | 59 | 0.634208 |
e2201c516bac82a11f40b492df0206f80a3fac45 | 2,820 | require File.expand_path('../boot', __FILE__)
require 'rails/all'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.requi... | 44.761905 | 100 | 0.735106 |
28cfad6020e84272fd6edb536ab53bdd40082a98 | 3,122 | require "formula"
class NoExpatFramework < Requirement
def expat_framework
"/Library/Frameworks/expat.framework"
end
satisfy :build_env => false do
not File.exist? expat_framework
end
def message; <<-EOS.undent
Detected #{expat_framework}
This will be picked up by CMake's build system and ... | 28.642202 | 90 | 0.688341 |
abe1435dd73048cab372ca4038733c2932f25962 | 1,711 | require 'spec_helper'
require_relative '../../lib/middleman-webp/pathname_matcher'
describe Middleman::WebP::PathnameMatcher do
describe '#matches?' do
it 'returns true when given file matches pattern' do
patterns = ['**/*.jpg', /jpg$/, ->(path) { path.end_with?('jpg') }]
files = [
'images/sa... | 29.5 | 76 | 0.581531 |
26dd3a5006023ce5b20548eb4ed0f67bb75c4bf2 | 1,454 | class Codequery < Formula
desc "Code-understanding, code-browsing or code-search tool."
homepage "https://github.com/ruben2020/codequery"
url "https://github.com/ruben2020/codequery/archive/v0.21.0.tar.gz"
sha256 "32c4fd9e7d1c05246b0b3866bb1ccb6eab5cf246b589ffcb9f1b32b07b5e6ff7"
bottle do
cellar :any
... | 33.813953 | 93 | 0.671939 |
1dbf78e4058da485ceb78bb4309a5d0f057f405b | 301 | class AddCommentsCountToPages < ActiveRecord::Migration
def self.up
add_column :pages, :comments_count, :integer
add_column :pages, :show_comments, :boolean, :default => false
end
def self.down
remove_column :pages, :show_comments
remove_column :pages, :comments_count
end
end | 27.363636 | 66 | 0.744186 |
613b9b2b35f9cab92355e5db089af822f3b2d20d | 84 | class Workout < ActiveRecord::Base
belongs_to :user
has_many :exercises
end
| 16.8 | 34 | 0.738095 |
628cbc8592b2171a6ff39247223260abf272b4dd | 877 | cask 'firefox-beta' do
version '48.0b5'
sha256 '395f0b09c9f619937fb969c3c50b88fef226869a1a9ba395ff31cb70f6046004'
url "https://download.mozilla.org/?product=firefox-#{version}-SSL&os=osx&lang=en-US"
name 'Mozilla Firefox'
homepage 'https://www.mozilla.org/en-US/firefox/channel/#beta'
license :mpl
app 'F... | 38.130435 | 143 | 0.714937 |
b9066d1b2e18fa5eb523ace518e4440f5c0f1f34 | 779 |
class PocketsphinxServer::Handler
attr_reader :recognizer, :config
def initialize(server, config={})
@config = config
@server = server
@recognizer = PocketsphinxServer::Recognizer.new(server, config.fetch('recognizer', {}))
end
# Can this handler handle this request?
def can_handle?(req)
... | 16.934783 | 92 | 0.677792 |
1aaeeaf038b23e6c1fedc8bc93d1bd9238e1603e | 33,187 | #! /usr/bin/env ruby -S rspec
require 'spec_helper'
require 'puppet/resource'
describe Puppet::Resource do
include PuppetSpec::Files
let :basepath do make_absolute("/somepath") end
[:catalog, :file, :line].each do |attr|
it "should have an #{attr} attribute" do
resource = Puppet::Resource.new("file",... | 37.205157 | 167 | 0.643927 |
ed1563bd20132ff5659ff186b58bb3262e32b09f | 1,967 | # encoding: UTF-8
#
# Author: Stefano Harding <riddopic@gmail.com>
# License: Apache License, Version 2.0
# Copyright: (C) 2014-2015 Stefano Harding
#
# 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 ... | 28.1 | 76 | 0.680224 |
1c0e5842ac04772cf7e364e7db59f8da188e6b13 | 157 | class AddDiscountToErpOrdersOrderDetails < ActiveRecord::Migration[5.1]
def change
add_column :erp_orders_order_details, :discount, :decimal
end
end
| 26.166667 | 71 | 0.802548 |
e9cfa291ad3c4c8367a3fac6cb435aaf75cb5783 | 2,212 | require "logstash/filters/base"
require "logstash/namespace"
require "logstash/timestamp"
require "stud/interval"
require "socket" # for Socket.gethostname
class LogStash::Codecs::RFC822 < LogStash::Codecs::Base
config_name "rfc822"
config :lowercase_headers, :validate => :boolean, :default => true
config :s... | 30.30137 | 86 | 0.673599 |
bb2d162d8dfdcb9a0d67c6e49c11bd6bff65b171 | 227 | class NomenclaturalRank::Iczn::SpeciesGroup::Species < NomenclaturalRank::Iczn::SpeciesGroup
def self.parent_rank
NomenclaturalRank::Iczn::SpeciesGroup::Subsuperspecies
end
def self.abbreviation
'sp.'
end
end
| 20.636364 | 92 | 0.76652 |
79815dd3939063e35d72aa5ae637c12243d9816b | 2,255 | require 'spec_helper'
describe "directory environments" do
let(:args) { ['--configprint', 'modulepath', '--environment', 'direnv'] }
let(:puppet) { Puppet::Application[:apply] }
context "with a single directory environmentpath" do
before(:each) do
environmentdir = PuppetSpec::Files.tmpdir('envpath')
... | 33.161765 | 90 | 0.673171 |
01034e866cd84cf6f0a83ea28c50485362bd894c | 346 | # frozen_string_literal: true
require 'capybara/rails'
require 'capybara-box'
Capybara.disable_animation = true
ci = Helper.true?(ENV['CI'])
CapybaraBox::Base.configure(
browser: ENV.fetch('BROWSER', :selenium_chrome_headless).to_sym,
log: !ci,
screenshot: { enabled: ci, s3: ci },
version: ENV[... | 21.625 | 69 | 0.702312 |
0329f0b43db35edd0b87d2d1e7106e42870fe041 | 6,971 | ##
# This code was generated by
# \ / _ _ _| _ _
# | (_)\/(_)(_|\/| |(/_ v1.0.0
# / /
require 'spec_helper.rb'
describe 'PhoneNumber' do
it "can create" do
@holodeck.mock(Twilio::Response.new(500, ''))
expect {
@client.messaging.v1.services('MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') \... | 35.030151 | 150 | 0.618276 |
bb3c3384b1d973299894bbbe4734dc4a302f057e | 881 | describe CampusSolutions::StudentTermGpa do
let(:user_id) { '61889' }
shared_examples 'a proxy that gets data' do
subject { proxy.get }
it_should_behave_like 'a simple proxy that returns errors'
it_behaves_like 'a proxy that properly observes the student success feature flag'
it_behaves_like 'a pr... | 32.62963 | 85 | 0.725312 |
1116ea8c7c4955eba7695993552010ebda08aeb6 | 210 | cask :v1 => 'sqwiggle' do
version :latest
sha256 :no_check
url 'https://www.sqwiggle.com/download/mac'
name 'Sqwiggle'
homepage 'https://www.sqwiggle.com'
license :gratis
app 'Sqwiggle.app'
end
| 17.5 | 45 | 0.690476 |
5d460ca14fc748a491e08f62c46f9ed87d1ffa62 | 188 | # Load the Rails application.
require File.expand_path('../application', __FILE__)
# Initialize the Rails application.
Rails.application.initialize!
Mime::Type.register "text/txt", :txt
| 23.5 | 52 | 0.771277 |
f7f3c351e0ab69e8c6335a48b2df3a0432309608 | 2,721 | class Telegraf < Formula
desc "Server-level metric gathering agent for InfluxDB"
homepage "https://www.influxdata.com/"
url "https://github.com/influxdata/telegraf/archive/v1.17.3.tar.gz"
sha256 "fea0a44a0dbbe9a506e695b41ffbbc065cf78acfa5b10d9da0678ce43340b238"
license "MIT"
head "https://github.com/influxd... | 35.802632 | 122 | 0.649761 |
ac5a2850f80edacc0c42cf3c073963dd8d4d4e33 | 640 | # frozen_string_literal: true
require "spec_helper"
require "lib/subscribe_user"
require "spec/mocks/user_mock"
require "spec/mocks/subscription_mock"
RSpec.describe SubscribeUser, active_mocker: true do
let(:user) { User.create }
subject { described_class.new(user: user) }
describe "with_yearly" do
it do
... | 22.068966 | 75 | 0.665625 |
bf65bf04f2554bd1432855095ed90bb03faa12bc | 2,083 | Pod::Spec.new do |s|
s.name = 'CorePlot'
s.version = '99.99.99'
s.license = 'BSD'
s.summary = 'Cocoa plotting framework for Mac OS X, iOS, and tvOS.'
s.homepage = 'https://github.com/core-plot'
s.social_media_url = 'https://twitter.com/CorePlot'
s.documentation_url = 'http://core-plot.github.io'
... | 45.282609 | 116 | 0.640422 |
0873a14d3cc8ba4012ad8139dd8e69f14384e7fc | 17,884 | require 'spec_helper'
require 'cloud_controller/diego/process_guid'
module VCAP::CloudController
RSpec.describe Runners do
subject(:runners) { Runners.new(config, message_bus, dea_pool) }
let(:config) do
{
staging: {
timeout_in_seconds: 90
}
}
end
let(:message_b... | 34.326296 | 145 | 0.615522 |
6aca2b75fcd03b17563d8f348900470ea8aa01cf | 8,304 | module ActiveScaffold::Bridges
class DatePicker
module Helper
DATE_FORMAT_CONVERSION = {
/%a/ => 'D',
/%A/ => 'DD',
/%b/ => 'M',
/%B/ => 'MM',
/%d/ => 'dd',
/%e|%-d/ => 'd',
/%j/ => 'oo',
/%m/ => 'mm',
/%-m|%-m/ => 'm',
/%y/ => ... | 45.878453 | 248 | 0.623916 |
f85945a5768deca0a17bbfe93885c3d5aa68d102 | 3,092 | # frozen_string_literal: true
module Mutations
module Snippets
class Create < BaseMutation
include ServiceCompatibility
include CanMutateSpammable
include Mutations::SpamProtection
authorize :create_snippet
graphql_name 'CreateSnippet'
field :snippet,
Types::Sni... | 33.247312 | 133 | 0.647477 |
ff22bffc20d0695b29bff30ef15680166cff2073 | 2,077 | # -*- encoding: utf-8 -*-
# stub: middleware 0.1.0 ruby lib
Gem::Specification.new do |s|
s.name = "middleware".freeze
s.version = "0.1.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Mitchell Ha... | 44.191489 | 112 | 0.654309 |
e9078f1168f60678a6f5058507177437bc4d4167 | 1,098 | # frozen_string_literal: true
require "ripper_parser/commenting_ripper_parser"
require "ripper_parser/sexp_processor"
module RipperParser
# Main parser class. Brings together Ripper and our
# RipperParser::SexpProcessor.
class Parser
def parse(source, filename = "(string)", lineno = 1)
parser = Commen... | 23.361702 | 67 | 0.659381 |
62591bb545f0cec7c16d3f6fe1c11602d93a53db | 2,914 | require 'sentry-raven'
describe 'Exception', set_app: true do
class FixRaven < Struct.new(:app)
def call(env)
requested_at = env['requested_at']
env['requested_at'] = env['requested_at'].to_s if env.key?('requested_at')
app.call(env)
rescue Exception => e
env['requested_at'] = request... | 33.883721 | 115 | 0.657515 |
bb0f8bb3f1e3d6aea448d2a40faec497e071c8dc | 801 | require 'spec_helper'
describe SmartRpc::Setting do
class << SmartRpc::Setting
def config
{'foo' => {
'v1' => {'base_uri' => 'http://example.com'},
'authentication' => {
'name_and_password' => {'name' => 'Foo', 'password' => 'BarBazBlah'}
}
}
}
en... | 25.83871 | 80 | 0.600499 |
e8e5adaa2741f56a2836cff9dc0a673142fe57fb | 11,953 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe IssuablesHelper do
let(:label) { build_stubbed(:label) }
let(:label2) { build_stubbed(:label) }
describe '#users_dropdown_label' do
let(:user) { build_stubbed(:user) }
let(:user2) { build_stubbed(:user) }
it 'returns unassigned' d... | 30.886305 | 141 | 0.646281 |
01fe1eaa2bf058507d2c023c08afd8b17a22918d | 343 | module UsersHelper
# 引数で与えられたユーザーのGravatar画像を返す
def gravatar_for(user, options = { sieze: 80 })
size = options[:size]
gravatar_id = Digest::MD5::hexdigest(user.email.downcase)
gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}"
image_tag(gravatar_url, alt: user.name, class:... | 31.181818 | 80 | 0.71137 |
79dc625f25ac0bf8943771325234af10046582e2 | 4,334 | require 'devise'
# Use this hook to configure devise mailer, warden hooks and so forth. The first
# four configuration values can also be set straight in your models.
Devise.setup do |config|
# Configure the e-mail address which will be shown in DeviseMailer.
config.mailer_sender = "please-change-me@config-initial... | 43.777778 | 83 | 0.736502 |
870f204db6cad21bb0459520c0bec55d06bd9b96 | 1,399 | # pagarme_core_api
#
# This file was automatically generated by APIMATIC v2.0
# ( https://apimatic.io ).
module PagarmeCoreApi
# Response object for listing subscription cycles
class ListCyclesResponse < BaseModel
# The subscription cycles objects
# @return [List of GetPeriodResponse]
attr_ac... | 26.903846 | 74 | 0.598284 |
627bd9e59adb60c984ea6a19f7af3b6fd4a0885d | 86 | require "super_features/version"
module SuperFeatures
# Your code goes here...
end
| 14.333333 | 32 | 0.767442 |
f7c9a3d9a775f71b3a88a3624a8b81b2b76cd217 | 1,988 | require "formula"
class Guile < Formula
desc "GUILE: GNU Ubiquitous Intelligent Language for Extensions"
homepage "https://www.gnu.org/software/guile/"
url "http://ftpmirror.gnu.org/guile/guile-2.0.11.tar.gz"
mirror "https://ftp.gnu.org/gnu/guile/guile-2.0.11.tar.gz"
sha1 "3cdd1c4956414bffadea13e5a1ca0894901... | 26.157895 | 88 | 0.652918 |
185a10a250c9083af11c29ff62c5c34fa11334e7 | 2,277 | # frozen_string_literal: true
module API
module Helpers
module IssuesHelpers
extend Grape::API::Helpers
params :negatable_issue_filter_params_ee do
end
params :optional_issue_params_ee do
end
params :issues_stats_params_ee do
end
def self.update_params_at_least... | 24.75 | 79 | 0.557312 |
f7ab2c6cd983ef493e31585556ad5259aa09e4c2 | 886 | module Prawn::SVG::Extensions
module AdditionalGradientTransforms
def gradient_coordinates(gradient)
# As of Prawn 2.2.0, apply_transformations is used as purely a boolean.
#
# Here we're using it to optionally pass in a 6-tuple transformation matrix that gets applied to the
# gradient. T... | 36.916667 | 108 | 0.639955 |
0172d6bbba38a2d60c503f1174e18ba27527cadd | 342 | # frozen_string_literal: true
class AddTextLimitToRequirementsDescription < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_text_limit :requirements, :description, 10_000
end
def down
remove_text_limit :requirements, :... | 19 | 74 | 0.780702 |
62d85b8cd4be26917e755ee95430827ca36d60d7 | 1,657 | require 'rails_helper'
RSpec.describe 'split decision flow' do
let(:split_page) { app.admin_split_show_page }
let(:split_decision_page) { app.admin_split_decision_new_page }
let(:user_id_values) { %w(4 8 15 16 23) }
let!(:split) { FactoryBot.create :split }
let!(:id_type_user_ids) { FactoryBot.create :identi... | 31.264151 | 118 | 0.730839 |
017853a1faff6c32235f00362fbb0e10a3df73f2 | 6,235 | # =================================================================
# Copyright 2018 IBM Corporation
#
# 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... | 46.529851 | 192 | 0.713873 |
e9fe147f5b0218c10125a347298eff916e8637c7 | 471 | 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 :set_locale
def set_locale
I18n.locale = params[:locale] || I18n.default_locale
end
# Hijack... | 27.705882 | 56 | 0.762208 |
7908bfa0dd0b16396d9233bf8a9a391c7a02ff10 | 47 | module ActiveID
VERSION = "0.6.1".freeze
end
| 11.75 | 26 | 0.702128 |
616190750bce3d3fbce534abf680d6f408501c22 | 175 | json.data @feed_reviews do |review|
user = review.end_user
json.user_name user.name || user.email
json.comment review.message
json.profile_photo user.profile_photo
end | 29.166667 | 40 | 0.782857 |
1c0dce506576f4d1c9437ae74fe62adc12ef7481 | 1,905 | require_relative 'chromosome'
require_relative 'population'
require 'colorize'
WORD = 'badania'
NUM_GENERATIONS = 20000
CROSSOVER_RATE = 0.7
population = Population.new
population.seed!
first_fitness = population.average_fitness
first_max_fitness = population.max_fitness
1.upto(NUM_GENERATIONS).each do |generation... | 26.458333 | 166 | 0.71811 |
0840fbd5b0c3a88677eb7138bfbfbfc7d4c1348c | 2,592 | class QuotesApp::Scraper
def self.random_quote
random_quote_page = Nokogiri::HTML(open("https://blog.hubspot.com/sales/famous-quotes")) # Working quotes page without dynamic ads
random_quote_page.css("#hs_cos_wrapper_post_body p").collect do |i|
{:body => i.text.split("\"")[1], :author => i.css("... | 68.210526 | 259 | 0.596451 |
bbaa0c5fd2356a1456550ab4c6b053e8ea2412ce | 156 | class AddUserIdToJobApplications < ActiveRecord::Migration
def change
add_column :job_applications, :user_id, :string, :foreign_key => true
end
end
| 26 | 73 | 0.775641 |
ab7a25687dfb9ebbc2174b87b374ae31d24cdabe | 90 | require 'sinatra'
get '/' do
erb :welcome
end
get '/about' do
'A little about me.'
end | 12.857143 | 22 | 0.655556 |
629b34b34b1954827ac46a32735410987df71280 | 1,839 | require 'spec_helper'
describe WaxIiif::ImageVariant do
let(:config) {WaxIiif::Config.new}
let(:data) { WaxIiif::ImageRecord.new({
'path' => './spec/data/test.jpg',
'id' => 1})
}
context 'initialization errors' do
it 'raises if the image does not have an ID' do
data.id =nil
expect{WaxI... | 27.447761 | 102 | 0.599239 |
39af7b85e191e063f699a95a41037b2ee0223af1 | 9,628 | # encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
class HolidaysTests < Test::Unit::TestCase
def setup
@date = Date.civil(2008,1,1)
end
def test_on
h = Holidays.on(Date.civil(2008,9,1), :ca)
assert_equal 'Labour Day', h[0][:name]
holidays = Holidays.on(Date.... | 35.397059 | 129 | 0.695368 |
0180002994edf8e0ffa1008a36e07fb9ba3ecdb8 | 2,067 | require 'rails_helper'
RSpec.describe Api::V0::Users::ToursController, :type => :controller, skip: true do
render_views
describe 'GET index' do
let!(:user) { FactoryBot.create(:pro_user) }
let!(:tour1) { FactoryBot.create(:tour, user: user, updated_at: Date.parse("10/10/2010")) }
let!(:tour2) { Factor... | 37.581818 | 109 | 0.570876 |
33ef4509bb581ef4ec9a59f93061a476c39530e3 | 126 | require 'test_helper'
class SpellingTestTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 15.75 | 48 | 0.714286 |
e8ca54387fd715807aae7007b082febbd9609641 | 354 | module Newsletterable
module OrmAdapters
class ActiveModel < Adapter
def query_subscription(query, initialize = false)
scope = subscriptions_model.where(query)
if initialize
scope.first_or_initialize do |s|
s.pending!
end
else
scope.first
end
end
def save(record)
r... | 16.090909 | 52 | 0.677966 |
21a45042fa545668c3ec79ad6a687321312b875a | 69,858 | require "cases/helper"
require 'models/developer'
require 'models/computer'
require 'models/project'
require 'models/company'
require 'models/contract'
require 'models/topic'
require 'models/reply'
require 'models/category'
require 'models/image'
require 'models/post'
require 'models/author'
require 'models/essay'
requ... | 33.265714 | 180 | 0.741003 |
7981b7cb356db855292f450726525664e29a79a5 | 137 | json.array!(@users) do |user|
json.extract! user, :id, :username, :avatar_url, :biography
json.url user_url(user, format: :json)
end
| 27.4 | 61 | 0.70073 |
3911540459dd148c177eeeefb75cc5b11abcbbee | 140 | module Serverspec
module Helper
module Debian
def commands
Serverspec::Commands::Debian.new
end
end
end
end
| 14 | 40 | 0.642857 |
d52d2b681d712015303a3af9e1d6de262dadd557 | 3,800 | class Timecop
# A data class for carrying around "time movement" objects. Makes it easy to keep track of the time
# movements on a simple stack.
class TimeStackItem #:nodoc:
attr_reader :mock_type
def initialize(mock_type, *args)
raise "Unknown mock_type #{mock_type}" unless [:freeze, ... | 26.950355 | 126 | 0.571316 |
accdc7b3ec3d3b49506557521e89b0cdf100755a | 1,157 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'pundit/resources/version'
Gem::Specification.new do |spec|
spec.name = "pundit-resources"
spec.version = Pundit::Resources::VERSION
spec.authors = ["Ross Penman", "Sean... | 38.566667 | 104 | 0.654278 |
b9ce11c33dbd0825b984d1e0f90c183f8001c44a | 1,642 | # frozen_string_literal: true
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'boletosimples/version'
Gem::Specification.new do |gem|
gem.name = 'boletosimples'
gem.version = BoletoSimples::VERSION
gem.authors = ['Kivanio Barbosa', 'Raf... | 39.095238 | 95 | 0.725944 |
e254fb4c68b21ad13164fa8b10e3bfeac7cc19c3 | 638 | class CreateMonsters < ActiveRecord::Migration[5.2]
def change
create_table :monsters do |t|
t.string :name
t.string :monster_type
t.integer :level, :default => 1
t.integer :exp_provide, :default => 100
t.integer :max_hp, :default => 1000
t.integer :hp, :default => 200
t.... | 29 | 51 | 0.60815 |
ff8714f7b40f9499e75d4ed7a2c8e75f5a70fbda | 2,250 | class Libcapn < Formula
desc "C library to send push notifications to Apple devices"
homepage "https://web.archive.org/web/20181220090839/libcapn.org/"
license "MIT"
revision 1
head "https://github.com/adobkin/libcapn.git"
stable do
url "https://github.com/adobkin/libcapn/archive/v2.0.0.tar.gz"
sha... | 38.793103 | 111 | 0.732 |
9167e61a423a0ca499dd6c7f48e4ef2234533785 | 1,489 | module GrapeV0_14_0
module Validations
class Base
attr_reader :attrs
# Creates a new Validator from options specified
# by a +requires+ or +optional+ directive during
# parameter definition.
# @param attrs [Array] names of attributes to which the Validator applies
# @param opt... | 33.088889 | 97 | 0.60779 |
bb156aa91b1fd6c847902aa00e1ff33b66f0d7eb | 181 | Rails.application.routes.draw do
resources :posts
get 'welcome/index'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
| 25.857143 | 101 | 0.767956 |
33f11ea3e63eb619df7aeeb6d1614bcad59799d6 | 168 | require 'multi_test'
# Now we create the world
MultiTest.extend_with_best_assertion_library(self)
# Now we execute a scenario and assert something
expect(1).to eq(1)
| 21 | 50 | 0.797619 |
79169d3ca6ae0feb036d6933aa6b8528961ac1b5 | 1,273 | #-- encoding: UTF-8
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2014 the OpenProject Foundation (OPF)
#
# 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,... | 42.433333 | 91 | 0.76198 |
032dd6519893c6d13222bdea1bf17259f1107d9a | 264 | module Util
class Sigint
def initialize
@trapped = false
end
def trap
Signal.trap 'INT' do
puts 'intercept INT and stop ..'
@trapped = true
end
self
end
def trapped?
@trapped
end
end
end
| 12.571429 | 40 | 0.534091 |
b917b898f86bc1c0b30cc58f22dfcf3fa59c8e6c | 338 | class CreateProducts < ActiveRecord::Migration[5.2]
def change
create_table :products do |t|
t.string :name, null: false
t.float :price, null: false
t.string :status, null: false, default: 'active'
t.references :category, foreign_key: true
t.integer :presentation
t.timestamps
... | 24.142857 | 54 | 0.659763 |
876aab053434c756390fc05b2236a754312dc4ea | 6,440 | ##
# $Id: module.rb 12624 2011-05-15 23:51:53Z hdm $
##
module Msf
module RPC
class RPC_Module < RPC_Base
def rpc_exploits
{ "modules" => self.framework.exploits.keys }
end
def rpc_auxiliary
{ "modules" => self.framework.auxiliary.keys }
end
def rpc_payloads
{ "modules" => self.framework.payloads.keys }
... | 20.062305 | 102 | 0.623602 |
18af9a68e7f256dd14ab8be5f34582cef9a2558e | 3,711 | #---
# Excerpted from "Everyday Scripting in Ruby"
# We make no guarantees that this code is fit for any purpose.
# Visit http://www.pragmaticprogrammer.com/titles/bmsft for more book information.
#---
require 'test/unit'
require 'exercise-7b'
class SubversionRepositoryTests < Test::Unit::TestCase
def setup... | 32.269565 | 531 | 0.643223 |
26a634615e78b643b1e842c19658f5dafbfa79cf | 1,470 | class RoastersController < ApplicationController
get '/roasters' do
if logged_in?
@roasters = Roaster.all
erb :'/roasters/index'
else
redirect '/login'
end
end
get '/roasters/new' do
if logged_in?
erb :'/roasters/new'
... | 28.269231 | 118 | 0.559184 |
03d5abf231d2da524b28df327e3f98d5963f919c | 1,492 | require_relative 'material'
module Raylib
class Model
# Model loading/unloading functions
ray_alias_static :LoadModel, :load # Load model from files (mesh and material)
ray_alias_object :UnloadModel, :unload # Unload model from memory (RAM and/or VRAM... | 34.697674 | 135 | 0.618633 |
1a7067c9ea58c476fb1ea5fbc256670c31616d1b | 1,625 | class RatingsController < ApplicationController
def create
respond_to do |format|
@post = Post.find(params[:post_id])
if @post.topic.locked?
format.js { render js: '' }
else
if (!@post.ratings.find_by(user_id: current_user.id))
@rating = @post.ratings.build(rating_param... | 26.209677 | 108 | 0.579077 |
26e91f62cfc7aff822941ce463ec75579cb15ba1 | 3,255 | # frozen_string_literal: true
require 'bitcoin'
require 'celluloid/current'
require_relative './/stream_parser'
# NOTE(yu): Celluloid is unmaintained
#
# While really simple to use (literally just include the module, and add a single `async` call),
# the library quickly crashed with
#
# `E, [2018-09-24T00:35:59.3477... | 21.136364 | 106 | 0.60768 |
266335fa37b3d4b41b483f9d98eb612fa2835778 | 1,279 | $:.push File.join(File.dirname(__FILE__), 'lib')
require 'concurrent/version'
Gem::Specification.new do |s|
s.name = 'concurrent-ruby-ext'
s.version = Concurrent::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Jerry D'Antonio", 'The Ruby Concurrency Team']
s.email = ['jerry.d... | 36.542857 | 82 | 0.658327 |
03ed37a5703237596ccbafa00ae009e6cab2d027 | 505 | cask "eddie" do
version "2.18.9"
sha256 "4b6e233496f8d63d1cbab01a2f24e46c480741746c1b1b6e7468442d41c648c1"
# eddie.website/ was verified as official when first introduced to the cask
url "https://eddie.website/download/?platform=macos&arch=x64&ui=ui&format=disk.dmg&version=#{version}"
appcast "https://github... | 29.705882 | 104 | 0.744554 |
ed7a8a417b8c2a6dd7d56cb88ccae81147dc2606 | 354 | cask 'melodics' do
version '2.0.2677'
sha256 '926241af674f116aeecaa2f298185006ec99e0c5951f7a6b37b4f1b842bd26f1'
url "https://web-cdn.melodics.com/download/MelodicsV#{version.major}.dmg"
appcast "https://api.melodics.com/download/osxupdatescastv#{version.major}.xml"
name 'Melodics'
homepage 'https://melodic... | 29.5 | 81 | 0.765537 |
214f5a090bede014937d2c46c81d95cdb5a9f64b | 5,465 | # encoding: utf-8
require_relative './data_import_entity_builder'
=begin
= DataImportCityBuilder
- Goggles framework vers.: 6.075
- author: Steve A.
Specialized +DataImportEntityBuilder+ for searching (or adding brand new)
Badge entity rows.
=end
class DataImportBadgeBuilder < DataImportEntityBuilder
#... | 38.216783 | 146 | 0.551876 |
01684cf3bd0141c2b376b95e2b974bc9f964dc48 | 1,401 | require 'spec_helper'
describe Opener::LanguageIdentifier do
before do
@input = 'Hello world, how are you doing today?'
end
context '#initialize' do
example 'store the options' do
instance = described_class.new(:kaf => false)
instance.options[:kaf].should == false
end
end
context '... | 24.155172 | 71 | 0.645967 |
3967868a13a01dda7650cead45e0cc90519a8c8c | 3,224 | # frozen_string_literal: true
class Jira
JIRA_KEY_REGEX = /[A-Z0-9]+-\d+/.freeze
include ActionView::Helpers::SanitizeHelper
attr_accessor :client, :jira_data
def initialize
options = {
username: ENV['JIRA_USERNAME'],
password: ENV['JIRA_PASSWORD'],
site: ENV['JIRA_URL'],
context_p... | 33.583333 | 116 | 0.704404 |
1ca698551e723fe316b3c657c7cbf84554722aca | 4,549 | class Plugins::Ecommerce::CartService
def initialize(site, cart)
@site = site
@cart = cart
end
attr_reader :site, :cart
def pay_with_authorize_net(options={})
payment_method = options[:payment_method] || site.payment_method('authorize_net')
billing_address = cart.get_meta("billing_address")
... | 35.539063 | 122 | 0.632447 |
e2f385415ede6b6a617c71170d52bfbec62e4690 | 4,415 | # encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Kusto::Mgmt::V2019_01_21
module Models
#
# Class representing an event hub data connection.
#
class EventHubDataConnection <... | 30.034014 | 78 | 0.47769 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.