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 |
|---|---|---|---|---|---|
1dd9e189374e516e77c4425d0d89f05b692bc396 | 29,763 | # frozen_string_literal: true
require "spec_helper"
require "dependabot/dependency_file"
require "dependabot/npm_and_yarn/file_updater/npmrc_builder"
RSpec.describe Dependabot::NpmAndYarn::FileUpdater::NpmrcBuilder do
let(:npmrc_builder) do
described_class.new(
dependency_files: dependency_files,
cr... | 35.729892 | 112 | 0.490374 |
013d21fe871e3e51f37ead082709b1c960ed5ba5 | 8,477 | class TrezorAgent < Formula
include Language::Python::Virtualenv
desc "Hardware SSH/GPG agent for Trezor, Keepkey & Ledger"
homepage "https://github.com/romanz/trezor-agent"
url "https://files.pythonhosted.org/packages/f1/a7/8989377dfce48abf9115055baf6d2cfba55102929a7c5f3e5b9c8e8b5c18/trezor_agent-0.11.0.tar.g... | 47.623596 | 152 | 0.827887 |
1a3803dbbf51f19f8ed29e67cad6f73825690733 | 186 | class CreateUsers < ActiveRecord::Migration[5.2]
def change
create_table :users do |t|
t.string :username
t.string :email
t.string :credentials
end
end
end
| 18.6 | 48 | 0.655914 |
33555776b6fce5d678706438a888a10cff127785 | 2,787 | module Api
class ConfigurationScriptSourcesController < BaseController
include Subcollections::ConfigurationScriptPayloads
def edit_resource(type, id, data)
config_script_src = resource_search(id, type, collection_class(:configuration_script_sources))
raise "Update not supported for #{config_scri... | 44.951613 | 150 | 0.748475 |
e9361c623774e99f9dfb92913b77ae1db580c419 | 67 | class NotLoggedPost < Post
has_logidze ignore_log_data: true
end
| 16.75 | 35 | 0.820896 |
18eaa07f2281fb2542449307920ad327602821e7 | 7,589 | class Employers::BrokerAgencyController < ApplicationController
include Acapi::Notifiers
include ApplicationHelper
before_action :find_employer
before_action :find_broker_agency, :except => [:index, :active_broker]
before_action :updateable?, only: [:create, :terminate]
def index
@filter_criteria = pa... | 51.277027 | 446 | 0.756885 |
6ab77998ed28cc53515ba7ae467a93b54bbb5b87 | 1,850 | # frozen_string_literal: true
require "set"
require "cache_store"
#
# `LinkageCacheStore` provides methods to fetch and mutate linkage-specific data used
# by the `brew linkage` command.
#
class LinkageCacheStore < CacheStore
# @param keg_path [String]
# @param database [CacheStoreDatabase]
# @return [nil]
de... | 23.717949 | 85 | 0.691892 |
ff186468dc80d8f25cb35a28598c356569f2305f | 391 | class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
has_and_belongs_to_many :posts, dependent: :destroy
h... | 35.545455 | 71 | 0.772379 |
e9928b8cb41b52e4d4d73635b913974471750a64 | 1,226 | class NytJourneys::Journeys
attr_accessor :name, :url, :type, :description
@@all = []
def initialize(trip_hash)
trip_hash.each {|k,v| self.send("#{k}=",v)}
@@all << self
end
def self.create_from_collection(trip_array)
trip_array.each {|trip| self.new(trip)}
end
def self.all
@@all
end... | 20.098361 | 95 | 0.622349 |
38d246101b1a7fd04bdb686b99e6e7c0168bea41 | 637 | require 'spec_helper'
module Tim
describe Template do
describe "Model relationships" do
it 'should have many base images' do
template = FactoryGirl.build(:template)
2.times do
template.base_images << FactoryGirl.build(:base_image)
end
template.save!
Templat... | 24.5 | 64 | 0.615385 |
4af0ac7bf352e0888f96ec15d7af98ca71591914 | 1,401 | #-- encoding: UTF-8
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2021 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 ChiliProj... | 33.357143 | 91 | 0.736617 |
ede7d238e1a331c3d1cdf6b8811e053c46d5bec4 | 502 | $LOAD_PATH << File.expand_path(File.dirname(__FILE__) + "/../../lib")
require 'rubygems'
require 'neo4j'
require 'neo4j/extensions/activemodel'
class Person
include Neo4j::NodeMixin
include ActiveModel::Validations
property :first_name
property :last_name
validates_presence_of :first_name, :last_name
end
... | 18.592593 | 69 | 0.74502 |
1d9a0acceb3d3a12e020461790313952ac10f54a | 3,927 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Groups::Memberships::ExportService do
let(:group) { create(:group) }
let(:owner_member) { create(:group_member, :owner, group: group)}
let(:current_user) { owner_member.user }
let(:service) { described_class.new(container: group, current_user:... | 30.679688 | 157 | 0.612172 |
1c96de9677734bc8381489b7fb89043a1bde56cd | 877 | # Copyright 2017 Google, 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-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 29.233333 | 74 | 0.710376 |
f7f7749e5e70b4e0f658c44afb6fcf962230c4fc | 7,805 | require 'active_record'
case ENV['DB'].try(:downcase)
when 'mysql', 'mysql2'
# To test with MySQL: `DB=mysql bundle exec rake spec`
ActiveRecord::Base.establish_connection(
adapter: 'mysql2',
database: 'ransack',
username: ENV.fetch("MYSQL_USERNAME") { "root" },
password: ENV.fetch("MYSQL_PASSWORD... | 25.177419 | 82 | 0.633953 |
1d921ebb008917840171b81448ee12a2b321b3e7 | 125 | class AddSiteIdToAdjustments < ActiveRecord::Migration
def change
add_column :adjustments, :site_id, :integer
end
end
| 20.833333 | 54 | 0.784 |
e9b82d39a9f12c1f4ca318d3dd180d910e8a66d6 | 505 | # Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary atta... | 63.125 | 179 | 0.833663 |
796ae3ed3d64e436bbb45a57b7e4d04b71595537 | 10,385 | # frozen_string_literal: true
module PaperTrail
module Events
# We refer to times in the lifecycle of a record as "events". There are
# three events:
#
# - create
# - `after_create` we call `RecordTrail#record_create`
# - update
# - `after_update` we call `RecordTrail#record_update`
... | 34.732441 | 91 | 0.633606 |
6a1ebd1ed68978464ebd3b1cdb68233c3a585780 | 1,226 | # frozen_string_literal: true
# Copyright (c) 2018-present, BigCommerce Pty. Ltd. All rights reserved
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without l... | 53.304348 | 120 | 0.780587 |
61cbb7549d376f1782b3070aa37a8408ca7604a7 | 818 | class Grails20 < Formula
desc "Web application framework for the Groovy language"
homepage "http://grails.org"
url "http://dist.springframework.org.s3.amazonaws.com/release/GRAILS/grails-2.0.4.zip"
sha256 "51a273b8d51c08a21111bba774745db70370fbe7df906dba5551da2376f4f41b"
bottle :unneeded
# Grails 2.0.x do... | 28.206897 | 88 | 0.679707 |
bb06bfb9aced3935930bf906999a59028b307691 | 1,105 | require 'spec_helper'
require 'request_logs'
module CloudFoundry
module Middleware
describe RequestLogs do
let(:middleware) { described_class.new(app, logger) }
let(:app) { double(:app, call: [200, {}, 'a body']) }
let(:logger) { double('logger', info: nil) }
let(:fake_request) { double('... | 31.571429 | 122 | 0.609955 |
e2b544ea4fe534169e1b4309f89beba6f27b1978 | 11,650 | # 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.
#
# This file is the source Rails uses to define your schema when running `rails
#... | 41.607143 | 119 | 0.720515 |
ac6dde1daaf3f9bb8bb68fd9aadc8a695c808fdb | 1,093 | =begin
#Selling Partner APIs for Fulfillment Outbound
#The Selling Partner API for Fulfillment Outbound lets you create applications that help a seller fulfill Multi-Channel Fulfillment orders using their inventory in Amazon's fulfillment network. You can get information on both potential and existing fulfillment orde... | 31.228571 | 268 | 0.783166 |
e8a69a3cfc766d13b4d32194e76c3544cf60cb47 | 1,668 | require 'spec_helper'
describe PlacesQuery do
let!(:early_special) { FactoryGirl.create :special }
let(:early_place) { early_special.place }
let!(:late_special) { FactoryGirl.create :special, start_day: 5, end_day: 5, starts_at: "17:00", ends_at: "02:00" }
let(:late_place) { late_special.place }
let(:param... | 26.47619 | 117 | 0.591127 |
335fc71377b0d0a578a876c539b9b8dc5ed03a21 | 1,874 | require "test_helper"
class UserTest < ActiveSupport::TestCase
def setup
@user = User.new(name: "Example user", email:"user@example.com",
password: "foobar", password_confirmation: "foobar")
end
test "should be valid" do
assert @user.valid?
end
test "name should be pre... | 27.558824 | 78 | 0.653682 |
ff54c45bbab07c0fb4794a8eebfb1da69978b06c | 180 | # frozen_string_literal: true
class AddVoidingToDeclarations < ActiveRecord::Migration[6.1]
def change
add_column :participant_declarations, :voided_at, :datetime
end
end
| 22.5 | 63 | 0.794444 |
2624f5bd0376b99dbc537a3439dbe8e88b8a7f0b | 323 | module Bing
module Ads
module API
# Bing::Ads::API::V13
module V13
NAMESPACE_IDENTIFIER = :v13
def self.constants
@_config || fail('Error loading bing ads gem')
end
def self.constants=(config)
@_config = config
end
end
end
end
e... | 17 | 56 | 0.541796 |
080a82ba74727bc0f41c10d8a568167920cf42bf | 1,082 | # 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... | 36.066667 | 86 | 0.749538 |
ab6d4ed033724b05beeeb2a2946f618f60e0d0cf | 17,853 | # frozen_string_literal: true
require 'erb'
require 'pry'
require 'fileutils'
require 'net/http'
require 'fhir_models'
require_relative './metadata_extractor'
OUT_PATH = '../../lib/app/modules'
RESOURCE_PATH = '../../resources/us_core_r4/'
def run
redownload_files = (ARGV&.first == '-d')
FileUtils.rm Dir.glob("#... | 41.712617 | 230 | 0.691424 |
616550440d45a16462fc65ea92f6bfa972c3bd2e | 759 |
Pod::Spec.new do |s|
s.name = 'PEPNetworking'
s.version = '0.5.1'
s.summary = 'A networking framework based on AFNetworking'
s.homepage = 'https://github.com/PEPDigitalPublishing/PEPNetworking'
s.license = { :type => 'MIT', :file => 'LICENSE' }
... | 21.083333 | 120 | 0.557312 |
1c46134b1c9726e0959b1df14046231be32b1690 | 880 | Given(/^I have logged in as a GDS Editor$/) do
GDS::SSO.test_user = create(:gds_editor)
end
Given(/^I have logged in as an admin$/) do
GDS::SSO.test_user = create(:admin)
end
Given(/^I have logged in as a member of DCLG$/) do
dclg = create(
:organisation,
title: "Department for Communities and Local Gov... | 28.387097 | 80 | 0.704545 |
d50bee0682a0926af31c438ccea59ce77fa15faf | 6,082 | require 'puppet/provider/package'
require 'xmlrpc/client'
Puppet::Type.type(:package).provide :conda,
:parent => ::Puppet::Provider::Package do
desc "Conda packages via `conda`."
has_feature :installable, :uninstallable, :upgradeable, :versionable
# ##
# OS dependant properties
# ##
def... | 24.82449 | 110 | 0.527458 |
629652a8fbc86b666bc8fc2bd24292f61c14d741 | 3,375 | module VCAP::CloudController
class TaskModel < Sequel::Model(:tasks)
include Serializer
TASK_NAME_REGEX = /\A[[:alnum:][:punct:][:print:]]+\Z/
TASK_STATES = [
SUCCEEDED_STATE = 'SUCCEEDED'.freeze,
FAILED_STATE = 'FAILED'.freeze,
PENDING_STATE = 'PENDING'.freeze,
RUNNING_STATE = 'RU... | 34.793814 | 141 | 0.719704 |
38f175d2f5ff200900e122e1167badb5bf675922 | 2,424 | require 'test_helper'
class UserTest < ActiveSupport::TestCase
def setup
@user = User.new(name: "Example.user", email: "user@example.com",
password: "foobar",password_confirmation: "foobar")
end
test "should be valid" do
assert@user.valid?
end
test "name should be present" do
... | 28.857143 | 109 | 0.681518 |
87e223297f4d7e4d8840462c8b5157e59607ad3b | 6,219 | require File.join(File.expand_path(__dir__), '../spec_helper')
describe Titlekit::Job do
describe 'Simultaneous Subtitles' do
context 'with dual subtitles' do
let(:ins) do
%w(one two).map do |file|
File.join(__dir__, 'dual', "#{file}.srt")
end
end
context 'exporting... | 28.140271 | 78 | 0.541405 |
1c582629df6431084cd5b14f82ea99254b7e8c54 | 2,486 | require 'spec_helper'
describe Fabricate do
describe ".times" do
it "fabricates an object X times" do
objects = Fabricate.times(3, :parent_ruby_object)
expect(objects.length).to eq 3
expect(objects.all?(&:persisted?)).to be true
end
it "delegates overrides and blocks properly" do
... | 33.146667 | 102 | 0.67136 |
ffc9fd0854fda944a996b5aa4d564de870804c3b | 3,842 | module GovKit
class Resource
include HTTParty
format :json
attr_reader :attributes
attr_reader :raw_response
def initialize(attributes = {})
@attributes = {}
@raw_response = attributes
unload(attributes)
end
# Returns a hash of the response object, potentially useful ... | 29.328244 | 113 | 0.621812 |
f844e6bdcc0c2f1f04b7348e9aaf67c3a3500487 | 1,834 | require 'rails_helper'
describe Geocode do
describe ".geocode_intersection" do
it "returns nil if either argument is nil" do
expect(Geocode.geocode_intersection("foo", nil)).to eql(nil)
expect(Geocode.geocode_intersection(nil, "bar")).to eql(nil)
end
it "searches" do
expect(Geocoder).t... | 38.208333 | 182 | 0.666848 |
3938437a13fb378e4d4e6f5bf8e0dbfeb108dcd5 | 66 | module Animator
class ReanimationError < StandardError
end
end | 16.5 | 40 | 0.818182 |
38617831555ca5d3e34c5bc6580e4eacef5a2c50 | 5,615 | # 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::ServiceFabric::V7_0_0_42
module Models
#
# Describes the parameters for a compose deployment upgrade.
#
class ComposeDeploym... | 35.99359 | 79 | 0.567231 |
1dacbc81fdbe299a489d760073ef668addd9a0a0 | 1,040 | module SessionsHelper
# Logs in the given user.
def log_in(user)
session[:user_id] = user.id
end
# Remembers a user in a persistent session.
def remember(user)
user.remember
cookies.permanent.signed[:user_id] = user.id
cookies.permanent[:remember_token] = user.remember_token
end
# Returns... | 22.608696 | 62 | 0.671154 |
ff340a354a46d8ba0fc9805c99cb518e2623396e | 610 | require 'aptible/resource'
module Aptible
module Api
class Resource < Aptible::Resource::Base
def namespace
'Aptible::Api'
end
def root_url
Aptible::Api.configuration.root_url
end
end
end
end
require 'aptible/api/account'
require 'aptible/api/app'
require 'aptible/... | 21.034483 | 44 | 0.731148 |
3901eff172b9f48182fb253cd03dd3e210426611 | 1,021 | # frozen_string_literal: true
module MixinBot
class CLI < Thor
desc 'read_me', 'fetch mixin bot profile'
option :config, required: true, aliases: '-c'
def read_me
api_method(:read_me)
end
desc 'read_assets', 'fetch mixin bot assets'
option :config, required: true, aliases: '-c'
def... | 24.902439 | 58 | 0.624878 |
798e2df94db566f73cfbfb6a0e7e9b6f54d70e02 | 197 | require 'mxx_ru/binary_unittest'
path = 'test/so_5_extra/revocable_timer/resend_existing'
MxxRu::setup_target(
MxxRu::BinaryUnittestTarget.new(
"#{path}/prj_s.ut.rb",
"#{path}/prj_s.rb" )
)
| 19.7 | 56 | 0.736041 |
62e92f5fce33ff2c44140f6d352ac793a39dcedd | 1,483 | require "administrate/base_dashboard"
class DeathTypeDashboard < Administrate::BaseDashboard
# ATTRIBUTE_TYPES
# a hash that describes the type of each of the model's fields.
#
# Each different type represents an Administrate::Field object,
# which determines how the attribute is displayed
# on pages throu... | 26.017544 | 76 | 0.698584 |
1c6e4235a97a476f0230bb393ca74a25c47bef74 | 273 | require 'benchmark/ips'
require 'power_assert'
def assertion_message(source = nil, source_binding = TOPLEVEL_BINDING, &blk)
::PowerAssert.start(source || blk, assertion_method: __callee__, source_binding: source_binding) do |pa|
pa.message unless pa.yield
end
end
| 30.333333 | 106 | 0.772894 |
bfc3d50bd53550d0f7952d9841c471dea67be7bc | 1,810 | require 'rails_helper'
RSpec.describe Author, type: :model do
describe Author do
before(:each) do
@author = Author.create!(first_name: "Fyodor", last_name: "Dostojevski", image: "https://upload.wikimedia.org/Project.jpg", birth_date: "11-11-1821", death_date: "9-2-1881", wiki_page: "https://en.... | 36.938776 | 243 | 0.68232 |
792f09af06b45c3aca0abc151661fefdcf49a5bb | 2,110 | #
# Cookbook:: graphite
# Library:: ChefGraphite
#
# Copyright:: 2014-2016, Heavy Water 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/LICENS... | 25.119048 | 89 | 0.620379 |
87533326d093e3a0f0287e56bcfc54079b6da072 | 8,418 | # encoding: utf-8
# frozen_string_literal: true
require 'test_helper'
class VariableTest < Minitest::Test
def test_variable_parse
assert_equal('world', variable_strict_parse("hello").render!({ 'hello' => 'world' }))
assert_equal('world', variable_strict_parse('"world"').render!)
assert_equal('answer', va... | 35.974359 | 118 | 0.658589 |
4a055744956e2522b045f08500692b008279d484 | 3,337 | # -*- encoding: utf-8 -*-
# stub: memosig 0.1.0 ruby lib
Gem::Specification.new do |s|
s.name = "memosig".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 = ["Florian Frank".fr... | 61.796296 | 614 | 0.678454 |
87896cbe5fd5870808af8a7540445f22fab0bb94 | 568 | # frozen_string_literal: true
class AddAuthorization < ActiveRecord::Migration[6.0]
def change
create_table "authorizations", force: :cascade do |t|
t.integer "user_id"
t.string "provider"
t.string "uid"
t.string "email"
t.timestamps
t.index ["provider", "uid"], name: "index_a... | 31.555556 | 83 | 0.68662 |
edda48906b2ae0ea731b1ff448ad308569244d1d | 367 | # frozen_string_literal: true
module VAOS
module V1
class OrganizationsController < VAOS::V1::BaseController
def index
response = fhir_service.search(request.query_string)
render json: response.body
end
def show
response = fhir_service.read(params[:id])
render j... | 20.388889 | 60 | 0.659401 |
7a8674cc46181d157835cbbdda23feaffab9d65a | 1,721 | # frozen_string_literal: true
module Split
class ExperimentCatalog
# Return all experiments
def self.all
# Call compact to prevent nil experiments from being returned -- seems to happen during gem upgrades
Split.redis.smembers(:experiments).map { |e| find(e) }.compact
end
# Return experi... | 33.745098 | 106 | 0.693202 |
bf72667e8e63c4c844d3bb0c62852a93bea29002 | 3,818 | # Redmine - project management software
# Copyright (C) 2006-2016 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any... | 34.089286 | 109 | 0.706391 |
f83923006930beabf67195aa02939cff7cbc105d | 1,354 | #
# Be sure to run `pod lib lint ObjectiveCDynamicCast.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 ... | 36.594595 | 111 | 0.644756 |
03e94449d14a94da4fc38f36a0ccc62201f5d0ae | 112 | class GroupOfLinePolicy < ApplicationPolicy
class Scope < Scope
def resolve
scope
end
end
end
| 14 | 43 | 0.696429 |
f7db59405c37396afc018a86f19a22dfbfb5a942 | 543 | # @param {String[]} words
# @return {Integer}
def max_product(words) # rubocop:disable Metrics/AbcSize
word_mask = Array.new(words.length, 0)
words.each_index do |idx|
words[idx].each_char do |char|
word_mask[idx] |= (1 << (char.ord - 97)) # "a".ord is 97
end
end
max = 0
words.each_index do |... | 20.884615 | 62 | 0.611418 |
6285d322d0231e49dc17be7adb2dc0d4bc03d689 | 6,129 | module RailsPowergrid::GridConcern
extend ActiveSupport::Concern
included do
layout false
before_action :set_default_json
before_action :load_grid
helper_method :powergrid_path
helper_method :powergrid_create_path
end
# LIST
def index
prepare_collection_query
render :json => @... | 24.614458 | 140 | 0.646761 |
0176294b7c5a78700cb1a2ef68ecb04dd736ff58 | 2,008 | describe ArticleFetcher do
let(:code) { 200 }
let(:response) { OpenStruct.new(body: body, code: code) }
let(:article_fetcher) { ArticleFetcher.new("foobar") }
describe "valid response" do
before do
expect(HTTParty).to receive(:get).and_return(response)
end
describe "globe article" do
l... | 31.873016 | 203 | 0.660359 |
ac0a17641474ec6726b21ad30b6f54705642691e | 206 | module SharedAdmin
include Spinach::DSL
step 'there are projects in system' do
2.times { create(:project, :repository) }
end
step 'system has users' do
2.times { create(:user) }
end
end
| 17.166667 | 45 | 0.669903 |
01ef94383a66368ce465e0127cf8ef92dee68f83 | 1,160 | # frozen_string_literal: true
module Jsclass
# SchemaUnmarshal manages schema decoding into hashses, calling
# getter methods for each property.
class SchemaMarshal
def initialize(builder, instance, options)
@builder = builder
@instance = instance
@options = options
end
# call retu... | 26.363636 | 78 | 0.632759 |
bf8b67998f9fddff4be133ebf052399db2645157 | 2,647 | POP::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
config.middleware.use ExceptionNotifier,
:email_prefix => "[oursolution.is App] ",
sender_address: %{"os Exception" <tvalent2@gmail.com>},
exception_recipients: %w{tvalent2@gmail.com}
# Th... | 35.77027 | 84 | 0.754817 |
5d99b8ee14111fdd13563506cfac5ae5ef020123 | 139 | FactoryGirl.define do
factory :product do
category
name('test_product')
description('lorem ipsum')
price(5.00)
end
end
| 15.444444 | 30 | 0.676259 |
b9a7e2208496c1354c9aa6e1370a67c63d22d727 | 464 | class Micropost < ApplicationRecord
belongs_to :user
default_scope -> { order(created_at: :desc) }
mount_uploader :picture, PictureUploader
validates :user_id, presence: true
validates :content, presence: true, length: { maximum: 140 }
validate :picture_size
private
# Validates size of an uploaded ... | 25.777778 | 62 | 0.702586 |
03e34c45926a8c09848b6a266d5cd40ad2ae134a | 311 | # encoding: utf-8
class ForceSSL
def initialize(app)
@app = app
end
def call(env)
req = Rack::Request.new(env)
if env['HTTPS'] == 'on' || env['HTTP_X_FORWARDED_PROTO'] == 'https'
@app.call(env)
else
[301, {"Location" => req.url.gsub(/^http:/, "https:")}, []]
end
end
end | 20.733333 | 71 | 0.562701 |
1a248dc75941e771e1c38e84dcbca5ace882166d | 318 | class ControlPanelsController < ApplicationController
layout 'admin'
def show
@press_run = @account.press_runs.build
@redesign = @account.redesigns.build(:design => @account.current_design)
@draft_front_pages = @account.front_pages.drafts.all(:order => "updated_at DESC", :limit => 15)
end
end
| 28.909091 | 99 | 0.72327 |
79ed0d2df24c037f49d0bbeba1cdb628601e5ace | 6,776 | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# This cop check for usages of not (`not` or `!`) called on a method
# when an inverse of that method can be used instead.
# Methods that can be inverted by a not (`not` or `!`) should be defined
# in `InverseMethods`
... | 34.222222 | 79 | 0.522875 |
87b39bd869f7f8fe14db2da18ebb9c954db7b6f6 | 1,328 | lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "ruby-cbc/version"
Gem::Specification.new do |spec|
spec.name = "ruby-cbc"
spec.version = Cbc::VERSION
spec.authors = ["Guillaume Verger"]
spec.email = ["verger.guillaume@gmail.co... | 39.058824 | 104 | 0.697289 |
e9cd475a199412c8f2853379571d05a528a2cb9e | 5,934 | # frozen_string_literal: true
class Projects::EnvironmentsController < Projects::ApplicationController
layout 'project'
before_action :authorize_read_environment!
before_action :authorize_create_environment!, only: [:new, :create]
before_action :authorize_stop_environment!, only: [:stop]
before_action :autho... | 28.666667 | 118 | 0.712673 |
f84e4246f87f6f7fc8a78053e6169da65a07ff63 | 1,579 | # -*- encoding: utf-8 -*-
# stub: mongoid 4.0.2 ruby lib
Gem::Specification.new do |s|
s.name = "mongoid"
s.version = "4.0.2"
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.6") if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib"]
s.authors = ["Durran Jordan"]
s.date = "2015-0... | 35.886364 | 109 | 0.629512 |
2154a82ae755101ec6cebb51da92e43a51bdba77 | 103 | class Note < ApplicationRecord
belongs_to :audition
belongs_to :notable, polymorphic: true
end
| 20.6 | 42 | 0.76699 |
3984916395af86c69fcb5f6920635f38c1f42132 | 682 | Gem::Specification.new do |s|
s.name = 'phony'
s.version = '2.16.4'
s.authors = ['Florian Hanke']
s.email = 'florian.hanke+phony@gmail.com'
s.homepage = 'http://github.com/floere/phony'
s.license = 'MIT'
s.platform = Gem::Platform::RUBY
s.summary = 'Fast international phone number (E164 standard) normal... | 42.625 | 188 | 0.687683 |
b91238683bd88f5d5fa724efc6b5ec1bd2088506 | 5,428 | require "sidekiq/web"
require "sidekiq/cron/web"
Rails.application.routes.draw do
draw(:redirects)
namespace :admin do
authenticate :user, lambda { |u| u.has_role?(:volunteer) } do
get "/" => "home#index"
authenticate :user, lambda { |u| u.has_role?(:supply_member) } do
# Supply
r... | 33.506173 | 117 | 0.631724 |
0163949cd2d748c4e54076124d772814e05725ff | 3,595 | module JsonApiClient
module Query
class Builder
attr_reader :klass, :path_params
def initialize(klass)
@klass = klass
@primary_key = nil
@pagination_params = {}
@path_params = {}
@filters = {}
@includes = []
@orders = []
@fields = []
... | 21.787879 | 79 | 0.50904 |
18d31caa771c944f7dfbffa886dd3618b2aa1ea2 | 90 | module Fire
module Jenkins
module Builder
VERSION = "0.1.5"
end
end
end
| 11.25 | 23 | 0.611111 |
037a0903d834930bc15e277ecdb343ea817607fc | 2,240 | module Sources::Strategies
class Pawoo < Base
IMAGE = %r!\Ahttps?://img\.pawoo\.net/media_attachments/files/(\d+/\d+/\d+)!
def domains
["pawoo.net"]
end
def site_name
"Pawoo"
end
def image_url
image_urls.first
end
# https://img.pawoo.net/media_attachments/files/00... | 21.960784 | 93 | 0.615179 |
87214972bb0013b85fecba59dda509cd099c0d3c | 55,309 | require_relative 'spec_helper'
describe 'Jekyll::AsciiDoc' do
let :config do
::Jekyll.configuration fixture_site_params(name, config_path)
end
let :site do
::Jekyll::Site.new config
end
let :converter do
::Jekyll::AsciiDoc::Converter.get_instance site
end
let :integrator do
::Jekyll::A... | 38.196823 | 119 | 0.651015 |
f894d45168474564377479c5e4efcb13224362b4 | 4,488 | # -*- coding: binary -*-
module Msf
module Exploit::Android
# Since the NDK stager is used, arch detection must be performed
SUPPORTED_ARCHES = [ ARCH_ARMLE, ARCH_MIPSLE, ARCH_X86 ]
# Most android devices are ARM
DEFAULT_ARCH = ARCH_ARMLE
# Some of the default NDK build targets are named differently than
... | 36.487805 | 129 | 0.60762 |
f7c7f217df2c62151e859198c68306c29df0ea5c | 104 | class DepartmentsController < AuthsController
def index
render json: Department.all
end
end
| 14.857143 | 45 | 0.75 |
33f8b4ec4fb11d743a1b16504d41e49c9dad554f | 618 | cask 'minecraftpe' do
version '1.12.5'
sha256 '27e60759e560b18674a2c4e758e30cb3b6f98a46e0e9a9620bd8f859aac94f7a'
# meedownloads.azureedge.net was verified as official when first introduced to the cask
url 'https://meedownloads.azureedge.net/retailbuilds/MacOS/Minecraft_Education_Edition.dmg'
appcast 'https:/... | 38.625 | 124 | 0.778317 |
38681490fe0503be2f8f4cd7b5d4e4564e5333d5 | 450 | module Pronto
module Formatter
def self.get(name)
formatter = FORMATTERS[name.to_s] || TextFormatter
formatter.new
end
def self.names
FORMATTERS.keys
end
FORMATTERS = {
'github' => GithubFormatter,
'github_pr' => GithubPullRequestFormatter,
'gitlab' => GitlabF... | 20.454545 | 56 | 0.624444 |
f772d2a744af1e0572b13522e3f1bb039f3f65c0 | 79,909 | # -*- ruby -*-
# encoding: utf-8
$LOAD_PATH.push File.expand_path('../src/ruby/lib', __FILE__)
require 'grpc/version'
Gem::Specification.new do |s|
s.name = 'grpc'
s.version = GRPC::VERSION
s.authors = ['gRPC Authors']
s.email = 'temiola@google.com'
s.homepage = 'https://git... | 62.575568 | 119 | 0.710295 |
0106f3989166322bfba7a2c6e83f12231956ff38 | 5,394 | module RedmineHelpdesk
module MailHandlerPatch
def self.included(base) # :nodoc:
base.send(:include, InstanceMethods)
base.class_eval do
alias_method :dispatch_to_default_without_helpdesk, :dispatch_to_default
alias_method :dispatch_to_default, :dispatch_to_default_with_helpdesk
... | 38.805755 | 124 | 0.624027 |
e2a7a163d6323d6dfef9a6ca1276cb9c7505b6ed | 1,843 | require "active_support/testing/time_helpers"
class ApplicationController < ActionController::Base
include Pundit
include ActiveSupport::Testing::TimeHelpers
set_current_tenant_through_filter
before_action :set_tenant
helper_method :current_member, :current_library
add_flash_types :success, :error, :war... | 21.940476 | 90 | 0.732501 |
bfe0410555967a0d7211bf86b6001c14a0a41e70 | 170 | # frozen_string_literal: true
class MeetingsList < ApplicationRecord
validates_presence_of :title, :responsible
has_many :meetings_items, dependent: :delete_all
end
| 24.285714 | 50 | 0.823529 |
7aefd123dc51148402391b8291639c41e3e68d5d | 3,676 | class ManageIQ::Providers::IbmCloud::Inventory::Collector::VPC < ManageIQ::Providers::IbmCloud::Inventory::Collector
require_nested :CloudManager
require_nested :NetworkManager
require_nested :StorageManager
require_nested :TargetCollection
def connection
@connection ||= manager.connect
end
def vpc
... | 25.706294 | 139 | 0.729597 |
e2dab079da9a08860c9a7c2c10e8c5ab8d9b751c | 1,783 | class CreateSupportTables < ActiveRecord::Migration
def up
create_table "support.load_events", force: :cascade do |t|
t.string "event_type"
t.string "status"
t.text "description"
t.text "problems"
t.integer "should_add"
t.integer "should_change"
t.integer ... | 27.430769 | 101 | 0.637128 |
f7d8825431f2f0bb9ddd809944169de57a912f99 | 1,926 | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... | 34.392857 | 97 | 0.649533 |
87663f4ee3ec8f7670edab9b95c829661bf25d63 | 9,193 | # encoding: utf-8
require "logstash/filters/base"
require "logstash/namespace"
# The date filter is used for parsing dates from fields, and then using that
# date or timestamp as the logstash timestamp for the event.
#
# For example, syslog events usually have timestamps like this:
#
# "Apr 17 09:32:01"
#
# You wo... | 40.676991 | 130 | 0.639617 |
f8cdfaf2bfe24db8813e09e235a2bf4722c9174a | 295 | cask "font-wire-one" do
version :latest
sha256 :no_check
url "https://github.com/google/fonts/raw/main/ofl/wireone/WireOne-Regular.ttf",
verified: "github.com/google/fonts/"
name "Wire One"
homepage "https://fonts.google.com/specimen/Wire+One"
font "WireOne-Regular.ttf"
end
| 24.583333 | 81 | 0.715254 |
084ed7d7b5ab987e6bab53eb1fb1050056da9dc5 | 1,077 | # frozen_string_literal: true
RSpec.describe RuboCop::Cop::InternalAffairs::UselessMessageAssertion do
subject(:cop) { described_class.new }
it 'registers an offense for specs that assert using the MSG' do
expect_offense(<<-RUBY, 'example_spec.rb')
it 'uses described_class::MSG to specify the expected m... | 34.741935 | 114 | 0.638812 |
01282a284b853b0ca2173370fe6369df3572cbcf | 89 | # desc "Explaining what the task does"
# task :electronics do
# # Task goes here
# end
| 17.8 | 38 | 0.685393 |
ed2e71b4044f7d7f1866fefed3154f62c8ca6194 | 1,210 | class Hub < Formula
desc "Add GitHub support to git on the command-line"
homepage "https://hub.github.com/"
url "https://github.com/github/hub/archive/v2.14.2.tar.gz"
sha256 "e19e0fdfd1c69c401e1c24dd2d4ecf3fd9044aa4bd3f8d6fd942ed1b2b2ad21a"
head "https://github.com/github/hub.git"
bottle do
cellar :any... | 34.571429 | 93 | 0.729752 |
f880b58d1197318467ffb6c26b3b2ec407ad5116 | 264 | require 'spec_helper'
module Chess
describe Rook do
context "#possible_moves" do
it "returns an array of possible_moves" do
rook = Rook.new
expect(rook.possible_moves([0,0])).to be_instance_of(Array)
end
end
end
end | 16.5 | 67 | 0.643939 |
2180e557e40c2d5695f3efcdf7cf3eabd00ad9ef | 1,021 | # Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to diction... | 35.206897 | 175 | 0.795299 |
bb50d490e441b3e33f90c0b0cfeaadcca6663cf2 | 789 | cask 'unity@2017.3.0b11' do
version '2017.3.0b11,8e840c60cd77'
sha256 :no_check
url "http://beta.unity3d.com/download/8e840c60cd77/MacEditorInstaller/Unity.pkg"
name 'Unity 2017.3.0b11'
homepage 'https://unity3d.com/unity/'
pkg 'Unity.pkg'
preflight do
if File.exist? "/Applications/Unity"
F... | 26.3 | 82 | 0.685678 |
03633c50db08f49ba2eb1444a886d660c8050518 | 192 | # encoding: utf-8
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'categorize'
require 'document_helper'
require 'rspec'
| 24 | 66 | 0.75 |
398f0da33955a03acdb823768f698517ae7b21de | 153 | module KiftViewTool
class Renderer
def self.copyright name, msg
"© #{Time.now.year} | <b>#{name}</b> #{msg}".html_safe
end
end
end | 21.857143 | 65 | 0.627451 |
01ee86a3580af76a95ae15ae4b72184e1ce0bbca | 37,574 | # frozen_string_literal: true
require_relative "lockfile_parser"
require "set"
module Bundler
class Definition
include GemHelpers
attr_reader(
:dependencies,
:locked_deps,
:locked_gems,
:platforms,
:requires,
:ruby_version,
:lockfile,
:gemfiles
)
# G... | 37.461615 | 187 | 0.649252 |
b9efe2b589fbad0aa72bf1d1b7c8b1dff82704dc | 5,542 | module WebService
module Request
require 'test_helper'
class ActionTest < Test::Unit::TestCase
def setup
@base_url = "http://bobcatdev.library.nyu.edu"
@isbn = "0143039008"
@user_id = "N12162279"
@institution = "NYU"
@doc_id = "nyu_aleph000062856"
@dedupmg... | 46.183333 | 134 | 0.660231 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.