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 |
|---|---|---|---|---|---|
abc20238e6ea6338f6c5889c49c5635e3ce7078c | 263 | class CreateRelatedLinks < ActiveRecord::Migration[6.0]
def change
create_table :related_links do |t|
t.references :work, null: false, foreign_key: true
t.string :link_title
t.string :url, null: false
t.timestamps
end
end
end
| 21.916667 | 56 | 0.676806 |
9136288305a1a95efc79baa9a3c9076108c749be | 1,421 | class Io < Formula
desc "Small prototype-based programming language"
homepage "http://iolanguage.com/"
url "https://github.com/IoLanguage/io/archive/2017.09.06.tar.gz"
sha256 "9ac5cd94bbca65c989cd254be58a3a716f4e4f16480f0dc81070457aa353c217"
license "BSD-3-Clause"
revision 1
head "https://github.com/IoLan... | 28.42 | 85 | 0.664321 |
1cd1a6d553b99e2f6a65e3c6e6f4a99d5813df46 | 1,026 | # frozen_string_literal: true
# module to Prepare Solicitations to persist in database
module PrepareSolicitationsToSave
def group_solicitation(solicitations)
group_room_solicitation = []
weeks = %w[Segunda Terca Quarta Quinta Sexta Sabado]
weeks.each do |day_of_week|
rows = row_mount(day_of_week, ... | 29.314286 | 63 | 0.648148 |
edf87172a25da0889b78f8a786e7541032d733ef | 2,378 | # frozen_string_literal: true
require "cfplist/version"
require "cfplist/cfplist"
# Main CFPlist Module.
module CFPlist
class << self
def [](object, opts = {})
if object.respond_to? :to_str
CFPlist.parse(object.to_str, opts)
else
CFPlist.generate(object, opts)
end
end
end... | 22.647619 | 78 | 0.637931 |
f8c89d6573d7d43b3fae2b93b6b6dd31f971c325 | 1,962 | require 'spec_helper'
describe Telapi::Conference do
before do
stub_telapi_request
set_account_sid_and_auth_token
end
it { should be_kind_of(Telapi::Resource) }
describe ".list" do
before { stub_telapi_request('{ "conferences": [] }') }
it "calls api via http get and returns a ResourceCollec... | 26.876712 | 91 | 0.674312 |
e21c977c8d334a8c30942f6aa476d18660a53562 | 177 | cask 'surge' do
version :latest
sha256 :no_check
url 'http://dl.nssurge.com/mac/Surge-latest.zip'
name 'Surge'
homepage 'https://nssurge.com/'
app 'Surge.app'
end
| 16.090909 | 50 | 0.677966 |
bb07b480c69dd6a96d66cc217611fc0959c38756 | 2,140 | require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
class TimePredicateTest < SemanticAttributes::TestCase
def setup
@predicate = Predicates::Time.new(:foo)
end
def test_default_validation
assert !@predicate.validate('2007-07-19 00:00:00', nil), 'value may not be a string, even if st... | 42.8 | 111 | 0.7 |
ff3ecacc600cbddbbb45c4083d2d041001cc1942 | 316 | # Plugin to add environment variables to the `site` object in Liquid templates
module Jekyll
class EnvironmentVariablesGenerator < Generator
def generate(site)
site.config['env'] = ENV['JEKYLL_ENV'] || 'development'
# Add other environment variables to `site.config` here...
end
end
end
| 21.066667 | 78 | 0.705696 |
b9215dba98336713541b422a4759d66ef583b254 | 6,847 | #!/usr/bin/env ruby
require 'dotenv'
require 'erubis'
def osx?
RUBY_PLATFORM.downcase =~ /darwin/
end
# This script will create a fully-working gov.uk-style setup locally
`./make_env`
Dotenv.load './env'
organisation = 'theodi'
projects = {
'signonotron2' => 'signon',
'static' => 'static',
... | 24.280142 | 265 | 0.626114 |
7a00806b5e2030ed7001573250cbc529c2eb31cb | 1,707 | class PinentryMac < Formula
desc "Pinentry for GPG on Mac"
homepage "https://github.com/GPGTools/pinentry-mac"
url "https://github.com/GPGTools/pinentry-mac/archive/v0.9.4.tar.gz"
sha256 "037ebb010377d3a3879ae2a832cefc4513f5c397d7d887d7b86b4e5d9a628271"
head "https://github.com/GPGTools/pinentry-mac.git"
b... | 37.933333 | 93 | 0.783245 |
6a5cc61f22578b4c09447c49cc55038bab415703 | 1,371 | # 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 source for your
# dat... | 42.84375 | 86 | 0.704595 |
0168d3b2f349606cee1d45b05c4b8656bf66f73a | 4,276 | #--
# Copyright: Copyright (c) 2010-2013 RightScale, Inc.
#
# 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 limitation the rights to use, copy, modify... | 35.932773 | 102 | 0.706034 |
21745878ba785c19d676cd020640722851b5388e | 317 | class CreateCharts < ActiveRecord::Migration
def change
create_table :charts do |t|
t.integer :topic_id, null: false
t.string :name, null: false
t.string :state, null: false
t.string :slug, null: false
t.timestamps null: false
end
add_index :charts, :topic_id
end
end
| 19.8125 | 44 | 0.649842 |
28f8da7c12fa975935ffaaca4a1ffce2fd8bd85a | 21,498 | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 50.943128 | 186 | 0.622616 |
18eaf570f25943c40df70b04268f342e798fc8f8 | 1,555 | cask "tunnelblick-beta" do
version "3.8.6beta06,5707"
sha256 "ca66fa55a45db1aa9e9e7d50843bf5176f2ded07d768ecbaff23ecd2982c9d84"
url "https://github.com/Tunnelblick/Tunnelblick/releases/download/v#{version.before_comma}/Tunnelblick_#{version.before_comma}_build_#{version.after_comma}.dmg",
verified: "github... | 33.085106 | 163 | 0.717685 |
622b8ff5a2466162d60a3d24560e217370ae873a | 22,639 | # -*- encoding: utf-8 -*-
require 'rack/utils'
require 'rack/mock'
require 'timeout'
describe Rack::Utils do
# A helper method which checks
# if certain query parameters
# are equal.
def equal_query_to(query)
parts = query.split('&')
lambda{|other| (parts & other.split('&')) == parts }
end
def k... | 39.440767 | 113 | 0.614294 |
38034358e0f560a2c31fba1f7160850c5ddade10 | 534 | class UserMember < CustomTranslation
include Mongoid::Document
include Mongoid::Timestamps
#############################
belongs_to :group, class_name: 'User', inverse_of: :members
belongs_to :member, class_name: 'User', inverse_of: :groups
#############################
attr_accessible :group_id, :mem... | 21.36 | 61 | 0.543071 |
5d2260eb13c9dec65607556fccc2536671b4fd0f | 1,958 | shared_context 'api v3 brazil importer qual values' do
include_context 'api v3 quals'
include_context 'api v3 brazil soy nodes'
let!(:api_v3_importer_zero_deforestation_value) do
Api::V3::NodeQual.where(
node_id: api_v3_importer1_node.id, qual_id: api_v3_zero_deforestation.id, year: nil
).first ||
... | 30.123077 | 94 | 0.678754 |
f824eac2f55cb254d728cd120fd2bc277636edad | 3,823 | # frozen_string_literal: true
describe ProGrammar do
describe 'loading rc files' do
before do
ProGrammar.config.rc_file = 'spec/fixtures/testrc'
stub_const('ProGrammar::LOCAL_RC_FILE', 'spec/fixtures/testrc/../testrc')
ProGrammar.instance_variable_set(:@initial_session, true)
ProGrammar.... | 33.831858 | 104 | 0.659953 |
61775c573c9a1bead03fcae71fa278301cd29867 | 384 | class WelcomeController < ApplicationController
before_action :set_sentry_context
def index
1 / 0
end
def view_error
end
def report_demo
# @sentry_event_id = Raven.last_event_id
render(:status => 500)
end
private
def set_sentry_context
counter = (Sentry.get_current_scope.tags[:cou... | 16.695652 | 64 | 0.710938 |
4a7c4fdc863e1fbd7e0b273c81c3be1873744ac2 | 2,716 | # 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::Network::Mgmt::V2018_04_01
module Models
#
# Response for the ListRoute API service call
#
class RouteListResult
incl... | 27.434343 | 80 | 0.515096 |
f82bd913970333ba68bd20d9722756a27ddcf0e9 | 2,610 | class Telegraf < Formula
desc "Server-level metric gathering agent for InfluxDB"
homepage "https://influxdata.com"
url "https://github.com/influxdata/telegraf/archive/1.4.0.tar.gz"
sha256 "4d6be93ef8881cfbf1cde7b1421e0cf6e998086adde16d1201df8c38b389078b"
head "https://github.com/influxdata/telegraf.git"
bo... | 33.461538 | 106 | 0.653257 |
87025d32b5404700e0e57647695ad51cef8d7001 | 3,585 | #-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2020 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork ... | 32.297297 | 95 | 0.730265 |
7a703644c679a07825f0bac1003ac9af554ce86b | 3,549 | # Meant to be in a Controller, included in our ControllerOverride module.
module BlacklightRangeLimit
module SegmentCalculation
protected
# Calculates segment facets within a given start and end on a given
# field, returns request params to be added on to what's sent to
# solr to get the calculated ... | 32.559633 | 94 | 0.630037 |
38a6fdad354906fb1a5e1bc49a1219e205dc2cb5 | 1,763 | # frozen_string_literal: true
require 'test_helper'
class StackEntryTest < ActiveSupport::TestCase
it '#destroy updates deleted_at and does not remove record from db' do
stack_entry = create(:stack_entry)
stack_entry.destroy
StackEntry.where(id: stack_entry.id).count.must_equal 1
end
it '#update_co... | 33.903846 | 84 | 0.757799 |
26fa20f856de195c6641f4e86eadb72eb80731cd | 40,527 | require 'carrierwave/orm/activerecord'
class Project < ActiveRecord::Base
include Gitlab::ConfigHelper
include Gitlab::ShellAdapter
include Gitlab::VisibilityLevel
include Gitlab::CurrentSettings
include AccessRequestable
include CacheMarkdownField
include Referable
include Sortable
include AfterComm... | 30.563348 | 141 | 0.726257 |
ac44adea9cca3bda860b5585671779fc902614ef | 1,608 | # frozen_string_literal: true
require 'spec_helper'
describe MergeRequest::Metrics do
describe '#review_start_at' do
it 'is the earliest date from first_comment_at, first_approved_at or first_reassigned_at' do
subject.first_approved_at = 1.hour.ago
subject.first_comment_at = 1.day.ago
subject.... | 25.935484 | 96 | 0.679104 |
ab256b3c832a7abd862a6894743cf299691c16e6 | 6,328 | # frozen_string_literal: true
# model for all user roles: volunteer supervisor casa_admin inactive
class User < ApplicationRecord
include Roles
include ByOrganizationScope
has_paper_trail
devise :database_authenticatable, :invitable, :recoverable, :validatable, :timeoutable, :trackable
validates :email, pr... | 33.839572 | 127 | 0.703066 |
21459f03e3d13a39f42971b2f989fe6bf2741a76 | 1,441 | # -*- encoding: utf-8 -*-
# stub: puma 3.12.1 ruby lib
# stub: ext/puma_http11/extconf.rb
Gem::Specification.new do |s|
s.name = "puma".freeze
s.version = "3.12.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.metadata = { "msys2_mingw_depende... | 53.37037 | 351 | 0.722415 |
ac442fcb9bbcd4b96529180c6b681c3f8eec72d3 | 30,332 | # 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::Network::Mgmt::V2020_06_01
#
# VirtualApplianceSites
#
class VirtualApplianceSites
include MsRestAzure
#
# Creates and in... | 46.592934 | 205 | 0.716504 |
188c94eea1f706a7c06fcf108ddfa11292d05282 | 2,457 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "warden-github"
s.version = "0.3.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Corey Donohoe"]
s.date = "2012-01-21"
s.description = "A warden strategy for easy oauth... | 40.95 | 105 | 0.595442 |
03666cebbea699e53e9e27da3cf0ea4b40ab5925 | 3,084 | #!/usr/bin/env ruby
# encoding: utf-8
require File.dirname(File.dirname(__FILE__)) + '/application.rb'
ARGV << '-h' if ARGV.empty?
options = {}
OptionParser.new do |opts|
opts.banner = "Usage: bulk_claim.rb [options]. Assumes collector and determiner are spelled exactly the same."
opts.on("-a", "--agent [agent_i... | 32.125 | 227 | 0.652724 |
e95b8a260d7a8d6818f937b6a6e5f66b5ca5be25 | 653 | Pod::Spec.new do |s|
s.name = 'SGLOpenGL'
s.version = '3.1.0'
s.summary = 'SwiftGL OpenGL Library'
s.description = <<-DESC
The SwiftGL OpenGL library allows for easy acess of OpenGL API from Swfit on macOS.
DESC
s.homepage = 'https://github.com... | 43.533333 | 98 | 0.558959 |
5dca1d3518ffc8edc61c5b73cf3cb7f540f35fd7 | 96 | # Tmdb::Api.key(ENV['THEMOVIEDB_API_KEY'])
Enceladus.connect(ENV['HBIZZLE_THEMOVIEDB_API_KEY']) | 32 | 52 | 0.791667 |
f82749a4fd56248ff39416613ebe51cddbd42e6a | 1,417 | require "active_record"
path = File.dirname(__FILE__) + "/authlogic/"
[
"i18n",
"random",
"regex",
"config",
"controller_adapters/abstract_adapter",
"crypto_providers",
"authenticates_many/base",
"authenticates_many/association",
"acts_as_authentic/email",
"acts_as_authentic/logged_in_status",
"acts_as... | 23.616667 | 73 | 0.770642 |
1a9e3e96c6d129bbb78f27d281ffc9098fbf5a0e | 723 | # Cookbook:: pentester
# Attributes:: gdb_dashboard
#
# 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 agr... | 40.166667 | 125 | 0.760719 |
bb585bcefe14c0cef938909b6e3437b2b3199a7e | 2,037 | # frozen_string_literal: true
require 'krane/kubernetes_resource/pod_set_base'
module Krane
class ReplicaSet < PodSetBase
TIMEOUT = 5.minutes
SYNC_DEPENDENCIES = %w(Pod)
attr_reader :pods
def initialize(namespace:, context:, definition:, logger:, statsd_tags: nil,
parent: nil, deploy_started_a... | 25.78481 | 108 | 0.650466 |
8719a6339af0f12a78fce9e1c1abe55de4eb7f15 | 4,820 | # Copyright (C) 2015 MongoDB, 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 writi... | 25.104167 | 81 | 0.587344 |
62d628c1325025118c3dcf85c9e384b68da2f0e2 | 61,698 | #
# tk/font.rb - the class to treat fonts on Ruby/Tk
#
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
#
require 'tk'
class TkFont
include Tk
extend TkCore
TkCommandNames = ['font'.freeze].freeze
(Tk_FontID = ["@font".freeze, "00000".taint]).instance_eval{
@mutex = Mutex.new... | 26.310448 | 98 | 0.55783 |
e828e9e4117705171c189e0ac09b0e884a4141f5 | 550 | # == Schema Information
#
# Table name: content_notes
#
# id :integer not null, primary key
# content_id :integer not null
# user_id :integer not null
# note :text not null
# created_at :datetime not null
# updated_at :datetime not null
#
cl... | 22.916667 | 53 | 0.590909 |
876908a6452f1a2c6da35ca087eb7caaf660e0ee | 80 | describe command('php --version') do
its('stdout') { should match /5.6/ }
end
| 20 | 38 | 0.65 |
5d16a003e8fa02e305e74bd729c8051691b72269 | 5,728 | class Alot < Formula
include Language::Python::Virtualenv
desc "Text mode MUA using notmuch mail"
homepage "https://github.com/pazz/alot"
url "https://github.com/pazz/alot/archive/0.8.1.tar.gz"
sha256 "823e2fae014c1036609068c6109042b676113a382eacbd04eb3dfa461ef53953"
head "https://github.com/pazz/alot.git"... | 41.208633 | 144 | 0.773568 |
0103cc3f49f2343649c50909443dc7ee1b181694 | 345 | cask :v1 => 'couchbase-server-enterprise' do
version '3.0.2'
sha256 '6129bd810ed8d5a27cc5d25e82b998e90f7b6f283fca8841592e0e842c8578d9'
url "http://packages.couchbase.com/releases/#{version}/couchbase-server-enterprise_#{version}-macos_x86_64.zip"
homepage 'http://www.couchbase.com/'
license :apache
app 'C... | 31.363636 | 113 | 0.773913 |
87eb36865d653a32292b6e4b0baf9c23f7c86128 | 25,353 | # frozen_string_literal: true
require "spec_helper"
require "dependabot/dependency"
require "dependabot/dependency_file"
require "dependabot/terraform/file_updater"
require_common_spec "file_updaters/shared_examples_for_file_updaters"
RSpec.describe Dependabot::Terraform::FileUpdater do
it_behaves_like "a dependenc... | 31.890566 | 111 | 0.486649 |
62f0e36ac2f22ca93b5aeb1789840c32a406ce46 | 2,626 | module MoreCoreExtensions
module StringToIWithMethod
NUMBER_WITH_METHOD_REGEX = /^([0-9\.,]+)\.([a-z]+)$/.freeze
# Converts to an Integer while also evaluating a method invocation
#
# This method is similar to #to_i, but does not support extraneous characters
# nor bases other than 10.
#
... | 29.840909 | 82 | 0.632521 |
ac427ebfd301db7a962bb08a4cdbe98ec7983d32 | 1,583 | # frozen_string_literal: true
# Abstract base controller for Claims controllers that use the SavedClaim
# and optionally, PersistentAttachment models. Subclasses must have:
#
# * `short_name()`, which returns an identifier that matches the parameter
# that the form will be set as in the JSON submission.
# * `claim_... | 31.66 | 114 | 0.754896 |
392a6afc6368650f029f1f43d02eaec10fac4aa8 | 707 | # frozen_string_literal: true
class Projects::Ci::PipelineEditorController < Projects::ApplicationController
before_action :check_can_collaborate!
before_action :setup_walkthrough_experiment, only: :show
before_action do
push_frontend_feature_flag(:schema_linting, @project, default_enabled: :yaml)
end
f... | 23.566667 | 107 | 0.772277 |
39b24aa32a5adc3185cc13908e2754997afcff26 | 265 | # frozen_string_literal: true
# Copyright The OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0
module OpenTelemetry
module Exporter
module Zipkin
## Current OpenTelemetry Zipkin exporter version
VERSION = '0.16.0'
end
end
end
| 17.666667 | 54 | 0.724528 |
e8fc658dcfb716c687b2268f47acfab929817161 | 383 | class AddPriceAdjustmentToVendorShopConfigurations < ActiveRecord::Migration[5.2]
def change
add_column :vendor_shop_configurations, :price_adjustment_value, :float, null: false, default: 0.0
add_column :vendor_shop_configurations, :price_adjustment_type, :string, null: false, default: :percent
add_index... | 42.555556 | 107 | 0.809399 |
bfc02f8dbea3788a9f3e250a3009bfea430e65e3 | 323 | class SessionsController < ApplicationController
def create
user = User.from_omniauth(request.env['omniauth.auth'])
session[:user_id] = user.id
flash[:success] = "Welcome, #{user.name}"
redirect_to root_url
end
def destroy
session[:user_id] = nil
flash[:success] = "Goodbye!"
redirect_to root_url
end
... | 23.071429 | 57 | 0.73065 |
1820d24cfa36eb258c472d4b8d76a65396629013 | 1,682 | # 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_09_07
module Models
#
# The resource model definition for a ARM proxy resource. It will have
# everything oth... | 26.28125 | 74 | 0.477408 |
610dc41a21def92a7a2ec6061ae6de3fe3a4921a | 3,575 | # 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... | 36.85567 | 84 | 0.616503 |
62a06b16fa12d3b949cd6b50223d2d08fd8c535c | 235 | class RemoveDefaultStatusOnVersion < ActiveRecord::Migration
def self.up
change_column :versions, :status, :integer, :default => nil
end
def self.down
change_column :versions, :status, :integer, :default => 70
end
end
| 23.5 | 63 | 0.723404 |
5d5ce92fa8519b8151b4ab07e6b12919dff18c29 | 8,204 | require 'rspec/core'
require 'rspec/core/formatters/base_formatter'
module Inspec::Formatters
class Base < RSpec::Core::Formatters::BaseFormatter
RSpec::Core::Formatters.register self, :close, :dump_summary, :stop
attr_accessor :backend, :run_data
def initialize(output)
super(output)
@run_... | 32.685259 | 125 | 0.652243 |
ac16cdc4f159224b687deda0e55df0436093d966 | 3,964 | # frozen_string_literal: true
require 'spec_helper'
require 'bolt_spec/conn'
require 'plan_executor/app'
require 'json'
require 'rack/test'
describe "PlanExecutor::App" do
include BoltSpec::Conn
include Rack::Test::Methods
let(:plan_name) { 'basic' }
let(:params) { {} }
let(:request) {
{
plan_nam... | 28.724638 | 97 | 0.644299 |
338a36932c4f94eadd58fc0e0f3f5d4c8c48b9ce | 5,286 | # frozen_string_literal: true
require 'rails_helper'
require 'claims_api/health_checker'
RSpec.describe 'Claims Status Metadata Endpoint', type: :request do
describe '#get /metadata' do
it 'returns metadata JSON' do
get '/services/claims/metadata'
expect(response).to have_http_status(:ok)
JSON... | 48.495413 | 91 | 0.707151 |
b90313d99eabd25a1a028ea9a5f878092adb1bc7 | 490 | require_relative 'graph'
class PathMeasurer
def initialize (graph)
@graph = graph
end
def distance (path)
begin
if path.count >= 2
previous_vertex = nil
distance = 0
path.each do | vertex |
if previous_vertex
distance += @graph.edge_distance(previous_vertex, vertex)
end
... | 10.425532 | 63 | 0.644898 |
1123e0371b36488d8d2037eb6735f0f8217a7c18 | 158 | FactoryBot.define do
factory :printer do
association :organization
association :printer_model
sequence(:name) { |n| "Sibilla #{n}" }
end
end
| 17.555556 | 42 | 0.683544 |
d5fd0435d56b0e8053ad5a64fa0e61fab1eadea7 | 940 | require 'socket'
module Muggy
module EC2
# stolen from ohai.
# XXX Seems to give false-positives.
def can_metadata_connect?(addr="169.254.169.254", port=80, timeout=2)
t = Socket.new(Socket::Constants::AF_INET, Socket::Constants::SOCK_STREAM, 0)
saddr = Socket.pack_sockaddr_in(port, addr)
... | 21.860465 | 83 | 0.579787 |
91b1e36874142becec87d1db53de595102951fff | 4,420 | require 'minitest/autorun'
require_relative '../../lib/poker/ranking'
module Poker
class RankingTest < Minitest::Test
def setup
@class = Ranking
end
def test_royal_flush?
suit = :spades
cards = [
Card.new(:ace, suit),
Card.new(:king, suit),
Card.new(:queen, suit... | 23.891892 | 79 | 0.542308 |
1a9cea83f8af6951b17e91f9023ab5a0d275c749 | 4,110 | # == Schema Information
# Schema version: 20081021084157
#
# Table name: stats
#
# id :integer(4) not null, primary key
# model_id :integer(4)
# model_type :string(255)
# stat_type :integer(4) not null
# day :integer(4)
# month :integer(4)
# year :integer(4)
# data :... | 39.142857 | 120 | 0.5382 |
1db49781cf33f606ed6f9c0d0996d20d50a065b3 | 207 | require 'rails_helper'
describe Nonprofit do
it { should have_many :order_items }
it { should belong_to :type }
it { should validate_presence_of :name }
it { should validate_presence_of :info }
end
| 23 | 42 | 0.743961 |
1ae010a708588de2cae13c1cd19508a0c841adb1 | 2,615 | class MecabIpadic < Formula
desc "IPA dictionary compiled for MeCab"
homepage "https://taku910.github.io/mecab/"
# Canonical url is https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7MWVlSDBCSXZMTXM
url "https://deb.debian.org/debian/pool/main/m/mecab-ipadic/mecab-ipadic_2.7.0-20070801+main.orig.tar.gz... | 42.868852 | 122 | 0.748375 |
abcdf642a96cb7bd6cf3a785f2f72164d1d8a75d | 4,635 | require 'test/unit'
require './src-gen-umple/student_v'
require './src-gen-umple/mentor_v'
require './src-gen-umple/program_v'
module CruiseAssociations
class NToNTest < Test::Unit::TestCase
def test_CreateStudentWithoutMentor
s = StudentV.new(99)
assert_equal(0,s.number_of_mentors)
end
... | 25.893855 | 56 | 0.65178 |
62fe5917e849d569572f37526bb218cb52b0ab24 | 206 | # frozen_string_literal: true
RSpec.describe Toggl do
it "has a version number" do
expect(Toggl::VERSION).not_to be nil
end
it "does something useful" do
expect(false).to eq(true)
end
end
| 17.166667 | 40 | 0.708738 |
ab532ac026bf987dc8f8766283e0f57806f0e042 | 134 | require_relative './config/environment'
use Rack::MethodOverride
use TripsController
use UsersController
run ApplicationController | 19.142857 | 39 | 0.850746 |
33f74fe816cf50e81f59ca917cf5071513047396 | 2,518 | Prelaunchr::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
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.act... | 35.971429 | 104 | 0.758539 |
1caad2187cfbacf68d7d2d281d1bce2f30aa539d | 2,480 | # Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: MIT
# @note +download+ and +upload+ require +curl+. If +curl+ is not in your +PATH+
# then set the +CURL+ environment variable to point to it.
# @todo Use an HTTP library instead of executing +curl+.
class RbVmomi::VIM::Datas... | 33.972603 | 135 | 0.633468 |
010e5abad13ffaac959f28a4857130aff2d9596d | 455 | class User < ApplicationRecord
before_save { self.email = email.downcase }
validates :name, presence: true, length: { maximum: 50 }
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+\z/i
validates :email, presence: true, length: { maximum: 255 },
format: { with: VALID_EMAIL... | 35 | 72 | 0.606593 |
87dd8dbbcc4b9ee73969147aaccae53359915c7c | 42 | module GameOfLife
VERSION = "2.5.1"
end
| 10.5 | 19 | 0.690476 |
9134c7216d5bd98533594ff7f8728465ba59817e | 1,346 | FactoryGirl.define do
factory :miq_schedule_validation, :class => :MiqSchedule do
sequence(:name) { |n| "schedule_#{seq_padded_for_sorting(n)}" }
description "test"
towhat "MiqReport"
run_at {}
sched_action {}
end
factory :miq_schedule do
run_a... | 42.0625 | 184 | 0.568351 |
1c86f2ebd2680e401f3824054864f97d5a0cf4fe | 1,530 | MailGetter::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test... | 40.263158 | 84 | 0.785621 |
91f43862df062258d9cffa05421c92b5dd8cceb2 | 252 | json.ignore_nil!
json.array! @metrics[0..100] do |metric|
json.id metric.id
json.datetime metric.datetime
metric.presenter.fields.each do |field|
json.(metric, field.to_sym )
end
json.url send(model_url(metric), metric.id) + '.json'
end
| 22.909091 | 55 | 0.710317 |
1dc144478206f38661828bef544d2a42dad194f0 | 8,464 | #
# Cookbook Name:: redisio
# Provider::sentinel
#
# Copyright 2013, Rackspace Hosting <ryan.cleere@rackspace.com>
#
# 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.or... | 38.825688 | 118 | 0.609877 |
795a7f1ac96a22b8412098a8ab5e6e59a65375c0 | 535 | require 'puppet/provider/cisco'
Puppet::Type.type(:interface).provide :cisco, :parent => Puppet::Provider::Cisco do
desc "Cisco switch/router provider for interface."
mk_resource_methods
def self.lookup(device, name)
interface = nil
device.command do |ng|
interface = device.interface(name)
e... | 19.107143 | 83 | 0.697196 |
4ab30a44232c624167ce7dba679178fbe861ea16 | 9,886 | require 'test/unit'
require 'require_relative'
require_relative '/../../lib/classes/match'
require_relative '/../../lib/classes/atom'
require_relative '/../../lib/classes/s_exp'
module MatchObjectsShouldBeEqualButDistinct
def test_that_match_objects_are_equal
assert_equal(@m1, @m2)
end
def test_that_match_ob... | 29.957576 | 97 | 0.679345 |
089aeb3f1267cbef39f19a73aff1d3da93cb8dc8 | 55 | require 'metasm/arm/parse'
require 'metasm/arm/encode'
| 18.333333 | 27 | 0.781818 |
1c849c99e3b07d4e8e74877a0b617b610f664b7b | 2,579 | require 'pathname'
require 'opal/version'
require 'opal/nodes/scope'
module Opal
module Nodes
# Generates code for an entire file, i.e. the base sexp
class TopNode < ScopeNode
handle :top
children :body
def compile
push version_comment
opening
in_scope do
... | 24.798077 | 118 | 0.556029 |
38ad269906ad5a3743186bb7cee5cc6aef088c1b | 5,498 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
class Metasploit3 < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::Remote::HttpServer::HTML
... | 31.965116 | 117 | 0.617315 |
bb1cb2988b83c0f01dc996a97bca4c23b96a766f | 969 | module Shoppe
class PaymentsController < ApplicationController
before_filter { @order = Shoppe::Order.find(params[:order_id]) }
before_filter { params[:id] && @payment = @order.payments.find(params[:id]) }
def create
payment = @order.payments.build(params[:payment].permit(:amount, :method, :refere... | 28.5 | 92 | 0.649123 |
79a5bf0f987d5de65f731d029e5025dfde3be97e | 512 | cask "timeular" do
version "3.4.0"
sha256 "e2f036a10adaf6bd75faa82d230666a7332aab4a48be97452ccadf76b6b9c301"
# timeular-desktop-packages.s3.amazonaws.com/ was verified as official when first introduced to the cask
url "https://timeular-desktop-packages.s3.amazonaws.com/mac/production/Timeular-#{version}.dmg"
... | 34.133333 | 106 | 0.779297 |
6ad6bc0212316a15681147442356ecd79de01375 | 716 | # typed: true
module KubeDSL
module DSL
module Autoscaling
module V2beta2
class ResourceMetricSource < ::KubeDSL::DSLObject
value_field :name
object_field(:target) { KubeDSL::DSL::Autoscaling::V2beta2::MetricTarget.new }
validates :name, field: { format: :string }, pr... | 25.571429 | 98 | 0.572626 |
ace7c8dd578d76192c5e0a354ea823501a9ea918 | 1,303 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'stub-hub/version'
Gem::Specification.new do |spec|
spec.name = "stub-hub"
spec.version = Stubhub::VERSION
spec.authors = ["Edward Huynh"]
spec.email = ["edwar... | 39.484848 | 111 | 0.643131 |
b9e2af9a392c876d174b8a69ee89f644c4b58c10 | 283 | module Util
def self.trace(msg = "")
begin
raise Exception.new(msg)
rescue => e
$stderr.puts "Util.trace::message:\n%s\ntimestamp:%s\nbacktrace:\n%s\n" % [
e.message,
Time.now,
e.backtrace.slice(1).join("\n")
]
end
end
end
| 20.214286 | 81 | 0.54417 |
1125b4773f99845f364d067feb64c37ed228d4d4 | 1,823 | require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "Report API" do
before do
@reports = Adzerk::Client.new(API_KEY).reports
$new_report = {
:start_date => "01/15/2011",
:end_date => "12/31/2011",
:group_by => ['month'],
'Top30countries' => false,
:exclu... | 31.982456 | 88 | 0.684037 |
5d7507e9a4c14aaba1dabf53cdedb88162fea520 | 195 | class CreateBodegueros < ActiveRecord::Migration[5.2]
def change
create_table :bodegueros do |t|
t.integer :usuario_id
t.integer :bodega_id
t.timestamps
end
end
end
| 19.5 | 53 | 0.682051 |
793bad21ce02d89acfde4da7c11c8592956bd750 | 785 | # frozen_string_literal: true
# Copyright (C) 2007-2019 Leah Neukirchen <http://leahneukirchen.org/infopage.html>
#
# Rack is freely distributable under the terms of an MIT-style license.
# See MIT-LICENSE or https://opensource.org/licenses/MIT.
# The Rack main module, serving as a namespace for all core Rack
# modul... | 26.166667 | 83 | 0.722293 |
ed599db9f2ca5aa32e3c4fe7c6ddb28d104a5a24 | 3,879 | # frozen_string_literal: true
RSpec.describe RuboCop::Cop::Rails::Date, :config do
subject(:cop) { described_class.new(config) }
context 'when EnforcedStyle is "strict"' do
let(:cop_config) { { 'EnforcedStyle' => 'strict' } }
%w[today current yesterday tomorrow].each do |day|
it "registers an offen... | 31.536585 | 131 | 0.61124 |
ac69ad1616e83cb2cc33382c6307f71fd5d384b8 | 1,461 | module Faye
class StaticServer
def initialize(directory, path_regex)
@directory = directory
@path_regex = path_regex
@path_map = {}
@index = {}
end
def map(request_path, filename)
@path_map[request_path] = filename
end
def =~(pathname)
@path_regex =~ ... | 25.631579 | 90 | 0.581793 |
1a1acf6deae2f4e93d67fe8c12aefaa4fe77c84f | 666 | # To download production data instead of these seeds, run
# rake db:restore_production_dump
5.times do |i|
puts "Creating developer ##{i + 1}"
username = Phil.name.downcase.delete(' ')
Developer.create!(username: username, email: "#{username}@hashrocket.com")
end
40.times do |i|
puts "Creating post ##{i + 1}"... | 28.956522 | 76 | 0.690691 |
ff52af9349532cbdba756b7ff97a2774742ffe4b | 4,365 | #
# Cookbook:: lvm
# Library:: resource_lvm_volume_group
#
# Copyright:: 2009-2017, Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/... | 29.693878 | 123 | 0.610997 |
1c63ddf2bcb928f320aea8b0cfabb20540e39e61 | 902 | require File.expand_path('../../../spec_helper', __FILE__)
require 'bigdecimal'
describe "BigDecimal#coerce" do
it "returns [other, self] both as BigDecimal" do
one = BigDecimal("1.0")
five_point_28 = BigDecimal("5.28")
zero_minus = BigDecimal("-0.0")
some_value = 32434234234234234234
BigDecima... | 33.407407 | 103 | 0.658537 |
ffd1c03553ae441ba1276f06709c2b56adc78190 | 59 | require "neuroprok/version"
module Neuroprok
#TO DO
end
| 9.833333 | 27 | 0.762712 |
3897768ef1399d687da852188e6ef5b5b00c4a0a | 44 | module K1bsViewTool
VERSION = "0.1.0"
end
| 11 | 19 | 0.704545 |
87606fb0400ecf16345fae8702cbcb6d7e3a6447 | 125 | Rails.application.config.middleware.use OmniAuth::Builder do
provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET']
end
| 31.25 | 60 | 0.784 |
4af0f19f29a1fb650ec7d3b5aa95e2c6990bb739 | 998 | # frozen_string_literal: true
RSpec.describe Analist::RubyExtractor do
describe '#extract' do
subject(:extracted_ruby) { described_class.extract(source) }
context 'when using <%=' do
context 'with proper spacing' do
let(:source) { '<%= some_ruby %>' }
it { expect(extracted_ruby).to eq... | 24.95 | 71 | 0.593186 |
6a04ae169b2e764675efefc81fa788a52d166cfd | 1,410 | #
# Cookbook Name:: base
# Recipe:: login
#
# Copyright (C) 2013 Jonas Pfenniger
#
# Sets up a proxy user for SSH login
#
return unless node.base.login.user
include_recipe "openssh"
### Login user config ###
# SSH as this user but automatically sudo su to root
# FIXME: This prevents scp from working
cookbook_file "... | 23.898305 | 78 | 0.709929 |
28e78f32267cff422bd623e8eaf592596d902023 | 20,170 | # frozen_string_literal: true
# Please do not make direct changes to this file!
# This generator is maintained by the community around simple_form-bootstrap:
# https://github.com/rafaelfranca/simple_form-bootstrap
# All future development, tests, and organization should happen there.
# Background history: https://gith... | 45.840909 | 216 | 0.67759 |
ed6e412167f5c091c1e9e552d36a9ec214cb6df3 | 309 | class CreateTeams < ActiveRecord::Migration[5.0]
def change
create_table :teams do |t|
t.references :user, foreign_key: true
t.string :name
t.string :website
t.string :slug
t.text :description
t.timestamps
end
add_index :teams, :slug, unique: true
end
end
| 20.6 | 48 | 0.640777 |
1844334eb9c70a7d97a39fc1fc47127f9e583635 | 1,048 | require 'yaml'
require 'active_support/core_ext/hash'
require 'acceptance_test'
require 'rspec/expectations'
config_name = File.expand_path("spec/acceptance_config.yml")
config = config_name ? HashWithIndifferentAccess.new(YAML.load_file(config_name)) : {}
AcceptanceTest.instance.configure(config)
AcceptanceTest.ins... | 29.942857 | 86 | 0.745229 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.