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 |
|---|---|---|---|---|---|
5dca5e784da760c80800d9dd38cb4f2856615e85 | 3,572 | require 'spec_helper'
describe Banzai::ReferenceParser::CommitRangeParser, lib: true do
include ReferenceParserHelpers
let(:project) { create(:empty_project, :public) }
let(:user) { create(:user) }
subject { described_class.new(project, user) }
let(:link) { empty_html_link }
describe '#nodes_visible_to_u... | 27.267176 | 80 | 0.632139 |
e93e199f107c921e472ecdbacbc50989be00e98d | 1,203 | # 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... | 37.59375 | 86 | 0.746467 |
38e68df212e0fbd555f498cd7223fb084daec42f | 176 | module Bitex
module Resources
module Merchants
# This resource allow map Payments data to JsonApi.
class BitcoinAddress < Private
end
end
end
end
| 17.6 | 57 | 0.681818 |
62d605eb1dbcc4b058022cbeb0ee614de0b70857 | 1,925 | @version = "2.0.1"
Pod::Spec.new do |s|
s.name = "DZNPhotoPickerController"
s.version = @version
s.summary = "A photo search/picker for iOS using popular providers like 500px, Flickr, Intagram, Google Images, etc."
s.description = "This framework tries to mimic as close as possib... | 42.777778 | 171 | 0.645195 |
621dbed1fbca3c97df19cbef768857f5588b0c40 | 1,976 | class ContinueBox
attr_accessor :x, :y, :w, :h, :text, :lines, :page, :line_height
def initialize box, font=nil
@x = box.x
@y = box.y
# W and H are in characters, not pixels
# Make sure the H you set leaves room for the "..." at the bottom
@w = box.w
@h = box.h
@font = box.font
@te... | 19.372549 | 88 | 0.544534 |
bfa529f758e8dc7533d379f6ee9d60952d1c215d | 3,393 | module Hancock
class Recipient < Hancock::Base
class Recreator
attr_reader :docusign_recipient, :tabs
IS_INVALID_RECIPIENT_ERROR = ->(e) { e.docusign_status == 'INVALID_RECIPIENT_ID' }
def initialize(docusign_recipient)
@docusign_recipient = docusign_recipient
begin
... | 37.7 | 131 | 0.655172 |
bb1296271f7a326e0dfc8ad233a9519551bc58f3 | 2,676 | # frozen_string_literal: true
require 'spec_helper'
require 'webmock/rspec'
describe 'gitlab_ci_runner::register_to_file' do
let(:url) { 'https://gitlab.example.org' }
let(:regtoken) { 'registration-token' }
let(:runner_name) { 'testrunner' }
let(:filename) { "/etc/gitlab-runner/auth-token-#{runner_name}" }
... | 41.169231 | 144 | 0.701046 |
ff1c63ee8d8bc9a1ee0943e912b0677cce9fe01e | 1,015 | cask "podolski" do
version "1.2.2,9724"
sha256 "36c3e778a3aaa82dcdb18459b9e01ba490884b52cc200941c299362024523994"
# uhedownloads-heckmannaudiogmb.netdna-ssl.com/ was verified as official when first introduced to the cask
url "https://uhedownloads-heckmannaudiogmb.netdna-ssl.com/releases/Podolski_#{version.befo... | 33.833333 | 141 | 0.733005 |
87c74ea6f6c4734c800e135c9b5ce0172ae50273 | 1,153 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'eversign/version'
Gem::Specification.new do |spec|
spec.name = "eversign"
spec.version = Eversign::VERSION
spec.authors = ["eversign"]
spec.email = ["support+... | 36.03125 | 74 | 0.653079 |
e914cf7d22f87ac5ba9dc0336f2d2ffe304fe804 | 1,072 | # 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... | 41.230769 | 86 | 0.768657 |
f7cf97140dd58d609ad11d120d9445fb5bb924ad | 4,488 | class Grafana < Formula
desc "Gorgeous metric visualizations and dashboards for timeseries databases"
homepage "https://grafana.com"
url "https://github.com/grafana/grafana/archive/v6.4.4.tar.gz"
sha256 "fad788bb4f8c4cef776a906603e5277955b6f63e150d34928980892abc5cc651"
head "https://github.com/grafana/grafana... | 32.057143 | 341 | 0.64082 |
1db250be842570144550a6f2612260afa71e7ba2 | 2,093 | require File.dirname(__FILE__) + "/../spec_helper"
describe CartsController do
include SpecControllerHelper
before :each do
scenario :shop_with_active_product
scenario :order_with_order_lines
scenario :cart_with_cart_items
set_resource_paths :cart, '/shops/1/'
end
it "should b... | 27.906667 | 89 | 0.62924 |
d5eb69cb5f0451bde47d3f6029091de5133b2be7 | 461 | class Launchcontrol < Cask
version '1.16.1'
sha256 '1475d384d1bfdb76e49a288b96a310b23a150946c568e045db0c0597b6c0b5a2'
url "http://www.soma-zone.com/download/files/LaunchControl_#{version}.tar.bz2"
appcast 'http://www.soma-zone.com/LaunchControl/a/appcast.xml',
:sha256 => 'a82b64b1b68b0fc013145825eee9... | 35.461538 | 87 | 0.776573 |
7aac946a93a84bccdd8a2fbfb0497ee04b080333 | 5,803 | =begin
#Ory Kratos
#Welcome to the ORY Kratos HTTP API documentation!
The version of the OpenAPI document: v0.4.6-alpha.1
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.3.1
=end
require 'cgi'
module OryHydraClient
class HealthApi
attr_accessor :api_client
def initialize(api_c... | 42.985185 | 451 | 0.699466 |
d583b506107c2eda1dda6f033f0487620eac17ec | 540 | Pod::Spec.new do |s|
s.name = "SimpleLogger"
s.version = "2.4.2"
s.summary = "Simple logging tool"
s.homepage = "https://github.com/thinkaboutiter/SimpleLogger"
s.license = 'MIT'
s.author = { "Thinka Boutiter" => "thinkaboutiter@gmail.com" }
s.source = {
:git => "https://github.com/thinkaboutiter/Simp... | 28.421053 | 65 | 0.6 |
61753a1e433475707cddf3728b64ffe0adde6052 | 1,558 | class Tomcat < Formula
desc "Implementation of Java Servlet and JavaServer Pages"
homepage "https://tomcat.apache.org/"
url "https://www.apache.org/dyn/closer.cgi?path=/tomcat/tomcat-9/v9.0.13/bin/apache-tomcat-9.0.13.tar.gz"
sha256 "b8f7b7ac0cb6c53ae6524086efc69c6ea6933344908b294d91f9af3c67b559e7"
bottle :u... | 25.540984 | 107 | 0.6181 |
e94b3237bea3435236033761b0683ac822bce16b | 3,210 | module Cucumber
class StepMatch #:nodoc:
attr_reader :step_definition
# Creates a new StepMatch. The +name_to_report+ argument is what's reported, unless it's is,
# in which case +name_to_report+ is used instead.
#
def initialize(step_definition, name_to_match, name_to_report, step_arguments)
... | 28.660714 | 137 | 0.660125 |
91a58253fdfb104b486e9dd4ae3cf78273c4039b | 355 | # coding: utf-8
# vim: set expandtab tabstop=2 shiftwidth=2 softtabstop=2 autoindent:
class BMFF::Box::MovieExtendsHeader < BMFF::Box::Full
attr_accessor :fragment_duration
register_box "mehd"
def parse_data
super
if version == 1
@fragment_duration = io.get_uint64
else
@fragment_duration... | 20.882353 | 69 | 0.709859 |
bb76488846f06df3b1a1bf7d6c540f57d359db2b | 144 | class User < ActiveRecord::Base
has_secure_password
has_many :vacations
validates_presence_of :username, :email, :password
end
| 20.571429 | 54 | 0.736111 |
e221a4da729b935b35195c4d13f2513a64ef9aee | 7,772 | #
# Author:: Tyler Cloke (<tyler@chef.io>)
# Copyright:: Copyright 2015-2016, Chef Software, 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
#
# ... | 35.815668 | 155 | 0.659676 |
ffa6a1d9b8ebb5edeafa8f088d6f2ceeb83446ce | 2,377 | class User < ApplicationRecord
attr_accessor :remember_token, :activation_token, :reset_token
before_save :downcase_email
before_create :create_activation_digest
validates :name, presence: true, length: { maximum: 50 }
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+\z/i
validates :email... | 28.638554 | 88 | 0.701304 |
39042f1656f13f3cf6c98579e75d7239cd6919ba | 1,645 | require_migration
describe AddContainerImageDigest do
let(:container_image_stub) { migration_stub(:ContainerImage) }
let(:row_entries) do
[
{:tag_in => 'sha256', :tag_out => 'sha256', :digest => nil},
{:tag_in => 'sha384', :tag_out => 'sha384', :digest => nil},
{:tag_in => 's... | 30.462963 | 83 | 0.545289 |
03b7834e893b8054342d0a8b2ccc2145c01541dd | 1,691 | class Mkclean < Formula
desc "Optimizes Matroska and WebM files"
homepage "https://www.matroska.org/downloads/mkclean.html"
url "https://downloads.sourceforge.net/project/matroska/mkclean/mkclean-0.8.10.tar.bz2"
sha256 "96773e72903b00d73e68ba9d5f19744a91ed46d27acd511a10eb23533589777d"
bottle do
cellar :a... | 35.229167 | 94 | 0.755174 |
791293a039f4f6bbc80f80e3cf90f5da84b0989a | 17,567 | # encoding: UTF-8
# This file contains data derived from the IANA Time Zone Database
# (http://www.iana.org/time-zones).
module TZInfo
module Data
module Definitions
module Atlantic
module Azores
include TimezoneDefinition
timezone 'Atlantic/Azores' do |tz|
... | 55.94586 | 69 | 0.57978 |
386ac283b83ff37d31dee3fc6c4eea38bb45d7c2 | 5,325 | require 'yabeda/prometheus'
require 'rack'
module ThreeScale
module Backend
class ListenerMetrics
AUTH_AND_REPORT_REQUEST_TYPES = {
'/transactions/authorize.xml' => 'authorize',
'/transactions/oauth_authorize.xml' => 'authorize_oauth',
'/transactions/authrep.xml' => 'authrep',
... | 33.490566 | 102 | 0.578592 |
1c28ecf31eb50d7137f48ec7b2fdc32a178a96e5 | 349 | module Softcover
module Commands
module Auth
extend self
def login(email, password)
require "softcover/client"
client = Softcover::Client.new email, password
client.login!
end
def logout
require "softcover/config"
Softcover::Config['api_key'] = nil... | 18.368421 | 54 | 0.604585 |
87bb428c67496b32c69a2327337b5243f139aaf3 | 28,373 | #
# Author:: Adam Jacob (<adam@opscode.com>)
# Author:: Christopher Brown (<cb@opscode.com>)
# Author:: Daniel DeLeo (<dan@opscode.com>)
# Copyright:: Copyright (c) 2008 Opscode, Inc.
# Copyright:: Copyright (c) 2010 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.... | 43.989147 | 152 | 0.671942 |
61e9419e8eb2881c6181e5764ff099c89da20520 | 2,752 | #
# = Capistrano database.yml task
#
# Provides a couple of tasks for creating the database.yml
# configuration file dynamically when deploy:setup is run.
#
# Category:: Capistrano
# Package:: Database
# Author:: Simone Carletti
# Copyright:: 2007-2009 The Authors
# License:: MIT License
# Link:: ... | 32 | 96 | 0.680596 |
1c45b30b32337725cd7ae03b1d1edfcc1f182962 | 1,490 | require 'rexml/document'
require 'rexml/formatters/transitive'
require File.dirname(__FILE__) + '/../../../spec_helper'
# Maybe this can be cleaned
describe "REXML::Document#write" do
before :each do
@d = REXML::Document.new
city = REXML::Element.new "Springfield"
street = REXML::Element.new "Ev... | 34.651163 | 120 | 0.675168 |
910a98e6f9b7e2b5bb651e538012f4f188ef7931 | 246 | require 'test_helper'
class MainAppRootUrlTest < ActionDispatch::IntegrationTest
test "root_url link points to main_app.root_url" do
visit "/pointless_feedback"
assert page.has_link?("Homepage", :href => current_host + "/")
end
end
| 24.6 | 66 | 0.743902 |
79a4b30c24a8aefe6a2be3da07788ba756a151ae | 1,117 | require "rails_helper"
describe Admin::CommentsController, type: :routing do
describe "routing" do
it "routes to #index" do
expect(get("/a/comments")).to route_to("admin/comments#index")
end
it "routes to #show" do
expect(get("/a/comments/1")).to route_to("admin/comments#show", :id => "1")
... | 27.925 | 93 | 0.623993 |
f7486aab890fe607f752204972ace90055e41574 | 910 | # encoding: UTF-8
#
# Cookbook Name:: dovecot
# Attributes:: conf_20_lmtp
# Author:: Xabier de Zuazo (<xabier@onddo.com>)
# Copyright:: Copyright (c) 2014 Onddo Labs, SL. (www.onddo.com)
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this fi... | 35 | 74 | 0.736264 |
1138087e41fd1b7d1d5a99bd7ca0dfce7770850d | 1,189 | # frozen_string_literal: true
module Jobs
class DiscourseAutomationTracker < ::Jobs::Scheduled
every 1.minute
BATCH_LIMIT = 300
def execute(_args = nil)
return unless SiteSetting.discourse_automation_enabled
DiscourseAutomation::PendingAutomation
.includes(:automation)
.lim... | 27.022727 | 86 | 0.683768 |
bff7917337326f5aad51247be02a43d562c62e48 | 2,303 | # -*- encoding: utf-8 -*-
# stub: rake 12.3.3 ruby lib
Gem::Specification.new do |s|
s.name = "rake".freeze
s.version = "12.3.3"
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.2".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Hiroshi SHIBATA".... | 52.340909 | 613 | 0.699088 |
1a87e65e961e80111d2b1673538f63fa6acd27ff | 1,533 | Leapforloaves::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 t... | 40.342105 | 84 | 0.78604 |
114064103fbe1dcf8cf8bda15c6ba7df9040045a | 509 | # frozen_string_literal: true
module Eve
class AllianceCorporation < ApplicationRecord
# TODO: has_paper_trail
belongs_to :alliance,
primary_key: "alliance_id",
counter_cache: :corporations_count,
optional: true
belongs_to :corporation, primary_key: "corporation_id", optional: true
... | 24.238095 | 87 | 0.746562 |
03711f105e27bb3867574f37aa1aa34c34d6e8f6 | 406 | require 'spec_helper'
describe "Event" do
it "forwards any defined event" do
def foo(msg, &block)
block.call_event :success
block.call_event :failure, "error"
end
expect{foo("my message") do |on|
on.success do
print "success"
end
on.failure do |msg|
print "\... | 22.555556 | 51 | 0.608374 |
0367256df356bf591456d3641fc9831ea13e1eb9 | 380 | require 'spec_helper'
module JSONAPIonify::Structure::Helpers
describe Errors do
describe '.new' do
pending
end
describe '.new' do
pending
end
describe '#add' do
pending
end
describe '#[]' do
pending
end
describe '#replace' do
pending
end
... | 13.103448 | 39 | 0.584211 |
116f7cc6f3615440874b0a1683132bf987de9180 | 304 | module TableauRestApi
class Server < Base
attr_reader :version, :build , :api_version
def initialize(server)
product_version = server.productVersion
@version = product_version.value
@build = product_version.build
@api_version = server.restApiVersion
end
end
end
| 23.384615 | 47 | 0.707237 |
e2794e112c8fa328d8e773d42ae3be6d24c87f59 | 1,578 | =begin
#Accounting API
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 2.0.0
Contact: api@xero.com
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.0.3
=end
require 'spec_helper'
require 'json'
... | 26.3 | 107 | 0.726869 |
bfcf290f46feefc438f24829d7e43143dbecbeaa | 269 | Rails.application.routes.draw do
resources :draws, except: [:edit, :update]
delete 'draws', to: 'draws#destroyall'
resources :cards, only: [:index, :show]
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
end
| 33.625 | 102 | 0.728625 |
2178e13838a543b1158e50f7c3f3aa375d800102 | 538 | module Shoppe
module AssociatedCountries
def self.included(base)
base.serialize :country_ids, Array
base.before_validation { self.country_ids = country_ids.map(&:to_i).select { |i| i > 0 } if country_ids.is_a?(Array) }
end
def country?(id)
id = id.id if id.is_a?(Shoppe::Country)
c... | 28.315789 | 124 | 0.667286 |
f8426c9262dfd10cfbf1a78076f3d1ad8978f57c | 2,054 | require 'rails_helper'
require 'devise/jwt/test_helpers'
RSpec.describe 'Mod::UsersController', type: :controller do
describe 'success scenarios when current user is supervisor/moderator' do
before(:each) do
@controller = Mod::UsersController.new
supervisor = create(:user, :supervisor, email: 'mod@ex... | 30.205882 | 88 | 0.627556 |
019f6c298ff14541021e7072523739b3fcc610dd | 835 | module Fog
module Storage
class HP
class Real
# Generate a temporary url for an object
#
# ==== Parameters
# * container<~String> - Name of container
# * object<~String> - Name of object
# * expires<~Integer> - Time the temporary url expire in secs.
... | 26.935484 | 78 | 0.619162 |
28b38a2526ed76407f8435d5196ce294337eb52d | 480 | module RockRMS
module Response
class TransactionDetail < Base
MAP = {
id: 'Id',
fee_amount: 'FeeAmount',
fund: 'Account',
fund_id: 'AccountId',
amount: 'Amount',
entity_type_id: 'EntityTypeId',
entity_id: 'EntityId'
}.freeze
def format_sin... | 21.818182 | 54 | 0.558333 |
79d75397c3579ff71e8ff92ca98cd3875bab817f | 8,570 | #-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2017 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of ... | 28.566667 | 91 | 0.670828 |
1d87ffb129ab53ddeaf795bdbc39d93517f3477f | 649 | # frozen_string_literal: true
class RemoveClutterFromUser < ActiveRecord::Migration[6.1]
def up
change_table :users, bulk: true do |t|
t.remove :login_token
t.remove :login_token_valid_until
t.remove :remember_created_at
t.remove :confirmation_token
t.remove :confirmed_at
t.r... | 23.178571 | 58 | 0.701079 |
1ae24aa9fd6fac3aed0827adb4f95e82745fd9d2 | 2,734 | # 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::ApiManagement::Mgmt::V2018_01_01_preview
module Models
#
# Paged Property list representation.
#
class PropertyCollection
... | 27.616162 | 80 | 0.523043 |
384edd7f5fdb0f2c39450221e16ac95983092fc4 | 635 | class AuthController < ApplicationController
skip_before_action :authorized, only: [:create]
def create
@user = User.find_by(username: user_login_params[:username])
if @user && @user.authenticate(user_login_params[:password])
token = encode_token({ user_id: @user.id })
r... | 31.75 | 91 | 0.647244 |
e88afde81aaa8a16b06f835be8a29e7a6e5ac2b4 | 1,660 | class Volunteer
attr_reader(:id, :name, :project_id)
def initialize(attributes)
@name = attributes.fetch(:name)
@id = attributes.fetch(:id)
@project_id = attributes.fetch(:project_id)
end
def save
result = DB.exec("INSERT INTO volunteers (name, project_id) VALUES ('#{@name}', #{@project_id}) ... | 30.740741 | 138 | 0.649398 |
4a7e687bd366b9125fb7cbb1780fa552a8aa68b6 | 10,893 | # -*- coding: utf-8 -*-
require "test_helper"
require "support/document_xml_helper"
require "support/xml_snippets"
class ProcessorTest < Sablon::TestCase
include DocumentXMLHelper
include XMLSnippets
def setup
super
@processor = Sablon::Processor
end
def test_simple_field_replacement
result = p... | 30.512605 | 130 | 0.550996 |
e834123f9c8694cabe81d2ddbe15b968ef17b557 | 192 | class MergeController < ApplicationController
param_accessible :a, :only => :create
param_accessible :b
param_accessible({ :h => :c}, :except => :update)
param_accessible :h => :b
end
| 27.428571 | 51 | 0.708333 |
f74682dd0ae3e445ff9dc55ce345cd08f9c4fe22 | 61 | module Houston::Tickets
module ApplicationHelper
end
end
| 12.2 | 26 | 0.803279 |
21fb6db3e14cea32c0a79dca82b86b57b1991776 | 281 | require 'hutch'
class LinkSetTitleConsumer
include Hutch::Consumer
consume 'link.set.title'
def process(message)
link = LinkRepository.find(message[:link_id])
title = Crawler.get_title(link.destination_url)
LinkRepository.update(link, title: title)
end
end
| 18.733333 | 51 | 0.743772 |
1de87c51c0fb0d339535aa970bf71a22ed5d88ea | 1,556 | class Pnpm < Formula
require "language/node"
desc "📦🚀 Fast, disk space efficient package manager"
homepage "https://pnpm.io/"
url "https://registry.npmjs.org/pnpm/-/pnpm-6.22.1.tgz"
sha256 "7aa88f16e4556006826f38812d01fe2adcc279d305ae37808e3e7a32e9eac1ee"
license "MIT"
livecheck do
url "https://re... | 40.947368 | 123 | 0.758997 |
2670bee95b3339c44f281340d87e1cfc2191b28c | 1,373 | class OryHydra < Formula
desc "OpenID Certified OAuth 2.0 Server and OpenID Connect Provider"
homepage "https://www.ory.sh/hydra/"
url "https://github.com/ory/hydra/archive/v1.9.1.tar.gz"
sha256 "b97037ec2fd35eb91b81b4885a4f169540adb9d410101c3db56869a63f96e25e"
license "Apache-2.0"
bottle do
cellar :an... | 31.204545 | 95 | 0.70284 |
e26bb7096a9933abb6102492f3716ac15fbbf115 | 3,296 | class Pgcli < Formula
desc "CLI for Postgres with auto-completion and syntax highlighting"
homepage "http://pgcli.com/"
url "https://pypi.python.org/packages/source/p/pgcli/pgcli-0.20.1.tar.gz"
sha256 "e645d21abf98303259bf588e9afa1bedf507f54ae27f78f0587cce98315421ab"
bottle do
cellar :any
sha256 "c61... | 37.885057 | 112 | 0.773058 |
111d6e02d6d3c03a0351a5cf35a5d733ab58800a | 2,199 | module Suit # :nodoc:
module Models # :nodoc:
module Matchers
# Ensures that the model can scope by 'source'
# requires that the class have a factory and that a user factory exist
# Tests:
# scope :created_by, lambda { |item_object| {:conditions => ["items.source_id = ? AND items.source... | 33.318182 | 163 | 0.589359 |
1ca08bed07915b19a726761c9e742bc1ab8c2b27 | 1,592 | require "securerandom"
class AccessToken < ApplicationRecord
belongs_to :issuer, class_name: "Character"
belongs_to :grantee, polymorphic: true, optional: true
validate :event_owner_categories_must_be_valid
before_create :generate_token_if_needed
scope :personal, ->(c) { where(issuer: c, grantee: c) }
s... | 19.654321 | 79 | 0.668342 |
1d39551fa8ff798539e49557e9d6a62c2c6bceac | 3,961 | require "se/api/version"
require "se/api/types/answer"
require "se/api/types/question"
require "se/api/types/comment"
require "se/api/types/user"
require "se/api/types/post"
require "se/api/types/tag"
require "net/http"
require "json"
require "uri"
require "time"
require "logger"
module SE
module API
class Clie... | 30.469231 | 151 | 0.586721 |
7adbc41b8419e7c1868f26e21d9884ad6dc37463 | 371 | require_relative '../../app/commands/report_robot_command.rb'
describe ReportRobotCommand do
let(:robot) { double('robot') }
let(:table) { double('table') }
let(:command) { "REPORT" }
subject { ReportRobotCommand.new(robot, table) }
it 'executes a REPORT command on the robot' do
expect(robot).to recei... | 23.1875 | 61 | 0.695418 |
f826584d15ebb7f13005a9b3528f1b999ffdec0a | 6,695 | class Ocrmypdf < Formula
include Language::Python::Virtualenv
desc "Adds an OCR text layer to scanned PDF files"
homepage "https://github.com/jbarlow83/OCRmyPDF"
url "https://files.pythonhosted.org/packages/3b/6f/b35629fe70cd059f5c503e544d9857b94b91ed58b50e291a34a7f0d3813b/ocrmypdf-11.6.2.tar.gz"
sha256 "0f6... | 43.474026 | 146 | 0.768633 |
6a6e3f4fc70ad7e634ff261078451eaf2b586834 | 11,116 | Rails.application.routes.draw do
# Pages and guides that have been renamed (and we don't want to break old URLs)
get "/docs/api", to: redirect("/docs/rest-api")
get "/docs/api/accounts", to: redirect("/docs/rest-api/organizations")
get "/docs/api/projects", ... | 91.114754 | 119 | 0.606243 |
0155d05529f9ee83600005bda20a6fda7c71b7de | 3,126 | # frozen_string_literal: true
module FatherlyAdvice
module SidekiqHelpers
class WorkSet
def self.build
new.build
end
def self.ttls
@ttls ||= {
default: 3.hours
}
end
def hosts
@hosts ||= {}
end
def each_host
hosts.valu... | 22.489209 | 79 | 0.578375 |
bbe97c576bffd5fc7bbc8ca10ce2f1c6c30d67e3 | 361 | #! /usr/bin/env ruby
=begin
Problem 38 - Project Euler
http://projecteuler.net/index.php?section=problems&id=38
=end
class Integer
def pandigital_9digits?
self.to_s.chars.map(&:to_i).push(0).uniq.size == 10
end
end
puts (9183..9999).map {|i| [i, i*2].map(&:to_s).join.to_i }
.select(&:p... | 22.5625 | 59 | 0.617729 |
b9e658ac4aa6253eafc3f4df461dae4ccee90025 | 719 | require 'csv'
module Hathi
# Load all allow or deny rows from the given file into HathiAccess objects
# with the given origin
# expected header rows are
# oclcl, local_id, item_type, access, rights
class LoadAccessFile
attr_reader :input_location, :origin
def initialize(input_location:, origin:)
... | 26.62963 | 76 | 0.641168 |
d58b54ac24a71450274cde33fc57bbdadee1a10a | 2,026 | require 'generators/generators_test_helper'
require 'rails/generators/channel/channel_generator'
class ChannelGeneratorTest < Rails::Generators::TestCase
include GeneratorsTestHelper
tests Rails::Generators::ChannelGenerator
def test_application_cable_skeleton_is_created
run_generator ['books']
assert_... | 32.677419 | 106 | 0.762093 |
edf04b2da23e9df2e618237c95bf929831b4eb56 | 469 | # frozen_string_literal: true
# A class for managing the arithmetic and geometric means
# of positive numbers
module FastStats
class Means
attr_reader :means
def initialize
@means = {}
end
def add(name, val)
mean_for(name) << val
end
def summary(round: Mean::DEFAULT_ROUND)
... | 15.633333 | 57 | 0.639659 |
eda49511f058506ed97e5cec282d04d7eea58745 | 3,329 | def source_paths
root_path = File.expand_path(File.dirname(__FILE__))
Array(super) + [root_path, File.join(root_path, 'padrino_root')]
end
project renderer: :slim, orm: :none, stylesheet: :none, test: :rspec
# copy over template files for Ruby
# - Gemfile w favourite gems
remove_file 'Gemfile'
copy_file 'padrino_... | 42.679487 | 145 | 0.768099 |
e2cda74dade03c7d6b2182871b37fc630695651b | 12,923 | #
# Copyright 2014 Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | 27.437367 | 98 | 0.569837 |
1cecddd92188ba6b19de9744d8e776235be97f9f | 1,110 | module Optimadmin
module ModuleHelper
def module_tooltip(tooltip_prompt_text, tooltip_content)
content_tag :span, "#{tooltip_prompt_text} <span class='octicon octicon-question'></span>".html_safe, data: { tooltip: '', aria_haspopup: true }, class: 'has-tip', title: tooltip_content
end
def list_item... | 30.833333 | 192 | 0.663964 |
1cb36011973b88afa08f68f195066a3f3889b0d2 | 323 | require 'spec_helper'
describe "spree/checkout/_summary.html.erb" do
# Regression spec for #4223
it "does not use the @order instance variable" do
order = stub_model(Spree::Order)
lambda do
render :partial => "spree/checkout/summary", :locals => {:order => order}
end.should_not raise_error
end
... | 29.363636 | 79 | 0.702786 |
116c9403028f3729fd6f0218bbcce007afccbe23 | 934 | class PostAppealsController < ApplicationController
before_action :member_only, :except => [:index, :show]
respond_to :html, :xml, :json, :js
def new
@post_appeal = PostAppeal.new(post_appeal_params)
respond_with(@post_appeal)
end
def index
@post_appeals = PostAppeal.includes(:creator).search(se... | 25.944444 | 120 | 0.702355 |
bb6beb4e4aa90e0a4a597b98153f31d87f065ded | 4,068 | # config/initializers/redis_memo.rb
RedisMemo.configure do |config|
# Passed along to the Rails
# {RedisCacheStore}[https://api.rubyonrails.org/classes/ActiveSupport/Cache/RedisCacheStore.html],
# sets the TTL on cache entries in Redis.
config.expires_in = 3.hours
# A global cache key version prepended to ea... | 39.495146 | 104 | 0.705506 |
bf1b0c6059ddecffb2c134f936683a88855b6f35 | 4,004 | #--
# Copyright (c) 2005-2011, John Mettraux, jmettraux@gmail.com
#
# 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... | 29.659259 | 79 | 0.651598 |
ffecd4f15d46bff6f8898fd98170e8f197f49e2e | 5,054 | class UtilLinux < Formula
desc "Collection of Linux utilities"
homepage "https://github.com/util-linux/util-linux"
url "https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.38/util-linux-2.38.tar.xz"
sha256 "6d111cbe4d55b336db2f1fbeffbc65b89908704c01136371d32aa9bec373eb64"
license all_of: [
"BSD-... | 35.591549 | 119 | 0.688959 |
330585f3645a751c18b4df8357b371c2792b8bcc | 15,788 | # frozen_string_literal: true
require_relative '../table'
require 'set'
module TTFunk
class Table
class OS2 < Table
attr_reader :version
attr_reader :ave_char_width
attr_reader :weight_class
attr_reader :width_class
attr_reader :type
attr_reader :y_subscript_x_size
att... | 39.273632 | 80 | 0.561502 |
6a8bd5f69072a9629743488f26d91eb691a2728a | 184 | require 'test_helper'
class UsertypesControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get usertypes_index_url
assert_response :success
end
end
| 18.4 | 63 | 0.788043 |
1a09ca7b73290b1b35247e0465b98ef5e098f9cf | 635 | require 'yajl/json_gem'
require 'yajl'
require 'byebug'
require 'pretty_search/version'
require 'pretty_search/cli_options'
require 'pretty_search/query'
require 'pretty_search/collection'
require 'pretty_search/document'
module PrettySearch
class MissingParameter < StandardError; end
def self.run(query, data: n... | 23.518519 | 79 | 0.722835 |
ac5d9c724281d0b477cb58f05161a4469c51d4c3 | 8,799 | # encoding: utf-8
require File.expand_path('../../spec_helper.rb', __FILE__)
describe Backup::Storage::CloudFiles do
let(:model) { Backup::Model.new(:test_trigger, 'test label') }
let(:storage) do
Backup::Storage::CloudFiles.new(model) do |cf|
cf.username = 'my_username'
cf.api_key = 'my_api_... | 34.505882 | 78 | 0.619616 |
bbc7c5da0c8429c9395c704ce0978e235e351f02 | 1,326 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core/handler/reverse_https'
require 'msf/base/sessions/meterpreter_options'
require 'msf/base/sessions/mettle_config'
require 'msf/base/sessions/meterpreter_aarch64_lin... | 28.212766 | 95 | 0.63273 |
7a705b81c32c6e9ab58f410653a779860800f4e6 | 59 | require "rman/version"
require "rman/cli"
module Rman
end
| 9.833333 | 22 | 0.762712 |
266901f9ae9ca1f1805033fc25fa94c21e080424 | 6,328 | require 'rails_helper'
describe TableHelper do
include FormatHelper
include UtilityHelper
include I18nHelper
include CrudTestHelper
before(:all) do
reset_db
setup_db
create_test_data
end
after(:all) { reset_db }
describe '#plain_table' do
subject { plain_table(%w[foo bar], :size) { ... | 23.264706 | 74 | 0.591814 |
1140f4875690aef595ea024ab7f3a44dd04c02a2 | 685 | # -*- encoding: utf-8 -*-
# stub: possibly 0.2.0 ruby lib
Gem::Specification.new do |s|
s.name = "possibly"
s.version = "0.2.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib"]
s.authors = ["Mikko Koski"]
s.date = "2014-04-25... | 32.619048 | 107 | 0.683212 |
ab4e1b3a53069b60a1a2bf8b94abbfd469c39d85 | 548 | $LOAD_PATH.unshift __dir__
require 'bundler'
Bundler.require :default
require 'temporal'
require 'temporal/metrics_adapters/log'
metrics_logger = Logger.new(STDOUT, progname: 'metrics')
Temporal.configure do |config|
config.host = ENV.fetch('TEMPORAL_HOST', 'localhost')
config.port = ENV.fetch('TEMPORAL_PORT', ... | 30.444444 | 77 | 0.773723 |
f716145bf49ee88b510489aa7ffd5894d3bca058 | 899 | class MicropostsController < ApplicationController
before_action :logged_in_user, only: [:create, :destroy]
before_action :correct_user, only: :destroy
def create
@micropost = current_user.microposts.build(micropost_params)
@micropost.image.attach(params[:micropost][:image])
if @micropost.save
... | 27.242424 | 67 | 0.701891 |
e84a6f4d25adbe44e7b0eae9fb83c529b76e6d34 | 2,630 | # 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::DataMigration::Mgmt::V2018_04_19
module Models
#
# Model object.
#
#
class MigrateSqlServerSqlDbSyncTaskOutputDatabaseEr... | 28.27957 | 96 | 0.49924 |
79fcfa0ef067740fd0397b4c99791e06e1f389cf | 11,186 | require "rails_helper"
RSpec.describe "Copying a vacancy" do
let(:school) { create(:school) }
let(:document_copy) { double("document_copy") }
before do
allow(DocumentCopy).to receive(:new).and_return(document_copy)
allow(document_copy).to receive(:copy).and_return(document_copy)
allow(document_copy... | 36.555556 | 117 | 0.720007 |
1827283265a25594923fbdf5b2d14893b49214f3 | 1,589 | require 'test_helper'
class UsersControllerTest < ActionDispatch::IntegrationTest
def setup
@user = users(:michael)
@other_user = users(:archer)
end
test "should redirect index when not logged in" do
get users_path
assert_redirected_to login_url
end
test "should get new" do
get s... | 26.483333 | 73 | 0.670233 |
d5af8e2ff2b86c5b87ebaeca3ea3fdd2c215603b | 399 | class Post < ApplicationRecord
belongs_to :topic
belongs_to :user
validates :title, presence: true, uniqueness: true
validates :body, presence: true, length: { minimum:20 }
before_save :set_visits_count
def update_visits_count
self.update(visits_count: self.visits_count + 1)
end
... | 23.470588 | 59 | 0.689223 |
26a5e039f37ae45b4135ce8be1d1f91bdde5faa7 | 1,076 | class DemandsController < ApplicationController
def create
@demand = Demand.new
@demand.author = User.find(params[:author_id])
@demand.reader = User.find(params[:reader_id])
@demand.article = Article.find(params[:article_id])
if @demand.save
# send a request to author
flash[:message]... | 26.243902 | 98 | 0.649628 |
912ada63e4e133d6b7467bb5fc5d7fd86b02b433 | 1,250 | require 'spec_helper'
RSpec.describe 'Biki integration specs' do
let(:client) { Cryptoexchange::Client.new }
let(:market) { 'biki' }
let(:btc_usdt_pair) do
Cryptoexchange::Models::MarketPair.new(base: 'BTC', target: 'USDT', market: market)
end
it 'fetch pairs' do
pairs = client.pairs('biki')
exp... | 29.069767 | 105 | 0.7048 |
38cff6f1f8073335d9ce6b0eafbb195d1d49ac23 | 4,222 | module VCAP::Services::ServiceBrokers::V2
class Client
CATALOG_PATH = '/v2/catalog'.freeze
def initialize(attrs)
@http_client = VCAP::Services::ServiceBrokers::V2::HttpClient.new(attrs)
end
def catalog
response = @http_client.get(CATALOG_PATH)
parse_response(:get, CATALOG_PATH, re... | 31.507463 | 120 | 0.662245 |
6a7f994320866b733eaea96330faba96883c26e4 | 1,859 | require "pathname"
require "cork"
require "rspec"
require "plist"
require "fileutils"
require "tmpdir"
require "fakefs/spec_helpers"
ROOT = Pathname.new(File.expand_path("../../", __FILE__))
$LOAD_PATH.unshift((ROOT + "lib").to_s)
$LOAD_PATH.unshift((ROOT + "spec").to_s)
require "playgroundbook"
require "linter/abstr... | 21.616279 | 73 | 0.740183 |
2891a3542907750b423fe734140e9905d6da64d1 | 359 | module UsersHelper
# Returns the Gravatar for the given user.
def gravatar_for(user, options = { size: 80 })
gravatar_id = Digest::MD5::hexdigest(user.email.downcase)
size = options[:size]
gravatar_url = "https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}"
image_tag(gravatar_url, alt: user... | 29.916667 | 80 | 0.696379 |
61f95c17f613ba97b844492cfc4d57145281b97e | 239 | actions :cmd
attribute :command, :kind_of => String
attribute :path, :kind_of => String
attribute :debug, :default => true
attribute :env, :kind_of => String, :default => "dev"
attribute :optional_params, :kind_of => Array, :default => [] | 34.142857 | 61 | 0.702929 |
26edb7e12e4130ce4d5b38fb453bb28cac4c1fad | 1,235 | require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "sprockets/railtie"
# require "rails/test_unit/railtie"
Bundler.require(*Rails.groups)
require "autoco... | 37.424242 | 99 | 0.748988 |
08b9820da2b241a10de85340838c5635a2b80c1b | 8,032 | # encoding: UTF-8
#
# = net/ntlm.rb
#
# An NTLM Authentication Library for Ruby
#
# This code is a derivative of "dbf2.rb" written by yrock
# and Minero Aoki. You can find original code here:
# http://jp.rubyist.net/magazine/?0013-CodeReview
# -------------------------------------------------------------
# Copyright (c... | 30.082397 | 107 | 0.597734 |
26a0e693a7f5966bab01e73a9520379c2552a8eb | 152 | class WelcomeController < ApplicationController
def index
end
def location
end
def sponsors
end
def about
end
def party
end
end
| 8.941176 | 47 | 0.703947 |
f740059f185dac34e8af16f32a097857a203b804 | 102 | # desc "Explaining what the task does"
# task :angular_ui_tinymce_rails do
# # Task goes here
# end
| 20.4 | 38 | 0.72549 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.