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 |
|---|---|---|---|---|---|
b94138f05706ae90d0169844a86ce77c2734a97f | 2,232 | require 'lru_redux'
module Stitches::ApiClientAccessWrapper
def self.fetch_for_key(key, configuration)
if cache_enabled
fetch_for_key_from_cache(key, configuration)
else
fetch_for_key_from_db(key, configuration)
end
end
def self.fetch_for_key_from_cache(key, configuration)
api_key_c... | 28.615385 | 127 | 0.72491 |
e97e3b9fcccc0dec453d81a3aa2a70419ff6602a | 1,994 | require 'parslet'
require 'gitsh/argument_builder'
require 'gitsh/commands/factory'
require 'gitsh/commands/git_command'
require 'gitsh/commands/internal_command'
require 'gitsh/commands/noop'
require 'gitsh/commands/shell_command'
require 'gitsh/commands/tree'
require 'gitsh/interpreter'
module Gitsh
class Transfor... | 27.694444 | 72 | 0.672518 |
01b441407bd19562c6ad3b80ae009fe8d752490e | 1,273 | class User < ApplicationRecord
attr_accessor :remember_token
before_save { self.email = email.downcase }
validates :name, presence: true, length: { maximum: 50 }
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :email, presence: true, length: { maximum: 255 },
format: { ... | 30.309524 | 78 | 0.681854 |
4ab1555cb283689edbaafc17458abcc42c4e75b5 | 4,399 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/googleads/v8/errors/extension_setting_error.proto
require 'google/protobuf'
require 'google/api/annotations_pb'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_file("google/ads/googleads/v8/errors/extension_setting_error.pr... | 46.305263 | 210 | 0.779268 |
38833d2b57029107a35515bff98794e6331b414c | 5,170 | require 'spec_helper'
describe Spree::Admin::ProductsController, type: :controller do
stub_authorization!
context '#index' do
let(:ability_user) { stub_model(Spree::LegacyUser, has_spree_role?: true) }
# Regression test for #1259
it 'can find a product by SKU' do
product = create(:product, sku:... | 32.111801 | 134 | 0.64236 |
acab10e96eeef45e8d60df2e0560c8575e7b9938 | 316 | # service center are the editional part for the system
# user will be assigned to different ServiceCenters to structured the system
class ServiceCenter < ActiveRecord::Base
# associations
has_many :profiles
# validations
validates_presence_of :name, :address, :phone
# scopes
# instance methods
end
| 19.75 | 76 | 0.765823 |
8709b8453d7f30b36f11d481f31fda8109e4fbfc | 1,618 | class Exploitdb < Formula
desc "Database of public exploits and corresponding vulnerable software"
homepage "https://www.exploit-db.com/"
url "https://github.com/offensive-security/exploitdb.git",
tag: "2021-07-24",
revision: "e9439759d73fffb91f8ce63bc234f9f0f5150a84"
version "2021-07-24"
lic... | 40.45 | 122 | 0.733004 |
08fa8263dcf5e47bfb8aaacd9221a093ad147da5 | 924 | # -*- coding: utf-8 -*-
require 'helper'
class TestRegressionChartDoughnut06 < Test::Unit::TestCase
def setup
setup_dir_var
end
def teardown
File.delete(@xlsx) if File.exist?(@xlsx)
end
def test_chart_doughnut06
@xlsx = 'chart_doughnut06.xlsx'
workbook = WriteXLSX.new(@xlsx)
worksheet ... | 23.692308 | 71 | 0.53355 |
b9c4f61fb6bf1174594ced8a406bce99a4b081e7 | 52,810 | # NOTE: Please do not add any further tests to the Rails 2 application unless
# the issue being tested specifically applies to Rails 2 and not the other
# versions.
# If possible, please use the rails5 app.
require_relative '../test'
class Rails2Tests < Minitest::Test
include BrakemanTester::FindWarning
include B... | 34.403909 | 181 | 0.636489 |
61a3410d10154ac5cbd447ce48af8ecbf668fc9b | 1,437 | module FilterHelper
def filter_option_link(site, type, options = {})
selected = options[:selected]
link_to filter_site_mappings_path(site),
'class' => "filter-option #{'filter-selected' if selected}",
'data-toggle' => 'dropdown',
'role' => 'button' do
... | 32.659091 | 147 | 0.660404 |
1c3dbd9ff6693f5e607dfb57549611de6fdb9ca6 | 73 | class DevelopmentController < ApplicationController
def show
end
end
| 14.6 | 51 | 0.821918 |
e9af83fd70f2a0b4273da95c7fefb94da2ca4f71 | 13,752 | # frozen_string_literal: true
require 'spec_helper'
require 'webmock/rspec'
WebMock.disable_net_connect!(allow_localhost: true)
describe Bosh::AzureCloud::AzureClient do
let(:logger) { Bosh::Clouds::Config.logger }
let(:azure_client) do
Bosh::AzureCloud::AzureClient.new(
mock_azure_config,
logger... | 26.702913 | 201 | 0.519706 |
ac6dd2658bd6c3cdc6fbb78a8a16058d5275decd | 1,393 | # This class interacts with puppetdb to pull the facts from the recent
# run of Puppet on a given node. This uses octocatalog-diff on the back end to
# pull the facts from puppetdb.
require "octocatalog-diff"
module OctofactsUpdater
module Service
class PuppetDB
# Get the facts for a specific node.
... | 32.395349 | 91 | 0.641062 |
bf69d29b08557ca3c3c8341f91a60631412bfba2 | 2,172 | module Aws
module Resources
class Documenter
class HasManyOperationDocumenter < BaseOperationDocumenter
def docstring
super + ' ' +<<-DOCSTRING.lstrip
Returns a {Resources::Collection Collection} of {#{target_resource_class_name}}
resources. No API requests are made until you call an enum... | 31.941176 | 96 | 0.656538 |
d5f9a3e140edd553e82aa90ad1bcdde37a5fc54d | 15,188 | # frozen_string_literal: true
# Assuming you have not yet modified this file, each configuration option below
# is set to its default value. Note that some are commented out while others
# are not: uncommented lines are intended to protect your configuration from
# breaking changes in upgrades (i.e., in the event that... | 48.679487 | 154 | 0.752634 |
1da7dad12824927fd6113e788fd3cc851d371d2c | 2,848 | # Copyright 2017 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, ... | 37.473684 | 133 | 0.73139 |
e2581623ccad52000088b8791618c60ab2558a70 | 387 | require 'shouty'
Given("{person} is located/standing {int} metre(s) from Sean") do |person, distance|
person.move_to(distance)
@lucy = person
end
When("Sean shouts {string}") do |message|
sean = Shouty::Person.new('Sean')
sean.shout(message)
@message_from_sean = message
end
Then("Lucy hears Sean's message"... | 22.764706 | 84 | 0.718346 |
01126b33dcd9dda1fe8ca82ed1da813d0a6368e2 | 64 | class Image < ActiveRecord::Base
has_attached_file :image
end
| 16 | 32 | 0.796875 |
abbaee4d618eae0b97e5e0292ca510311f15b93a | 1,445 | # Require any additional compass plugins here.
# set the css file encoding
Encoding.default_external = "utf-8"
dist_root = "dist/"
http_images_path = "../img/common"
http_generated_images_path = "../../img"
generated_images_dir = dist_root + "img"
# To enable relative paths to assets via compass helper functions. Un... | 31.413043 | 109 | 0.721799 |
d5a92703bbcd5746c8e01f1bead0ccf1efb4dad7 | 22,067 | require 'spec_helper'
describe Boxr::Client do
#PLEASE NOTE
#This test is intentionally NOT a series of unit tests. The goal is to smoke test the entire code base
#against an actual Box account, making real calls to the Box API. The Box API is subject to frequent
#changes and it is not sufficient to mock re... | 40.049002 | 141 | 0.733448 |
1d251b3a2678a611918e8820b01c9b75e29f74e4 | 264 | module BulkBundler
class Command
def initialize(command)
@command = command
end
def run
cmd = IO.popen("#{@command} 2>&1")
$stdout.write(cmd.getc) until cmd.eof?
cmd.close
raise 'error' unless $? == 0
end
end
end
| 17.6 | 44 | 0.583333 |
bbc8ee9ab43e7b7e68b94e09afbf6f4e78e4b48f | 244 | class CommentsController < ApplicationController
include SocialStream::Controllers::Objects
def show
parent = resource.post_activity.parent
redirect_to polymorphic_path(parent.direct_object,:anchor => dom_id(parent))
end
end
| 27.111111 | 80 | 0.782787 |
01513ae95737e7289504e14df233da526fe4cdb4 | 2,474 | # This file is copied to spec/ when you run 'rails generate rspec:install'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
requ... | 46.679245 | 86 | 0.748989 |
01c575ce95d687c0b2d0fd377ac015b2dc5ed933 | 10,438 | # coding: utf-8
require 'test_helper'
class RemoteBarclaysEpdqExtraPlusTest < Test::Unit::TestCase
def setup
@gateway = BarclaysEpdqExtraPlusGateway.new(fixtures(:barclays_epdq_extra_plus))
@amount = 100
@credit_card = credit_card('4000100011112224', :verification_value => '987')
@mastercard ... | 43.857143 | 161 | 0.758574 |
283d7316439c2671e3c7c6d2b3b05ab5ffccf0b0 | 579 | cask 'syncthing' do
version '0.12.16'
sha256 '62f7492ebd7a155f6e66e1ba22c68b829463cb53774f4f91a6d8390263f04d7e'
url "https://github.com/syncthing/syncthing/releases/download/v#{version}/syncthing-macosx-amd64-v#{version}.tar.gz"
appcast 'https://github.com/syncthing/syncthing/releases.atom',
checkpoi... | 36.1875 | 118 | 0.778929 |
281ee6f39a7a54d3eea02355171b304e1af4493c | 145 | class Views::HelpersSystemSpec::ControllerHelperMethod < Fortitude::Widgets::Html5
def content
text "it is #{decorate('Fred')}!"
end
end
| 24.166667 | 82 | 0.731034 |
26153d4319f69150ae2b40a6451005b01e1502bb | 2,619 | class Cairo < Formula
desc "Vector graphics library with cross-device output support"
homepage "https://cairographics.org/"
url "https://cairographics.org/releases/cairo-1.16.0.tar.xz"
sha256 "5e7b29b3f113ef870d1e3ecf8adf21f923396401604bda16d44be45e66052331"
revision 3
bottle do
sha256 "6a23a68837269a8... | 28.467391 | 94 | 0.653303 |
91743c6fd319fae471b2367a2bf8f066d4a1e887 | 540 | require 'uglifier'
activate :automatic_image_sizes
activate :directory_indexes
activate :livereload
activate :syntax
set :page_title, 'GIFPoint'
ready do
sprockets.append_path File.join root, 'bower_components'
end
set :css_dir, 'assets/stylesheets'
set :js_dir, 'assets/javascripts'
set :images_dir, 'assets/image... | 21.6 | 78 | 0.785185 |
5d930ddc7f11a58dff3e01ea648f68df4c3baff8 | 1,200 | class MacRobber < Formula
desc "Digital investigation tool"
homepage "https://www.sleuthkit.org/mac-robber/"
url "https://downloads.sourceforge.net/project/mac-robber/mac-robber/1.02/mac-robber-1.02.tar.gz"
sha256 "5895d332ec8d87e15f21441c61545b7f68830a2ee2c967d381773bd08504806d"
bottle do
cellar :any_sk... | 50 | 107 | 0.811667 |
087f5d3ad2586025488c241601f7c875771e92ef | 612 | # @param {Integer} num
# @return {Integer}
# def add_digits(num)
# while num >= 10
# temp = 0
# while num > 0
# temp += num % 10
# num /= 10
# end
# num = temp
# end
# return num
# end
# def add_digits(num)
# num if num.to_s.length <= 1
# while num >= 10
# num = num.to_s.... | 17 | 84 | 0.545752 |
d559d1f90fe0b3be8f43d457fd234d1174c697b8 | 2,038 | class Reports::ContributionReportsForProjectOwnersController < Reports::BaseController
before_filter :check_if_project_belongs_to_user
def end_of_association_chain
conditions = { project_id: params[:project_id] }
conditions.merge!(reward_id: params[:reward_id]) if params[:reward_id].present?
super.
... | 55.081081 | 101 | 0.7316 |
5d683541d2cd9b15ec6aaf71fcc9a2af32f9ac43 | 2,124 | # frozen_string_literal: true
#
# Copyright:: Copyright 2019, Chef Software Inc.
# Author:: Tim Smith (<tsmith@chef.io>)
#
# 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.... | 35.4 | 139 | 0.643597 |
1816939bc1f5e97659b94c895ec7b25fbc4b962f | 219 | class CreateProgramas < ActiveRecord::Migration[7.0]
def change
create_table :programas do |t|
t.string :nombre
t.references :area, null: false, foreign_key: true
t.timestamps
end
end
end
| 19.909091 | 56 | 0.675799 |
392796ed99089c8ff0df248faae4185fc38273eb | 2,045 | =begin
#Datadog API V1 Collection
#Collection of all Datadog Public endpoints.
The version of the OpenAPI document: 1.0
Contact: support@datadoghq.com
Generated by: https://openapi-generator.tech
Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
This product... | 35.877193 | 112 | 0.756968 |
e8090e387fa5fef3fd65b8b71e57c275b752e0b6 | 655 | require 'spec_helper'
describe DataMapper::Address do
describe ".config" do
before(:each) do
# Force to default state
DataMapper::Address.instance_variable_set(:@config, nil)
end
after(:all) do
# Force to default state for other specs
DataMapper::Address.instance_variable_set... | 26.2 | 79 | 0.673282 |
f817ed2a5a304a5d5ffc41804d23d6c167beb7c8 | 15,083 | require 'abstract_unit'
require 'active_model'
class Bunny < Struct.new(:Bunny, :id)
extend ActiveModel::Naming
include ActiveModel::Conversion
def to_key() id ? [id] : nil end
end
class Author
extend ActiveModel::Naming
include ActiveModel::Conversion
attr_reader :id
def to_key() id ? [id] : nil end
... | 31.554393 | 229 | 0.655572 |
ed9104889cd132c207ac667ed9a9f129519dae51 | 242 | class CreateUsers < ActiveRecord::Migration[5.2]
def change
create_table :users do |t|
t.string :first_name
t.string :last_name
t.string :user_name
t.string :password_digest
t.timestamps
end
end
end
| 18.615385 | 48 | 0.657025 |
1d826720502b52cc2a128f9d3617a16d45ba8719 | 1,142 | cask 'unity-windows-mono-support-for-editor@2019.3.0b3' do
version '2019.3.0b3,d0377b9426dc'
sha256 :no_check
url "http://beta.unity3d.com/download/d0377b9426dc/MacEditorTargetInstaller/UnitySetup-Windows-Mono-Support-for-Editor-2019.3.0b3.pkg"
name 'Windows Build Support (Mono)'
homepage 'https://unity3d.co... | 31.722222 | 136 | 0.717163 |
b952c9fa3aefdf6e47e482dd62b4681b06a84dfe | 1,248 | module ActiveAdmin
module Axlsx
module ResourceControllerExtension
def self.included(base)
# base.send :alias_method_chain, :per_page, :xlsx
# base.send :alias_method_chain, :index, :xlsx
base.prepend(ResourceControllerExtension)
base.send :respond_to, :xlsx
end
... | 32 | 107 | 0.639423 |
4a8fec8454b28c62703c6e29462cac0249aa73e2 | 3,463 | require 'spec_helper'
describe 'Stock Transfers', :type => :feature, :js => true do
stub_authorization!
let(:admin_user) { create(:admin_user) }
let(:description) { 'Test stock transfer' }
before do
allow_any_instance_of(Spree::Admin::BaseController).to receive(:spree_current_user).and_return(admin_user)... | 32.980952 | 110 | 0.697661 |
1a40fd61db21c9e6a382b3c17b497c7528670fda | 278 | require_relative './app'
require 'test/unit'
require 'rack/test'
set :environment, :test
class MyAppTest < Test::Unit::TestCase
include Rack::Test::Methods
def app
Sinatra::Application
end
def test_get_request
get '/'
assert last_response.ok?
end
end
| 13.9 | 38 | 0.701439 |
f7bc9f081d1967ca1adb50ddc63da82a16d5affc | 863 | Pod::Spec.new do |s|
s.name = "AsyncOperation"
s.version = "1.1.0"
s.summary = "A hassle-free implementation of asynchronous NSOperations/NSBlockOperations."
s.description = <<-DESC
AsyncOperation aims to ease the pain commonly encountered when having to subclass NSOperat... | 39.227273 | 129 | 0.630359 |
e24a4c8968da2af59ec8a18385dddfd6f8ff5dd5 | 175 | module Watchtower
module Views
class Poll < Mustache
include Watchtower::Helpers
def beams
format_beams(@results || [])
end
end
end
end | 14.583333 | 36 | 0.611429 |
f736361dfd1a634096379ce0c54d9b8381b628b2 | 1,671 | require 'spec_helper'
describe ArcFurnace::MultiCSVSource do
let(:filenames) do
[
"#{ArcFurnace.test_root}/resources/source1.csv",
"#{ArcFurnace.test_root}/resources/empty_source.csv",
"#{ArcFurnace.test_root}/resources/source2.csv"
]
end
let(:source) { ArcFurnace::MultiCSVSource.new(f... | 30.944444 | 73 | 0.583483 |
010dd2d5e244893d5dfb6e31e99a274c3cf3a1ed | 910 | # frozen_string_literal: true
module HttpSignatures
class HeaderList
# Cannot sign the signature headers
ILLEGAL = %w[authorization signature].freeze
def self.from_string(string)
new(string.split(' '))
end
def initialize(names)
@names = names.map(&:downcase)
validate_names!
... | 19.782609 | 82 | 0.646154 |
79365b7642e38f77d2d7cd488f89ba43774454f4 | 14,947 | require 'test_helper'
class HyperGraphTest < Test::Unit::TestCase
def setup
@mock_connection = mock('api-connection')
@mock_connection.stubs(:verify_mode=)
Net::HTTP.stubs(:new).returns(@mock_connection)
end
def test_get_object_info_while_unauthenticated
json_api_response = '{"id":"518018845"... | 67.026906 | 388 | 0.599184 |
b935cbd195c323d10971639bfd40611883b5f1df | 708 | cask :v1 => 'libreoffice' do
version '4.3.4'
if Hardware::CPU.is_32_bit? or MacOS.version < :mountain_lion
sha256 '9e466cdd41ab29e0845267f6e46ed7c6edb79b36b4bcb121edd0df55aee4e53c'
url "https://download.documentfoundation.org/libreoffice/stable/#{version}/mac/x86/LibreOffice_#{version}_MacOS_x86.dmg"
els... | 37.263158 | 130 | 0.772599 |
33f1021ec0f0ff68f62f2536c76fc1a3684b9c6b | 1,048 | require './test/test_helper'
class AccountTest < TestHelper
def test_it_reads_all_usernames_of_an_account
file_io_test
generate_test_account(2)
account = Account.new(account: 'test', destination: '~/Library/RyPass/test')
clean_test_csvs
assert_equal account.usernames, ['Username','test0@test.com... | 31.757576 | 107 | 0.707061 |
1adf31176a13280f6574fc6a502cbba7ce184b02 | 33,956 | # frozen_string_literal: true
require "action_view/helpers/javascript_helper"
require "active_support/core_ext/array/access"
require "active_support/core_ext/hash/keys"
require "active_support/core_ext/string/output_safety"
module ActionView
# = Action View URL Helpers
module Helpers #:nodoc:
# Provides a set... | 44.041505 | 139 | 0.585493 |
d5f3c679213ac045491ad42e4f2516c9e5fb7b7b | 409 | class CreateSearchableBoards < ActiveRecord::Migration
def change
create_table :searchable_boards, id: false do |t|
t.primary_key :searchable_id
t.string :searchable_type, null: false
t.tsvector :content, null: false, default: ''
t.string :section, null: false
end
add_index :searc... | 29.214286 | 55 | 0.709046 |
62d41fcdab3ab401193f4819761c3e43915fc7e9 | 825 | class AssetBaseAuditResultsListReport < Report
def get_data(conditions)
if conditions[:audit_result_type_id].to_i == AuditResultType::AUDIT_RESULT_UNKNOWN.to_i
audit_results = []
not_tested = TransitAsset.operational.where(organization_id: conditions[:organization_id], (conditions[:filterable_type].... | 45.833333 | 273 | 0.773333 |
aca53d702eba3b6260ad294985a1998554b77029 | 2,047 | require "spec_helper"
module Refinery
describe "the Admin Images Tab" do
refinery_login_with :refinery_user
include_context 'admin images tab'
context 'When there are no images' do
include_context 'no existing images'
it 'says there are no images'do
visit refinery.admin_images_path... | 26.934211 | 103 | 0.703468 |
9142aaf99fa89bbf924465c667c68d95a360350c | 314 | CoDy::LogBook.new do
r = repo '.'
log do
position 'b56ab8e15a865918acfaccad0b486544a78b37a2'
entry '''
This is an empty repository ...
'''
position '6fe8def3e2719f53c7ad929e491d8fc201815c38'
end
final do
position r.current_branch
end
end | 14.272727 | 59 | 0.601911 |
ac30b3b7a14c58e773357a883f67fa124afe6b7b | 5,027 | # Copyright 2011-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" fil... | 28.725714 | 79 | 0.605132 |
b9e74f5b31f72ac174dd6ddf889b0a308d877ca9 | 83 | module Docker
# The version of the docker-api gem.
VERSION = '2.0.0.pre.1'
end
| 16.6 | 38 | 0.674699 |
28985cc4d942125e94568b0a0320dcd6526da678 | 3,924 | class Remarshal < Formula
include Language::Python::Virtualenv
desc "Convert between TOML, YAML and JSON"
homepage "https://github.com/dbohdan/remarshal"
url "https://files.pythonhosted.org/packages/24/37/1f167687b2d9f3bac3e7e73508f86c7e6c1bf26a37ca5443182c8f596625/remarshal-0.14.0.tar.gz"
sha256 "16425aa157... | 44.590909 | 146 | 0.744903 |
7a8f5c74b1f3a7c3724dcb0070cd41e9b83b5daa | 526 | unless String.method_defined? :rpartition
require 'backports/tools/arguments'
class String
def rpartition(pattern)
pattern = Backports.coerce_to(pattern, String, :to_str) unless pattern.is_a? Regexp
i = rindex(pattern)
return ["", "", self] unless i
if pattern.is_a? Regexp
matc... | 26.3 | 89 | 0.63308 |
1ac652a282d99325f3c976d4ab9e5e351a61ca9c | 68 | require_relative './base_views'
class HistoryViews < BaseViews; end | 22.666667 | 35 | 0.808824 |
ff0a43c7baf53ebc9b94013f3e37df3c73024aa2 | 3,254 | require File.expand_path('../boot', __FILE__)
require 'rails/all'
Bundler.require
require "ornament"
module Dummy
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
... | 46.485714 | 113 | 0.732329 |
21e3870153b292b9928f2d37e3573b3945653052 | 179 | class AddStatusFeedback < ActiveRecord::Migration
def self.up
add_column :statuses, :feedback, :text
end
def self.down
remove_column :statuses, :feedback
end
end
| 17.9 | 49 | 0.731844 |
0381cba24b53769a4e925fb267eea3680617867b | 4,062 | require 'sinatra/base'
require 'slack-ruby-client'
require 'uri'
require 'incident'
def get_random_string(length=7)
source=("a".."z").to_a + (0..9).to_a
key=""
length.times{ key += source[rand(source.size)].to_s }
return key
end
# Load Slack app info into a hash called `config` from the environment variables ... | 33.295082 | 140 | 0.698178 |
61c84c6a32ceff9cb8865e9de36dd0c6b7e30bd4 | 1,825 | # -*- encoding: utf-8 -*-
# stub: redcarpet 3.4.0 ruby lib
# stub: ext/redcarpet/extconf.rb
Gem::Specification.new do |s|
s.name = "redcarpet".freeze
s.version = "3.4.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".free... | 40.555556 | 112 | 0.667397 |
d5eaba9033010cc63fa3d8ef652f06793e9f41cc | 1,662 | class Topgrade < Formula
desc "Upgrade all the things"
homepage "https://github.com/r-darwish/topgrade"
url "https://github.com/r-darwish/topgrade/archive/v6.9.1.tar.gz"
sha256 "4cd2a24fcb5f3b9c709b8ff85ff9bdc52afe87735d39f0096e46c57931b5680c"
license "GPL-3.0-or-later"
bottle do
sha256 cellar: :any_sk... | 41.55 | 122 | 0.738267 |
91c5ea265a17daf19b9d6d0af36e26226c9d9be4 | 300 | class PolychromeShow < ActiveRecord::Base
attr_accessible :show_data, :slug
before_create :create_unique_slug
def to_param
slug
end
def create_unique_slug
begin
self[:slug] = SecureRandom.urlsafe_base64(8)
end while OpenNoteNote.exists?(:slug => self[:slug])
end
end
| 18.75 | 56 | 0.723333 |
d588ba50e50f5627cf3c61759629f44ba202508a | 4,811 | ##
# 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 = NormalRanking
include Msf::Exploit::Remote::BrowserExploitServer
def initialize(info={})
s... | 36.44697 | 168 | 0.565787 |
038f29c10098691079d5d2e16010884206d4f4ce | 2,845 | require 'trashed/test_helper'
require 'trashed/reporter'
require 'logger'
require 'stringio'
class ReporterTest < Minitest::Test
def setup
@reporter = Trashed::Reporter.new
@reporter.timing_sample_rate = 1
@reporter.gauge_sample_rate = 1
end
def test_sample_rate_defaults
assert_equal 0.1, Trashe... | 45.15873 | 204 | 0.660105 |
ed9f4fa1428942b5730a059df8611a35d7860430 | 203 | component "rubygem-aws-sdk-ec2" do |pkg, settings, platform|
pkg.version "1.259.0"
pkg.md5sum "e93081b9c457f7efda1299e19602d794"
instance_eval File.read('configs/components/_base-rubygem.rb')
end
| 29 | 64 | 0.773399 |
bb813d34486887daa074a1c9018fefc696b78055 | 253 | module Api
class BaseController < ApplicationController
before_action :doorkeeper_authorize!
respond_to :json
def render_json(results)
render json: results
.map(&:attributes)
.map(&:to_snake_keys)
end
end
end
| 18.071429 | 46 | 0.679842 |
260d11d1b34697b5eb8bbc63014e4e3edd9465a7 | 419 | # 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::V2019_06_01
module Models
#
# Defines values for PcStatus
#
module PcStatus
NotStarted = "NotStarted"
Running = "Ru... | 22.052632 | 70 | 0.661098 |
ac0e01f83f8a2b37ff7a478ee5614f2fa1c81fdb | 3,334 | #
# Cookbook Name:: f5-bigip
# Library:: loader
#
# Copyright 2014, Target Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | 31.158879 | 120 | 0.65147 |
268452f422637448e1ca20f979633662a10519bb | 5,381 | require 'set'
module ActiveRecord
module Associations
class AssociationCollection < AssociationProxy #:nodoc:
def to_ary
load_target
@target.to_ary
end
def reset
@target = []
@loaded = false
end
# Add +records+ to this association. Returns +self+... | 33.42236 | 197 | 0.599703 |
f7f328058449aa3e32585743350d4481071d4de1 | 3,740 | require File.dirname(__FILE__) + '/../test_helper'
class DependencyTest < ActiveSupport::TestCase
should belong_to :rubygem
should belong_to :version
context "with dependency" do
setup do
@version = Factory(:version)
@dependency = FactoryGirl.build(:dependency, :version => @version)
end
... | 34 | 130 | 0.670321 |
1dad8d5118318eee115360193a9b1bd2878e8047 | 856 | Pod::Spec.new do |s|
s.name = "SwiftMandrill"
s.version = "1.0.4"
s.summary = "A simple iOS client for the Mandrill Mail API"
s.description = <<-DESC
SwiftMandrill provides simple alternative when you need to send an email with your iOS app.
DESC
s.homepage = "https... | 32.923077 | 106 | 0.606308 |
d5d59943bdf85532421233537ecbee72ea72ec9f | 497 | # frozen_string_literal: true
class CreateOutboundWebhooks < ActiveRecord::Migration[4.2]
def change
create_table :outbound_webhooks do |t|
t.timestamps null: false
t.timestamp :deleted_at, default: nil
t.integer :project_id, null: false
t.integer :stage_id, null: false
t.string :u... | 24.85 | 59 | 0.700201 |
f8afb9d9dd484b66be9af026a80b762fbde4718b | 1,484 | require 'thread'
# used to run concurrent sneaql transforms
# from a threadsafe queue.
class ParallelizeSneaqlTransforms
# initialize object and run concurrent transforms.
# @param [Queue] queue_to_process queue of hashes with all params needed for transform
# @param [Fixnum] concurrency number of threads
# @p... | 30.285714 | 88 | 0.634771 |
38020030114915e87c8d4269770e9e56462d7902 | 9,640 | require 'xsd/qname'
module AdwordsApi; module V13; module AccountService
# AccountInfo
# - billingAddress - AdwordsApi::V13::AccountService::Address
# - currencyCode - SOAP::SOAPString
# - customerId - SOAP::SOAPLong
# - defaultNetworkTargeting - AdwordsApi::V13::AccountService::NetworkTarget
# - descriptiveName - S... | 29.937888 | 290 | 0.771577 |
21392f1780826589ecc87e98358ef11c1fb49f53 | 282 | #!/usr/bin/env ruby
require 'dcell/explorer'
require_relative 'options'
explorer_host = 'localhost'
explorer_port = 7778
DCell.start registry: registry
DCell::Explorer.new explorer_host, explorer_port
puts "Visit explorer page at http://#{explorer_host}:#{explorer_port}"
sleep
| 20.142857 | 70 | 0.783688 |
1d180734adb63cf89edfcd65fc4a8f1cedc55384 | 1,551 | require_relative 'helper'
require 'zendesk/deployment/restart'
describe Zendesk::Deployment::Restart do
let(:exclude_services) { [] }
let(:allow_check_services_failure) { false }
before do
cap.extend(Zendesk::Deployment::Restart)
cap.set :application, 'test_app'
cap.set :exclude_services, exclude_s... | 33.717391 | 106 | 0.728562 |
ac5b664697f42986b2cb875b2ff4bb0a0a9a42a6 | 172 | # -*- coding: binary -*-
module Rex
module Java
module Serialization
module Model
class NullReference < Element
end
end
end
end
end | 14.333333 | 37 | 0.587209 |
28da2f31b3cb4b16f46495bac1dfae91c04d8faa | 134 | # frozen_string_literal: true
FactoryGirl.define do
factory :comment do
content 'MyText'
post_id 1
user_id 1
end
end
| 13.4 | 29 | 0.708955 |
79a9488c539aa6fb7ea683da22d30624bd3adcb8 | 7,909 | require File.dirname(__FILE__) + '/spec_helper'
describe "Pages" do
in_contexts do
before(:each) do
@pages = @articles.pages
@per_page = 2
@articles.stub!(:per_page).and_return(@per_page)
@articles.stub!(:page_name).and_return("Page")
end
it "should raise an error if per_page... | 31.636 | 119 | 0.626754 |
ac45b53ada8f0a78dc84f103dfc7017cde915cf9 | 127 | class AddDummyBlobToQuestions < ActiveRecord::Migration
def change
add_column :questions, :dummy_blob, :string
end
end
| 21.166667 | 55 | 0.779528 |
7a4a25655e3ccd2615b8cd1db1ebe5c249e7b50a | 1,254 | # frozen_string_literal: true
# WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
Gem::Specification.new do |spec|
spec.name = 'aws-sdk-shield'
sp... | 38 | 110 | 0.661882 |
bb58c62f708285fd5e6f7de33a5a8aaf870c0bf5 | 2,353 | module Jets::Job::Dsl
module DynamodbEvent
def dynamodb_event(table_name, options={})
return if ENV['JETS_BUILD_NO_INTERNET'] # Disable during build since jets build tries to init this
stream_arn = full_dynamodb_stream_arn(table_name)
default_iam_policy = default_dynamodb_stream_policy(stream_a... | 35.119403 | 106 | 0.661283 |
33cfca732cab380edf8b80db3cf5859323e77ab3 | 120 | class User < ApplicationRecord
validates :name, presence: true
validates :email, presence: true, email: true
end
| 17.142857 | 47 | 0.741667 |
18a41b1c95b196989f5150aa2cdd306add7b55a4 | 12,029 | #! /usr/bin/env ruby
require 'webrick'
require 'optparse'
require 'ostruct'
include WEBrick
# We are a servlet for the WEBRick server that we are creating.
class DoppioServer
attr_accessor :server, :serverpid, :expIndex, :experiments
module Mode
DEV = 0
BMK = 1
REL = 2
end
module Browser
CHR... | 28.985542 | 84 | 0.549755 |
332bd0cc72a6a04830b09b53f2e014c66a51a76b | 633 | # frozen_string_literal: true
module Nomis
module Elite2
class UserApi
extend Elite2Api
def self.user_details(username)
route = "/elite2api/api/users/#{username}"
response = e2_client.get(route)
user = api_deserialiser.deserialise(Nomis::UserDetails, response)
user.e... | 23.444444 | 86 | 0.658768 |
79ff72984e5bac3d81733ae308df68f5593ab71e | 3,212 | # 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::SQL::Mgmt::V2014_04_01
module Models
#
# A database geo backup policy.
#
class GeoBackupPolicy < ProxyResource
includ... | 28.424779 | 78 | 0.460149 |
d560ebcc6e620fd3a5a3ce97efec9493ffde002e | 2,021 | # frozen_string_literal: true
class BulkImportWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
data_consistency :always
feature_category :importers
sidekiq_options retry: false, dead: false
PERFORM_DELAY = 5.seconds
DEFAULT_BATCH_SIZE = 5
def perform(bulk_import_id)
... | 25.582278 | 109 | 0.748639 |
7adaee4d8b279af8282828f464b6bcffda448c55 | 167 | class AddNameToIssues < ActiveRecord::Migration
def self.up
add_column :issues, :name, :string
end
def self.down
remove_column :issues, :name
end
end
| 16.7 | 47 | 0.712575 |
1a9258fda052a710065dee96d7644f9093fa3be6 | 5,269 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Getting issues for an epic' do
include GraphqlHelpers
let_it_be(:current_user) { create(:user) }
let_it_be(:user) { create(:user) }
let_it_be(:group) { create(:group, :public) }
let_it_be(:epic) { create(:epic, group: group) }
let_it_be(... | 31.933333 | 114 | 0.649839 |
e90f252a3dab71d273dec5d1de3a74be46816db5 | 195 | if Gem::Specification.find_by_name('capistrano').version >= Gem::Version.new('3.0.0')
load File.expand_path('../capistrano/tasks.cap', __FILE__)
else
require_relative 'capistrano/tasks2'
end
| 32.5 | 85 | 0.753846 |
380c3a7909a33c1dda80c5420c8ce6def7c384ad | 1,900 | # Load the rails application
require File.expand_path('../application', __FILE__)
require File.expand_path('../../lib/printing/invoice_printer', __FILE__)
# Initialize the rails application
Hadean::Application.initialize!
Hadean::Application.configure do
config.after_initialize do
unless Settings.encryption_key
... | 42.222222 | 104 | 0.503684 |
f8deb9d5255a74c17e3869d9ec3ee2abe3e76224 | 761 | require 'upsert/connection/jdbc'
class Upsert
class Connection
# @private
class Java_ComMysqlJdbc_JDBC4Connection < Connection
include Jdbc
def quote_ident(k)
if metal.useAnsiQuotedIdentifiers
DOUBLE_QUOTE + k.to_s.gsub(DOUBLE_QUOTE, '""') + DOUBLE_QUOTE
else
... | 25.366667 | 107 | 0.621551 |
39de2fd686d6cb529dfebca1d0aafa7c8a535d00 | 1,257 | t = PryTheme.create :name => 'pry-modern-256' do
author :name => 'Kyrylo Silin', :email => 'kyrylosilin@gmail.com'
description 'Nifty version of pry-classic'
define_theme do
class_ 'fuchsia', [:bold]
class_variable 'robin_egg_blue04'
comment 'cerulean_grey01'
constant 'klein_blue', [:bold, :under... | 25.653061 | 67 | 0.641209 |
6a23c2fe164cdec89105c1a2b7046fe20335027a | 759 | module Sanction
class Permission
attr_reader :predicates
def initialize(permission_graph, *predicates)
@graph = permission_graph
@predicates = predicates
end
def path
@path ||= begin
path = @graph.root
@predicates.each do |predicate|
if predicate.is_... | 19.973684 | 88 | 0.602108 |
b91301e0feebf8e1c773829fa957aa1cd3bb1a76 | 1,002 | lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "wasmer/version"
Gem::Specification.new do |spec|
spec.name = "wasmer"
spec.version = Wasmer::VERSION
spec.authors = ["Ivan Enderlin"]
spec.email = ["ivan.enderlin@hoa-projec... | 33.4 | 81 | 0.650699 |
6278d199a7d495032ac1d008c5926dd93b485bc0 | 302 | module Golem
module Actions
class ListPlayers < Action
def setup
log "#{state.players.size} other players"
state.players.each do |name, entity|
pos = entity.position.map {|v| v / 32 }
log "#{name}: #{pos.inspect}"
end
end
end
end
end
| 21.571429 | 49 | 0.559603 |
33625f010fcb96d0fdaca9cc24b3f25f60e0f7ae | 922 | #
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
# Run `pod lib lint kuma_player.podspec' to validate before publishing.
#
Pod::Spec.new do |s|
s.name = 'kuma_player'
s.version = '0.0.1'
s.summary = 'A new flutter plugin project.'
s.description... | 38.416667 | 104 | 0.598698 |
ace7666f6721f5bfb463addd2c255da34d55c37e | 555 | module HealthSeven::V2_5_1
class Cf < ::HealthSeven::DataType
# Identifier
attribute :identifier, St, position: "CF.1"
# Formatted Text
attribute :formatted_text, Ft, position: "CF.2"
# Name of Coding System
attribute :name_of_coding_system, Id, position: "CF.3"
# Alternate Identifier
attribute :alterna... | 34.6875 | 66 | 0.74955 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.