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 |
|---|---|---|---|---|---|
4af2ad479ede50a2f835037026bfe15b7e93e4d4 | 1,564 | require "digest"
require "method_source"
module SafeMonkeypatch
extend self
class UpstreamChanged < StandardError
end
class ConfigurationError < StandardError
end
class InvalidMethod < StandardError
end
end
class Module
def safe_monkeypatch(meth, options={})
options = options.dup
info = opt... | 23 | 100 | 0.632353 |
ac15857abbe15678c5f68dd2ef6c53ab6a1696d4 | 1,206 | module Feedjira
module Parser
class AtomYoutubeEntry
include SAXMachine
include FeedEntryUtilities
element :title
element :link, as: :url, value: :href, with: { rel: 'alternate' }
element :name, as: :author
element :"media:description", as: :content
element :summary
... | 40.2 | 77 | 0.665008 |
fffca2fafb81aa7fa33c33eaf343a763ea9e826b | 118 | module Wf
class ApplicationController < ActionController::API
# protect_from_forgery with: :exception
end
end
| 19.666667 | 53 | 0.779661 |
61023eaba8d468d921818506281016978a03c31a | 1,019 | describe :argf_readlines, :shared => true do
before :each do
ARGV.clear
@file1 = ARGFSpecs.fixture_file('file1.txt')
@file2 = ARGFSpecs.fixture_file('file2.txt')
@stdin = ARGFSpecs.fixture_file('stdin.txt')
@contents_file1 = File.read(@file1)
@contents_file2 = File.read(@file2)
@contents_s... | 30.878788 | 100 | 0.669284 |
39283f6855559fc5a4af12c75823a4fde0c67a67 | 278 | class CreateComments < ActiveRecord::Migration[5.2]
def change
create_table :comments do |t|
t.text :content
t.integer :user_id, foreign_key: true
t.integer :post_id, foreign_key: true
t.references :comment_id
t.timestamps
end
end
end
| 21.384615 | 51 | 0.672662 |
b9cdf0e17873a72293a0803ce28b4f3282ebab36 | 7,301 | require_relative "../prepositions"
module Acl9
module ModelExtensions
module ForSubject
include Prepositions
DEFAULT = Class.new do
def default?
true
end
end.new.freeze
##
# Role check.
#
# There is a global option, +Acl9.config[:protect_globa... | 31.334764 | 109 | 0.58581 |
01ec04f2976316e435e5468bf145358c34105125 | 424 | require 'spec_helper'
require 'result'
describe Result do
let(:value) {3}
describe '.Success' do
let(:result) {described_class.Success(value)}
it 'is a success' do
expect(result).to be_a(described_class::Success)
end
end
describe '.Failure' do
let(:result) {described_class.Failure(val... | 17.666667 | 54 | 0.67217 |
6a3bd609f4e814c92e2280afad5ee87c364fea72 | 641 | rule "FC026", "Conditional execution block attribute contains only string" do
tags %w{correctness}
recipe do |ast|
find_resources(ast).map { |r| resource_attributes(r) }.map do |resource|
[resource["not_if"], resource["only_if"]]
end.flatten.compact.select do |condition|
condition.respond_to?(:x... | 42.733333 | 121 | 0.680187 |
62a18c28a6a5ac006579c71733b901746ad4c761 | 866 | module BERTRPC
class Service
attr_accessor :host, :port, :timeout
# For streaming, object must respond to write method
attr_accessor :stream
def initialize(host, port, timeout = nil)
@host = host
@port = port
@timeout = timeout
end
def call(options = nil)
verify_optio... | 22.789474 | 82 | 0.605081 |
62517e6c1d183a2c918e2d6859a72aaa896b26f6 | 5,020 | #-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2021 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork ... | 30.797546 | 98 | 0.677888 |
1cbe9865335bfbd4054a9b095fc4583ae4be2afd | 1,842 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::TrafficManager::Mgmt::V2018_04_01
module Models
#
# Subnet first address, scope, and/or last address.
#
class EndpointPropertiesSubnetsItem
... | 26.695652 | 74 | 0.513029 |
1cf00665698155d9ccaab3303109ed97eebe34f4 | 1,429 | module MathCaptcha
class Captcha
class << self
# Only the #to_secret is shared with the client.
# It can be reused here to create the Captcha again
def from_secret(secret)
yml = cipher.decrypt64 secret.to_s rescue {:x => 0, :y => 0, :operator => :+}.to_yaml
args = YAML.load(yml)... | 21.651515 | 93 | 0.578027 |
bbff4f5ec3f581066fc2aa7e7773aaf1b28cfd93 | 821 | =begin
#Tatum API
## Authentication <!-- ReDoc-Inject: <security-definitions> -->
OpenAPI spec version: 3.9.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 3.0.31
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for Tatum::OneOfhrm20DeployBody
# Aut... | 23.457143 | 85 | 0.749086 |
e9c2b1c2f28dc324eb61ab75eb94bd62e45c6fb9 | 151 | class AddAlertSentToPipelineRun < ActiveRecord::Migration[5.1]
def change
add_column :pipeline_runs, :alert_sent, :integer, default: 0
end
end
| 25.166667 | 64 | 0.768212 |
4ad03958dbcd205bd99784844422326185c0a80b | 12,023 | module RunLoop
# A class for interacting with .app bundles.
class App
# @!attribute [r] path
# @return [String] The path to the app bundle .app
attr_reader :path
# Creates a new App instance.
#
# @note The `app_bundle_path` is expanded during initialization.
#
# @param [String] app... | 28.694511 | 106 | 0.63994 |
1d0b0e089a3c05a662de1cb41c829f2ff83c4f15 | 1,166 | require "test_helper"
class MaintainingRepoSubscriptionsTest < ActionDispatch::IntegrationTest
fixtures :repos
def triage_the_sandbox
login_via_github
visit "/"
click_link "issue_triage_sandbox"
first(:button, "Triage Issues").click
assert page.has_content?("You'll receive daily triage e-mai... | 25.911111 | 88 | 0.723842 |
e2d9fd62378da33f9c00af8daa62cd89ed2b3c53 | 735 | require 'test_helper'
class HomeControllerTest < ActionController::TestCase
include Devise::TestHelpers
test "anonymous index" do
get :index
assert_redirected_to user_session_path
end
test "AdminUser index" do
sign_in users(:admin_user)
get :index
assert_response :success
assert_sele... | 25.344828 | 57 | 0.718367 |
d562beb5b0a0902b00c9acd1664690a550df9303 | 122 | module Fix
module Protocol
#
# The message classes container module
#
module Messages
end
end
end
| 12.2 | 42 | 0.639344 |
6201bbdadacd99e47287640b3f08419ede68c690 | 30,372 | # Copyright 2018 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, ... | 41.210312 | 131 | 0.548795 |
086fcb23b16c8ec63fe22b8d1f28cb0585a80220 | 2,159 | # frozen_string_literal: true
module MachineLearningWorkbench::Compressor
# Incremental Dictionary Train-less VQ, creating new centroids rather than training
# Optimized for online training.
# TODO: as the deadline grows nigh, the hacks grow foul. Refactor all VQs together.
class IncrDictVQ < VectorQuantizatio... | 40.735849 | 101 | 0.693377 |
7ac233be2e66a5c8c3c06cde14bce39da6ab16f2 | 4,376 | # Copyright 2011-2018, The Trustees of Indiana University and Northwestern
# University. 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
# ... | 66.30303 | 116 | 0.693556 |
f7346af505d4c7648af3a4331ddda1b2fd771ee4 | 7,587 | # frozen_string_literal: true
#
# Provides the ability to perform +FileUtils+ actions, while restricting
# any destructive actions outside of the specified +sandbox_path+.
#
# == Usage
#
# To enable protection:
#
# require 'sandbox_file_utils'
#
# SandboxFileUtils.activate!
# SandboxFileUtils.sandbox_path = 'my_... | 28.958015 | 88 | 0.639779 |
33316f949ed81f3058d7287b4f99f5badfbca831 | 1,194 | # m_3_3_03.rb
require_relative 'mesh'
include GeometricForm
U_RANGE = (-PI..PI)
V_RANGE = (-PI..PI)
MAX_V = 200
MAX_U = 200
attr_reader :renderer, :points
def settings
size 300, 300 , P3D
end
def setup
sketch_title 'Geometric Forms'
ArcBall.init(self)
@renderer = AppRender.new(self)
@points = generate_poi... | 19.57377 | 73 | 0.663317 |
e219cd87c5efbe1cd93cf900e69f9d682425bf87 | 135 | require 'rails_helper'
RSpec.describe Spree::SeedCredit, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end
| 22.5 | 56 | 0.748148 |
eda06876cd33135670209ffce55d43712607c5bd | 3,129 | #!/usr/bin/env ruby
# frozen_string_literal: true
require 'minitest/autorun'
require_relative '../../constants'
require_relative '../../../lib/wavefront-cli/stdlib/string'
require_relative '../../../lib/wavefront-cli/commands/base'
# Test extensions to string class
#
class StringTest < MiniTest::Test
def test_cmd_f... | 36.811765 | 75 | 0.592522 |
4a841b53fe1b85ab6c0e7b91fc9f9ccf9e07a4ca | 1,698 | require_relative '../lib/banking_processor/io/preety_output'
require_relative '../lib/banking_processor/config'
require_relative '../lib/banking_processor/datastore/ddb_handler'
preety = BankingProcessor::IO::PreetyOutput.new
config = BankingProcessor::Config.new
ddb = BankingProcessor::Datastore::DynamoDBHandle... | 26.123077 | 106 | 0.71437 |
bffbe1e7c85d53b4ce531d711d5e4d45d73bbac7 | 3,078 | require_relative "../models/story"
require_relative "../utils/sample_story"
class StoryRepository
def self.add(entry, feed)
Story.create(feed: feed,
title: entry.title,
permalink: entry.url,
body: extract_content(entry),
is_read: false,
... | 26.084746 | 109 | 0.643925 |
38bd76738c31ca35a8ee6179116e570efdd52c59 | 644 | class ChangeEnvDeployGroupToScope < ActiveRecord::Migration
def change
remove_index :environment_variables, name: "environment_variables_unique_deploy_group_id"
add_column :environment_variables, :scope_type, :string
rename_column :environment_variables, :deploy_group_id, :scope_id
EnvironmentVariabl... | 46 | 211 | 0.793478 |
1a5714fcc59173726e01155402a6f908343dddfe | 3,023 | require 'spec_helper'
describe Bosh::OpenStackCloud::Cloud do
before(:each) { allow(Bosh::OpenStackCloud::TagManager).to receive(:tag_server) }
let(:server) { double('server', id: 'i-foobar', metadata: double('metadata')) }
context 'without registry_key set' do
before(:each) do
@cloud = mock_cloud do... | 35.988095 | 122 | 0.62653 |
3951e65dc4fd4858f2634b8d511f8f7f0bab0866 | 54,486 | Rails.application.routes.draw do
# No Devise modules are enabled
# Custom, magic-link based authentication flow used. See, for example -
# CandidateInterface::SignInController
devise_for :candidates, skip: :all
devise_scope :candidate do
get '/candidate/sign-out', to: 'devise/sessions#destroy', as: :cand... | 55.484725 | 182 | 0.701832 |
2631f6671a0721f5433e29a8a58a1f54a3e09dac | 136 | class AddBlogsCommentCountToUser < ActiveRecord::Migration
def change
add_column :users, :blogs_comment_count, :integer
end
end
| 22.666667 | 58 | 0.794118 |
087133bf7f1772c0049b42af22a327ac4092d10b | 1,784 | require 'stash/indexer/index_config'
require 'rsolr'
module Stash
module Indexer
module Solr
# Configuration for a Solr index.
class SolrIndexConfig < IndexConfig
adapter 'Solr'
SUSPICIOUS_OPTS = { proxy_url: :proxy, proxy_uri: :proxy }.freeze
private_constant :SUSPICIOUS_O... | 29.733333 | 150 | 0.59417 |
2865c5833420b7852470bc3fe82c32618d462745 | 8,737 | # frozen_string_literal: true
require "isolation/abstract_unit"
require "env_helpers"
module ApplicationTests
class RakeTest < ActiveSupport::TestCase
include ActiveSupport::Testing::Isolation, EnvHelpers
def setup
build_app
end
def teardown
teardown_app
end
def test_gems_task... | 29.417508 | 92 | 0.649765 |
61d323b1e9ade3435d2d6645ea83f551c58bd0f1 | 125 | class AddSignInCountToUsers < ActiveRecord::Migration
def change
add_column :users, :sign_in_count, :integer
end
end
| 20.833333 | 53 | 0.776 |
d54e11f817855965c2ac75a86e2cbbeab2c34fc9 | 6,866 |
require 'file/visitor'
require 'spec_utils'
describe File::Visitor do
include SpecUtils
before(:each) do
setup_test_dir
@visitor = File::Visitor.new
end
after(:all) do
clear_test_dir
end
it 'can be created with new()' do
visitor = File::Visitor.new
expect(visitor).to be_a File::Visi... | 27.13834 | 70 | 0.607049 |
f7fc2bc05c5d0cbce42ba24a9ca9d18239a75c23 | 740 |
$vertx.create_http_server().request_handler() { |request|
# Let's say we have to call a blocking API (e.g. JDBC) to execute a query for each
# request. We can't do this directly or it will block the event loop
# But you can do this using executeBlocking:
$vertx.execute_blocking(lambda { |promise|
# Do t... | 21.142857 | 84 | 0.663514 |
616447cbac7aa67d5cde9f13372205ab3ba642ee | 414 | 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]+\z/i
validates :email, presence: true, length: { maximum: 255 }, format: { with: VALID_EMAIL_REGEX }, uniqueness: { case_sensitive: ... | 46 | 135 | 0.695652 |
d5fcc1ed9e6b29b625f13178c4df95395e26d6c7 | 61,253 | # 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, ... | 42.714784 | 124 | 0.566242 |
1a5c0cc655008494a43b35ef2043f28822a5a667 | 959 | class Pgdbf < Formula
desc "Converter of XBase/FoxPro tables to PostgreSQL"
homepage "https://github.com/kstrauser/pgdbf"
url "https://downloads.sourceforge.net/project/pgdbf/pgdbf/0.6.2/pgdbf-0.6.2.tar.xz"
sha256 "e46f75e9ac5f500bd12c4542b215ea09f4ebee638d41dcfd642be8e9769aa324"
bottle do
cellar :any_sk... | 43.590909 | 93 | 0.777894 |
f808796241550b009331e0f3c69a3d37255dfe8b | 4,471 | # frozen_string_literal: true
require 'test_helper'
class ShopifyApp::ScripttagsManagerTest < ActiveSupport::TestCase
include ActiveJob::TestHelper
setup do
@scripttags = [
{ event: 'onload', src: 'https://example-app.com/fancy.js' },
{ event: 'onload', src: 'https://example-app.com/foobar.js' },
... | 36.349593 | 111 | 0.711698 |
f88dd8c66a50e9f6bee0fb2d4e6eedd7aa2b0c83 | 332 | ENV['SINATRA_ENV'] ||="Development"
require 'bigdecimal'
require 'bundler/setup'
Bundler.require(:default, ENV['SINATRA_ENV'])
#ActiveRecord::Base.establish_connection(ENV['SINATRA_ENV'].to_sym)
ActiveRecord::Base.establish_connection(
:adapter => "sqlite3",
:database => "db/#{ENV['SINATRA_ENV']}.sqlite"
)
requi... | 25.538462 | 67 | 0.740964 |
e2d9ba8cb76300a63df2d08d1d5b4b4b836ec8cd | 887 | class DockerCompletion < Formula
desc "Bash, Zsh and Fish completion for Docker"
homepage "https://www.docker.com/"
url "https://github.com/docker/cli.git",
tag: "v20.10.8",
revision: "3967b7d28e15a020e4ee344283128ead633b3e0c"
license "Apache-2.0"
livecheck do
formula "docker"
end
b... | 28.612903 | 112 | 0.733935 |
f8d9b27e3dd9d3a88510765a347d7376827fb4c6 | 918 | class EmancipationCategory < ApplicationRecord
has_many :casa_case_emancipation_categories, dependent: :destroy
has_many :casa_cases, through: :casa_case_emancipation_categories
has_many :emancipation_options
validates :name, presence: true
validates :mutually_exclusive, inclusion: {in: [true, false]}
def ... | 29.612903 | 67 | 0.705882 |
7a7dc6f2eca7ae54e9cbb8400693cf5e56081724 | 734 | # frozen_string_literal: true
describe ::AwsPublicIps::Checks::Cloudfront do
it 'should return cloudfront ips' do
stub_request(:get, 'https://cloudfront.amazonaws.com/2018-06-18/distribution')
.to_return(body: ::IO.read('spec/fixtures/cloudfront.xml'))
stub_dns(
'd22ycgwdruc4lt.cloudfront.net' =... | 28.230769 | 82 | 0.613079 |
3883d3163598b21ea7ce2103a0ab8d3f77885b19 | 984 | cask "unity-ios-support-for-editor" do
version "2021.3.0f1,6eacc8284459"
sha256 "4566c87017abe6e5c03acb86d2ce9e32cde70794e34f3d882710d77de474d65e"
url "https://download.unity3d.com/download_unity/#{version.csv.second}/MacEditorTargetInstaller/UnitySetup-iOS-Support-for-Editor-#{version.csv.first}.pkg",
ver... | 33.931034 | 158 | 0.704268 |
bfaa4a822fdee90e6412401a8796722434f6b3db | 450 | class AccountActivationsController < ApplicationController
skip_before_action :authorize_request, only: :edit
def edit
user = User.find_by(email: params[:email])
if user && !user.activated? && user.authenticated?(:activation, params[:id])
user.activate
#log_in user
#render inli... | 32.142857 | 82 | 0.648889 |
bb1c3b46f52759de14a61d477d5e7d9823076496 | 922 | # frozen_string_literal: true
class AddLdapAttrsToUser < ActiveRecord::Migration[5.1]
def self.up
add_column :users, :display_name, :string
add_column :users, :address, :string
add_column :users, :admin_area, :string
add_column :users, :department, :string
add_column :users, :title, :string
a... | 30.733333 | 55 | 0.713666 |
b9c03a338ff351c6023179006425b326507a701a | 223 | class Idris < Cask
url 'http://www.idris-lang.org/pkgs/idris-current.pkg'
homepage 'http://www.idris-lang.org'
version 'latest'
no_checksum
install 'idris-current.pkg'
uninstall :pkgutil => 'org.idris-lang'
end
| 24.777778 | 56 | 0.713004 |
2697fceab058cb7f5bdb762e90b0c444beeb99b2 | 561 | require 'json'
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
Pod::Spec.new do |s|
s.name = 'AparajitaCapacitorSecureStorage'
s.version = package['version']
s.summary = package['description']
s.license = package['license']
s.homepage = package['repository']['url']
s.author = package['... | 31.166667 | 77 | 0.666667 |
338961076e60cff2aea8e6537d39c4e63463ead4 | 1,115 | # Page Helper
# mixin for methods which can be used on more than one Page
module PageHelper
# Common to Checkout pages
def progress_bar_element(stage)
browser.div(:class => 'progress_wrapper', :class => 'top').li(:class => stage, :class => 'act')
end
# Common to Item pages
def add_... | 26.547619 | 102 | 0.583857 |
916b5a0271d13a4ac62f66878a5e85b7959135dc | 502 | cask 'packages' do
version '1.2.2'
sha256 'bbee49a09e63339600ff5a97dedcecd8a00e4271477f02623e88ce6ebf295288'
url 'http://s.sudre.free.fr/Software/files/Packages.dmg'
appcast 'http://s.sudre.free.fr/Software/documentation/RemoteVersion.plist',
checkpoint: '36303735f67c30f292c67cdeed1c4d9ac050547eca212... | 33.466667 | 88 | 0.778884 |
1d4f890d384b879caf05df661f141ab9d0052a81 | 489 | # frozen_string_literal: true
require 'spec_helper'
RSpec.shared_examples_for 'Agent' do
subject { described_class.new(api_key: ENV['API-KEY']) }
let(:config_params) { { appid: subject.api_key } }
it '#execute', :vcr do
allow(subject).to receive(:execute)
.with(city: 'Santiago', action: 'weather', con... | 27.166667 | 83 | 0.705521 |
d526e9746484a14071640037e8bee1d3ba9f364e | 9,216 | #encoding: utf-8
module PFM
class Pokemon
# Tell if PSDK test evolve on form 0 or the current form
EVOLVE_ON_FORM0 = true
# Return the base experience of the Pokemon
# @return [Integer]
def base_exp
return $game_data_pokemon[@sub_id ? @sub_id : @id][@form].base_exp
end
# Return the ... | 36 | 138 | 0.625326 |
39da90836ef4ebcde8b8bff60ad381c7ab5bffb1 | 2,482 | =begin
#Hydrogen Atom API
#The Hydrogen Atom API
OpenAPI spec version: 1.7.0
Contact: info@hydrogenplatform.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.14
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for NucleusApi::PageModelAssetSize
#... | 27.577778 | 102 | 0.717969 |
abdf1f1b0eabf1a773eb66d06bf6090cde6249df | 207 | require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../../../shared/mutex/try_lock', __FILE__)
describe "Mutex#try_lock" do
it_behaves_like :mutex_try_lock, :try_lock
end
| 29.571429 | 68 | 0.73913 |
0124e2e10eee8330cf3819d207e8ff90a77d1538 | 1,950 | # frozen_string_literal: true
require 'spec_helper'
describe Dnsimple::Client, ".vanity_name_servers" do
subject { described_class.new(base_url: "https://api.dnsimple.test", access_token: "a1b2c3").vanity_name_servers }
describe "#enable_vanity_name_servers" do
let(:account_id) { 1010 }
before do
... | 34.210526 | 117 | 0.696923 |
bb98937203457f35777e8e9fbb5bee6059edbfdd | 3,260 | # 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::KeyVault::V7_1_preview
module Models
#
# The SAS definition create parameters.
#
class SasDefinitionCreateParameters
... | 31.047619 | 79 | 0.515951 |
21ad92a597f3d85b059a7b75eedb9f5e3d233a44 | 1,765 | Rails.application.routes.draw do
get 'authors/new'
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rails routes".
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
resources :authors
... | 28.467742 | 101 | 0.655524 |
1d14f5075b83ae7ae3606fb6c2a58fae0f8e2795 | 724 | # frozen_string_literal: true
require 'tanker/c_tanker'
module Tanker
class Core
def create_group(member_identities)
cmember_identities = CTanker.new_cstring_array member_identities
CTanker.tanker_create_group(@ctanker, cmember_identities, member_identities.length).get_string
end
def update... | 36.2 | 119 | 0.751381 |
61f25e4b809fb263d63f16208b6cf981e48fb3e7 | 3,267 | #!/usr/bin/env ruby
#
# This is a 'fake' MQTT server to help with testing client implementations
#
# It behaves in the following ways:
# * Responses to CONNECT with a successful CONACK
# * Responses to PUBLISH by echoing the packet back
# * Responses to SUBSCRIBE with SUBACK and a PUBLISH to the topic
# * Respo... | 25.130769 | 77 | 0.640649 |
e8b15a05e216837a342371bf085d146525bd4a7b | 674 | require "magic/link/engine"
require "magic/link/railtie"
module Magic
module Link
mattr_accessor :user_class
@@user_class = "User"
mattr_accessor :email_from
@@email_from = "please-change-me@magic-link.com"
mattr_accessor :token_expiration_hours
@@token_expiration_hours = 6
mattr_acces... | 19.257143 | 52 | 0.689911 |
113a3faea5119d9fb146a9d46248dc18f70a52a9 | 1,104 | require 'spec_helper'
require 'trix/simple_form/trix_editor_input'
describe Trix::SimpleForm::TrixEditorInput, type: :view do
include SimpleFormSpecHelper
let(:post) { mock_model('Post', body: 'My super awesome post content.') }
let(:form) do
simple_form_for(post, url: 'some-url') do |f|
f.input(:bod... | 26.926829 | 87 | 0.689312 |
1dcda1d18e2a812b75d25fe6d33e10b5d267854b | 813 | # frozen_string_literal: true
require 'term/ansicolor'
module Pact
module XML
NEWLINE = "\n"
C = ::Term::ANSIColor
# Formats list of differences into string
class DiffFormatter
def self.color(text, color, options)
options.fetch(:colour, false) ? C.color(color, text) : text
end
... | 24.636364 | 71 | 0.587946 |
bfaf0eb2fae152ad10766aabfef5fc5903847c2a | 3,158 | class SentNotification < ActiveRecord::Base
serialize :position, Gitlab::Diff::Position
belongs_to :project
belongs_to :noteable, polymorphic: true
belongs_to :recipient, class_name: "User"
validates :project, :recipient, presence: true
validates :reply_key, presence: true, uniqueness: true
validates :n... | 23.744361 | 101 | 0.682711 |
18a4f45b9b4c7fc8b6890359275acd5ed9e66913 | 5,090 | # frozen_string_literal: true
require 'spec_helper'
RSpec.shared_examples_for 'running the molecule graph plugin' do
let(:conversion_attributes) { { source: :molecule_source } }
let(:graph) do
gql = Scenario.default.gql
graph = gql.future_graph
node = graph.plugin(:molecules).molecule_graph.node(:m_l... | 29.085714 | 99 | 0.681532 |
212ab486c97cf517896da01ff77eb050a794db1a | 1,051 | class AddValidationsToEvents < ActiveRecord::Migration[5.1]
def self.up
change_column :events, :title, :string, null: false
change_column :events, :overview, :text, null: false
change_column :events, :agenda, :text, null: false
change_column :events, :img, :string, null: false
change_column :event... | 43.791667 | 66 | 0.714558 |
39bb7d644783cb08716c3b39ae0e2dc2b6b65c79 | 1,514 | # frozen_string_literal: true
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('dummy/config/environment', __dir__)
abort('The Rails environment is running in production mode!') if Rails.env.production?
require 'rspec/rails'
require 'factory_bot'
require 'spree/testing_support/factories'
require 'spree/testing_s... | 31.541667 | 101 | 0.749009 |
916f33edfd8a52986f2d061b40c4fba9b85f12ca | 1,296 | Rails.application.configure do
config.cache_classes = false
config.eager_load = false
config.consider_all_requests_local = true
if Rails.root.join('tmp/caching-dev.txt').exist?
config.action_controller.perform_caching = true
config.cache_store = :memory_store
config.public_file_server.headers =... | 32.4 | 65 | 0.709877 |
1df3c1400aed4a0663238c2b0120a5c8bb1ffdac | 34,551 | # encoding: utf-8
require 'spec_helper'
describe Ably::Rest::Push::Admin do
include Ably::Modules::Conversions
vary_by_protocol do
let(:default_options) { { key: api_key, environment: environment, protocol: protocol} }
let(:client_options) { default_options }
let(:client) do
Ably::Rest::Client.... | 36.874066 | 154 | 0.600127 |
ed239b1c57cace5336a1a4ad1ad3f10c993a2cfd | 1,925 | # I'm sorry for this code
require "mongo_mapper"
require "json"
require "httparty"
MongoMapper.database = "food"
require_relative "model.rb"
require_relative "apikey.rb"
class Migros
include HTTParty
base_uri "https://test-web-api.migros.ch/eth-hack"
def someProducts limit, offset
respons = self.class.ge... | 29.615385 | 174 | 0.596883 |
e948ce425a86575afb590020619203612c600263 | 8,365 | # frozen_string_literal: true
require 'logstasher/version'
require 'logstasher/active_support/log_subscriber'
require 'logstasher/active_support/mailer_log_subscriber'
require 'logstasher/active_record/log_subscriber' if defined?(ActiveRecord)
require 'logstasher/action_view/log_subscriber' if defined?(ActionView)
req... | 35.147059 | 125 | 0.73425 |
7a87d4cfba9e53714aa093caeb733e962d351e58 | 4,955 | $:.unshift(File.expand_path('../../../lib', __FILE__))
require 'chef/config'
require 'tempfile'
require 'opscode/dark_launch'
describe Opscode::DarkLaunch do
before(:each) do
Chef::Log.level = :fatal
@valid_config_file = Tempfile.new("valid_dark_launch_config")
@valid_config_file_contents = <<EOM
{
"fe... | 38.115385 | 117 | 0.723108 |
085d39aef5db15d6ed60696920803d9f49947dc0 | 2,908 | class LibtorrentRasterbar < Formula
desc "C++ bittorrent library with Python bindings"
homepage "https://www.libtorrent.org/"
url "https://github.com/arvidn/libtorrent/releases/download/libtorrent_1_2_7/libtorrent-rasterbar-1.2.7.tar.gz"
sha256 "bc00069e65c0825cbe1eee5cdd26f94fcd9a621c4e7f791810b12fab64192f00"
... | 36.35 | 113 | 0.628267 |
4a9304f19cfe110b9b71ebe55d64b6692a8d0d6b | 262 | module GabeKossDotCom
class SitemapHelper
def self.sitemap_items(items)
items.reject do |i|
i[:is_hidden] ||
i.binary? ||
i.path == '/sitemap.xml' ||
!( i.identifier.scan(/\.json/).empty? )
end
end
end
end
| 20.153846 | 47 | 0.553435 |
919785ceb88474ebdce2a620826a0c5ff2af4ee9 | 641 | # Ignore Styles.
# Illustration by George Brower.
#
# Shapes are loaded with style information that tells them how
# to draw (the color, stroke weight, etc.) The disableStyle()
# method of PShape turns off this information. The enableStyle()
# method turns it back on.
class DisableStyle < Processing::App
def se... | 17.805556 | 64 | 0.656786 |
21b2d50fc3f07bfc3b5d85bddf825284f0b9a5c8 | 4,123 | # This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel... | 62.469697 | 204 | 0.792142 |
1ad195922723ebb8e2555869f0182db534661b4b | 290 | execute "allow clicking by touch" do
command "defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking 1"
user WS_USER
end
execute "allow dragging by touch" do
command "defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Dragging 1"
user WS_USER
end | 32.222222 | 88 | 0.813793 |
3983cab001863790cf6a506be7fa0248f2e1b071 | 201 | require_relative "phone_form"
class ContactForm < Rectify::Form
attribute :name, String
attribute :number, String
attribute :phones, Array[PhoneForm]
validates :name, :presence => true
end
| 20.1 | 37 | 0.746269 |
d5e5dd42f0dde15d51241d2449909a313be27e32 | 346 | module TelefonicaHandle
class MeteringDelegate < DelegateClass(Fog::Metering::TeleFonica)
include TelefonicaHandle::HandledList
include Vmdb::Logging
SERVICE_NAME = "Metering"
attr_reader :name
def initialize(dobj, os_handle, name)
super(dobj)
@os_handle = os_handle
@name ... | 20.352941 | 67 | 0.687861 |
e9d6e7e91e9155c108d00b90906bfdfe236ede78 | 991 | class Gvars < Formula
desc "Lightweight and simple configuration library for C++ programs."
homepage "http://www.edwardrosten.com/cvd/gvars3.html"
url "http://www.edwardrosten.com/cvd/gvars-3.0.tar.gz"
sha256 "fc051961d4da5dce99a20f525dc1e98368f7283aed7b20e68ffb35e34ac3f5fa"
license "BSD-2-Clause"
head "htt... | 30.96875 | 75 | 0.622603 |
d59305544701436b7d5a34d225c224d6a93cc183 | 3,796 | # frozen_string_literal: true
require 'spec_helper'
require 'logstasher/active_record/log_subscriber'
describe LogStasher::ActiveRecord::LogSubscriber do
let(:log_output) { StringIO.new }
let(:logger) do
logger = Logger.new(log_output)
logger.formatter = lambda { |_, _, _, msg|
msg
}
def log_... | 31.114754 | 172 | 0.66254 |
5d463b271665d6b24e2089c1ada3deabbd1b2bcc | 1,341 | Gem::Specification.new do |s|
s.name = 'logstash-input-elasticsearch'
s.version = '4.0.6'
s.licenses = ['Apache License (2.0)']
s.summary = "Read from an Elasticsearch cluster, based on search query results"
s.description = "This gem is a Logstash plugin required to be i... | 43.258065 | 205 | 0.652498 |
339588735c30d55585a9a810823c7e9611bbe3c1 | 2,725 | xml.instruct!
xml.person do
xml.identification @person.identification
xml.lastname @person.last_name
xml.firstnames @person.first_names
xml.date_of_birth @person.date_of_birth
xml.gender @person.gender
xml.place_of_residence @person.municipality.to_s
xml.type_of_residence @person.accommodation
xml.langu... | 30.617978 | 72 | 0.61211 |
f78e8cb07483b03d69c479e490639ef920798120 | 496 | cask '4k-video-downloader' do
version '4.4.7.2307'
sha256 '4aa585e4f89d3ffc80618518dc7950aed8bf16c07fcb3f77224b8b9fd9eec7a2'
url "https://dl.4kdownload.com/app/4kvideodownloader_#{version.major_minor_patch}.dmg"
appcast 'https://www.4kdownload.com/download',
checkpoint: 'bc602309e88e5f0311dbad6bb4fea... | 38.153846 | 88 | 0.794355 |
e2f04805c2ed3cf7f643c220a7d80b1302decf35 | 2,585 | require 'pp'
if defined?(RUBY_ENGINE) and RUBY_ENGINE == 'rbx'
Object.const_set(:Compiler, Compile.compiler)
require 'compiler/text'
else
$: << 'lib'
require File.join(File.dirname(__FILE__), '..', 'compiler', 'mri_shim')
end
def record_block(data, block)
record_seq data, block.dup
0.upto(block.size - 3) ... | 18.597122 | 73 | 0.621277 |
edf3545782ec3e83203fa8eeafa9402bbfac253e | 1,223 | require "abstract_unit"
module ContentNegotiation
# This has no layout and it works
class BasicController < ActionController::Base
self.view_paths = [ActionView::FixtureResolver.new(
"content_negotiation/basic/hello.html.erb" => "Hello world <%= request.formats.first.to_s %>!"
)]
def all
r... | 33.054054 | 109 | 0.663941 |
e8d4161af1ccf5143469de956191b3ca96fc0aca | 2,661 | class Sshguard < Formula
desc "Protect from brute force attacks against SSH"
homepage "http://www.sshguard.net/"
url "https://downloads.sourceforge.net/project/sshguard/sshguard/1.6.0/sshguard-1.6.0.tar.xz"
mirror "https://mirrors.kernel.org/debian/pool/main/s/sshguard/sshguard_1.6.0.orig.tar.xz"
sha256 "dce3... | 32.060241 | 106 | 0.662157 |
6aa762c5cabb45f1b779ce92c1627d7eb1e40fe6 | 5,243 | require File.dirname(__FILE__) + '/spec_helper'
require 'rack/mock'
require 'rack/contrib/response_cache'
require 'fileutils'
context Rack::ResponseCache do
F = ::File
def request(opts={}, &block)
Rack::MockRequest.new(Rack::ResponseCache.new(block||@def_app, opts[:cache]||@cache, &opts[:rc_block])).send(opts... | 37.992754 | 175 | 0.646958 |
1a8365736ab610e97773441686cd2b742f377395 | 148 | class CreateBlogs < ActiveRecord::Migration
def change
create_table :blogs do |t|
t.string :title
t.timestamps
end
end
end
| 14.8 | 43 | 0.662162 |
3819ef07292459b2b849495aa6d2064e35e8e841 | 3,028 | # frozen_string_literal: true
require 'commonmarker'
module GraphQLDocs
module Helpers
SLUGIFY_PRETTY_REGEXP = Regexp.new("[^[:alnum:]._~!$&'()+,;=@]+").freeze
attr_accessor :templates
def slugify(str)
slug = str.gsub(SLUGIFY_PRETTY_REGEXP, '-')
slug.gsub!(%r!^\-|\-$!i, '')
slug.down... | 24.419355 | 168 | 0.623184 |
bb5e19740d7714a2060c408c60c7972dd45d27bd | 461 | cask :v1 => 'detect-crop' do
version '5.4'
sha256 'cfcf3d492b13d22c15ea9566364592a6b1e193a798bd7eca7e348681318f0dbb'
url 'https://github.com/donmelton/video-transcoding-scripts/archive/master.zip'
name 'Video Transcoding Scripts'
homepage 'https://github.com/donmelton/video-transcoding-scripts/'
license :m... | 30.733333 | 81 | 0.744035 |
b92e332fdbb6feee09431926c53e9e7a7c376b54 | 2,134 | # This command does some automation with the _drafts folder. Specifically,
# when run, it:
#
# * Copies every file from _drafts into _posts, into my preferred folder
# structure (one folder per year)
# * Creates a Git commit for the change
# * Pushes said Git commit to GitHub
#
# It gets copied directly into the... | 31.850746 | 99 | 0.613402 |
87e7296bdb19d0b8a726e7a4e6f122fd8aa9ff33 | 762 | require "rails/generators"
module Clubhouse
module Generators
class InstallGenerator < Rails::Generators::Base
source_root File.expand_path("../templates", __FILE__)
def install_migrations
Dir.chdir(Rails.root) { `rake clubhouse:install:migrations` }
end
def mount
inject... | 25.4 | 91 | 0.645669 |
e2bb2ee0244c0cd55f0e04e0d9c26473d37d2c16 | 246 | describe Fastlane::Actions::FigletAction do
describe '#run' do
it 'prints a message' do
expect(Fastlane::UI).to receive(:message).with("The figlet plugin is working!")
Fastlane::Actions::FigletAction.run(nil)
end
end
end
| 24.6 | 85 | 0.691057 |
39c9c74c9467b4c07e1bb5821a415a027735b0bb | 27,466 | require 'abstract_unit'
require 'pp'
module ModuleWithMissing
mattr_accessor :missing_count
def self.const_missing(name)
self.missing_count += 1
name
end
end
module ModuleWithConstant
InheritedConstant = "Hello"
end
class DependenciesTest < Test::Unit::TestCase
def teardown
ActiveSupport::Depen... | 35.303342 | 133 | 0.744266 |
f8a90a74cb82dc63df9e66308e5c7cede7db52a0 | 264 | class Api::V0::PledgesController < Api::V0::BaseController
def index
@pledges = Pledge.order('created_at desc').limit(100)
render "api/v0/pledges/index"
end
def show
@pledge = Pledge.find(params[:id])
render "api/v0/pledges/show"
end
end | 20.307692 | 58 | 0.67803 |
1c1e5369eedc245c09ca307dec9095c04eaa0e73 | 331 | class CreatePatientRecords < ActiveRecord::Migration[6.0]
def change
create_table :patient_records do |t|
t.string :last_name
t.string :first_name
t.date :dob
t.string :member_id
t.date :effective_date
t.date :expiry_date
t.string :phone_number
t.timestamps
end... | 20.6875 | 57 | 0.65861 |
388afe2ae8972548eb87728573c1c938492f16dc | 1,110 | class Openfortivpn < Formula
desc "Open Fortinet client for PPP+SSL VPN tunnel services"
homepage "https://github.com/adrienverge/openfortivpn"
url "https://github.com/adrienverge/openfortivpn/archive/v1.5.0.tar.gz"
sha256 "a96016826bf85435c26ef0e58d14ae91990a08aaf67c701dfa56345dd851c185"
bottle do
sha25... | 37 | 94 | 0.731532 |
39c6102d85ceeae7b40aea8e5ee10340a7cab3f1 | 136 | # frozen_string_literal: true
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
require "quicksort_c"
require "minitest/autorun"
| 19.428571 | 54 | 0.779412 |
6acecad3b91cc8eb0c403053298efb0525b050ad | 380 | #require_relative ""
#defining the reservation class
path = File.dirname(__FILE__).split("/")
path.pop
DATABASE = "#{path.join("/")}/public/database.json"
class Reservation
attr_reader :name, :phone, :notes
def initialize(time, name, phone, notes)
@time = time
@name = name
@phone = phone
@notes = ... | 19 | 51 | 0.692105 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.