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 |
|---|---|---|---|---|---|
911ecc2884d41d23a55a4ce47b00e1a9848ce55e | 1,121 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/googleads/v9/errors/string_format_error.proto
require 'google/api/annotations_pb'
require 'google/protobuf'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_file("google/ads/googleads/v9/errors/string_format_error.proto", :s... | 35.03125 | 194 | 0.752007 |
333cb9fd1e04c4d1e51512ddbe95d20320c81f50 | 893 | class Api::V0::TeamClaimsController < Api::V0::BaseController
before_action :require_team_claim, only: [:update]
def index
@team_claims = TeamClaim.where(accepted_at: nil, rejected_at: nil).order(:created_at).includes(:team, :person => :github_account)
end
def update
raise "already accepted/rejected"... | 29.766667 | 133 | 0.737962 |
ab45b7ebccfb296b755392a1234e154c16016b10 | 121 | # open custom monit web port
firewall_rule "http" do
port 2812
action :allow
notifies :enable, "firewall[ufw]"
end
| 17.285714 | 35 | 0.727273 |
79650e00deda4d1568003072c15202f7f2b89889 | 303 | # frozen_string_literal: true
module Milestoner
# Gem identity information.
module Identity
NAME = "milestoner"
LABEL = "Milestoner"
VERSION = "12.1.0"
VERSION_LABEL = "#{LABEL} #{VERSION}".freeze
SUMMARY = "A command line interface for crafting Git repository tags."
end
end
| 23.307692 | 74 | 0.693069 |
f85ad48dda2394920d43d1f1588652331f439c9e | 157 | # frozen_string_literal: true
require 'faker'
FactoryBot.define do
factory :answer do
association :question
value { Faker::Lorem.word }
end
end
| 15.7 | 31 | 0.726115 |
4a3c6afe4aa5bb093761b9ae4074f71674efa30b | 668 | class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_action :configure_permitted_parameters, if: :devise_controller?
protected
def configure_permitted_paramet... | 27.833333 | 72 | 0.755988 |
d56533f41da4b2e7a656bf6d39259c25753ff11c | 1,701 | module ActiveRecordSeek
module Scopes
class SeekScope < BaseScope
attr_reader(*%w[ seek_query active_record_query components components_hash ])
def query=(new_query)
@seek_query = new_query.to_seek_query
@active_record_query = @seek_query.to_active_record_query
@seek... | 30.927273 | 105 | 0.631393 |
b90d6a00e3a0cac73938ee1574722418f1d42b9f | 839 | class SessionsController < ApplicationController
skip_before_action :require_login
def new
end
def create
if auth
@user = User.find_or_create_by(uid: auth['uid']) do |u|
u.name = auth['info']['name']
u.email = auth['info']['email']
end
session[:user_id] = @user.id
r... | 21.512821 | 65 | 0.617402 |
ab18d77877cc973de6a6682fce880acca9235210 | 2,779 | require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
# require "active_record/railtie"
require "action_controller/railtie"
# require "action_mailer/railtie"
require "active_resource/railtie"
# require "sprockets/railtie"
# require "rails/test_unit/railtie"
Bundler.require
require "esendex"
... | 41.477612 | 100 | 0.737316 |
28447e861fcbf5169abf46782c59e367173d62cd | 2,942 | # frozen_string_literal: true
module GraphQL8
class Query
class SerialExecution
module ValueResolution
def self.resolve(parent_type, field_defn, field_type, value, selection, query_ctx)
if value.nil? || value.is_a?(GraphQL8::ExecutionError)
if field_type.kind.non_null?
... | 33.431818 | 125 | 0.495921 |
1d53212ca24548b520eb658de6ca2c67b6d57367 | 1,935 | class Povray < Formula
desc "Persistence Of Vision RAYtracer (POVRAY)"
homepage "https://www.povray.org/"
url "https://github.com/POV-Ray/povray/archive/v3.7.0.8.tar.gz"
sha256 "53d11ebd2972fc452af168a00eb83aefb61387662c10784e81b63e44aa575de4"
revision 1
bottle do
rebuild 1
sha256 "eae4cf975215cdfd... | 30.234375 | 93 | 0.69199 |
bbfa00f7faa8b8d6b8e054b71c57c7a4a1c5079b | 14,170 | require 'active_model'
require 'crud_methods'
require 'zoho_crm_utils'
class RubyZoho::Crm
class << self
attr_accessor :module_name
end
@module_name = 'Crm'
include CrudMethods
include ZohoCrmUtils
def initialize(object_attribute_hash = {})
@fields = object_attribute_hash == {} ? RubyZoho.config... | 36.240409 | 175 | 0.684615 |
8708b7a8f1dc214ad62bc55edf68372f302c57cb | 262 | # frozen_string_literal: true
class Slide < ApplicationRecord
# mountes
mount_uploader :image, SlideUploader
# validations
validates :title, presence: true
validates :image, presence: true
# scopes
scope :active, -> {where(is_active: true)}
end
| 18.714286 | 44 | 0.732824 |
d54eb0fec2443f40940e2c690eaabf4b511684a3 | 1,683 | cask 'safari-technology-preview' do
if MacOS.version <= :mojave
version '91,061-10708-20190903-4bf79804-9f40-4b31-97c9-c914330c30b1'
sha256 'ad39ec6525db9c95eaa9559ad446ab24bf179cdb599a8d5b47e01f4b395e1897'
else
version '91,061-10706-20190903-6cbd1abb-4b46-4a3f-9229-5e3f89061692'
sha256 'f9db8462b5d... | 49.5 | 165 | 0.738562 |
38975c98269a6fb72d303e7e4423f97fd3070af5 | 12,792 | # frozen_string_literal: true
require 'rails_helper'
require File.join(Rails.root, 'spec/shared_contexts/test_enterprise_admin_seed')
RSpec.describe Admin::TenantsController, type: :controller, dbclean: :after_each do
include_context 'setup enterprise admin seed'
let!(:tenant_account) { FactoryBot.create(:account... | 34.95082 | 200 | 0.664009 |
f7083985c2bb3af9db4df7e7f42a52aa41e479b2 | 2,632 | module Sanitizer
# Sanitize params recursively
#
# @param [Hash] passed_params
#
def sanitize_params_recursively(passed_param)
if passed_param.is_a?(String)
# if the passed_param is a string, sanitize it directly to remove script tags etc
passed_param = Sanitize.fragment(passed_param.to_s).gs... | 34.631579 | 108 | 0.714286 |
5d1eaea0f7460a41504b783e1500852dde67978f | 169,123 | describe MiqExpression do
describe '#reporting_available_fields' do
let(:vm) { FactoryBot.create(:vm) }
let!(:custom_attribute) { FactoryBot.create(:custom_attribute, :name => 'my_attribute_1', :resource => vm) }
let(:extra_fields) do
%w(start_date
end_date
interval_name
d... | 49.465633 | 232 | 0.601586 |
01371b4422a8cd602721627495c27c53265cac3c | 961 | # The Book of Ruby - http://www.sapphiresteel.com
# illustrates how to read and write instance variables
# using accessor methods
class Thing
def initialize( aName, aDescription )
@name = aName
@description = aDescription
end
# get accessor for @name
def name
... | 21.840909 | 56 | 0.631634 |
1dbf630f53cdb091914611233429d6575eee2177 | 1,141 | module User
module Academics
class EnrollmentTermInstruction
attr_reader :user
attr_reader :term_id
def initialize(user, term_id)
@user = user
@term_id = term_id
end
def enrollment_periods
@enrollment_periods ||= EnrollmentPeriods.new(enrollment_period_data)... | 21.942308 | 78 | 0.60298 |
ff9339eb33c9ad759be07e79f21a0d86dacfc125 | 175 | require 'resque'
require 'resque/scheduler/server'
Rails.application.routes.draw do
root "checks#index"
resources :checks
mount Resque::Server.new, at: '/resque'
end
| 15.909091 | 41 | 0.742857 |
1af1190ff9d971808c7862340bcac5e262c44d17 | 516 | cask 'stand' do
version '1.0_4'
sha256 '8919e43c9c591657d8d6961b25e8dc5f77d706d71eb246839be22522a82bb0ec'
# get-stand-app.s3.amazonaws.com was verified as official when first introduced to the cask
url "https://get-stand-app.s3.amazonaws.com/#{version.sub(%r{.*_}, '')}/Stand.zip"
appcast 'https://standapp-sp... | 36.857143 | 93 | 0.753876 |
91387269eb4204a40d7afea087de92916396a779 | 3,854 | class Arangodb < Formula
desc "Multi-Model NoSQL Database"
homepage "https://www.arangodb.com/"
url "https://download.arangodb.com/Source/ArangoDB-3.9.0.tar.bz2"
sha256 "a6fb06bdfcaa8884d8a060e4aa1164d94db12bf2df332a2e44b2de2283204bca"
license "Apache-2.0"
head "https://github.com/arangodb/arangodb.git", br... | 30.587302 | 111 | 0.656201 |
62f64472f158b8ebf4cc651405db8cdc82f3e0c8 | 448 | # Definition for a binary tree node.
# class TreeNode
# attr_accessor :val, :left, :right
# def initialize(val)
# @val = val
# @left, @right = nil, nil
# end
# end
# @param {TreeNode} root
# @return {Integer[]}
def postorder_traversal(root)
ans = []
def traverse(node, ans)
unless node.nil?
... | 18.666667 | 37 | 0.622768 |
b9f5050e6ecd1aceaf330061be009c16b02b6492 | 6,817 | # rubocop:disable Style/GlobalVars
require 'rubygems'
require 'fileutils'
require 'rufus-scheduler'
# Pupistry::Agent
module Pupistry
# Functions for running the Pupistry agent aka "apply mode" to actually
# download and run Puppet against the contents of the artifact.
class Agent
## Run as a daemon
def ... | 37.251366 | 146 | 0.660114 |
1d06a1dc5c9c280adebb20b317db8b930b7664db | 580 | require 'rails'
require 'jquery-rails'
require 'remotipart'
require 'bootstrap-sass'
require 'kaminari'
require 'rack-pjax'
require 'rails_admin'
module RailsAdmin
class Engine < Rails::Engine
isolate_namespace RailsAdmin
initializer "RailsAdmin precompile hook" do |app|
app.config.assets.precompile +=... | 27.619048 | 174 | 0.743103 |
91fbd7d0cede21fc0ec5deb514ddc8fc1afa35d0 | 627 | class ChannelPostObserver < ActiveRecord::Observer
observe :channel_post
def before_save(channel_post)
if channel_post.visible
channel_post.published_at = DateTime.now unless channel_post.published_at.present?
end
end
def after_save(channel_post)
if channel_post.visible
channel_post.ch... | 24.115385 | 88 | 0.661882 |
2185d300a496e8ceae4139f7ed755af77e7bff60 | 13,783 | #
# Cookbook Name:: arcgis-notebooks
# Attributes:: default
#
# Copyright 2019 Esri
#
# 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
#
# Unle... | 64.406542 | 148 | 0.572372 |
4ad96d0e469d4d8268551d7dd7ad0e1780ffea90 | 2,613 | require_relative '../base'
require_relative './associated-pool-item'
# Nocoah
module Nocoah
# Types
module Types
# Network
module Network
# Loadbalancer health monitor item
class HealthMonitorItem < Base
# @return [String] Health monitor ID
... | 36.291667 | 100 | 0.500574 |
abcfa7e8ce2226e57ba1b7ea0ca6da34dff1d322 | 103 | class ApplicationMailer < ActionMailer::Base
default from: ENV["ADMIN_EMAIL"]
layout 'mailer'
end
| 20.6 | 44 | 0.757282 |
4a49266fdc1f427bedef4963a9bad5c13d0aa958 | 1,667 | class Bumpversion < Formula
include Language::Python::Virtualenv
desc "Increase version numbers with SemVer terms"
homepage "https://pypi.python.org/pypi/bumpversion"
# maintained fork for the project
# Ongoing maintenance discussion for the project, https://github.com/c4urself/bump2version/issues/86
url "... | 41.675 | 140 | 0.763047 |
6af835c02f5f9459f96fb409b049767b0a49d8c6 | 376 | # 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::TrafficManager::Mgmt::V2017_05_01
module Models
#
# Defines values for ProfileStatus
#
module ProfileStatus
Enabled = ... | 22.117647 | 70 | 0.702128 |
ac022c71d7bcebe361566536fc3c706925c214c9 | 1,329 | require "image_processing/mini_magick"
class ImageAttachment < Shrine
plugin :hanami
end
class ComplexAttachment < Shrine
include ImageProcessing::MiniMagick
plugin :hanami
plugin :processing
plugin :versions # enable Shrine to handle a hash of files
plugin :delete_raw # delete processed files after upl... | 24.611111 | 88 | 0.774266 |
1c713fd13c4517438bdaa60863139a0b4ee65e8b | 7,525 | class WorkflowStep < DbConnection::KitSaasSubenv
enum kind: {
# Token setup
GlobalConstant::WorkflowStep.economy_setup_init_kind => 1,
GlobalConstant::WorkflowStep.generate_token_addresses_kind => 2,
GlobalConstant::WorkflowStep.fund_aux_funder_addr_kind => 3,
GlobalConstant::WorkflowStep.verify_... | 58.333333 | 89 | 0.802658 |
18aa70a01de5012912520af8fdd36adc6ba4e071 | 5,796 | # frozen_string_literal: true
require_relative "shared_examples/invalid_option"
describe Cask::Cmd::Outdated, :cask do
let(:installed) do
[
Cask::CaskLoader.load(cask_path("basic-cask")),
Cask::CaskLoader.load(cask_path("outdated/local-caffeine")),
Cask::CaskLoader.load(cask_path("outdated/loc... | 29.42132 | 109 | 0.562802 |
b9d8dd0bb94996d8d766c5c17e65babf3eb26c58 | 1,266 | require 'rake/dsl_definition'
module Capistrano
module Container
class Manager
include Rake::DSL
def initialize()
@container = {}
end
def add(name, config)
@container[name.to_sym] = container = Instance.new(name, config)
config[:server].map!{ |ip| server(ip) }
... | 20.754098 | 72 | 0.578199 |
28536579dc22bb9db46c6449d5f97ebfc5af30ec | 984 | Given /^a query is cached with results:$/ do |results|
Oculus::Query.create(:name => "all users",
:query => "SELECT * FROM oculus_users",
:results => results.raw,
:started_at => Time.now,
:finished_at => Time... | 24.6 | 71 | 0.583333 |
f84940ad3660441880441768ef70634cf9084893 | 889 | require 'spec_helper'
describe Statistrano::Log do
def clean_logger_cache
if described_class.instance_variable_get(:@_logger)
described_class.send(:remove_instance_variable, :@_logger)
end
end
before :each do
clean_logger_cache
end
after :each do
clean_logger_cache
end
describe ... | 24.027027 | 77 | 0.703037 |
ab640634c1b3ea58fc2dcd001a5a8e409f854c23 | 465 | module Expectant
module ClassMethods
def expectation_choices
Hash[Expectation.all.order_by(text: :asc).map {|e| [e.text, e._id.to_s] }]
end
end
extend ActiveSupport::Concern
included do
field :expectation_ids, type: Array, default: []
field :minutes_to_complete, type: Stri... | 21.136364 | 80 | 0.694624 |
215ccaa8961b7737b7b1226aad32960c99028101 | 335 | def start
@old_speed = @ball_speed
@ball_speed += 5
@time = 0
@stop_time = 300
end
def updating
@power_pos = [0,0]
@time += 1
if @time >= @stop_time
stop
end
end
def stop
@ball_speed = @old_speed
reset_power
end
def drawing
@font3.render(((@stop_time-@time)/30).to_i.to_s, true, [255,255,255]).blit(@scre... | 13.958333 | 91 | 0.665672 |
7ae518fc1aa4614b2517b2174e549b6f69835da7 | 2,015 | class Zeromq < Formula
desc "High-performance, asynchronous messaging library"
homepage "https://zeromq.org/"
url "https://github.com/zeromq/libzmq/releases/download/v4.3.3/zeromq-4.3.3.tar.gz"
sha256 "9d9285db37ae942ed0780c016da87060497877af45094ff9e1a1ca736e3875a2"
livecheck do
url :head
regex(/^v?... | 29.632353 | 93 | 0.672457 |
1d993cd36c8514899b6f126e8c2258afabcf4817 | 1,740 | # frozen_string_literal: true
class DeviseCreateUsers < ActiveRecord::Migration[6.1]
def change
create_table :users do |t|
## Database authenticatable
t.string :email
t.string :username
t.string :encrypted_password, null: false, default: ""
t.string :first_name
t.string :last... | 28.52459 | 101 | 0.678161 |
790fb8c03f80ba0adba5e03c3e9e85746fe21be4 | 708 | require "exifr"
module Jekyll
module PhotoFilter
def photo_filter(files)
photos = files.select {|photo| photo.relative_path.include?("original") }
sorted = photos.sort_by { |photo|
(EXIFR::JPEG.new(photo.path).exif? && EXIFR::JPEG.new(photo.path).date_time_original ?
EXIFR::JPEG.new(p... | 35.4 | 94 | 0.677966 |
33c637771090af051e781b06b490fc954d5ca084 | 4,532 | require 'formula'
class Ffmpeg < Formula
homepage 'http://ffmpeg.org/'
url 'http://ffmpeg.org/releases/ffmpeg-1.2.4.tar.bz2'
sha1 'ee73a05bde209fc23441c7e49767c1b7a4b6f124'
head 'git://git.videolan.org/ffmpeg.git'
# This is actually the new stable, not a devel release,
# but not everything builds with it... | 36.256 | 123 | 0.647396 |
038cd353950ae1b9dd434c6016778a4deb830c7f | 832 | # frozen_string_literal: true
RSpec.describe Eezee, type: :module do
it { expect(described_class::VERSION).not_to be_nil }
describe '.configure' do
subject do
described_class.configure do |config|
config.add_service :linqueta,
protocol: 'https',
... | 24.470588 | 83 | 0.602163 |
e2ddcfa8f115288c70ef7dc48831de1adf8a09cb | 309 | require 'faraday'
require 'faraday_middleware'
require 'nokogiri'
require 'archive_today/version'
require 'archive_today/archiver'
module ArchiveToday
class Error < StandardError; end
class << self
def capture(url:, debug: false)
Archiver.new(url: url, debug: debug).capture
end
end
end
| 19.3125 | 50 | 0.737864 |
612562379ed24e08c07b416bfc76c635d9082490 | 35,351 | class AzureCli < Formula
include Language::Python::Virtualenv
desc "Microsoft Azure CLI 2.0"
homepage "https://docs.microsoft.com/cli/azure/overview"
url "https://codeload.github.com/Azure/azure-cli/legacy.tar.gz/3fa3de4fe7ddff0f58a33eb6ae62e358c91718e6"
version "2.0.77"
sha256 "ee328b7799cfae149feb49bd1d4... | 50.646132 | 164 | 0.826313 |
edc2c937e5c76da098ecc58f2bdc0b863fb9ff35 | 2,456 | require 'rails_helper'
RSpec.describe Course, type: :model do
let(:course) {
Course.create(
name: "Puppy Beginner",
length: 8,
cost: 250
)
}
it "is valid with a name, length, and cost" do
expect(course).to be_valid
end
it "has many tricks through trick_course" do
trick = ... | 52.255319 | 203 | 0.710505 |
1aa0a1e0e93a7044ace06c7167d7e63a98fc078c | 96 | module Accela
class SalutationTranslator < Translator
include SimpleTranslation
end
end
| 16 | 41 | 0.802083 |
6a47a3210f5bf056627320e1a2bd2d640d80c441 | 926 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 30.866667 | 62 | 0.768898 |
2820cfae19df484235b246da16aab8fd392da7ab | 564 | module Admin
class ArticlesController < Admin::ApplicationController
# To customize the behavior of this controller,
# simply overwrite any of the RESTful actions. For example:
#
# def index
# super
# @resources = Article.all.paginate(10, params[:page])
# end
# Define a custom fin... | 28.2 | 80 | 0.691489 |
bfbc1c4a95c288fed8e78909fa944e49be68833f | 74 | #! /usr/bin/env ruby
require_relative 'core'
grexec('./hello-world.sh')
| 12.333333 | 26 | 0.689189 |
62fc438f20d45dc9f38192431690420a8a4d9870 | 1,396 | # Copyright:: 2016 Nordstrom, 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 wri... | 34.04878 | 75 | 0.722063 |
5d0434f9a246dc98c7151dd7d087dddc70d62201 | 1,110 | require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Mrw
class Application < Rails::Application
# Settings in config/environments/* take precedenc... | 41.111111 | 99 | 0.732432 |
d54f9371fbe8e4e605a99eee9c072a8772060d1f | 3,144 | require 'mime/types'
module API
# Projects API
class Branches < Grape::API
before { authenticate! }
before { authorize! :download_code, user_project }
resource :projects do
# Get a project repository branches
#
# Parameters:
# id (required) - The ID of a project
# Examp... | 34.933333 | 113 | 0.643448 |
3979f36757294eda698298161f11cf66dda9d8cc | 463 | def upgrade ta, td, a, d
unless a.key? "domain_specific_drivers"
a["domain_specific_drivers"] = ta["domain_specific_drivers"]
end
unless a.key? "domain_config_dir"
a["domain_config_dir"] = ta["domain_config_dir"]
end
return a, d
end
def downgrade ta, td, a, d
unless ta.key? "domain_specific_drivers... | 23.15 | 64 | 0.712743 |
333f97604073e0ddb633ce73d4150e99a6b4d1c2 | 3,366 | # Copyright (c) 2009 ngmoco:)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, dis... | 44.88 | 152 | 0.699346 |
114509229c5d23c07dfcb34d9906aaf72d8cf24e | 1,858 | # frozen_string_literal: true
require 'spec_helper'
describe Projects::MoveLfsObjectsProjectsService do
let!(:user) { create(:user) }
let!(:project_with_lfs_objects) { create(:project, namespace: user.namespace) }
let!(:target_project) { create(:project, namespace: user.namespace) }
subject { described_class... | 32.034483 | 88 | 0.743811 |
e9dadefec24a6f5e0842a683a8b907341da0b098 | 2,076 | $:.unshift File.dirname(__FILE__)
require 'bayes_utils'
module Weka
module Classifier
#This module stores the classifiers from the 'weka.classifiers.bayes' package
module Bayes
java_import "weka.classifiers.bayes.NaiveBayes"
java_import "weka.classifiers.bayes.BayesianLogisticRegression"
ja... | 24.139535 | 81 | 0.55106 |
e26cf05a6f47df8eb8152c938f5d8aa43adc0fbd | 18,538 | require 'ratistics/collection'
require 'ratistics/math'
require 'ratistics/sort'
module Ratistics
# Various probability computation functions.
module Probability
extend self
# Calculates the statistical frequency.
#
# When a block is given the block will be applied to every element
# in the d... | 38.380952 | 189 | 0.639335 |
384d1b2a4880411be72988c7c74849e852e9771f | 217 | Rails.application.config.middleware.use OmniAuth::Builder do
# provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET']
provider :github, 'e34d8260405f64d20dc1', 'cefe52df15831f2eb8e8a12346c633bc4885847d'
end | 54.25 | 88 | 0.792627 |
edb892d518373edeb05a153e8a09db3dc6d17bca | 1,317 | require 'bundler/setup'
require 'open-uri'
require 'rubygems'
require 'nokogiri'
require_relative 'document_info'
class DocumentInfoController
def initialize()
@url = nil
@charset = nil
end
def get (url, username = "", password = "")
#get html
html = open(url, http_basic_au... | 23.517857 | 84 | 0.497342 |
e9452e8f3ce9e0a3e1d9d2fddba3d93a0ef4a8ad | 2,949 | #
# Copyright:: 2018, 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... | 35.107143 | 135 | 0.665649 |
1a2e6762ed1e2db2432fb968cacf6bc35af192e9 | 918 | # RSpec Exercise 2 - From App Academy Open Full Stack Course
# https://open.appacademy.io/learn/full-stack-online/software-engineering-foundations/rspec-exercise-2
# Solution by: Alex Boutilier
#
# Part of 'bootler/fullstack-solutions' repository
# https://github.com/bootler/fullstack-solutions
def partition(arr,num)
... | 26.228571 | 102 | 0.608932 |
f825b8d1dc7d18392e95c22e436a71e53935c30a | 16,117 | namespace :prune_db do
desc "Fixes a mis-match between a vote's prompt_id and its appearance's prompt_id. Sets the appearance prompt_id to match the vote's prompt_id"
task :fix_promptid_mismatch => :environment do
bad_records = Vote.connection.select_all "
SELECT
votes.prompt_id, appearances.id a... | 33.78826 | 223 | 0.637588 |
f7150c4400c910afe949e8af13a2444b3260d379 | 187 | class AddAdCategoryToPresentations < ActiveRecord::Migration
def change
add_column :presentations, :ad_category, :string
add_column :sessions, :ad_category, :string
end
end
| 26.714286 | 60 | 0.770053 |
edf1475772cc7359debaf8fc36bcb9d8ea903273 | 550 | desc "update created time stamps on existing listings"
task update_created: :environment do
puts "Updating timestamps..."
xml = Nokogiri::XML(open(Movie::HBO_XML_URL))
hbo_features = Hash.from_xml(xml.to_s)['response']['body']['productResponses']['featureResponse']
count = 0
hbo_features.each do |feature|
... | 32.352941 | 99 | 0.683636 |
1d2ba53f9d96fc1e4a90812f0e4ca7ffd70ce4b7 | 297 | module Locomotive
module Wagon
module Liquid
module Drops
class SessionProxy < ::Liquid::Drop
def before_method(meth)
request = @context.registers[:request]
request.session[meth.to_sym]
end
end
end
end
end
end | 16.5 | 50 | 0.569024 |
e212cab198e2d1fd8f1d28cbba073c0a4e4118de | 358 |
require 'bblib' unless defined?(BBLib)
require 'socket'
require 'json'
require 'yaml'
require 'securerandom'
require 'openssl'
require 'digest/sha1'
require_relative 'ava/version'
require_relative 'replicant/replicant'
require_relative 'replicant/chained_replicant'
require_relative 'client/client'
require_relative 'c... | 19.888889 | 46 | 0.818436 |
21302f2b1ec626d51ecbd1d7f388673db2643705 | 527 | # frozen_string_literal: true
module CaseGen
class ExpectRule
include ComboMatcher
def initialize(rule_data)
@rule_data = rule_data
end
def apply(combos)
combos.each do |combo|
expect_keys = combo.names.select { |name| combo.send(name) == :expect }
next if expect_keys.no... | 21.08 | 79 | 0.643264 |
f8f07d114b2e9632d27e99ba6cbb6ab976db589b | 98 | # desc "Explaining what the task does"
# task :jsonapi_parser_rails do
# # Task goes here
# end
| 19.6 | 38 | 0.714286 |
110f5fcf1a58398a2960e14c816194482fc71199 | 755 | require 'chefspec'
describe 'zypper_package::purge' do
let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'opensuse', version: '42.3').converge(described_recipe) }
it 'purges a zypper_package with an explicit action' do
expect(chef_run).to purge_zypper_package('explicit_action')
expect(chef_run).to_not p... | 37.75 | 111 | 0.766887 |
5d62b78a075fac1cb908c0e0035872824c9d79b0 | 3,394 | require 'spec_helper'
describe 'sudo::default_entry' do
context 'supported operating systems' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts){ os_facts }
let(:title) { 'default_entry_spec'}
context 'default parameters' do
let(:params) { {:conte... | 35.726316 | 84 | 0.553329 |
26da61bfd8458755dc15d7784bba65e67dbfba17 | 1,678 | # frozen_string_literal: true
module Resolvers
# Base resolver class include everything you need for sorting and filtering entities
class BaseResolver < GraphQL::Schema::Resolver
# override in your resolver to allow order by attributes
def allowed_filter_attributes
raise 'Return an array with ... | 33.56 | 121 | 0.655542 |
ab932aed7e921ed4cf6145617a7657c3d98d72a9 | 1,646 | require 'spec_helper'
feature "Creating new resources" do
scenario "Creating a resource in a collection" do
datacenters = Abiquo::Resource("http://abiquo.example.com/api/admin/datacenters", auth)
stub_auth_request(:options, "http://admin:admin@abiquo.example.com/api/admin/datacenters").
to_ret... | 37.409091 | 115 | 0.659781 |
bf47411ab2bb7d3cfd12d862aeca122ec3e32657 | 1,580 | module Fog
module Compute
class OpenStack
class Real
def list_usages(date_start = nil, date_end = nil, detailed=false)
params = Hash.new
params[:start] = date_start.iso8601.gsub(/\+.*/, '') if date_start
params[:end] = date_end.iso8601.gsub(/\+.*/, '') if date_end
... | 37.619048 | 93 | 0.427848 |
33fb6b8ef0d1c2e479ad8ae602a48e6a0cc56fe0 | 469 | # frozen_string_literal: true
class AddEmailHeaderAndFooterEnabledFlagToAppearancesTable < ActiveRecord::Migration[5.0]
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
DOWNTIME = false
def up
add_column_with_default(:appearances, :email_header_and_footer_enabled, :boolean, default: f... | 26.055556 | 150 | 0.812367 |
180a43b70757eba754e3e3217f5857447a44ce1b | 70 | //
puts "Hello, World!"
//
text = "Hello, World!"
print "#{text}"
| 8.75 | 22 | 0.528571 |
286a985f7c31dce3434cead215d59df9fa098ea8 | 19,405 | #
# DO NOT MODIFY!!!!
# This file is automatically generated by Racc 1.4.14
# from Racc grammer file "".
#
require 'racc/parser.rb'
require "lexer/lexer"
require "parser/nodes"
class Parser < Racc::Parser
module_eval(<<'...end grammar.y/module_eval...', 'grammar.y', 144)
def parse(code, show_tokens=false)
... | 28.369883 | 74 | 0.44035 |
ffa0a311b058195a7e7fbe446186313b81c9e870 | 78 | Rails.application.routes.draw do
mount PdfMerge::Engine => "/pdf_merge"
end
| 19.5 | 40 | 0.75641 |
e84d971871ffd12a30f2a903fc4a8783ccca5a5e | 877 | require 'puppet/indirector/status'
require 'puppet/indirector/rest'
class Puppet::Indirector::Status::Rest < Puppet::Indirector::REST
desc "Get puppet master's status via REST. Useful because it tests the health
of both the web server and the indirector."
def find(request)
return super unless use_http_cl... | 31.321429 | 125 | 0.700114 |
62141941bc7fa668aa1c31a16052216ad4b6fd18 | 635 | require 'net/http'
require 'uri'
module Rss
extend ActiveSupport::Concern
class_methods do
def getRssContent(url)
uri = URI.parse(url)
response = Net::HTTP.get(uri)
hash = Hash.from_xml(response)
rssList = Array.new
hash["rss"]["channel"]["item"].each { |item|
... | 22.678571 | 79 | 0.519685 |
1c83a9a40e75cfa77263bcc59154d10348660219 | 1,547 | # :nodoc:
#
# Copyright (C) 2014-2020 Authlete, 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 o... | 26.672414 | 74 | 0.586296 |
f850a2330f35f48aa72d9f549448c062c7c39fb8 | 1,432 | class Opal::RSpec::UpstreamTests::Runner
def initialize(gem_name = ::RSpec.current_example.metadata[:gem_name])
@gem_name = gem_name
@config = Opal::RSpec::UpstreamTests::Config.new(gem_name)
end
def run
@config.stubs.each { |f| ::Opal::Config.stubbed_files << f }
output, exit_status = StdoutCap... | 25.571429 | 85 | 0.653631 |
f75f705ee9adfa77d322807aa75efb8a3fb75838 | 47 | module CharacterTitles
VERSION = '0.1.1'
end
| 11.75 | 22 | 0.723404 |
5df67b088a614d6750a8a2d93c0225ab9f68e2da | 1,188 | Pod::Spec.new do |spec|
spec.name = "AUKit"
spec.version = "3.0.20"
spec.summary = "Internal framework of AppUnite."
spec.homepage = "http://appunite.com/"
spec.license = 'Apache 2.0'
spec.author = { "emil.wojtaszek" => "emil@appunite.com" }
spec.source = { :git => '... | 38.322581 | 138 | 0.611111 |
e2d15c1f53e2125ac5279afea8af08fc5022152c | 21,772 | module ActiveMerchant #:nodoc:
class InvalidCountryCodeError < StandardError
end
class CountryCodeFormatError < StandardError
end
class CountryCode
attr_reader :value, :format
def initialize(value)
@value = value.to_s.upcase
detect_format
end
def to_s
value
end
p... | 72.573333 | 119 | 0.472396 |
1a25d55a4e40a34cdf1496fb1bec844f8d2ab103 | 7,638 | # -*- encoding: utf-8 -*-
#
# Author:: Fletcher Nichol (<fnichol@nichol.ca>)
#
# Copyright (C) 2014, Fletcher Nichol
#
# 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.o... | 23.86875 | 77 | 0.581566 |
1d4f2ee5345a0d0c8aa0c82773c6823266b9e4b9 | 449 | # frozen_string_literal: true
require 'vk/api/responses'
module Vk
module API
class Notifications < Vk::Schema::Namespace
module Responses
# @see https://github.com/VKCOM/vk-api-schema/blob/master/objects.json
class MarkAsViewedResponse < Vk::Schema::Response
# @return [API::Base:... | 26.411765 | 78 | 0.663697 |
62ad39177d2b2d8f8a4af39d171e0219a539f5ab | 4,438 | # Note that x.even are stable releases, x.odd are devel releases
class Node010 < Formula
desc "Platform built on V8 to build network applications"
homepage "https://nodejs.org/"
url "https://nodejs.org/dist/v0.10.41/node-v0.10.41.tar.gz"
sha256 "79f694e2a5c42543b75d0c69f6860499d7593136d0f6b59e7163b9e66fb2c995"
... | 32.874074 | 103 | 0.677557 |
7953b6862bde5028247070cf587fd6a7c84d0cbc | 6,368 | require "spec_helper"
require_relative "shared_examples"
RSpec.describe OrcaApi::LockService, orca_api_mock: true do
let(:service) { described_class.new(orca_api) }
describe "#list" do
context "排他中" do
it "一覧を取得できる" do
expect_data = [
{
path: "/api21/medicalmodv37",
... | 27.929825 | 84 | 0.468279 |
3878a284199a8e04498b356ac7a2f8d6c0bf8757 | 341 | class Video
def initialize(pathname)
@pathname = pathname
@md5sum = Digest::MD5.file(full_path).hexdigest
end
def ext
@pathname.extname.downcase
end
def name
@pathname.basename
end
def full_path
@pathname.to_s
end
def md5sum
@md5sum
end
def creation_datetime
@path... | 12.178571 | 51 | 0.671554 |
ed9e656717db998385bda6d90aa217991780ad35 | 13,906 | require 'test/unit'
require 'socket'
require 'thread'
require 'test/test_helper'
require 'ipaddr'
WINDOWS = RbConfig::CONFIG['host_os'] =~ /Windows|mswin/
class SocketTest < Test::Unit::TestCase
include TestHelper
# Should this work on windows? JRUBY-6665
if !WINDOWS
def test_multicast_send_and_receive
... | 27.001942 | 114 | 0.634906 |
e2b8330b0bcd6d0848c6d4d43aded4cf42aed503 | 1,438 | # Copyright (c) 2008-2013 Michael Dvorkin and contributors.
#
# Fat Free CRM is freely distributable under the terms of MIT license.
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
require 'spec_helper'
describ... | 29.346939 | 92 | 0.652295 |
392520c800c71f9c58a016f6fa73a79048a1e7e5 | 1,453 | require 'securerandom'
##
# This file mounts each app in the Padrino project to a specified sub-uri.
# You can mount additional applications using any of these commands below:
#
# Padrino.mount('blog').to('/blog')
# Padrino.mount('blog', :app_class => 'BlogApp').to('/blog')
# Padrino.mount('blog', :app_file => '... | 37.25641 | 100 | 0.706813 |
1cacfcf24ddda3b8119261ed4a9350be71d419d5 | 550 | RSpec.describe 'feature' do
xit 'randomises players into groups of 4' do
names = %w[A B C D E F G H I J]
players = generate_players(names)
tournament_generator = Tournament::Generator.new('output.csv')
tournament_generator.create_tournament(players)
contents = File.read('output.csv')
expect(co... | 23.913043 | 66 | 0.656364 |
03db2696441bc1c13fb8cd8be121a65ac094247b | 379 | require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe PasswordResetsHelper do
#Delete this example and add some real ones or delete this file
it "should be included in the object returned by #helper" do
included_modules = (class << helper; self; end).send :included_modules
includ... | 31.583333 | 74 | 0.762533 |
61675753f30bb0d01a0def42205cef70104e49ed | 84 | # frozen_string_literal: true
class CommitteeContribution < ActiveRecord::Base
end
| 16.8 | 48 | 0.833333 |
4aed87e9346339750ba559840ae3b898f0c07f38 | 966 | require_relative "../canvas_base_input_type"
module LMSGraphQL
module Types
module Canvas
class CanvasFileInput < BaseInputObject
description "Plagiarism Detection Submissions. API Docs: https://canvas.instructure.com/doc/api/plagiarism_detection_submissions.html"
argument :size, Int, "Exa... | 48.3 | 163 | 0.736025 |
4adae48c743326756f68a6abf5f2d4e1304af784 | 583 | set :stage, :staging
server 'oaklan-roots.sit', user: 'vagrant', roles: %w{web app db}
set :ssh_options, {
keys: %w(~/.vagrant.d/insecure_private_key),
}
# and/or per server
# server 'example.com',
# user: 'user_name',
# roles: %w{web app},
# ssh_options: {
# user: 'user_name', # overrides user setting ab... | 25.347826 | 65 | 0.662093 |
084e0ec3cad68e61d5ae1e69c6fa331e33f8551d | 5,318 | #
# Be sure to run `pod spec lint XWebView.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://github.co... | 38.817518 | 194 | 0.598721 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.