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 |
|---|---|---|---|---|---|
e9bffeb8867bb90e773c39b00879544834766a0a | 3,348 | # 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::Cosmosdb::Mgmt::V2019_12_12
module Models
#
# Parameters to create and update Cosmos DB Table.
#
class TableCreateUpdatePara... | 29.892857 | 79 | 0.453405 |
3925efd8af634743cbbc1dfa9f87e5d555b273fb | 3,042 | describe RedClothParslet::Parser::Attributes::LinkUri do
let(:parser) { described_class.new }
# Though technically valid, punctuation is not allowed at the end of a URL in
# the context of inline Textile.
describe "termination" do
it { should parse("http://red.cloth.org") }
it { should parse("http://re... | 41.671233 | 79 | 0.605851 |
6a9f3ce26532891c527c8e4b1469b05283facd77 | 4,014 | require 'spec_helper'
describe 'openstacklib::db::postgresql' do
password_hash = 'AA1420F182E88B9E5F874F6FBE7459291E8F4601'
title = 'nova'
let (:title) { title }
let :required_params do
{ :password_hash => password_hash }
end
let (:pre_condition) do
"include ::postgresql::server"
end
context... | 26.939597 | 116 | 0.606876 |
2194cb54b13d95dbefabb87c0fb1743da205cd57 | 3,719 | cask "karabiner-elements" do
if MacOS.version <= :el_capitan
version "11.6.0"
sha256 "c1b06252ecc42cdd8051eb3d606050ee47b04532629293245ffdfa01bbc2430d"
url "https://pqrs.org/osx/karabiner/files/Karabiner-Elements-#{version}.dmg"
pkg "Karabiner-Elements.sparkle_guided.pkg"
elsif MacOS.version <= :m... | 39.56383 | 129 | 0.639419 |
91ef17fcc61215c2c3214f37f93658af957ed4e4 | 1,259 | # frozen_string_literal: true
require 'pdf_mage/workers/render_pdf'
RSpec.describe PdfMage::Workers::RenderPdf do
describe '#perform' do
let(:callback_url) { 'https://example.com/callback' }
let(:filename) { nil }
let(:meta) { nil }
let(:website_url) { 'https://google.com' }
subject do
Pd... | 24.211538 | 90 | 0.635425 |
016b8ef16a68dbeca1060e8187155dec32969261 | 7,516 | module Deface
class Override
include OriginalValidator
include Applicator
extend Applicator::ClassMethods
extend Search::ClassMethods
cattr_accessor :_early, :current_railtie
attr_accessor :args, :parsed_document, :failure
@@_early = []
# Initializes new override, you must supply on... | 31.447699 | 158 | 0.637041 |
1d20db726e7847995f82c67117db145824bf845c | 1,158 | # Sources/resources:
# https://stackoverflow.com/questions/11806004/rails-activerecord-db-sort-operation-case-insensitive
class StaticPagesController < ApplicationController
# require 'firebase'
def letsencrypt
render text: "#{params[:id]}.9l4va-Uy7XrFPGS51hnH7HwkF2nn3XhwfuR8U5ylxIM"
end
#the homepage of the ... | 26.930233 | 100 | 0.724525 |
6a541c1c77ab883ce80d47a6ab8c3b12744e3bed | 1,508 | # encoding: utf-8
class PinImageUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
# include CarrierWave::RMagick
include CarrierWave::MiniMagick
# Choose what kind of storage to use for this uploader:
storage :file
# storage :fog
# Override the directory where uploaded f... | 29 | 112 | 0.699602 |
ffc5b87b6aa0329f4c60138864d50286069735be | 2,203 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# dat... | 42.365385 | 116 | 0.705856 |
bfee72f63afc72fa2ecf7e2b29c81de69d4cb76e | 304 | url = node['device42']['instance']
user = node['device42']['user']
password = node['device42']['password']
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
ip = IPAM.new(url, user, password).suggest_ip('10.90.0.0/16')
puts ip
reserved = IPAM.new(url, user, password).reserve_ip(ip)
puts reserved
| 25.333333 | 61 | 0.707237 |
33148e92012a5fe7cd9cb17144238c3d07a61f28 | 10,542 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::CmdStager
include Msf::Exploit::Remote::HttpClient
def initialize(info = {})
... | 31.189349 | 121 | 0.582812 |
87b3837149103f0a007a9f40d83eb0aa0f2bb28f | 398 | module Jobs
class SyncBackupsToDrive < ::Jobs::Base
sidekiq_options queue: 'low'
def execute(arg)
backups = Backup.all.take(SiteSetting.discourse_sync_to_googledrive_quantity)
backups.each do |backup|
DiscourseBackupToDrive::DriveSynchronizer.new(backup).sync
end
DiscourseBac... | 26.533333 | 83 | 0.738693 |
bba1bd02cd94c58f32917af9b14859c28ae4d4e6 | 23 | module StudyHelper
end
| 7.666667 | 18 | 0.869565 |
bf912fbfc8f0647fff83399b8c73a06df84be74a | 282 | class InterleavedInnocentJointable < ActiveRecord::Migration
def self.up
create_table("people_reminders", :id => false) do |t|
t.column :reminder_id, :integer
t.column :person_id, :integer
end
end
def self.down
drop_table "people_reminders"
end
end
| 21.692308 | 60 | 0.702128 |
1d0a397520793d886d52e9fccfaa425c6b8bcb78 | 623 | PADRINO_ROOT = File.dirname(__FILE__) unless defined? PADRINO_ROOT
module LibDemo
def self.give_me_a_random
@rand ||= rand(100)
end
end
class Complex1Demo < Padrino::Application
set :reload, true
get("/old"){ "Old Sinatra Way" }
end
class Complex2Demo < Padrino::Application
set :reload, true
get("/ol... | 18.878788 | 69 | 0.699839 |
1c69d85b212a03a031026b397d05bbbc968050c9 | 1,637 | require 'locomotive/common'
require_relative '../tools/styled_yaml'
require_relative 'loggers/sync_logger'
require_relative_all 'concerns'
require_relative 'sync_sub_commands/concerns/base_concern'
require_relative 'pull_sub_commands/pull_base_command'
require_relative_all 'pull_sub_commands'
require_re... | 22.121622 | 84 | 0.694563 |
0394ce1d3183d90d96da4ed87f16356ffec449f0 | 1,446 | class Simg2img < Formula
desc "Tool to convert Android sparse images to raw images and back"
homepage "https://github.com/anestisb/android-simg2img"
url "https://github.com/anestisb/android-simg2img/archive/1.1.3.tar.gz"
sha256 "82eb629ac0beb67cc97396e031555f0461dcb66e1b93aad53e2f604a18037c51"
head "https://g... | 45.1875 | 93 | 0.720609 |
3812193db510c226702b7a862b0cbbf2266a02c6 | 1,360 | =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::ScryptaTransaction
# Autom... | 25.660377 | 102 | 0.725 |
ff2e910bffaae1e6d2c2853d52c8f035d5f715c8 | 14,144 | # 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, ... | 42.990881 | 131 | 0.591488 |
216aaae70ee261592b08f5165fede4fbab25f03e | 1,016 | require 'spec_helper'
describe NamespacePolicy do
let(:user) { create(:user) }
let(:owner) { create(:user) }
let(:admin) { create(:admin) }
let(:namespace) { create(:namespace, owner: owner) }
let(:owner_permissions) { [:create_projects, :admin_namespace, :read_namespace, :read_statistics] }
subject { de... | 23.627907 | 101 | 0.67815 |
61fe36b71c7573f92ec7e109e957ee0400ea7d09 | 326 | module TD::Types
# The connection state has changed.
# This update must be used only to show a human-readable description of the connection state.
#
# @attr state [TD::Types::ConnectionState] The new connection state.
class Update::ConnectionState < Update
attribute :state, TD::Types::ConnectionState
en... | 32.6 | 95 | 0.742331 |
ff70e40ceb61b08487d3b9bd6e912322dee6e58b | 319 | # frozen_string_literal: true
FactoryBot.define do
factory :registration_number_form, class: WasteCarriersEngine::RegistrationNumberForm do
trait :has_required_data do
initialize_with { new(create(:renewing_registration, :has_required_data, workflow_state: "registration_number_form")) }
end
end
end
| 31.9 | 125 | 0.799373 |
bbf77aed1c2c459cfc9a5c955186209ad2ba1911 | 1,912 | # 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
#
# Response for CheckIPAddressAvailability API service call.
#
class IPAddressAvailabilityResult
... | 28.969697 | 77 | 0.524059 |
acf8ab814fd868a726a4ad516f4e0054fbee0cbc | 612 | class Option::ActivationPriceCalc
class << self
def activation_price(user, option)
user.plan.option_price(option.code) * billing_interval_percent_left(user)
end
def billing_interval_percent_left(user)
days_passed = (Time.current.to_date - user.last_withdrawal_date.to_date).to_i
days_lef... | 27.818182 | 83 | 0.712418 |
6a77cda2d2122f610261421af21e02f1c88aef12 | 402 | class AddModerationLog < ActiveRecord::Migration[5.2]
def up
add_column "users", "is_moderator", :boolean, :default => false
create_table "moderations" do |t|
t.timestamps :null => false
t.integer "moderator_user_id"
t.integer "story_id"
t.integer "comment_id"
t.integer "user_id... | 21.157895 | 67 | 0.636816 |
e8755cf76918f31ca54645352bd0b4703a70e308 | 4,973 | require 'simplecov'
SimpleCov.start 'rails'
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
# this file to always be... | 50.232323 | 96 | 0.717474 |
03d1f46b517b58113c57110dee157cc4efd567d5 | 906 | require 'spec_helper'
describe Gitlab::Ci::Status::Build::Common do
let(:user) { create(:user) }
let(:build) { create(:ci_build) }
let(:project) { build.project }
subject do
Gitlab::Ci::Status::Core
.new(build, user)
.extend(described_class)
end
describe '#has_action?' do
it { is_expe... | 21.571429 | 64 | 0.643488 |
1db6b3665d8648fb2dcade2ffcb9cd4ff10562f2 | 101 | class GameSessionsPlayer < ApplicationRecord
belongs_to :player
belongs_to :game_session
end
| 20.2 | 44 | 0.80198 |
870d468c1becaaefcc6d439bc3fc7494c5aacca4 | 3,336 | require 'rails_helper'
RSpec.describe Entry, type: :model do
describe '#import_text' do
let(:user) { User.create(name: 'martin') }
let(:entry) {
Entry.create(
user: user,
heslo: Faker::Lorem.word,
rod: Entry.map_rod('m'),
druh: Entry.map_druh('adj')
)
}
le... | 38.344828 | 107 | 0.681954 |
1d104a2a56a290ed5d9a0b5e6c5e81b3160dd19a | 413 | require 'mercadopago.rb'
$mp = MercadoPago.new('ACCESS_TOKEN')
paymentData = Hash[
"transaction_amount" => 100,
"token" => "ff8080814c11e237014c1ff593b57b4d",
"description" => "Title of what you are paying for",
"installments" => 1,
"payment_method_id" => "visa",
"payer" => Hash[
"email" => "test_user_... | 22.944444 | 54 | 0.677966 |
6158d79f64c2f70549d6515d4bd6bebf0805913e | 3,069 | # has_many :iterations
# text :name
# text :friendly_id
# text :description
# integer :session_type
# datetime :last_executed_at
class ::CommandProposal::Task < ApplicationRecord
self.table_name = :command_proposal_tasks
attr_accessor :user, :skip_approval
has_many :iterations
has_many :ordered_iterations, ->... | 23.790698 | 105 | 0.687846 |
26305423c46fe04744ca004fdc21c803ca9682bd | 558 | # frozen_string_literal: true
When(/I navigate to the '(.*)' page/) do |tab|
route = tab.downcase
if route == 'home'
visit('/')
else
visit(route)
end
end
When(/I do (not?) submit username and password/) do |auth|
@user = nil if auth
end
Then(/I should (not?) be logged in/) do |_auth|
expect(@user... | 18 | 58 | 0.634409 |
185301615a76cef4744d83889f5a8f08bdf1b0f9 | 554 | When(/^I fill in Associated organisation with "([^"]*)"$/) do |value|
hidden_field = find :xpath, "//input[@id='user_associated_organisation']"
hidden_field.set value
end
When(/^I fill in Associated country with "([^"]*)"$/) do |value|
hidden_field = find :xpath, "//input[@id='user_associated_country']"
user =... | 30.777778 | 75 | 0.696751 |
9123858cfa6d4dfcf6cd0aab1d263eb789824569 | 1,703 | # Merb::Router is the request routing mapper for the merb framework.
#
# You can route a specific URL to a controller / action pair:
#
# match("/contact").
# to(:controller => "info", :action => "contact")
#
# You can define placeholder parts of the url with the :symbol notation. These
# placeholders will be avai... | 37.844444 | 85 | 0.698767 |
183c58b0f35e4c8043aab8de4fa2c80c41f1815f | 1,090 | class Cproto < Formula
desc "Generate function prototypes for functions in input files"
homepage "https://invisible-island.net/cproto/"
url "https://invisible-mirror.net/archives/cproto/cproto-4.7o.tgz"
mirror "https://deb.debian.org/debian/pool/main/c/cproto/cproto_4.7o.orig.tar.gz"
sha256 "c76b0b72064e59709... | 37.586207 | 93 | 0.699083 |
7a862ebef14bb9332c2908b4bc04070f4cfa3d99 | 1,345 | # -------------------------------------------------------------------------- #
# Copyright 2002-2020, OpenNebula Project, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# no... | 44.833333 | 78 | 0.409665 |
397403c3d6ca22c6e868b280cbd72aced6b92826 | 2,063 | module CelluloidIOPGListener
module Initialization
#
# Null Object Pattern, just in case there are no options passed to initialize
#
# @conninfo_hash - Extracted (actually removed!) PG database connection options, such as would be sent to:
# PG.connect( *args ) # PG::Conne... | 49.119048 | 141 | 0.636452 |
e22e65914c64866930a8805fac382a9923ef6b86 | 11,335 | # Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use yo... | 47.62605 | 150 | 0.746096 |
91dfcaf4d06fb034e148e5af818456e62a656338 | 1,104 | class PostsController < ApplicationController
before_action :set_post, only: [:show, :edit, :update, :destroy]
# GET /posts
def index
@posts = Post.all
end
# GET /posts/1
def show
end
# GET /posts/new
def new
@post = Post.new
end
# GET /posts/1/edit
def edit
end
# POST /posts
... | 18.711864 | 73 | 0.648551 |
ac9b5f47c2f1fea5aca899572b890bc62c46c3cd | 1,066 | require 'formula'
class Gcab < Formula
homepage 'https://wiki.gnome.org/msitools'
url 'http://ftp.gnome.org/pub/GNOME/sources/gcab/0.4/gcab-0.4.tar.xz'
sha1 'd81dfe35125e611e3a94c0d4def37ebf62b9187c'
depends_on 'intltool' => :build
depends_on 'pkg-config' => :build
depends_on 'vala' => :build
depends_on... | 26.65 | 71 | 0.652908 |
4ad2b99b7e8985ff40b7e19d9988865c56da9379 | 1,773 | #
# Cookbook:: prometheus
# Recipe:: elasticsearch_exporter
#
# Copyright:: 2018, BaritoLog.
include_recipe "prometheus::user"
# Create directory
directory node["elasticsearch_exporter"]["dir"] do
owner node["prometheus"]["user"]
group node["prometheus"]["group"]
mode "0755"
recursive true
end
directory node... | 30.568966 | 240 | 0.702764 |
08fc975dee57bd75ff8780f0b8a1f22d9731a6a0 | 1,946 | lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "codenewbie/version"
Gem::Specification.new do |spec|
spec.name = "codenewbie"
spec.version = Codenewbie::VERSION
spec.authors = ["Molly McCarron"]
spec.email = ["mccarronmoll... | 44.227273 | 96 | 0.684995 |
e8cd1760139a4d5a757dc0dbc08837565cf9eddb | 1,230 | require 'spec_helper'
describe NotificationsController do
include SocialStream::TestHelpers
render_views
before do
@user = Factory(:user)
@actor = @user.actor
sign_in @user
@receipt = @user.notify("subject", "body", Factory(:activity))
end
it "should render index" do
get :index
as... | 26.170213 | 73 | 0.699187 |
796bb85b8fe2528c5a26f265307a09763022d4bc | 1,271 | require 'rails_spec_helper'
describe 'AppMap tracer via Railtie' do
before(:all) { @fixture_dir = 'spec/fixtures/rails_users_app' }
include_context 'Rails app pg database'
let(:env) { {} }
let(:cmd) { %(docker-compose run --rm -e RAILS_ENV -e APPMAP app ./bin/rails r "puts Rails.configuration.appmap.enable... | 28.244444 | 133 | 0.612116 |
21b890d27c203586a931b6078ab08c7de788c721 | 20,985 | # Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either lic... | 45.619565 | 340 | 0.713367 |
38f18f4809c96f8c549c8b10efcf762fdd3cd141 | 2,708 | #!mruby
#Ver.2.27
#TB6612FNG L-L->STOP. L-H->CCW, H-L->CW, H-H->ShortBrake
MaxVero = 120
Rottime = 1500
Vero = [4,10]
Num = [18,3,15,14]
Lev = [0,16]
Sens = 17 #アナログ距離センサ
Usb = Serial.new(0)
for i in Num do
pinMode(i, OUTPUT)
end
for i in Lev do
pinMode(i, 2) #プルアップ
end
#-------
# レバー状態状態を取得します
#--... | 17.248408 | 56 | 0.534712 |
6a046982bef4728ce74796a4bcd4f1d3bf3e85ba | 390 | # encoding: utf-8
require 'spec_helper'
require "logstash/filters/sig"
describe LogStash::Filters::Sig do
describe "Set to Hello World" do
let(:config) do <<-CONFIG
filter {
sig {
message => "Hello World"
}
}
CONFIG
end
sample("message" => "some text") do
... | 18.571429 | 57 | 0.587179 |
ed76c911f91757436a2d6197a2554984edcfbd45 | 3,434 | require 'rails_helper'
describe "upload UntaggedAnimalAssessment category", type: :feature do
let(:user) { create(:user) }
let(:valid_file) { "#{Rails.root}/db/sample_data_files/untagged_animal_assessment/Untagged_assessment_03122018.csv" }
let(:invalid_file) { "#{Rails.root}/spec/support/csv/invalid_headers.csv... | 42.925 | 198 | 0.714619 |
1d82dc968a327638f7266aaf51f43954024f79ff | 2,448 | # Frozen-string-literal: true
# Copyright: 2015 - 2016 Jordon Bedwell - Apache v2.0 License
# Encoding: utf-8
require "open3"
require "json"
module Docker
module Template
class Auth
DEFAULT_SERVER = "https://index.docker.io/v1/"
def initialize(repo)
@repo = repo
end
def auth_wit... | 24.48 | 68 | 0.52165 |
877e62b4200d684040bb74152aae7cadb3644d8f | 1,437 | module Intrigue
module Ident
module Check
class Kong < Intrigue::Ident::Check::Base
def generate_checks(url)
[
{
type: "fingerprint",
category: "service",
tags: ['Networking', 'Proxy', 'API'],
vendor: "Kong",
product:"Kong",
descriptio... | 24.775862 | 89 | 0.448156 |
7976dffb8d12a71c3ab9b880fb0a6792697e79b8 | 8,150 | require_relative './json_rpc'
require_relative './subscription'
require 'websocket-eventmachine-client'
module Graphene
module RPC
#
# API 0: stateless apis called via rpc instance (id = 0)
# API 1: login and get api calls (id = 1), return varrious API ids
# API n: access various api with their accor... | 25.628931 | 114 | 0.573129 |
39020f5b951309fbcbe6ad216f3051686d29fa83 | 196 | require "application_system_test_case"
class HostsTest < ApplicationSystemTestCase
# test "visiting the index" do
# visit hosts_url
#
# assert_selector "h1", text: "Host"
# end
end
| 19.6 | 43 | 0.719388 |
011ecd8f6ee2b5c54ce5128e37c8751d1c2ed683 | 291 | module Steps
module Opening
class ResearchConsentController < Steps::OpeningStepController
def edit
@form_object = ResearchConsentForm.build(current_c100_application)
end
def update
update_and_advance(ResearchConsentForm)
end
end
end
end
| 20.785714 | 74 | 0.71134 |
38735fbbeea3bf12c486c17a3ed32b3554bc657e | 4,350 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Exploit::Remote
Rank = GoodRanking
include Msf::Exploit::Remote::Tcp
def initialize(info = {})
super(update_info(info,
'Name' ... | 45.3125 | 130 | 0.617701 |
acb475e92ab718531b3af74a9c7f76d89313b829 | 6,441 | require 'spec_helper'
describe "Keepalive" do
let(:config) do
{
:shared_memory_size => '256m',
:keepalive_requests => 500,
:header_template => '',
:message_template => '~text~',
:footer_template => '',
:publisher_mode => 'admin'
}
end
it "should create many channels o... | 48.428571 | 257 | 0.62925 |
1ce7e088c563b96793ff34a20108dcd17dd6d547 | 138 | class ProfessionalSpecializationsResume < ApplicationRecord
belongs_to :professional_specialization
belongs_to :resume, touch: true
end
| 27.6 | 59 | 0.869565 |
03f872d812a128392842b40ded024332994ae2f9 | 7,148 | module Blazer
class BaseController < ApplicationController
# skip filters
filters = _process_action_callbacks.map(&:filter) - [:activate_authlogic]
if Rails::VERSION::MAJOR >= 5
skip_before_action(*filters, raise: false)
skip_after_action(*filters, raise: false)
skip_around_action(*filt... | 36.10101 | 232 | 0.615417 |
ff235304c964b4ad9bec0f1eb669468dbd047060 | 1,857 | # frozen_string_literal: true
module VcReader
class LinkRepository
attr_accessor :last_id, :links
attr_reader :per_page
# @param file_manager [FileManager]
# @param per_page [Integer]
def initialize(file_manager = FileManager.instance, per_page = 4)
@file_manager = file_manager
@save... | 23.2125 | 69 | 0.59343 |
03d53d4f2de85d9644e0e47894d31ff1a64c1ae9 | 2,085 | # frozen_string_literal: true
#
# bool2str.rb
#
module Puppet::Parser::Functions
newfunction(:bool2str, type: :rvalue, doc: <<-DOC
@summary
Converts a boolean to a string using optionally supplied arguments.
The optional second and third arguments represent what true and false will be
converted to... | 32.076923 | 104 | 0.629736 |
2648bc88ca2a7d208068daaca57144be82e3a152 | 301 | # frozen_string_literal: true
# Migration to create media table
class CreateMedia < ActiveRecord::Migration[6.1]
def change
create_table :media do |t|
t.references :client, null: false, foreign_key: true
t.string :name, null: false
t.timestamps null: false
end
end
end
| 21.5 | 58 | 0.697674 |
08ff0dfc58ae75fc718c2bd48e3e18a0bd4c2c9c | 212 | class AddTransactionerIdToSpreeStoreCredits < ActiveRecord::Migration
def change
add_column :spree_store_credits, :transactioner_id, :integer
add_index :spree_store_credits, :transactioner_id
end
end
| 30.285714 | 69 | 0.820755 |
79823979e583432d2a721f62460ba6476b33e74f | 135 | class AddHighScoreToDecks < ActiveRecord::Migration[5.1]
def change
add_column :decks, :high_score, :float, default: 0
end
end
| 22.5 | 56 | 0.740741 |
bb75bd19bd7c694c712babe110d38d0979e3b9d6 | 1,602 | class Ry < Formula
desc "Ruby virtual env tool"
homepage "https://github.com/jayferd/ry"
url "https://github.com/jayferd/ry/archive/v0.5.2.tar.gz"
sha256 "b53b51569dfa31233654b282d091b76af9f6b8af266e889b832bb374beeb1f59"
head "https://github.com/jayferd/ry.git"
bottle do
cellar :any_skip_relocation
... | 34.826087 | 93 | 0.748439 |
e94230e9e537bf74cacaf7f3d0b7527e21361e67 | 6,602 | module Travis::API::V3
module Routes
require 'travis/api/v3/routes/dsl'
extend DSL
resource :broadcasts do
route '/broadcasts'
get :for_current_user
end
resource :build do
capture id: :digit
route '/build/{build.id}'
get :find
post :cancel, '/cancel'
po... | 20.251534 | 98 | 0.558922 |
f8fda00823e87c19702309ebe3f0ea8422294bc8 | 876 | cask "nvidia-geforce-now" do
version "2.0.26.116,897C99"
sha256 "f74cafac283b933d05fcf4957e7faad18de05f2a1169993a223a7bea124c3687"
url "https://ota-downloads.nvidia.com/ota/GeForceNOW-release.app_#{version.after_comma}.zip"
appcast "https://ota.nvidia.com/release/available?product=GFN-mac&version=#{version.bef... | 39.818182 | 118 | 0.743151 |
6a5b910adf13fcf91d284e57b9cac09dbc1a9411 | 444 | module IndexTank
class IndexAlreadyExists < StandardError; end
class NonExistentIndex < StandardError; end
class TooManyIndexes < StandardError; end
class MissingFunctionDefinition < StandardError; end
class InvalidApiKey < StandardError; end
class InvalidQuery < StandardError; end
class IndexInitializing... | 37 | 54 | 0.810811 |
f7e06d83b7e4a9c9165f5dc147be41728323593d | 3,583 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... | 41.183908 | 102 | 0.759419 |
0363306becdce188ac3e02e0bc78bf46730c046d | 433 | require 'aspose_pdf_cloud'
include AsposePdfCloud
app_key = 'XXXXX'
app_sid = 'XXXXX'
@pdf_api = PdfApi.new(app_key, app_sid)
file_name = 'PdfWithAnnotations.pdf'
# Upload the File
@pdf_api.put_create(file_name, :: File.open('example_data/' + file_name, 'r') { |io| io.read(io.size) })
puts 'Uploaded the File'
opts = {... | 27.0625 | 104 | 0.741339 |
084278a2ca9425a473d3e646f5c7ce35d51f145c | 3,731 | require 'rails_helper'
describe Ability do
let(:ability) { Ability.new(admin) }
context 'standard rights' do
let(:admin) { create(:admin, rights: 'standard') }
specify { expect(ability.can?(:manage, admin)).to be true }
specify { expect(ability.can?(:read, Admin.new)).to be false }
specify { expe... | 53.3 | 94 | 0.672474 |
33ae44d37bd277a5ffbf22adc527bd525ee01ad3 | 3,719 | # frozen_string_literal: true
require "spec_helper"
require "generators/graphql/object_generator"
class GraphQLGeneratorsObjectGeneratorTest < BaseGeneratorTest
tests Graphql::Generators::ObjectGenerator
ActiveRecord::Schema.define do
create_table :test_users do |t|
t.datetime :created_at
t.date :... | 26.564286 | 91 | 0.693735 |
6a0b6e5ceccf2216ca738ac6fc15debca699f794 | 3,657 | #
# Copyright:: Copyright (c) 2017 GitLab Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | 34.17757 | 113 | 0.732568 |
87e9255d49e07010ce3f01cf9af90f9e9e02f41e | 184 | # frozen_string_literal: true
# encoding: utf-8
class Role
include Mongoid::Document
field :name, type: String
belongs_to :user
belongs_to :post
recursively_embeds_many
end
| 16.727273 | 29 | 0.766304 |
f8f9975ae6641abcea6af41deadc3f06324420fb | 7,411 | #!/usr/bin/env ruby
# Copyright (c) 2004-2020 Microchip Technology Inc. and its subsidiaries.
# SPDX-License-Identifier: MIT
require_relative 'libeasy/et'
$ts = get_test_setup("mesa_pc_b2b_4x")
cap_check_exit("QOS_INGRESS_MAP_CNT")
#---------- Configuration -----------------------------------------------------
$i... | 33.084821 | 110 | 0.48536 |
33c4caaddcb21cdabf4e8d7a8918296cf81eddbb | 1,406 | # frozen_string_literal: true
module QA
module Page
module Group
module SubMenus
class Members < Page::Base
include Page::Component::UsersSelect
view 'app/views/shared/members/_invite_member.html.haml' do
element :member_select_field
element :invite_memb... | 30.565217 | 166 | 0.623755 |
ed93a2f09cddc8882bf27db6985ff9b3f4dfb2bb | 7,512 | require "active_support/core_ext/array/extract_options"
require "action_dispatch/middleware/stack"
require "action_dispatch/http/request"
require "action_dispatch/http/response"
module ActionController
# Extend ActionDispatch middleware stack to make it aware of options
# allowing the following syntax in controlle... | 27.719557 | 88 | 0.644569 |
380b86d859317ca983a5f4b6e40e5127eabc9037 | 153 | require "hesburgh_errors/engine"
require "hesburgh_errors/controller_error_trapping"
require "hesburgh_errors/error_trapping"
module HesburghErrors
end
| 21.857143 | 51 | 0.875817 |
e8b236426e907248b41d4c25d52662f7ecf01355 | 1,048 | require 'spec_helper'
describe 'Gitlab::Popen', lib: true, no_db: true do
let(:path) { Rails.root.join('tmp').to_s }
before do
@klass = Class.new(Object)
@klass.send(:include, Gitlab::Popen)
end
context 'zero status' do
before do
@output, @status = @klass.new.popen(%w(ls), path)
end
... | 23.818182 | 74 | 0.628817 |
bbacaab943a80a343445d7b4750e0b53fe985f1e | 249 | newparam(:name) do
include EasyType
include EasyType::Validators::Name
include EasyType::Mungers::Upcase
desc "The role name "
isnamevar
to_translate_to_resource do | raw_resource|
raw_resource.column_data('ROLE').upcase
end
end
| 17.785714 | 45 | 0.751004 |
f86cb6aed149ba36f5c9be9e9f3bb42b6b1bd02b | 2,281 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mutations::Boards::Issues::IssueMoveList do
let_it_be(:group) { create(:group, :public) }
let_it_be(:project) { create(:project, group: group) }
let_it_be(:board) { create(:board, group: group) }
let_it_be(:epic) { create(:epic, group: group) ... | 30.413333 | 98 | 0.679088 |
08e59be02f3436209eae796630bd9804b9549636 | 25,754 | require File.join(File.dirname(__FILE__), 'spec_helper')
context "DB#create_table" do
setup do
@db = SchemaDummyDatabase.new
end
specify "should accept the table name" do
@db.create_table(:cats) {}
@db.sqls.should == ['CREATE TABLE cats ()']
end
specify "should accept the table name in multip... | 33.665359 | 273 | 0.649297 |
4a1463cb672ec952cd686085cd38f0024b8fee1b | 1,580 | require File.dirname(__FILE__) + "/../spec_helper"
describe Inflector do
it "should camelize strings" do
Inflector.camelize("data_mapper").should == "DataMapper"
Inflector.camelize("data_mapper/support").should == "DataMapper::Support"
end
it "should pluralize strings" do
Inflector.pluralize("post... | 37.619048 | 77 | 0.702532 |
267e31e2c50adb54cc6d5784b3b0615b043dba8c | 464 | module Embulk
require 'embulk/data_source'
class DecoderPlugin
def self.transaction(config, &control)
raise NotImplementedError, "DecoderPlugin.transaction(config, &control) must be implemented"
end
# TODO
# TODO new_java
def self.from_java(java_class)
JavaPlugin.ruby_adapter_cl... | 17.846154 | 98 | 0.698276 |
287f3aab45a8e553ee76933756a799a63a8ca770 | 329 | require 'spec_helper'
require "paperclip/matchers"
RSpec.configure do |config|
config.include Paperclip::Shoulda::Matchers
end
describe Artifact do
it { should belong_to(:job) }
it { should validate_presence_of(:job) }
it { should have_attached_file(:asset) }
it { should validate_attachment_presence(:asse... | 20.5625 | 52 | 0.753799 |
08217a09bdf4f0e20a65175e90516a7912938227 | 612 | # frozen_string_literal: true
require "git_modified_lines"
require "rspec/core/memoized_helpers"
Dir[File.dirname(__FILE__) + "/support/**/*.rb"].sort.each { |f| require f }
RSpec.configure do |config|
config.include GitSpecHelpers
# Enable flags like --only-failures and --next-failure
config.example_status_pe... | 25.5 | 76 | 0.735294 |
b93ddbb7e75cef97500f4c5b5f5732f6eb79fbbe | 480 | # frozen_string_literal: true
module ActiveRecordDataLoader
module ActiveRecord
class IntegerValueGenerator
class << self
def generator_for(model_class:, ar_column:, connection_factory: nil)
range_limit = [((256**number_of_bytes(ar_column)) / 2) - 1, 1_000_000_000].min
-> { ran... | 21.818182 | 88 | 0.629167 |
1c7a9c2c17107b0b64bff188e4a1f39bed6c1692 | 5,407 | #
# Be sure to run `pod spec lint MapTungiFramework.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 https://guides.cocoapods.org/syntax/podspec.html
# To see working Podspecs in the CocoaPods repo see http... | 37.811189 | 121 | 0.604772 |
d5efd772c70c338bcfa4801c5ac73adaa34c734f | 3,423 | class Pmc::Criterio < ActiveRecord::Base
self.table_name = "#{CONFIG.bases.pez}.criterios"
has_many :peces_criterios, :class_name => 'Pmc::PezCriterio', :foreign_key => :criterio_id
has_many :peces, :through => :peces_criterios, :source => :pez
belongs_to :propiedad, :class_name => 'Pmc::Propiedad'
scope ... | 34.928571 | 137 | 0.658779 |
aba004d2f57c3c0e95fa5ae239356194820acefb | 602 | namespace :test_track do
task :vendor_deps do
FileUtils.module_eval do
cd "vendor/gems" do
rm_r 'ruby_spec_helpers'
`git clone --depth=1 https://github.com/Betterment/ruby_spec_helpers.git && rm -rf ruby_spec_helpers/.git`
end
cd "vendor/gems/ruby_spec_helpers" do
rm_r(Di... | 27.363636 | 114 | 0.571429 |
260a8cd03532a8ac3d3a185abe8024a445824666 | 206 | # frozen_string_literal: true
module Api
module V1
class HealthCheckController < BaseController
def index
render json: { message: 'Welcome to Fshare Tool' }
end
end
end
end
| 17.166667 | 58 | 0.669903 |
8757032254a94a059afdf754724de2ca4d05d219 | 216 | class CreateJoinTablePostsTopics < ActiveRecord::Migration[5.1]
def change
create_join_table :posts, :topics do |t|
# t.index [:post_id, :topic_id]
# t.index [:topic_id, :post_id]
end
end
end
| 24 | 63 | 0.671296 |
aca550118584e886668cbeb71dbec728d6043540 | 690 |
class Landslider
# search criteria for getLeads
class WsLeadSearch < WsSearch
# @return [Integer]
attr_writer :account_id, :company_id, :primary_owner_id, :status_id
# @return [Boolean]
attr_writer :hot
# @return [Date]
attr_writer :updated_on
# @return [String]
attr_writer :name
# @par... | 21.5625 | 76 | 0.7 |
1ca60eae24a85d664a735e151fa53dd2098dce3b | 2,386 | module Selenium
module WebDriver
module Remote
module Http
class Common
MAX_REDIRECTS = 20 # same as chromium/gecko
CONTENT_TYPE = "application/json"
DEFAULT_HEADERS = { "Accept" => CONTENT_TYPE }
attr_accessor :timeout
attr_writer :server_url
... | 31.813333 | 114 | 0.532691 |
bb23a027e0a1b5b87cb55625e795205ea0e9f290 | 424 | module ImproveTypography
module Processors
class EmDash < Processor
REGEXP = /(\w+?)\s+-{1,3}\s+(\w+?)/i
def call
return str unless sign_exists?(em_dash_sign)
return str unless str.match?(/-{1,3}/)
str.gsub(REGEXP, '\1'+em_dash_sign+'\2')
end
private
def em... | 21.2 | 64 | 0.596698 |
261f84565e4d0e6f22191f53504043f2063ecc5b | 5,949 | module MCollective
# A simple plugin manager, it stores one plugin each of a specific type
# the idea is that we can only have one security provider, one connector etc.
module PluginManager
@plugins = {}
# Adds a plugin to the list of plugins, we expect a hash like:
#
# {:type => "base",
#... | 33.801136 | 108 | 0.635569 |
18f2648bd60f36fb31b702d75ebb7ab67569d165 | 4,248 | ##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Auxiliary
include Msf::Exploit::Remote::HttpServer
def initialize(info = {})
super(update_info(info,
'Name' => 'Basic HttpSe... | 27.764706 | 106 | 0.610169 |
012e7c2233d07c575747ca64d3e619f9d4dc8e3c | 38 | # stub
require 'facets/string/upcase'
| 12.666667 | 30 | 0.763158 |
bf53ef50ff0d5280e7067e72c87ae15d96ed4619 | 223 | class CreateUsers < ActiveRecord::Migration[5.1]
def change
create_table :users do |t|
t.string :name
t.integer :age
t.string :astrological_sign
t.integer
t.timestamps
end
end
end
| 17.153846 | 48 | 0.636771 |
ed2e00f1241b820eff82b9527a1d807c0dd4f825 | 571 | # frozen_string_literal: true
class DeleteUserWorker # rubocop:disable Scalability/IdempotentWorker
include ApplicationWorker
feature_category :authentication_and_authorization
loggable_arguments 2
def perform(current_user_id, delete_user_id, options = {})
delete_user = User.find(delete_user_id)
cur... | 31.722222 | 88 | 0.788091 |
f8e2958b3d0042272e02862fc0a277ca394274f2 | 1,954 | require File.dirname(__FILE__) + "/../../../test_helper"
class TestWorkingCopyExternals < Test::Unit::TestCase
def setup
@wcdir = Pathname.new("tmp/wc")
@wc = Piston::Svn::WorkingCopy.new(@wcdir)
end
def test_parse_empty_svn_externals
@wc.stubs(:svn).returns(EMPTY_EXTERNALS)
assert_equal({}, @wc... | 34.892857 | 136 | 0.723132 |
03a8d8c0ee26b07b1012ec24008d153a0e7c85da | 1,674 | class Aravis < Formula
desc "Vision library for genicam based cameras"
homepage "https://wiki.gnome.org/Projects/Aravis"
url "https://download.gnome.org/sources/aravis/0.8/aravis-0.8.6.tar.xz"
sha256 "f2460c8e44ba2e6e76f484568f7b93932040c1280131ecd715aafcba77cffdde"
license "LGPL-2.1-or-later"
bottle do
... | 33.48 | 117 | 0.733572 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.