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 |
|---|---|---|---|---|---|
873fcabc7f26b2a3a2875a13851c4e50fe53d79a | 2,394 | # frozen_string_literal: true
# encoding: utf-8
module Mongoid
module Fields
class Localized < Standard
# Demongoize the object based on the current locale. Will look in the
# hash for the current locale.
#
# @example Get the demongoized value.
# field.demongoize({ "en" => "testi... | 24.9375 | 89 | 0.547619 |
6aa3fba4eb60e7434f4ac14e7a1af279194782ab | 3,654 | class Glade < Formula
desc "RAD tool for the GTK+ and GNOME environment"
homepage "https://glade.gnome.org/"
url "https://download.gnome.org/sources/glade/3.36/glade-3.36.0.tar.xz"
sha256 "19b546b527cc46213ccfc8022d49ec57e618fe2caa9aa51db2d2862233ea6f08"
revision 1
livecheck do
url :stable
end
bot... | 29.232 | 117 | 0.616037 |
28835bf4e980009b9bd3dd653b438d53881e24bd | 166 | class AddBondsEarlyAdopterToUsers < ActiveRecord::Migration
def change
add_column :users, :bonds_early_adopter, :boolean, null: false, default: false
end
end
| 27.666667 | 82 | 0.783133 |
6a1978cc15742dfad18675eae5e45c0f4016b46c | 3,681 | module Fog
module GoGrid
class Compute < Fog::Service
requires :go_grid_api_key, :go_grid_shared_secret
recognizes :host, :path, :port, :scheme, :persistent
recognizes :provider # remove post deprecation
model_path 'fog/compute/models/go_grid'
model :image
collection ... | 30.172131 | 133 | 0.550394 |
ed144886e42bbd3472e3e048f15c4241df6231d8 | 2,826 | class Urh < Formula
desc "Universal Radio Hacker"
homepage "https://github.com/jopohl/urh"
url "https://files.pythonhosted.org/packages/76/14/f5a44ea32d473f9432c05087b5cab4c77882a18da48c2d258474d0fe7c63/urh-2.0.0.tar.gz"
sha256 "b52b6d85a2f5af1fc87603365d6572dd1b68f396b281f7059fe32415f8ea03dd"
revision 2
he... | 38.712329 | 136 | 0.748408 |
bb1117d730c5bfc5f9bac60ff03ef79193d58c54 | 11,438 | module TransactionService::Store::Transaction
TransactionModel = ::Transaction
ShippingAddressModel = ::ShippingAddress
NewTransaction = EntityUtils.define_builder(
[:community_id, :fixnum, :mandatory],
[:listing_id, :fixnum, :mandatory],
[:starter_id, :string, :mandatory],
[:listing_quantity, :... | 34.765957 | 170 | 0.680713 |
e8bce849a16b57381c9a0f60b33108ded2da6265 | 1,798 | require "elfproef_plan/engine"
class BsnValidator < ActiveModel::EachValidator
def validate_each(record,attribute,value)
record.errors.add(attribute, options[:message]|| "ongeldig bsn nr", options) unless ElfproefPlan::ElfProef.new(value).validBsn
end
end
class RekeningValidator < ActiveModel::EachValidat... | 25.323944 | 162 | 0.682425 |
6150e1d908a7b4cef96e6dc680d688d27c83efdf | 38,411 | # frozen_string_literal: true
require "rails_helper"
RSpec.describe CatalogController do
let(:persister) { Valkyrie::MetadataAdapter.find(:indexing_persister).persister }
describe "#index" do
render_views
it "finds all public documents" do
persister.save(resource: FactoryBot.build(:complete_scanned_r... | 38.372627 | 190 | 0.667725 |
4a6706f1c337aab29b39bb57f9ed0b07ce68e47a | 64 | module SolidusLocaleJa
class Engine < Rails::Engine
end
end
| 12.8 | 30 | 0.765625 |
3960a203f0af01d01c71672237c27ac3ce270e57 | 314 | require_relative 'objects'
class TelegramBot::Document <
Struct.new(:id, :thumb, :file_name, :meme_type, :file_size)
include TelegramBot::AutoFromMethods
def self.hash_key_aliases
{
:id => :file_id
}
end
def self.extra_types
{
thumb: TelegramBot::PhotoSize
}
end
end
| 16.526316 | 65 | 0.659236 |
bbae72dde27af24a3e5143518a0ad98d446e6a50 | 938 | class Point
attr_reader :x, :y
def initialize x, y
@x, @y = x, y
end
def taxicab_dist other_point
(@x - other_point.x).abs + (@y - other_point.y).abs
end
# Returns element in points that has the shortest taxicab distance from start and there
# are exactly one point in points with this minimum d... | 22.878049 | 89 | 0.573561 |
33962d04be6181c154c62d7264c687314d31e982 | 456 | require "rails_helper"
RSpec.describe MetricUtil do
describe "#a_test?" do
it "returns true when running in RSpec" do
expect(MetricUtil.send(:a_test?)).to eq(true)
end
it "returns false when env is overridden" do
temp = Rails.env
begin
Rails.env = "asdf"
expect(MetricUt... | 20.727273 | 54 | 0.605263 |
395b99c13add52adc93bbb1e0f57481efb2ee7cd | 3,710 | class Admin::AccountsController < AdminBaseController
before_filter :accounts_meta
before_filter :get_account, :except => [:new,:index, :create]
before_filter :init_fp, :only => [:new, :create]
protected
def accounts_meta
set_meta :tab1 => :admin, :tab2 => :accounts, :title => 'Accounts'
end
d... | 24.090909 | 127 | 0.609434 |
21be696bb03b6821935843cdccb53a4eae6771a1 | 1,692 | module SessionsHelper
# Logs in the given user.and stores cookie which is non persistent
def log_in(user)
session[:user_id] = user.id
end
#Returns the current logged-in user (if any).
#def current_user
#@current_user ||= User.find_by(id: session[:user_id])
#end
# Returns true if the use... | 26.857143 | 73 | 0.696809 |
f8731728be5e74da627ba988ce53d7e0a84c232f | 184 | require 'test_helper'
class StaticControllerTest < ActionDispatch::IntegrationTest
test "should get markdown" do
get static_markdown_url
assert_response :success
end
end
| 18.4 | 60 | 0.788043 |
f8f29cd2035c41772e1db3df5290bf6ba7cc6f92 | 244 | require 'rubygems'
gemfile = File.expand_path('../../../../Gemfile', __FILE__)
if File.exist?(gemfile)
ENV['BUNDLE_GEMFILE'] = gemfile
require 'bundler'
Bundler.setup
end
$LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
| 22.181818 | 64 | 0.67623 |
1c739b288be0ce59def8cd1b586b9e3ac773997c | 105 | Dummy::Application.routes.draw do
get "stuff/public"
get "stuff/private"
root 'stuff#public'
end
| 13.125 | 33 | 0.714286 |
790c8c6b928e78dba941823a8d6f169f8760076b | 2,308 | require 'rails_helper'
describe View::Mappings::BulkTagger do
let!(:site) { create(:site) }
let!(:mappings) {
[
create(:mapping, site: site, tag_list: 'fee, fum, fox'),
create(:mapping, site: site, tag_list: 'fi, fum, fox'),
create(:mapping, site: site, tag_list: 'fo, fum, fox')
]
}
l... | 28.85 | 81 | 0.62175 |
6105ffc326bdf1ea5e064bf71fd037392b67009c | 546 | class ProposalServices
def initialize(proposal)
@proposal = proposal
end
def create_new_observation(user, adder, reason, id)
ObservationCreator.new(
observer: user,
proposal_id: id,
reason: reason,
observer_adder: adder
).run
end
def sql_for_step_user_or_delegate
<<-S... | 23.73913 | 89 | 0.699634 |
39dd6a3be2ec4631cc8f6fdaef9ae9f6ca6036c0 | 5,100 | #
# Be sure to run `pod spec lint VoidxinTools.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://githu... | 36.690647 | 99 | 0.587843 |
33375d3e39e5406ffcd8456ec561bb60efafd80c | 971 | # frozen_string_literal: true
class AidStationsDisplay < LiveEventFramework
delegate :course, :organization, :home_time_zone, to: :event
def post_initialize(args)
ArgsValidator.validate(params: args, required: :event, exclusive: [:event, :times_container], class: self.class)
end
def aid_station_rows
... | 27.742857 | 116 | 0.651905 |
6a63cfbfcf7771621f8f8af548aa786904ca12d9 | 5,124 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded we... | 45.345133 | 115 | 0.745706 |
1cc18726a05f443ee1f1eee7b1c4a360a4beb94b | 2,336 | require 'base64'
Gem::Specification.new do |s|
s.name = 'bookbindery'
s.version = '10.1.15'
s.summary = 'Markdown to Rackup application documentation generator'
s.description = 'A command line utility to be run in Book repositories to stitch together their constituent Markdown repos into a stati... | 49.702128 | 307 | 0.718322 |
79fc2efb187a92445fddc924e87c3b7612b3ec4b | 152 | # -*- encoding : utf-8 -*-
require 'test_helper'
class AirformsHelperTest < ActionView::TestCase
test 'something' do
assert true
end
end
| 13.818182 | 47 | 0.671053 |
f8956c7e4a6973bf0a5f0b24e876beb11fc54ae9 | 1,077 | # -*- encoding: utf-8 -*-
require File.expand_path('../lib/pushy_client/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ["Mark Anderson"]
gem.email = ["mark@chef.io"]
gem.description = %q{Client for Chef push jobs server}
gem.summary = %q{Client for Chef push jobs server... | 37.137931 | 150 | 0.653668 |
39de7eb4d109ae4ffa522aeea2c0bde3e4f5e101 | 46 | module SinRefinements
VERSION = "0.1.0"
end
| 11.5 | 21 | 0.717391 |
1a0fa45b673ae4e07d32769baba0bd6f7bec8f9d | 111 | require 'rails_i18n/common_pluralizations/east_slavic'
::RailsI18n::Pluralization::EastSlavic.with_locale(:sh) | 37 | 55 | 0.846847 |
7a09c8fd0bb8c550246e6ab050df1c157d40f99e | 1,025 | #
# Author:: John Keiser (<jkeiser@opscode.com>)
# Copyright:: Copyright (c) 2012 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# 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
#
# ... | 27.702703 | 74 | 0.713171 |
f728c9f3e5886546245806934d3923b1b99bcbf6 | 2,735 | # frozen_string_literal: true
class ApplicationController < ActionController::Base
include HykuHelper
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception, prepend: true
force_ssl if: :ssl_configured?
helper Openseadr... | 30.054945 | 104 | 0.693967 |
ab22b03fc89b9ae391e9c5faeb320ccf557f1f63 | 2,879 | module Vocab
module Converter
class Rails < Base
SEPARATOR_ESCAPE_CHAR = "\001"
class << self
def convert_xml_to_yml( file = nil )
xml_root = 'hash'
keys = xml_to_yml_keys( Hash.from_xml( File.read( file ) )[ xml_root ] )
unwound_keys = unwind_keys( keys )
... | 33.091954 | 110 | 0.544634 |
08eab6e25524b69d443e57380a0362c102c76351 | 397 | # frozen_string_literal: true
require "spec_helper"
require_relative "../../../lib/lark/record_parsers/json_parser"
RSpec.describe Lark::RecordParsers::JSONParser do
subject(:parser) { described_class.new }
describe "#parse" do
let(:input) { StringIO.new('{ "key": "value" }') }
it "parses data to a hash... | 23.352941 | 63 | 0.680101 |
2615de2cde26ddd25a2a613185ec4de1c76cfcec | 1,253 | # frozen_string_literal: true
module FinishedGoodsApp
class EcertAgreementInteractor < BaseInteractor
def update_agreements
res = nil
repo.transaction do
res = api.update_agreements
raise Crossbeams::InfoError, res.message unless res.success
end
success_response(res.messag... | 24.096154 | 77 | 0.681564 |
2155060a4a98a69afa4e90e5c43601e6af521258 | 326 | require "logstash/devutils/rspec/spec_helper"
unless defined?(LogStash::OSS)
LogStash::OSS = ENV['DISTRIBUTION'] != "default"
end
require "logstash/outputs/elasticsearch"
module LogStash::Outputs::ElasticSearch::SpecHelper
end
RSpec.configure do |config|
config.include LogStash::Outputs::ElasticSearch::SpecHelp... | 23.285714 | 61 | 0.788344 |
7a8c87c7183f1e3ce40bee9b4a15786849210d50 | 9,545 | #
# Author:: Joshua Timberman (<joshua@opscode.com>)
# Copyright:: Copyright (c) 2009 Opscode, Inc
# License:: Apache License, Version 2.0
#
# 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
#
# ... | 36.431298 | 215 | 0.571503 |
1c7f234ac49d3285fc715a2d86a58077faf03b4b | 1,149 | #
# Cookbook:: test
# Recipe:: source_next
#
# Copyright:: 2021, Dominik Jessich
#
# 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 ... | 28.02439 | 85 | 0.7302 |
9131997d6ab3e7124e2254841491fb3f2e320ae8 | 41 | require 'pry'
class Scraper
end | 5.857143 | 14 | 0.609756 |
21007b844cdff42e1cab34b675431a4e7d8e6385 | 766 | require_relative '../spec_helper'
describe 'symbol' do
it 'can be built dynamically' do
:"foo #{1 + 1}".should == :"foo 2"
end
describe '#inspect' do
it 'returns a code representation of the symbol' do
:foo.inspect.should == ':foo'
:foo_bar.inspect.should == ':foo_bar'
:"foo bar".inspe... | 24.709677 | 68 | 0.597911 |
bb95be74157cb0c4f9b2e41983e902a1994c1105 | 1,486 | cask 'metasploit' do
version '4.16.9+20170923102137'
sha256 'aecbc70a245225ad4dee778b429bfdaf8298ad840adf3903df46c680adf6b9d2'
url "https://osx.metasploit.com/metasploit-framework-#{version}-1rapid7-1.pkg"
appcast 'https://osx.metasploit.com/LATEST',
checkpoint: '023251abb87b2f6c27b873e2a523905f6c57e... | 39.105263 | 88 | 0.705922 |
6abc1b99df1a0b4256c41ea2105ab3d47dfad583 | 7,073 | # Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either lic... | 39.077348 | 245 | 0.694189 |
1abfa82e10d03082fdccf49faef1913c3f00b5ed | 716 | class GemCollector::Webhooks
def initialize(octokit)
@octokit = octokit
end
def create(full_name)
hook = find_hook(full_name)
unless hook
@octokit.create_hook(full_name, WEBHOOK_NAME, { url: WEBHOOK_URL, content_type: 'json' }, { events: WEBHOOK_EVENTS, active: true })
end
end
def remo... | 23.866667 | 138 | 0.685754 |
edf0754966adc4360c3c74e6fd220a9ce92c7f6f | 873 | module SuperGood
module SolidusTaxjar
module CalculatorHelper
extend ActiveSupport::Concern
def incomplete_address?(address)
return true if address.is_a?(Spree::Tax::TaxLocation)
[
address.address1,
address.city,
address.state&.abbr || address.state_name... | 22.384615 | 68 | 0.593356 |
f7170950c3f32ae436c4995159b2633dff3096c9 | 765 | module Export
# Export and de-pseudonymise monthly / annual KIT death PID extract
# Specification: plan.io #25535 / MBIS project 276
class KitDeathsPid < DeathFileSimple
# pr = Project.find(276)
# pr.project_nodes.sort_by(&:id).collect { |data_item| data_item.name }
FIELDS = (
%w[mbisid nhsnorss... | 28.333333 | 93 | 0.653595 |
4ae65e319c3fdc4732c73da934fc1ea30b448fb8 | 1,004 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
Gem::Specification.new do |spec|
spec.name = "street-happening-mailer"
spec.version = 1
spec.authors = ["Josef Šimánek"]
spec.email = ["josef.simanek@gmail.com"]
spe... | 35.857143 | 74 | 0.669323 |
e9c6927701d7a3c629c42047c536e9759f0f163e | 576 | require 'executable'
class TestExecutable < Test::Unit::TestCase
class SampleCli
include Executable
attr :result
def initialize
@result = []
end
def output=(value)
@result << "output: #{value}"
end
def jump
@result << "jump"
end
end
#
def test_parse_witho... | 14.769231 | 52 | 0.607639 |
33ad2cbe5fa687286df96332cdaf3c701e66b6ca | 5,438 | class AnimeDownloader < Formula
include Language::Python::Virtualenv
desc "Download your favourite anime"
homepage "https://github.com/vn-ki/anime-downloader"
url "https://files.pythonhosted.org/packages/f5/61/feb32904b5fa1d1e36908bb781f722e924402e329dbb538ce5cb5eb8c44c/anime-downloader-4.3.0.tar.gz"
sha256 ... | 44.211382 | 144 | 0.812615 |
1c1b577f80d1386b9fc166ac96748ef784c349bb | 117 | class Patient < UserBase
belongs_to :health_plan, optional: true
validates :health_plans_id, presence: true
end
| 19.5 | 44 | 0.786325 |
33485e3ad0345e79c88df9dca3f6038e8a6c7bd8 | 461 | module TerraspacePluginGoogle::Interfaces
class Config
include Terraspace::Plugin::Config::Interface
include Singleton
# interface method
# load_project_config: config/plugins/google.rb
def provider
"google"
end
# interface method
def defaults
c = ActiveSupport::OrderedOp... | 20.954545 | 51 | 0.678959 |
288769dbe1259eede08b36a70f099fcc9219c245 | 3,422 | require "spec_helper"
RSpec.describe Sentry::Rails::Tracing, type: :request do
let(:transport) do
Sentry.get_current_client.transport
end
let(:event) do
transport.events.last.to_json_compatible
end
after do
transport.events = []
end
context "with traces_sample_rate set" do
before do
... | 32.903846 | 108 | 0.69024 |
280de2d6f66b23c2ca4ec2f6871da6cbb22e23f8 | 1,173 | class Infracost < Formula
desc "Cost estimates for Terraform"
homepage "https://www.infracost.io/docs/"
url "https://github.com/infracost/infracost/archive/v0.7.1.tar.gz"
sha256 "b28379c767d1c2e94b3824c4ff34223621856b85bcb69ee2de9f9347bae6e51c"
license "Apache-2.0"
head "https://github.com/infracost/infraco... | 36.65625 | 93 | 0.744246 |
5d7f2f76e1bbcdeaba213112c365c785b6a57b81 | 620 | class Groups::PasswordsController < Devise::PasswordsController
# GET /resource/password/new
# def new
# super
# end
# POST /resource/password
# def create
# super
# end
# GET /resource/password/edit?reset_password_token=abcdef
# def edit
# super
# end
# PUT /resource/password
# def... | 18.787879 | 73 | 0.701613 |
e81cd8eb1b08adf14df8ecaf5c4a233bd8654770 | 3,092 | # frozen_string_literal: true
# This file has been generated based on the Unicode Common Locale Data Repository.
# Do not edit directly.
# Shared namespace for all units. This module can safely be included in Object or
# your own namespace, to avoid long class prefixes.
module Nii::Units
# Instances of this class r... | 33.608696 | 82 | 0.612549 |
d5fcaf96f50495e2b928115e1b9b7abce5cf96b5 | 1,088 | require 'spec_helper'
require 'apartment/migrator'
describe Apartment::Migrator do
let(:tenant){ Apartment::Test.next_db }
# Don't need a real switch here, just testing behaviour
before { allow(Apartment::Tenant.adapter).to receive(:connect_to_new) }
describe "::migrate" do
it "switches and migrates" do... | 28.631579 | 82 | 0.706801 |
d5f3a93ad26e5a638fdc76b78fca5bf6f49b2fd4 | 1,904 | # This file is copied to spec/ when you run 'rails generate rspec:install'
ENV['RAILS_ENV'] ||= 'test'
require_relative 'dummy/config/environment'
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
require 'spec_helper'
r... | 41.391304 | 86 | 0.742122 |
f8ff59281120a0fe07491b4c254ebc01a71fdcfe | 50 | module Hyrax
VERSION = '3.0.0-beta1'.freeze
end
| 12.5 | 32 | 0.7 |
7a93007386bb735787a5b6823872870856b0765b | 3,421 | class GdkPixbuf < Formula
desc "Toolkit for image loading and pixel buffer manipulation"
homepage "https://gtk.org"
url "https://download.gnome.org/sources/gdk-pixbuf/2.38/gdk-pixbuf-2.38.2.tar.xz"
sha256 "73fa651ec0d89d73dd3070b129ce2203a66171dfc0bd2caa3570a9c93d2d0781"
bottle do
sha256 "07d351a8ad7e280... | 30.544643 | 93 | 0.660041 |
1c727c16caaffc7ab262107afeb45525fcda27c8 | 1,262 | module PatientReportable
extend ActiveSupport::Concern
LTFU_TIME = 12.months
included do
has_many :patient_states, class_name: "Reports::PatientState"
delegate :sanitize_sql, to: ActiveRecord::Base
scope :with_diabetes, -> { joins(:medical_history).merge(MedicalHistory.diabetes_yes).distinct }
... | 32.358974 | 108 | 0.714739 |
874c6254988484db543424e61fc79c86d315a305 | 480 | cask 'consul@1.6.0' do
version '1.6.0'
sha256 'cda9a251036ce1f14db59af68dbc7499ac88490dfff794c998f8120d00812a58'
# releases.hashicorp.com was verified as official when first introduced to the cask
url 'https://releases.hashicorp.com/consul/1.6.0/consul_1.6.0_darwin_amd64.zip'
appcast 'https://github.com/hash... | 30 | 85 | 0.766667 |
87d08b8e0fbe25bf89b7bdfb29f34f1a82c85947 | 1,131 | # -*- encoding: utf-8 -*-
# stub: will_paginate 3.1.5 ruby lib
Gem::Specification.new do |s|
s.name = "will_paginate".freeze
s.version = "3.1.5"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Misla... | 47.125 | 227 | 0.72237 |
614a53969f18d67e9acb29284cd8eeb00afb0fb2 | 486 | class CreateTransitShapes < ActiveRecord::Migration[5.2]
def change
create_table :transit_shapes, id: false do |t|
t.bigserial :id, primary_key: true
t.string :gtfs_id, null: false
t.st_point :lonlat, geographic: true
t.integer :seq... | 34.714286 | 71 | 0.611111 |
bbb419e30525b1bd265bc382147d680d5f8778f3 | 41 | module Unbundler
VERSION = "0.0.2"
end
| 10.25 | 19 | 0.682927 |
bf994da13df74d63f0fc7c4514defdf8c434c82a | 96 | require 'rails_helper'
RSpec.describe Admin::HandbooksController, :type => :controller do
end
| 16 | 66 | 0.78125 |
1ce47f4504ee97577735766d25bddf2bf3b61b49 | 356 | class Word < ActiveRecord::Base
belongs_to(:words)
validates(:name, :presence => true, uniqueness: { case_sensitive: false})
before_save(:capitalize_first_letter)
validates :name, format: { with: /[a-zA-Z]/}
private
def capitalize_first_letter
name = self.name.split(" ")
self.name = name.map{|word| ... | 23.733333 | 75 | 0.696629 |
1135783cdd974fa7a6ce0040dfa71a00b52c63b4 | 244 | require "object_logging/log/base"
module ObjectLogging
module Log
class Stdout < Base
def log(level, context, message)
super
puts "[#{level.downcase}] #{context} #{message}"
end
end
end
end | 17.428571 | 56 | 0.590164 |
4a87fb8bb840d444855dfba77c4dac92184db180 | 2,722 | require "spec_helper"
RSpec.describe Electretri::Calculate do
let(:result){ YAML.load_file(result_yml) }
context "raised" do
it "is not a hash" do
expect { Object.extend(Electretri).result('project') }.to raise_error(RuntimeError, /Expected hash value!/)
end
end
context "calculate" do
cont... | 37.805556 | 113 | 0.676341 |
7908458a43e216c71d6991ab5244ec1c7bb18bad | 261 | cask 'resxtreme' do
version :latest
sha256 :no_check
url 'http://resxtreme.com/download/ResXtreme.zip'
name 'ResXtreme'
homepage 'http://resxtreme.com/'
app 'ResXtreme.app'
zap trash: '~/Library/Preferences/info.chrismiles.ResXtreme.plist'
end
| 20.076923 | 68 | 0.727969 |
7a8e3fc30cc17fed4d12d9b9b1e3bd0a1b03efa8 | 123 | json.array!(@places) do |place|
json.extract! place, :id, :name, :address
json.url place_url(place, format: :json)
end
| 24.6 | 43 | 0.691057 |
03f96fac19f68d9468ee32d0ccf5bb1273968d55 | 126 | require 'rails_helper'
RSpec.describe Speaking, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end
| 21 | 56 | 0.746032 |
e8975afedba59d7da0804800f6a9242941e11033 | 1,120 | require File.expand_path('../../spec_helper', __FILE__)
module ProjectSpecs
describe CaseConverter do
it 'converts a name to the plist format' do
result = CaseConverter.convert_to_plist(:project_ref)
result.should == 'ProjectRef'
end
it 'converts a name to the plist format starting with a lo... | 32.941176 | 80 | 0.713393 |
7a2b7c92bd1c420a56d2d4ea00503acd239194b1 | 674 | # frozen_string_literal: true
require 'fast_spec_helper'
require_relative '../../../../rubocop/cop/rspec/modify_sidekiq_middleware'
RSpec.describe RuboCop::Cop::RSpec::ModifySidekiqMiddleware do
subject(:cop) { described_class.new }
it 'registers an offense and corrects', :aggregate_failures do
expect_offens... | 28.083333 | 86 | 0.675074 |
18edcde7e545e21398301f5898341d2f283d5b3e | 1,296 | Pod::Spec.new do |s|
s.name = "ReSwift"
s.version = "5.0.0"
s.summary = "Unidirectional Data Flow in Swift"
s.description = <<-DESC
ReSwift is a Redux-like implementation of the unidirectional data flow architecture in Swift.
It ... | 39.272727 | 124 | 0.584105 |
abb95e6f21224b41f683e8f759c0cd4893123f07 | 331 | Rails.application.config.assets.precompile += %w(
better_rails_debugger/jquery.min.js
better_rails_debugger/bootstrap.min.js
better_rails_debugger/moment.min.js
better_rails_debugger/place.min.js
better_rails_debugger/popper.min.js
better_rails_debugger/Chart.min.js
better_rails_debugger/prism.css
better_rails_debugger... | 33.1 | 49 | 0.873112 |
b9d705e568b7997bd7198626959c130eac515312 | 3,423 | # -*- encoding: utf-8 -*-
# stub: jekyll 3.8.6 ruby lib
Gem::Specification.new do |s|
s.name = "jekyll".freeze
s.version = "3.8.6"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Tom Preston-Werner"... | 47.541667 | 112 | 0.630733 |
28817bab3255fd94923743e0f947407d8ae44d96 | 1,504 | # encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
# This class serves as the base for objects wanting to monitor and respond to
# incoming web requests. Examples include cross application tracing and
# synthetic... | 33.422222 | 132 | 0.71875 |
87f7e6460deeb9d814418ee0e75fa03e7df17037 | 8,113 | require 'rest_client'
require 'active_support/core_ext/hash/conversions'
module JdPay
module Service
UNIORDER_URL = 'https://paygate.jd.com/service/uniorder'
QUERY_URL = 'https://paygate.jd.com/service/query'
REFUND_URL = 'https://paygate.jd.com/service/refund'
H5_PAY_URL = 'https://h5pay.jd.com/jdpa... | 38.089202 | 114 | 0.632319 |
1daf3c9ff621c705840ad0f5f14019add4fc28e4 | 299 | class Nethackcocoa < Cask
version '0.3.4'
sha256 '83a9db8f633996a563fbe939141404625f9cf66180612215484f391df0475e94'
url "https://nethack-cocoa.googlecode.com/files/NetHackCocoa-#{version}.dmg"
homepage 'https://code.google.com/p/nethack-cocoa/'
license :oss
app 'NetHackCocoa.app'
end
| 27.181818 | 78 | 0.772575 |
d59845d8f26b492a4e173c22da11977486621e86 | 1,261 | # frozen_string_literal: true
require "rails_helper"
RSpec.describe CookbookRailsSchema do
describe ".resolve_type" do
it "resolves the given type dynamically" do
[Menu, Recipe, User].each do |klass|
expect(described_class.resolve_type(nil, klass.new, nil).name).
to eq(klass.name)
... | 27.413043 | 75 | 0.668517 |
0308722e44ef622890ec4c4438f4f556ad0f6055 | 70 | module RadialIndicator
module Rails
VERSION = "0.1.0"
end
end
| 11.666667 | 22 | 0.685714 |
9154a159c738c23f62f1686275aabe7237895276 | 60 | # typed: true
while class Foo; tap do end; end; break; end
| 15 | 44 | 0.683333 |
ffd356fd180d0b5b546ae0432f6f8ccda5bb2ec7 | 972 | class UsersController < ApplicationController
def new
@user = User.new
end
def create
@user = User.new user_params
@user.password = 'password'
@user.password_confirmation = 'password'
@user.save
if @user.save
# The `session` is an object available in all controllers.
# It use... | 25.578947 | 89 | 0.658436 |
e9e8b5c69e44803a8c74c0f8dca207987bedd37a | 3,842 | =begin
#Ory APIs
#Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers.
The version of the OpenAPI document: v0.0.1-alpha.93
Contact: support@ory.sh
Generated by: https://openapi-generator.tech
O... | 32.285714 | 177 | 0.732171 |
1d1bd9c1d120111451d1b53c19cad183689f6495 | 21,406 | require 'spec_helper'
require "#{File.dirname(__FILE__)}/../support/tables_spec_helper"
describe "BulkMethodsMixin" do
include TablesSpecHelper
before do
class Employee < ActiveRecord::Base
extend BulkMethodsMixin
end
create_tables
end
describe "create_many" do
context "when call metho... | 49.09633 | 103 | 0.458049 |
391d7e38c96a98606f74732f24660f217e153c10 | 19,021 | # typed: true
# frozen_string_literal: true
module Homebrew
# Helper module for querying Homebrew-specific environment variables.
#
# @api private
module EnvConfig
extend T::Sig
module_function
ENVS = {
HOMEBREW_ARCH: {
description: "Linux only: Pass this va... | 46.279805 | 117 | 0.555702 |
ff8af6b93bca73f5b13f74ff64b159568ca4e4cd | 615 | class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
def url
Rails.application.routes.url_helpers.send("api_v1_#{class_name}_url", self)
end
def relationships_url(association)
Rails.application.routes.url_helpers.send("relationships_#{association}_api_v1_#{class_name}_url", self)
... | 23.653846 | 108 | 0.75935 |
e24b6bf9b86761bf759a5ffe5a772bc9acb8dec0 | 1,310 | require 'spec_helper'
describe PagesController do
let(:user) { create(:user) }
describe 'GET #welcome' do
context 'user is not signed in' do
it 'responds with a 200' do
get :welcome
expect(response.status.to_i).to eql(200)
end
it 'sends cookbook count to the view' do
... | 20.46875 | 62 | 0.619847 |
916527350e0dabe4b7aee60d989d9a4c09a2da5e | 1,128 | module Giphy
class Client
def trending(options={})
get('/trending', options)
end
def translate(word)
get('/translate', s: word)
end
def search(keyword, options={})
options_hash = {q: keyword}.merge(options)
get('/search', options_hash)
end
def favorite(id)
... | 18.193548 | 56 | 0.580674 |
ace91a22d1f6451d29c6beaa3cd5c815a09e9c10 | 1,240 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'caracal/version'
Gem::Specification.new do |spec|
spec.name = 'caracal'
spec.version = Caracal::VERSION
spec.authors = ['Trade Infomatics', 'John Dugan']
spec.email ... | 42.758621 | 176 | 0.659677 |
bbb6daa8b167520053e484747fc27c71eceae648 | 452 | module Accounts
module EventLinkPolicy
class Finder
attr_reader :event
delegate :entity, to: :event
delegate :route, :linkable?, to: :policy
def initialize(opts = {})
@event = opts.fetch(:event)
end
private
def policy
"#{self.class.to_s.deconstantize}:... | 20.545455 | 93 | 0.621681 |
f8d12e9f8e6ddff49b4814e6960a3983c647ac78 | 108 | class Answer < ApplicationRecord
belongs_to :question
validates :body, :question_id, presence: true
end
| 21.6 | 47 | 0.787037 |
18f2757a58961a233d1b85ba29510e9e2646cc31 | 81 | module FeedbackHelper
include CommonwealthVlrEngine::FeedbackHelperBehavior
end | 27 | 55 | 0.901235 |
b9fb5e40acd1c8a2231048a7dee64f6d95115e14 | 57 | class Item < ActiveRecord::Base
belongs_to :user
end | 19 | 32 | 0.736842 |
181b7999f707f4a587311e6fd1f6819b838d114d | 292 | cask "font-miniver" do
version :latest
sha256 :no_check
url "https://github.com/google/fonts/raw/main/ofl/miniver/Miniver-Regular.ttf",
verified: "github.com/google/fonts/"
name "Miniver"
homepage "https://fonts.google.com/specimen/Miniver"
font "Miniver-Regular.ttf"
end
| 24.333333 | 81 | 0.722603 |
f718ad814d33ecb49e27053ae838ca0bb0c18eef | 370 | Given /^the following posts:$/ do |posts|
Post.create!(posts.hashes)
end
When /^I delete the (\d+)(?:st|nd|rd|th) post$/ do |pos|
visit posts_path
within("table tr:nth-child(#{pos.to_i+1})") do
click_link "Destroy"
end
end
Then /^I should see the following posts:$/ do |expected_posts_table|
expected_pos... | 24.666667 | 68 | 0.683784 |
b92f2188e98b16bde0e4385898840af172de2b54 | 2,286 | module Spree
module Api
class VariantsController < Spree::Api::BaseController
before_filter :product
def create
authorize! :create, Variant
@variant = scope.new(variant_params)
if @variant.save
respond_with(@variant, status: 201, default_template: :show)
els... | 29.307692 | 133 | 0.608049 |
ab783d40315bb702910ffe86091ceff4c3eb2d42 | 1,508 | # frozen_string_literal: true
require 'spec_helper'
describe 'cis_hardening::setup::sudo' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }
# Section 1.3 - Configure sudo
# Ensure sudo is installed - Section 1.3.1
it {
is_expected.... | 29.568627 | 87 | 0.54443 |
bfc78f8ddd830f1105718620c68dcc35b54b9a10 | 347 | class Author
include Mongoid::Document
include Mongoid::Slug
field :name, type: String
field :permalink, type: String
field :direction, type: String, default: 'rtl'
validates_presence_of :name, :permalink, :direction
validates_uniqueness_of :permalink
slug :permalink
embeds_many :translations
i... | 19.277778 | 53 | 0.740634 |
e2d8363551222ac4d80873914084e86366f61d3f | 435 | class CreateErpQuangminhProductBrands < ActiveRecord::Migration[5.1]
def change
create_table :erp_quangminh_product_brands do |t|
t.string :image_url
t.string :name
t.string :description
t.string :meta_keywords
t.string :meta_description
t.string :alias
t.integer :custom_... | 25.588235 | 68 | 0.682759 |
1cbe73472474d619c38266e1dcde809745225b31 | 279 | class DataController < ApplicationController
def index
end
def petitions
end
def petitions_count
render partial:'data/petitions/petitions_count'
end
def petitions_support_spread
render partial:'data/petitions/petitions_support_spread'
end
end
| 14.684211 | 60 | 0.756272 |
38823a9177a70b0a7b605061caa2f366e3b25313 | 925 | # frozen_string_literal: true
require_relative 'collection/images'
require_relative 'collection/metadata'
module WaxTasks
#
class Collection
attr_reader :name, :config, :ext, :search_fields,
:page_source, :metadata_source, :imagedata_source
include Collection::Metadata
include Collect... | 30.833333 | 91 | 0.660541 |
f81193bc7e1e94e83167d77c5ece733cf58d857a | 639 | module EventStore
module HTTP
module Controls
module Hostname
def self.example
Available.example
end
module Other
def self.example
Available::Other.example
end
end
module Available
def self.example
'eve... | 17.75 | 42 | 0.499218 |
ed9f9e188d425474f6fff5fc2a3e2b5d275d3243 | 1,011 | # frozen_string_literal: true
require "parallel"
require "uri"
require_relative "./collector"
class Crawler
attr_reader :path_to_list
SKIP_DOWNLOADED = true
def initialize(path_to_list)
@path_to_list = path_to_list
end
def crawl
raise ArgumentError, "Please input a valid file path" unless valid_... | 18.381818 | 77 | 0.680514 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.