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 |
|---|---|---|---|---|---|
269cab00d213a7319dcd7183866fe0b4a944b5b9 | 2,577 | class Arangodb < Formula
desc "The Multi-Model NoSQL Database"
homepage "https://www.arangodb.com/"
url "https://download.arangodb.com/Source/ArangoDB-3.3.12.tar.gz"
sha256 "c2df4a898b047e90434a1ca1523690dde167d157bee1e10a8b76044fe77f21c5"
head "https://github.com/arangodb/arangodb.git", :branch => "unstable"... | 27.709677 | 111 | 0.655413 |
e969e2ef58018809329ba8a4ecc46da55ce77426 | 1,990 | # encoding: UTF-8
# frozen_string_literal: true
module API
module V2
module Entities
class Market < Base
expose(
:id,
documentation: {
type: String,
desc: "Unique market id. It's always in the form of xxxyyy,"\
"where xxx is the base cur... | 21.170213 | 81 | 0.434673 |
0893dcb39b6afd0ab3e2d0e45f40fcc00289680f | 35,170 | require 'spec_helper'
describe API::Groups do
include UploadHelpers
let(:user1) { create(:user, can_create_group: false) }
let(:user2) { create(:user) }
let(:user3) { create(:user) }
let(:admin) { create(:admin) }
let!(:group1) { create(:group, avatar: File.open(uploaded_image_temp_path)) }
let!(:group2... | 35.0998 | 166 | 0.649872 |
bf70a26e849bcda12c9994f178fdd4c59eb416f8 | 616 | module Fog
module Cloudstack
class Compute
class Real
# Remove a VMware datacenter from a zone.
#
# {CloudStack API Reference}[http://cloudstack.apache.org/docs/api/apidocs-4.4/root_admin/removeVmwareDc.html]
def remove_vmware_dc(*args)
options = {}
if ar... | 23.692308 | 118 | 0.547078 |
f86f3f8aeb4d07d4427a7b891444917c0a5edaa7 | 695 | require "edr_treadmill/activities/base_activity"
require "etc"
module EdrTreadmill
module Activities
class ProcessActivity < BaseActivity
self.activity_description = "Spawn a new process"
self.activity_options = {
command: {
required: true,
type: :string,
desc: "... | 22.419355 | 58 | 0.574101 |
ac0f74c99f0e598eb16a6855a99c6bffa2477a2e | 82 | require 'rails_helper'
RSpec.describe LaunchController, type: :controller do
end
| 16.4 | 53 | 0.817073 |
39889a19adcec01c97d28a7df7d8a33c7142b537 | 135 | require 'rails_helper'
RSpec.describe ConsultationStock, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end
| 22.5 | 56 | 0.762963 |
acfc8e22412769c4a0efbc93ca85d38855cca67a | 1,446 | require "rails_helper"
RSpec.describe Post, type: :model do
%w(draft edited designed published).each do |status_name|
describe "#{status_name}?" do
subject { post.send("#{status_name}?") }
context "with status of #{status_name}" do
let(:status) { Status.new(name: status_name) }
let(:... | 22.59375 | 59 | 0.605809 |
269a2ed8b3ca8497488e098e5fc3bc8ba7f55d9c | 487 | cask 'pgweb' do
version '0.6.3'
sha256 'bfa041bdbdd7a3424faa0be6b524302c0f4c6610c06afa8784904b2a91b64024'
url "https://github.com/sosedoff/pgweb/releases/download/v#{version}/pgweb_darwin_amd64.zip"
appcast 'https://github.com/sosedoff/pgweb/releases.atom',
:sha256 => '3a0c23bf19e274e52895f4d1a9ae781... | 34.785714 | 94 | 0.767967 |
79760a9684bb364fa1637a5fb4c691719c98b8f5 | 1,842 | # encoding: utf-8
#
control "V-77823" do
title "The operating system must require authentication upon booting into
single-user and maintenance modes."
desc "If the system does not require valid root authentication before it
boots into single-user or maintenance mode, anyone who invokes single-user or
maintenance m... | 35.423077 | 81 | 0.735071 |
acebeadda9f65905b4ff73d4598bd6b7d0434cc3 | 560 |
class AddTranslationTables < ActiveRecord::Migration
def change
create_table :translation_records do |t|
#t.integer :id
t.string :locale
t.integer :translator_id
t.string :key
t.text :value
t.datetime :created_at
end
create_table :dynamic_translation_recor... | 22.4 | 53 | 0.616071 |
e96c7f98b20a797f0eba68142f222cbef43d8cd5 | 2,210 | require 'r10k/git/rugged'
require 'r10k/git/rugged/credentials'
require 'r10k/logging'
class R10K::Git::Rugged::BaseRepository
include R10K::Logging
# @return [Pathname] The path to this repository.
# @note The `@path` instance variable must be set by inheriting classes on instantiation.
attr_reader :path
... | 23.510638 | 140 | 0.671041 |
ed018bf93719975f381c9193f0fee286ea9e7257 | 1,017 | # frozen_string_literal: true
# Copyright 2015-2017, the Linux Foundation, IDA, and the
# CII Best Practices badge contributors
# SPDX-License-Identifier: MIT
require 'test_helper'
class ClientIpTest < ActiveSupport::TestCase
# Mocked request with a fixed ip address
class MockReq1
def get_header(_x)
ni... | 22.108696 | 73 | 0.679449 |
d56138909318d864e0ee862fc826307ce42fd5d5 | 10,029 | #
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# Homebrew doesn't support specifying anything more recent than 'nehalem',
# but nehalem is 19x slower than sandybrdige ... | 35.438163 | 125 | 0.710539 |
3308831d945d5aac364876e6080c18215f109900 | 2,835 | 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(*Rails.groups)
require "uc... | 42.313433 | 100 | 0.73933 |
4aa937b04e25ec4b888ec629a43930ddeec688b4 | 194 | require File.dirname(__FILE__) + '/spec_helper'
describe ID3::TagBag::Anonymizer do
it "should print mp3s metadata" do
# puts ID3::TagBag::Anonymizer.new(ENV['HOME'] / 'Music')
end
end
| 24.25 | 61 | 0.706186 |
4a39ee36dc6b1c23cf1fb25e7ea500feb049563e | 695 | class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
add_flash_types :success
private
def go_back_link_to(path)
@go_back_link_to ||= path
@go_back_link_to
end
private
def logged_in?
current_user
end
helper_metho... | 19.305556 | 99 | 0.623022 |
4ae0673d56962123b14a9ea8c99ca42996a022c8 | 5,242 | require 'test_helper'
class PasswordResetsTest < ActionDispatch::IntegrationTest
def setup
ActionMailer::Base.deliveries.clear #初期化?
@user = users(:michael) #michaelをテストユーザとする
end
test "password resets" do
g... | 64.716049 | 128 | 0.499046 |
acde96fdc786d13819be2d206c2153ac8b34a612 | 3,900 | class ChangeRegFeeToRealObject < ActiveRecord::Migration
class PaymentDetail < ActiveRecord::Base
belongs_to :payment, inverse_of: :payment_details
belongs_to :expense_item
has_one :refund_detail
scope :completed, -> { includes(:payment).includes(:refund_detail).where(payments: {completed: true}).whe... | 31.707317 | 155 | 0.70641 |
e8e2dc2175e148c08b4f8a3c6ebe65ea67cc41ed | 1,048 | class Planck < Formula
desc "Stand-alone ClojureScript REPL"
homepage "https://planck-repl.org/"
url "https://github.com/planck-repl/planck/archive/2.23.0.tar.gz"
sha256 "b18932d5d6db7b825e0c18edc9f6f268e741bc58890d64ea1dbc81034a275fe4"
head "https://github.com/planck-repl/planck.git"
bottle do
cellar ... | 31.757576 | 93 | 0.736641 |
6af37e26121041355a2c72cc8f8bdf764c772f10 | 1,892 | class EventsController < ApplicationController
before_action :set_event, only: [:show, :edit, :update, :destroy]
# GET /events
# GET /events.json
def index
@events = current_user.events.all
end
# GET /events/1
# GET /events/1.json
def show
end
# GET /events/new
def new
@event = Event.ne... | 25.226667 | 94 | 0.651163 |
79ee9f027acf354a70ff5c9bcc6adc2fd6137835 | 1,161 | require 'json'
module Fastlane
module Actions
class SetPackageDataAction < Action
def self.run(params)
data_to_write = params[:data]
package_path = params[:package_path]
file = File.read(package_path)
data_hash = JSON.parse(file, symbolize_names: true)
data_hash.update(data_to_write)
p... | 23.693878 | 83 | 0.59087 |
91b7d9a60cfc8e4e308bb5e89e5480796e28ab27 | 48,339 | require 'spec_helper'
require 'request_spec_shared_examples'
RSpec.describe 'Processes' do
let(:space) { VCAP::CloudController::Space.make }
let(:app_model) { VCAP::CloudController::AppModel.make(space: space, name: 'my_app', droplet: droplet) }
let(:droplet) { VCAP::CloudController::DropletModel.make }
let(:d... | 36.100822 | 158 | 0.525911 |
ac77cbc56305d534d4eec259be48d48b64058c95 | 653 | # Loads a component with custom CSS, to make sure that also dynamically loaded components get the correct CSS applied
class LoaderOfComponentWithCustomCss < Netzke::Base
component :component_with_custom_css do |c|
c.klass = ComponentWithCustomCss
end
action :load_component_with_custom_css
def configure(c)... | 27.208333 | 117 | 0.742726 |
33ad09eb21288445afb396482e251c63697c33e0 | 1,595 | # Rake task "requires" this.
module Releases
class Create < Mutations::Command
required do
# "https://github.com/FarmBot/farmbot_os/releases/download/v11.0.1/farmbot-rpi3-11.0.1.fw"
string :image_url
string :version, matches: Release::VERSION_STORAGE_FORMAT
string :platform, in: Release::... | 32.55102 | 96 | 0.682132 |
bb2625c90401475e524969a4ec1bb22819ed5ffa | 1,147 | class User < ApplicationRecord
attr_reader :password
validates :username, :email, :password_digest, :session_token, presence: true
validates :password, length: {minimum: 6, allow_nil: true}
validates :username, :email , uniqueness: true
after_initialize :ensure_session_token
has_many :trips
... | 24.934783 | 81 | 0.677419 |
03dc752702e2c3478d70608e27cb0533ec52373f | 32 | for i in 0..5
puts "#{i}"
end | 10.666667 | 14 | 0.5 |
e2b6a03521d54987697d03cc489b42d04808f223 | 969 | gem_name = ARGV[0]
raise "gem name sans version must be supplied" if gem_name.to_s == ""
api_key = ENV["GEM_HOST_API_KEY"]
raise "GEM_HOST_API_KEY must be set" if api_key.to_s == ""
version = ENV["VERSION"]
raise "VERSION environment must be set" if version.to_s == ""
gem_filename = "#{gem_name}-#{version}.gem"
rais... | 29.363636 | 101 | 0.701754 |
386a7bf2c6085d9a297774ead7592203503c0b1a | 428 | # frozen_string_literal: true
# Day 1: Sonar Sweep
# Sum every three inputs in array
def sum_three(input)
input.each_cons(3).map { |a, b, c| a + b + c }
end
def sonar_sweep(input)
increments = 0
input.each_cons(2) { |p, n| increments += 1 if p < n }
increments
end
filename = $PROGRAM_NAME.gsub('.rb', '')
de... | 22.526316 | 71 | 0.675234 |
1c8c367cb22de132fe0abb81832c0bda34c06967 | 294 | # Implement a caesar cipher that takes in a string and
# the shift factor and then outputs the modified string:
def caesar_cipher(string, factor)
p string.each_char.map {|char| (char.ord + factor).chr}.join
end
caesar_cipher("hello", 3)
caesar_cipher("HELLO", 3)
caesar_cipher("HeLlO", 3)
| 26.727273 | 62 | 0.744898 |
e2d14e69ac0e149b374b6c092778e242ab3dbf0a | 12,378 | require File.dirname(__FILE__) + '/../test_helper'
class ResultControllerTest < ActionController::TestCase
fixtures :users, :targets, :results
def test_routing
assert_routing '/my/target/777/results', :controller => 'result', :action => 'target', :target_id => '777'
assert_routing '/my/result/91', ... | 27.506667 | 155 | 0.685571 |
28ad71aa932353122c57a8e686465ae5ed514eb5 | 25,543 | # -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
module DataWrangler
module Model
class PubchemCompound < Compound
SOURCE = "PubChem".freeze
EUTILS_URL = 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils'.freeze
PUG_URL = 'https://pubchem.ncbi.nlm.nih.gov/rest/pug'.freeze
WEB... | 36.699713 | 209 | 0.542849 |
1acdc9d3343078560fd9d0fabcf2217ff469ba07 | 36 | module R10K
VERSION = '3.3.3'
end
| 9 | 19 | 0.638889 |
f8c05fdd27e8452531a24f11b820270180b3b453 | 2,827 | require 'spec_helper'
describe 'deploy job template', type: :integration do
with_reset_sandbox_before_each
it 're-evaluates job templates with new manifest job properties' do
manifest_hash = Bosh::Spec::Deployments.simple_manifest
manifest_hash['properties'] = { 'test_property' => 1 }
deploy_from_scra... | 40.971014 | 110 | 0.73364 |
1d9b19391d9d1cf5288f48acea3ea5674ada1c67 | 383 | cask 'airdroid' do
version '3.6.3.0'
sha256 '3d23d7e711243322ed545badd60e6e1ca40d0ca97cb435fb281c60cbf7ec56c9'
# s3.amazonaws.com/dl.airdroid.com was verified as official when first introduced to the cask
url "https://s3.amazonaws.com/dl.airdroid.com/AirDroid_Desktop_Client_#{version}.dmg"
name 'AirDroid'
... | 31.916667 | 95 | 0.772846 |
1c7b1e67f969fc08763a6418d8b00be95b779d7a | 1,242 | Pod::Spec.new do |s|
s.name = "Differ"
s.version = "1.4.6"
s.summary = "A very fast difference calculation library written in Swift."
s.homepage = "https://github.com/tonyarnold/Diff"
s.description = <<-DESC
Differ generates the differences between `Collection` instances (this includes ... | 31.05 | 102 | 0.632045 |
913e78b69aaf423bfa0d0f741dedda1f679b4d66 | 1,737 | #!/usr/bin/env ruby -w
# coding: utf-8
# Copyright (C) 2004-2021 Koichiro Eto, All rights reserved.
# License: BSD 3-Clause License
module SGL
# window functions
def window(*a) $__a__.window(*a); end
def close_window() $__a__.close_window; end
def width() $__a__.width; end
def height() $__a__.height; end... | 28.47541 | 60 | 0.649971 |
391a943ff042290e6854bb377e916cf52608c95c | 2,507 | require_relative '../panos_provider'
require 'base64'
# Implementation for the panos_admin type using the Resource API.
class Puppet::Provider::PanosAdmin::PanosAdmin < Puppet::Provider::PanosProvider
def munge(entry)
if entry.key?(:ssh_key) && !entry[:ssh_key].nil?
# remove newline characters that can mes... | 40.435484 | 121 | 0.690467 |
6aaf1d8faf540a6a60562def897bd82add6e60d7 | 2,199 | class UsersController < ApplicationController
before_action :set_user, only: [:show, :edit, :update, :destroy]
before_action :signed_in_user, only: [:edit, :update, :destroy]
before_action :correct_user, only: [:edit, :update, :destroy]
# GET /users
# GET /users.json
def index
@users = User.all
... | 25.870588 | 88 | 0.651205 |
d570adfd594188a76f948c645e382ba30e8e09c2 | 7,340 | require 'zlib'
require 'stringio'
When("I build {string} using the {string} bugsnag config") do |module_config, bugsnag_config|
steps %Q{
When I set environment variable "MODULE_CONFIG" to "#{module_config}"
When I set environment variable "BUGSNAG_CONFIG" to "#{bugsnag_config}"
And I run the script "features/sc... | 39.462366 | 134 | 0.780518 |
914fd554d07063bd9edaaf49503d6bf8b01bc4d8 | 88 | class SponsorshipType < EnumerateIt::Base
associate_values :gold, :silver, :bronze
end | 29.333333 | 42 | 0.795455 |
ac3fe72faeff52f3577f657f96dcde771ef74716 | 41,914 | # frozen_string_literal: true
require "active_support/core_ext/hash/indifferent_access"
require "active_support/core_ext/array/wrap"
require "active_support/core_ext/string/filters"
require "active_support/core_ext/object/to_query"
require "action_dispatch/http/upload"
require "rack/test"
require "stringio"
require "s... | 34.986644 | 167 | 0.633989 |
e907b5176f372dfdd86e8a7573b7de964c8d2200 | 1,078 | require 'simp/cli/config/items/data/simp_options_ldap_sync_hash'
require 'rspec/its'
require_relative '../spec_helper'
describe Simp::Cli::Config::Item::SimpOptionsLdapSyncHash do
before :each do
@ci = Simp::Cli::Config::Item::SimpOptionsLdapSyncHash.new
item = Simp::Cli::Config::Item::SimpOptionsLdapSyncPw... | 33.6875 | 103 | 0.714286 |
394ff58ee50eff3aea32e9bd0621c6fa0c092e77 | 70 | module ListHelper
def body_class
'application list'
end
end
| 11.666667 | 22 | 0.714286 |
871e70ab91c18f2bd33609834da3da9492610e6c | 636 | # Method name: factorial
# Inputs: A single non-negative integer, n
# Returns: The factorial of n (see below)
# Prints: Nothing
# The factorial of 5 is denoted by 5! and is defined as
# 5! = 5*4*3*2*1
#
# In English, you'd read "5!" as "five factorial". In general, the factorial
# of a number is the p... | 26.5 | 77 | 0.65566 |
bb18a638ee35e29bb1f6b77da6fc8b79e7a4bb47 | 1,854 | class GoogleJavaFormat < Formula
include Language::Python::Shebang
desc "Reformats Java source code to comply with Google Java Style"
homepage "https://github.com/google/google-java-format"
url "https://github.com/google/google-java-format/releases/download/v1.15.0/google-java-format-1.15.0-all-deps.jar"
sha... | 34.333333 | 117 | 0.697411 |
edde502373e8e84eac3ae03483b2cb94e1935e61 | 1,367 | # -*- encoding: utf-8 -*-
# stub: slim 2.0.2 ruby lib
Gem::Specification.new do |s|
s.name = "slim"
s.version = "2.0.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib"]
s.authors = ["Daniel Mendler", "Andrew Stone", "Fred Wu"]
... | 35.051282 | 128 | 0.633504 |
f727be05b43520d1bf6e93e9682b513b31a1a7d4 | 1,609 |
# FIXME policy = :recalc doesnt work
module EH::Game
class Goal
def initialize
@state = :before
end
def setup
@state = :progress
end
def state
return @state
end
def restart
@state = :before
end
def recalc
restart
end
end
class MotionGoa... | 17.117021 | 40 | 0.521442 |
f86f1fe16e75aa0d1376568f9b132c28578756ce | 869 | #
# Cookbook Name:: practicingruby
# Recipe:: god
#
# Installs, configures, and starts God
#
# Install Ruby first
include_recipe "practicingruby::_ruby"
# Install god gem
gem_package "god"
# Create config directory
directory "/etc/god" do
owner "root"
group "root"
mode "0755"
end
# Create god config file
fil... | 18.489362 | 66 | 0.675489 |
e2e1eea7e9d27d1af65efff3bccf3d84c1ef38fe | 1,337 | require 'spec_helper'
class ForgeriesController < ActionController::Base
include Clearance::Controller
protect_from_forgery
if respond_to?(:before_action)
before_action :require_login
else
before_filter :require_login
end
# This is off in test by default, but we need it for this test
self.allo... | 22.283333 | 66 | 0.670157 |
6ab9c92c9ad00cb92e9a8432ee49e26c5297b5dc | 374 | # frozen_string_literal: true
# vi:ts=2 sw=2 tw=79 et lbr wrap
# Copyright 2018 by David Rabkin
require_relative 'action'
module Renamr
# Omits file names shorter than limit.
class OmitAction < Action
def initialize(lim)
raise 'lim cannot be nil.' if lim.nil?
@lim = lim
end
def do(src)
... | 17 | 44 | 0.652406 |
26b1037be2de2c939c93b460c6ce63fa0f541d2e | 736 | # encoding: utf-8
#
# As of 40c7bde9690e5174b6a958a5df6b2aabc6b8b041 this code produces an extra
# empty line of text in row 2.
#
# Simple rounding of string_width floats seems to fix this issue, see the patch
# in 09c837466c31bb715f1276118c606e20477577df.
#
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '.... | 29.44 | 79 | 0.629076 |
91cc918c688bb28d2b601fa3be9a12888e9b62fb | 1,199 | $:.unshift( File.expand_path( "../lib", __FILE__ ) )
require 'lab42/open_object/version'
version = Lab42::OpenObject::VERSION
Gem::Specification.new do |s|
s.name = 'lab42_open_object'
s.version = version
s.summary = 'OpenObject an Immutable OpenStruct Enhancement'
s.description = %{An Open Objec... | 38.677419 | 123 | 0.680567 |
01fe73869fb00188c0287f8a1a1c904e5bec9b46 | 1,055 | # typed: true
module KubeDSL::DSL::Apps::V1
class DeploymentCondition < ::KubeDSL::DSLObject
value_field :last_transition_time
value_field :last_update_time
value_field :message
value_field :reason
value_field :status
value_field :type
validates :last_transition_time, field: { format: :s... | 30.142857 | 80 | 0.67109 |
87f3810d55cfde79d2d6f8d56085c876c0bb7eb5 | 404 | # frozen_string_literal: true
require 'spec_helper'
describe GitlabSchema.types['DiffPosition'] do
it 'exposes the expected fields' do
expected_fields = %i[
diff_refs
file_path
height
new_line
new_path
old_line
old_path
position_type
width
x
y
... | 16.833333 | 68 | 0.655941 |
e803a637012e49c50a41c82dd315978c179c2349 | 11,166 | ##
# This code was generated by
# \ / _ _ _| _ _
# | (_)\/(_)(_|\/| |(/_ v1.0.0
# / /
#
# frozen_string_literal: true
module Twilio
module REST
class Events < Domain
class V1 < Version
##
# PLEASE NOTE that this class contains beta products that are subject to change. U... | 37.469799 | 111 | 0.566452 |
87624c49bb9bf167c7dffb0f957c1dfd030742f3 | 1,101 | require 'spec_helper'
describe Membership, :type => :model do
let(:membership) { create(:membership) }
it "should have a valid factory" do
expect(build(:membership)).to be_valid
end
describe "#user_group" do
it "must have a user group" do
expect(build(:membership, user_group: nil)).to_not be_val... | 21.588235 | 65 | 0.645777 |
f76aabcb2970ec9a139a42f1f89f625ac81f98a2 | 267 | # RAILS_ENV=production ./script/rails runner script/patch_expense_create_at_yyyymm.rb
logger = RAILS_DEFAULT_LOGGER
logger.info "Start batch"
Expense.all.each do |ex|
ex.create_at_yyyymm = ex.created_at.strftime("%Y%m")
ex.save!
end
logger.info "End batch"
| 24.272727 | 87 | 0.76779 |
79ee3be9582b4cf660344bc41576d4bf0db61980 | 18,261 | require 'ostruct'
require 'base64'
require 'tmpdir'
require 'fileutils'
require 'timeout'
require 'iron_worker_ng/api_client'
module IronWorkerNG
class ClientProxyCaller
def initialize(client, prefix)
@client = client
@prefix = prefix
end
def method_missing(name, *args, &block)
full_n... | 31.268836 | 163 | 0.645857 |
87442493f7b5de06b88204055aef263dfa48dfe2 | 231 | class CreateOrders < ActiveRecord::Migration[6.0]
def change
create_table :orders do |t|
t.integer :qty
t.decimal :amount
t.integer :product_id
t.integer :user_id
t.timestamps
end
end
end
| 17.769231 | 49 | 0.640693 |
e8e9c263d2324b71af99ec2ac33f8437b4d66cc5 | 35,422 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Issuable do
include ProjectForksHelper
using RSpec::Parameterized::TableSyntax
let(:issuable_class) { Issue }
let(:issue) { create(:issue, title: 'An issue', description: 'A description') }
let(:user) { create(:user) }
describe "Associat... | 33.354049 | 163 | 0.664926 |
2162e8e7f7766db3e54adc713ef0d43bd9dd82ce | 713 | require 'mini_magick'
require 'aws-sdk-s3'
file_uri = STDIN.read.strip
image = MiniMagick::Image.open(file_uri)
image.contrast
image.resize "250x200"
image.rotate "-90"
s3 = Aws::S3::Client.new
bucket = ENV['AWS_S3_BUCKET']
obj = s3.put_object( bucket: bucket,
key: File.basename(file_uri),
... | 31 | 91 | 0.664797 |
2107123cbf3d6efe10819c0cc350dc40cf98e860 | 219 | require 'test_helper'
class SiteLayoutTest < ActionDispatch::IntegrationTest
test "layout liks" do
get root_path
assert_template 'static_pages/home'
assert_select "a[href=?]", root_path,count:2
end
end
| 21.9 | 54 | 0.748858 |
ab330066b45552bb1b4e0808265b429fa2f8a21a | 256 | class Webstorm < Cask
url 'http://download.jetbrains.com/webstorm/WebStorm-8.0.2.dmg'
homepage 'http://www.jetbrains.com/webstorm/'
version '8.0.2'
sha256 '4ba90cec20a7b115f840adc26892d76e71e049a65570af9fa5d0f54ba7caa9f8'
link 'WebStorm.app'
end
| 32 | 75 | 0.777344 |
e962d41bd9520673a7ecf478c17aacd9a27e6ae4 | 391 | # 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::ServiceFabric::V7_0_0_42
module Models
#
# Defines values for FailureAction
#
module FailureAction
Invalid = "Invalid"... | 21.722222 | 70 | 0.68798 |
7a8ec94cfa1e1475c0ccb6eeb08099d09b2aa5d9 | 935 | class Support::AllocationForm
include ActiveModel::Model
attr_reader :allocation
attr_accessor :current_allocation, :school_allocation
delegate :cap, :raw_devices_ordered, :is_in_virtual_cap_pool?, to: :school_allocation
validate :check_decrease_allowed
validate :check_minimum
def initialize(params = ... | 21.744186 | 89 | 0.767914 |
d556625dbf4a33438dd2fc2ff1c88e743b05e562 | 1,120 | require 'test_helper'
class CallBoxesControllerTest < ActionController::TestCase
setup do
@call_box = call_boxes(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:call_boxes)
end
test "should get new" do
get :new
assert_response :succes... | 22.4 | 77 | 0.703571 |
3954a29cad9ad826dfe87a773b0ce4b23f8e99fc | 23 | module BanksHelper
end
| 7.666667 | 18 | 0.869565 |
f80664d5fa260f721fec1bdd4c3ffe630fd1e1f3 | 1,322 | require "#{File.dirname(__FILE__)}/spec_helper"
describe "vCard subset matching" do
JOHN = <<end_vcard
BEGIN:VCARD
VERSION:3.0
N:Smith;John;M.;Mr.;Esq.
TEL;TYPE=WORK,VOICE,MSG:+1 (919) 555-1234
TEL;TYPE=CELL:+1 (919) 554-6758
TEL;TYPE=WORK,FAX:+1 (919) 555-9876
ADR;TYPE=WORK,PARCEL,POSTAL,DOM:Suite 101;1 Central St... | 21.322581 | 73 | 0.65053 |
38c9f08503dedcd80aeba75998a8c7fe05f08fd5 | 1,567 | /*
* 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 ... | 26.116667 | 63 | 0.624761 |
b98d63eb5f402e8495d30bdc2763dc28a9d897f4 | 39,731 | # 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::Monitor::Mgmt::V2019_10_17_preview
#
# Monitor Management Client
#
class PrivateLinkScopes
include MsRestAzure
#
# Create... | 44.641573 | 152 | 0.706451 |
62ada22dcad5f408b2b744982bc9684a69d74988 | 496 | # Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attac... | 62 | 171 | 0.832661 |
7ab0a546de0325badbe99fa1073e04dce33bad86 | 1,166 | # -*- encoding: utf-8 -*-
# stub: turbolinks 5.2.1 ruby lib
Gem::Specification.new do |s|
s.name = "turbolinks".freeze
s.version = "5.2.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.metadata = { "source_code_uri" => "https://github.com/turb... | 36.4375 | 116 | 0.711835 |
ffc355a92be4128a8962f2827ef20f2d1a2c9339 | 1,831 | # frozen_string_literal: true
require "abstract_unit"
require "console_helpers"
class Quails::Engine::CommandsTest < ActiveSupport::TestCase
include ConsoleHelpers
def setup
@destination_root = Dir.mktmpdir("bukkits")
Dir.chdir(@destination_root) { `bundle exec quails plugin new bukkits --mountable` }
... | 22.604938 | 88 | 0.691972 |
ff2d39e1e37afe6fa27821ee7753bc6a60cf6c5a | 5,569 | class ManageIQ::Providers::Openstack::CloudManager::Vm < ManageIQ::Providers::CloudManager::Vm
include_concern 'Operations'
include_concern 'RemoteConsole'
include_concern 'Resize'
include_concern 'AssociateIp'
include_concern 'ManageSecurityGroups'
include ManageIQ::Providers::Openstack::HelperMethods
... | 32.005747 | 115 | 0.679835 |
1dd1ca4e115214ca0275eebf7ece702e2318bb67 | 23,787 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe API::Ci::JobArtifacts do
include HttpBasicAuthHelpers
include DependencyProxyHelpers
include HttpIOHelpers
let_it_be(:project, reload: true) do
create(:project, :repository, public_builds: false)
end
let_it_be(:pipeline, reload: tru... | 32.764463 | 137 | 0.616934 |
91ee6077798b0bd36e90f35d35b2fbbd2257f15d | 117 | require "Rescue_Story/version"
module RescueStory
class Error < StandardError; end
# Your code goes here...
end
| 16.714286 | 34 | 0.752137 |
ab236e6cda118da15756c5bdce953ce19e70b760 | 311 | # frozen_string_literal: true
module ActiveValidation
module Type
class Version < ActiveModel::Type::Integer
def serialize(value)
value.to_i
end
def deserialize(value)
return unless value
ActiveValidation::Values::Version.new value
end
end
end
end
| 17.277778 | 51 | 0.659164 |
4abdeb0d1df4c138a169f0a093415a66e591369d | 198 | require 'spec_helper'
describe Outlearn do
it 'has a version number' do
expect(Outlearn::VERSION).not_to be nil
end
it 'does something useful' do
expect(false).to eq(true)
end
end
| 16.5 | 43 | 0.707071 |
f85c1bdad686856bd39feaaa45717d702eaf6e81 | 1,171 | require 'image_optim/worker'
require 'image_optim/option_helpers'
require 'image_optim/non_negative_integer_range'
class ImageOptim
class Worker
# http://pngquant.org/
class Pngquant < Worker
QUALITY_OPTION =
option(:quality, 100..100, NonNegativeIntegerRange, 'min..max - don\'t '\
'sav... | 26.613636 | 80 | 0.553373 |
875ef08e9d58e80623d07b14f25119be9216058e | 2,924 | module WikiPagesHelper
acts_as_wiki_pages_helper
def wiki_content(text)
Irwi.config.formatter.format(wiki_macros(wiki_linkify( wiki_show_attachments(text)))).html_safe
end
def wiki_macros(text)
wiki_css(wiki_nav(text))
end
def wiki_nav(text)
text.gsub(/\{\{nav.*?\}\}/) do |match|
page_ti... | 33.609195 | 161 | 0.621067 |
03b9ea7b889fc0a3a2b50399633fe034d10c0cc5 | 1,227 | # Doc placeholder
module ZimbraRestApi
class Account < ZimbraBase
def add_alias(alias_name)
zmobject.add_alias(alias_name)
end
def delegated_auth_token
zmobject.delegated_auth_token
end
def disable_archive
zmobject.disable_archive
end
def enable_archive(cos_id = nil, ... | 20.79661 | 62 | 0.666667 |
d50fc68b904d6224589392bdb140bf88c36ba61b | 465 | require File.expand_path('../nellie/errors/errors', __FILE__)
require File.expand_path('../nellie/configuration', __FILE__)
require File.expand_path('../nellie/api', __FILE__)
require File.expand_path('../nellie/client', __FILE__)
require File.expand_path('../nellie/response', __FILE__)
module Nellie
extend Configur... | 27.352941 | 61 | 0.735484 |
185f03f07be2a2ea2544f83041c9f217bc764d52 | 825 | require 'test_helper'
module Abid
class StateManager
class StateServiceTest < AbidTest
def new_state_service(name, params)
StateService.new(env.state_manager.states, name, params)
end
def test_params_text
service = new_state_service('name', b: 1, a: Date.new(2000, 1, 1))
... | 30.555556 | 79 | 0.641212 |
18611f3bb38cfd397c3a64f6406c35921ff9906d | 2,207 | # Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
require 'search_container_test'
class ComponentExclusive < SearchContainerTest
def setup
set_owner("valerijf")
set_description("Verify that only one instance of the component is running at a given... | 31.084507 | 116 | 0.702311 |
ff09bf5c42960cab7226e6bab721cf97260b5607 | 241 | class House < ApplicationRecord
has_many :viewings
has_one_attached :picture
validates :location, presence: true
validates :description, presence: true
validates :bedrooms, presence: true
validates :bathrooms, presence: true
end
| 26.777778 | 40 | 0.784232 |
3363b3e8788860c8c8822271e8bd9ec93e80c0f7 | 580 | worker_processes Integer(ENV['WEB_CONCURRENCY'] || 3)
timeout 15
preload_app true
before_fork do |server, worker|
Signal.trap 'TERM' do
puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
Process.kill 'QUIT', Process.pid
end
defined?(ActiveRecord::Base) and
ActiveRecord::Base.conn... | 27.619048 | 91 | 0.756897 |
bb37cba3876724e4421c455cc147100e20e4ed63 | 618 | require 'castanet/testing'
require 'logger'
require 'net/http'
require 'openssl'
require 'uri'
module Castanet::Testing
module ConnectionTesting
LOGGER = Logger.new($stderr)
def responding?(url, logger = LOGGER)
uri = URI(url)
begin
h = Net::HTTP.new(uri.host, uri.port)
h.use_ss... | 21.310345 | 56 | 0.593851 |
ff8fefea2395507de3ebbb26e10786c06c6d72f3 | 299 | # frozen_string_literal: true
class User < ApplicationRecord
has_many :api_keys, foreign_key: "issuer_id", inverse_of: "issuer"
def self.settings_keys
%w[name]
end
def name
settings["name"] || default_name
end
private
def default_name
email.split(/@/).first
end
end
| 14.95 | 68 | 0.695652 |
7a41533806b94474b65e8c14d1ca2c482f371d2d | 579 |
require 'thp/utils/embeds'
module THP
module Commands
module Team
module Attributes
ALL = [
TEAM = {
description: 'Show the creators of bot.',
help_available: true,
max_args: 0,
rescue: 'Oh no, something terrible has happened. An Error occu... | 24.125 | 105 | 0.564767 |
1c709e0adb4a4be885accef86ad617e30f62ccfe | 226 | def template(from, to)
erb = File.read(File.expand_path("../templates/#{from}", __FILE__))
put ERB.new(erb).result(binding), to
end
def set_default(name, *args, &block)
set(name, *args, &block) unless exists?(name)
end
| 25.111111 | 69 | 0.690265 |
e9ec8ef4c743c635b739eb6b651562b7bd3c55d1 | 1,072 | require 'rails_helper'
RSpec.describe "procedimientos/new", type: :view do
before(:each) do
assign(:procedimiento, Procedimiento.new(
:tratamiento => "MyString",
:via_acceso => "MyString",
:descripcion => "MyText",
:glucometria1 => 1,
:glucometria2 => 1,
:electrocardiograma =>... | 31.529412 | 108 | 0.709888 |
1d46f81f8c19ab6d504a9995773c00223d299ba1 | 1,401 | # Copyright (c) 2018 Public Library of Science
# 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, pub... | 45.193548 | 76 | 0.772305 |
e2708be5125f7bbf571ca664449774ff1c49c9c8 | 8,633 | module Cms
module AssetsPrecompile
def self.initialize_precompile
Cms::AssetsPrecompile::SprocketsExtension.init
end
class SprocketsExtension
def self.init_options(*args)
#puts "init_options: ARGV: #{ARGV.inspect}"
arr = args
if arr.empty?
arr = (ARGV[1] |... | 37.534783 | 220 | 0.562493 |
ed6860516074d0cb62fc331a9062ec739b055f0c | 4,001 | module FCB
class Verification
TEST_API_PATH = "http://www-test2.1cb.kz/VerService/VerificationService".freeze
PROD_API_PATH = "https://secure2.1cb.kz/VerService/VerificationService".freeze
ERRORS = {
"-1000" => :authentication_error,
"-1011" => :duplication_error,
"-1012" => :subject_not... | 32.795082 | 83 | 0.553112 |
1ab3434518db7b95953827f09571cc32681b8f02 | 2,643 | require 'spec_helper'
describe Tablado do
it 'has a version number' do
expect(Tablado::VERSION).not_to be nil
end
end
describe Tablado::Presentation do
let(:presentation) { Tablado::Presentation.new }
it 'should have attribute FPS' do expect( presentation.respond_to? :fps) end
it 'should have attribut... | 30.034091 | 112 | 0.716988 |
4af5c1b32000cae759f56f33a90d68983ce5bccb | 684 | require "rails_helper"
describe ContactPolicy do
let(:user) { create(:user) }
let(:provider) { create(:provider) }
let(:contact) { create(:contact, provider: provider) }
subject { described_class }
permissions :show?, :update? do
context "a user that belongs to the provider" do
before do
... | 22.8 | 56 | 0.638889 |
38f170ace87d9d881e0e6f78e49ccdeef364d73a | 308 | class Enrollment < ApplicationRecord
belongs_to :user
belongs_to :course
validates_uniqueness_of :user_id, scope: :course_id, message: "You have already rated this course."
validates :rating, presence: true
validates_inclusion_of :rating, :in => 1..5
accepts_nested_attributes_for :course
end
| 25.666667 | 101 | 0.775974 |
26ab0f10ae55645a85be0ce8a89117db8bfa6809 | 1,161 | cask "protonvpn" do
version "1.8.0"
sha256 "549c9a19a75cc23e238b276fb27006b7c310434ce3539b588a990f2b43ba3e05"
url "https://protonvpn.com/download/ProtonVPN_mac_v#{version}.dmg"
appcast "https://protonvpn.com/download/macos-update2.xml"
name "ProtonVPN"
desc "VPN client focusing on security"
homepage "htt... | 34.147059 | 75 | 0.719208 |
e2a9a731753e3fb7aa75c422e68ea5d7edfccead | 273 | module PopcorntimeSearch
class MovieResult
attr_accessor :title, :year, :imdb
def initialize(result)
@title = result['title']
@year = result['year']
@imdb = result['imdb_id']
end
def to_s
"#{title} (#{year})"
end
end
end
| 17.0625 | 38 | 0.582418 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.