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 |
|---|---|---|---|---|---|
bfa5e63c5156916ff6413cc4f969b3e3c0c6aae3 | 259 | class AddContextsProjects < ActiveRecord::Migration[5.2]
def self.up
create_table :contexts_projects, :id => false do |t|
t.integer :context_id
t.integer :project_id
end
end
def self.down
drop_table :contexts_projects
end
end
| 19.923077 | 56 | 0.698842 |
d59cf4c8aba189262239d15ffbde70d3df2db442 | 2,527 | ######################################################################
# Copyright (c) 2008-2016, Alliance for Sustainable Energy.
# All rights reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the ... | 32.818182 | 125 | 0.641868 |
397c2a62a5ee180b769b1bfe61ec3b42719874b4 | 605 | class ArticlesController < ApplicationController
def index
@articles = Article.find :all
set_json :setTitle => 'Listing articles'
end
def show
@article = Article.find params[:id]
set_json :setTitle => "Listing articles #{@article.id}",
:article_id => @article.id
end
def new... | 22.407407 | 79 | 0.644628 |
1d97036c99dce22d4076435193dba84e4c35d556 | 2,991 | require 'bundler/setup'
require 'netforum_enterprise'
require 'minitest/autorun'
require 'minitest/pride'
require 'webmock/minitest'
require 'byebug'
def stub_wsdl
stub_request(:get, "https://eweb.foodexport.org/nffoodextest/xweb/secure/netForumXML.asmx?WSDL").
to_return(:status => 200, :body => File.read('test/... | 49.85 | 121 | 0.726513 |
4adb8075684bfeb0d5e03bfcd8da0376278c3ad8 | 787 | class PermissionForMetareviewAssignment < ActiveRecord::Migration[4.2]
def self.up
controller_id = SiteController.find_by_name('review_mapping').id
do_assignments_id = Permission.find_by_name('do assignments').id
action = 'assign_metareviewer_dynamically'
unless ControllerAction.where(site_controller_... | 41.421053 | 127 | 0.786531 |
0835d8b617508f7e9e3492c6fa8ad4ba217e865e | 2,820 | Shipit::Engine.routes.draw do
stack_id_format = %r{[^/]+/[^/]+/[^/]+}
sha_format = /[\da-f]{6,40}/
root to: 'stacks#index'
mount Pubsubstub::StreamAction.new, at: "/events", as: :events
# Robots
get '/status/version' => 'status#version', as: :version
resources :webhooks, only: :create
# API
namesp... | 30.652174 | 110 | 0.624468 |
ed6feaf9ad89c610f448bdf01910b833440f91a0 | 12,799 | # 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|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render invalid all existing
# confirmat... | 48.851145 | 154 | 0.750215 |
39beae4bbf90bbb9f64ed480f3113a7c6a58c61f | 6,382 | require File.expand_path(File.dirname(__FILE__) + '../../spec_helper')
require 'fileutils'
# Ideally want to test everything in Capybara::Session::DSL_METHODS
# These methods haven't been tested yet:
#NODE_METHODS = [
# :resolve, :query # These don't appear to be actual methods?
#]
#SESSION_METHODS = [
#]
#
# As me... | 46.926471 | 136 | 0.701661 |
03d28c80c1c6cb01401a799db3afd1e7e0a6aaf5 | 715 | # RPC handlers for getting pseudo-random addresses in a given state
class RandomAddressHandler < ThriftServer::ThriftHandler
include ThriftServer::Middleware::SkylightInstrumentation::Mixin
include ThriftUtils::Validation
include ThriftUtils::EnumConversion
process ThriftDefs::VoterVerifier::Service, only: %i[... | 31.086957 | 67 | 0.758042 |
6ae3e2abd06d5637ccfaef274b31cbfd5b448dc8 | 480 | class Box < Formula
desc "📦🚀 Fast, zero config application bundler with PHARs"
homepage "https://github.com/humbug/box"
url "https://github.com/humbug/box/releases/download/3.7.0/box.phar"
sha256 "57daab20d12c9eeec2cf244b0f1966327de369a66d2f59ed3bda6a3f5e9f05a9"
bottle :unneeded
depends_on "php" if MacO... | 25.263158 | 75 | 0.725 |
33d8908efaf51c9b6378a88fb7d1ac0353eaa0dd | 655 | # Set RAILS_ROOT and load the environment if it's not already loaded.
unless defined?(Rails)
ENV["RAILS_ROOT"] = File.expand_path("../example", __FILE__)
require File.expand_path("../example/config/environment", __FILE__)
end
Teaspoon.configure do |config|
config.mount_at = "/teaspoon"
config.root = TurboGraft... | 32.75 | 83 | 0.723664 |
111745e0624b356613f564c323ab9de5586775ee | 394 | module Jobs
class Retry
InvalidStateError = Class.new(RuntimeError)
def initialize(job:)
self.job = job
end
def call
job.reload
raise InvalidStateError, "Can not retry job with state #{job.state}" unless job.state == 'failed'
job.update! state: 'rescheduled'
UpdateJob.... | 17.909091 | 103 | 0.652284 |
1c92db5c7761d63c8a19113fa30d392105f6daea | 36,674 | # frozen_string_literal: false
#
# treeview widget
# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
#
require 'tk'
require 'tkextlib/tile.rb'
module Tk
module Tile
class Treeview < TkWindow
end
end
end
module Tk::Tile::TreeviewConfig
include TkItemConfigMethod
def __item_c... | 27.553719 | 139 | 0.582674 |
26da8fa5c1f77e066195b9e1bcd9c33d146f3d17 | 472 |
# to open file (if in another directory add full path in brackets), example below
File.open("arrays.rb", "r") do |file|
# then add puts and file in a line to print whatever is in the file
puts file
# then to read file
puts file.read()
# to check if sumthing is in the file or not
puts file.read().include?... | 27.764706 | 81 | 0.686441 |
8794cc37a273453c00743598241136e986b69c17 | 1,927 | # Copyright (c) 2017-present, Facebook, Inc. All rights reserved.
#
# You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
# copy, modify, and distribute this software in source code or binary form for use
# in connection with the web services and APIs provided by Facebook.
#
# As with any so... | 32.661017 | 82 | 0.714063 |
01d0d230a00354f51ffe64f84500073cae153c79 | 1,066 | # List with workouts.
module Workouts
attr_reader :workouts_list
@workouts_list = ['https://www.youtube.com/watch?v=mH3AzNyPalY',
'https://www.youtube.com/watch?v=X94NBB5C4d4',
'https://www.youtube.com/watch?v=OzfXqTpYUcg',
'https://www.youtube.com/watch?... | 44.416667 | 71 | 0.560038 |
3872de8cbee39e22f565a9b3824ce7c234f66074 | 1,014 |
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "multiverse/version"
Gem::Specification.new do |spec|
spec.name = "multiverse"
spec.version = Multiverse::VERSION
spec.authors = ["Andrew Kane"]
spec.email = ["andrew@chartki... | 32.709677 | 74 | 0.667653 |
389cbec43a9c5d774c3f5b04a0a9a35a64667e7c | 3,709 | require "openssl"
module HTTPI
module Auth
# = HTTPI::Auth::SSL
#
# Provides SSL client authentication.
class SSL
VERIFY_MODES = [:none, :peer, :fail_if_no_peer_cert, :client_once]
CERT_TYPES = [:pem, :der]
# Ssl versions permmited
SSL_VERSIONS = [:TLSv1_2, :TLSv1_1, :TLSv1,... | 31.700855 | 108 | 0.620113 |
91603adb2cb459577b4eb47de70fbd1978112c0c | 190 | # Return a full path to fixture given by name.
def fixture(name)
path = Pathname.new(__FILE__).dirname + "../fixtures/#{name}"
path.realpath
end
require_relative '../fixtures/message'
| 21.111111 | 63 | 0.721053 |
e98f0f623be573d388c18aa0ec70f1b3b9eddf0d | 4,437 | module Option
def option(thing)
validate = thing.respond_to?(:empty?) ? thing.empty? : !thing
validate ? none : some(thing)
end
def some(thing)
Some.new(thing)
end
def none(thing=nil)
None.new(thing)
end
class Some
include Comparable
def initialize(content)
@content = c... | 14.547541 | 94 | 0.583728 |
ed52a0a0fca718a9710c4ed7f6a7fda30e5d5a80 | 3,182 | module JsonApiClient
module Parsers
class Parser
class << self
def parse(klass, response)
data = response.body.present? ? response.body : {}
ResultSet.new.tap do |result_set|
result_set.record_class = klass
result_set.uri = response.env[:url]
... | 30.893204 | 131 | 0.556882 |
91c5baee745eb9acfe85ac8480d6de89f101e8d4 | 6,750 | require 'chef/provider/lwrp_base'
require 'shellwords'
require_relative 'helpers'
require_relative 'helpers_ubuntu'
class Chef
class Provider
class MysqlService
class Ubuntu < Chef::Provider::MysqlService
provides :mysql_service, platform: 'ubuntu'
use_inline_resources if defined?(use_inli... | 30 | 119 | 0.534667 |
1ca77aead52408216c09e8a59d92ea795106e5bd | 1,872 | ##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
class MetasploitModule < Msf::Exploit::Remote
Rank = AverageRanking
include Msf::Exploit::Remote::Tcp
def initialize(info = {})
super(update_info(info... | 27.130435 | 77 | 0.53953 |
1cf8eb55f23ca9b772fd12864d1f8c593c148825 | 3,287 | module WinFFI
if WINDOWS_VERSION >= :xp
module Comctl32
class << self
#define Button_GetIdealSize(hwnd, psize) (BOOL)SNDMSG((hwnd), BCM_GETIDEALSIZE, 0, (LPARAM)(psize))
def Button_GetIdealSize(hwnd, psize) send_button_control_message(hwnd, :GETIDEALSIZE, lparam: psize) end
#... | 56.672414 | 130 | 0.702768 |
3999e19d20573adb7585fc0b0545120eb987e926 | 5,843 | require 'test_helper'
class HelpersTest < Test::Unit::TestCase # :nodoc:
context "an array of values" do
setup do
@a = ['abc', 'def', 3]
end
[/b/, 'abc', 3].each do |x|
should "contain #{x.inspect}" do
assert_raises(Test::Unit::AssertionFailedError) do
assert_does_not_cont... | 30.591623 | 90 | 0.606024 |
b99fcc5971815101fc92cc6859411933f52f0fe5 | 516 | cask "river-sparkle" do
version "3.1.3,8548"
sha256 :no_check
url "https://sparkleapp.com/update/Sparkle.zip"
name "Sparkle"
desc "App to build websites"
homepage "https://sparkleapp.com/"
livecheck do
url "https://sparkleapp.com/update/appcast.php?lang=en"
strategy :sparkle
end
app "Sparkl... | 22.434783 | 59 | 0.695736 |
21449f41c0d28fbab44461ec477b3a35dae51364 | 2,681 | # Copyright:: Copyright 2020 Trimble Inc.
# License:: The MIT License (MIT)
# The OrientedBounds2d class is a bounding box represented by four
# {Geom::Point2d} objects, upper left, upper right, lower left and lower right
# positions.
#
# @version LayOut 2018
class Geom::OrientedBounds2d
# Instance Methods
# The... | 26.029126 | 81 | 0.667288 |
bf7fd8e1f480dec5d825ed0df9177f39d85a2e35 | 5,938 | module Guard
# Base class that every Guard plugin implementation must inherit from.
#
# Guard will trigger the `start`, `stop`, `reload`, `run_all` and `run_on_changes`
# (`run_on_additions`, `run_on_modifications` and `run_on_removals`) task methods
# depending on user interaction and file modification.
#... | 35.345238 | 114 | 0.672617 |
080839cb2bc54386f6c8dffa662c4a10a7ce093f | 1,234 | # frozen_string_literal: true
# WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
Gem::Specification.new do |spec|
spec.name = 'aws-sdk-dynamodb'
... | 38.5625 | 120 | 0.665316 |
aceebc7eec81d452f3940c481b58e00de49e8072 | 163 | module NuOrderServices
class Inventory < Base
def update_inventory!(id, data)
nuorder.post("/api/inventory/external_id/#{id}", data)
end
end
end
| 20.375 | 60 | 0.693252 |
1af0cf7095888e33fb1a017dc0f525ca488cb85f | 846 | class AddLatestMergeRequestDiffIdToMergeRequests < ActiveRecord::Migration[4.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_column :merge_requests, :latest_merge_request_diff_id, :integer
add_concurrent_index :merge_requests, :latest_merge_request_d... | 31.333333 | 79 | 0.755319 |
26e02007eb9a8f95cbe01abfecf51fa754df5ebc | 1,978 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Web::Mgmt::V2016_08_01
module Models
#
# Database connection string information.
#
class ConnStringInfo
include MsRestAzure
# @r... | 27.859155 | 79 | 0.515672 |
0854ae68882894ceba392aaa4ecb194b1ef092dc | 898 | class JvmMon < Formula
desc "Console-based JVM monitoring"
homepage "https://github.com/ajermakovics/jvm-mon"
url "https://github.com/ajermakovics/jvm-mon/releases/download/0.3/jvm-mon-0.3.tar.gz"
sha256 "9b5dd3d280cb52b6e2a9a491451da2ee41c65c770002adadb61b02aa6690c940"
license "Apache-2.0"
revision 2
li... | 26.411765 | 114 | 0.691537 |
ed924b636f82038523161b6b8cda0d1ebccdbd81 | 8,013 | # typed: false
require 'spec_helper'
require 'ddtrace/transport/http/adapters/net'
RSpec.describe Datadog::Transport::HTTP::Adapters::Net do
subject(:adapter) { described_class.new(hostname, port, **options) }
let(:hostname) { double('hostname') }
let(:port) { double('port') }
let(:timeout) { double('timeou... | 23.429825 | 101 | 0.593785 |
ed4bdcd783bfe1b67827806371a9fe63fa08dacc | 11,532 | ENV["TEST_NAME"] = "functional_oauth_controller_test"
require 'test_helper'
class OauthControllerTest < ActionController::TestCase
def setup
@request.env['HTTP_ACCEPT'] = "application/json"
@controller = allow_multiple_execution(OauthController.new)
@clients = {
:my_sso_client_id => {
:i... | 35.483077 | 147 | 0.712019 |
edf0ad49e4623b2991401e7c79c152b1e5eafa51 | 1,612 | require 'test_helper'
class UsersLoginTest < ActionDispatch::IntegrationTest
def setup
@user = users(:michael)
end
test 'login with invalid information' do
get login_path
assert_template 'sessions/new'
post login_path, params: { session: { email: "", password: "" } }
assert_template 'sessio... | 29.851852 | 69 | 0.674318 |
d51ecf34fbb4194b71b6a2514ad54514387f3ca0 | 1,045 | Pod::Spec.new do |s|
s.name = "JDFlipNumberView"
s.version = "2.0.5"
s.summary = "A simple, yet powerful, customizable FlipNumberView based on CoreAnimation (Simulating an analog flip display)."
s.description = "The FlipNumberView is simulating an analog flip display (like those for t... | 49.761905 | 339 | 0.670813 |
01b721ef5336d39e2e7eea3e2b2a5d1991e21cbd | 379 | class MembershipsController < ApplicationController
def index
@memberships = Membership.all
@all_memberships = Membership.group(:team_id).pluck(:team_id)
end
def show
@membership = Membership.find(params[:id])
end
def new
@membership = Membership.new({member: current_user})
end
def edi... | 18.95 | 65 | 0.707124 |
ed8769907fdc4c31249df51032205b276e4cbb11 | 1,256 | # frozen_string_literal: true
require 'spec_helper'
Awspec::Stub.load 'iam_user'
describe iam_user('my-iam-user') do
it { should exist }
it { should belong_to_iam_group('my-iam-group') }
it { should have_iam_policy('ReadOnlyAccess') }
it { should have_inline_policy }
it { should have_inline_policy('AllowS3B... | 27.304348 | 106 | 0.642516 |
f72cd008f7eeb09ce7fbe7726924e2d38f2a34dc | 13,563 | require "spec_helper"
describe RenderAsync::ViewHelper do
let(:helper) { Class.new { extend RenderAsync::ViewHelper } }
describe "#render_async_cache_key" do
it "returns cache key" do
expect(helper.render_async_cache_key("users")).to eq("render_async_users")
end
end
describe "#render_async_cach... | 28.433962 | 84 | 0.516405 |
b92a440a01db31954e16582688143898818a4063 | 1,238 | module Views
module PasswordResets
class Edit < Views::Base
needs :account
needs :token
def content
# TODO: this is nearly identical to Views::AccountClaims::Edit. Definitely refactor if it's similar to change-password.
row(class:'top-spacer__variable') {
column(:'medi... | 28.790698 | 127 | 0.424879 |
f8ac6202422736a604ec7f5c3032eb3bb265204f | 426 | number = 7
if number
puts "My favorite number is #{number}."
else
puts "I don't have a favorite number."
end
=begin
Output:
My favorite number is 7.
The variable 'number' is evaluated in a boolean context, which means it will be evaluated as a truthy or falsy value. This implicitly type coerces it into a boolea... | 26.625 | 263 | 0.744131 |
1c6d012eeeaebb03783779142268a377ea81ca5a | 2,378 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "has_enumeration"
s.version = "1.0.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to?(:required_rubygems_version=)
s.authors = ["Greg Spurrier"]
s.date = "2012-04-06"
s.description = "Extends ActiveRecord with the ... | 45.730769 | 642 | 0.737595 |
ff723a4793f8066c1d5f3b87dd9771f62efcf464 | 353 | # frozen_string_literal: true
#
class ValidateU2fRegistrationsUserIdForeignKey < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
CONSTRAINT_NAME = 'fk_u2f_registrations_user_id'
def up
validate_foreign_key :u2f_registrations, :user_id, name: CONSTRAINT_NAME
end
... | 20.764706 | 77 | 0.776204 |
f8fb7acb63f3de90ea4a2d2a6b102b9df46bf5c8 | 371 | # frozen_string_literal: true
module Dotloop
module Models
module LoopDetails
class Property
include Virtus.model
attribute :bedrooms
attribute :year_built
attribute :square_footage
attribute :type
attribute :bathrooms
attribute :school_district
... | 19.526316 | 34 | 0.649596 |
6aa176261559718438526e6f64e5b13069354912 | 228 | require 'spec_helper'
describe ComposerFinder do
it 'has a version number' do
expect(ComposerFinder::VERSION).not_to be
end
it 'does something useful' do
expect(false).to eq(true)
end
end
| 19 | 50 | 0.653509 |
91e177072bd3c02b388b340058e3892b04de9a00 | 10,276 | class GccAT5 < Formula
desc "GNU Compiler Collection"
homepage "https://gcc.gnu.org/"
url "https://ftp.gnu.org/gnu/gcc/gcc-5.5.0/gcc-5.5.0.tar.xz"
mirror "https://ftpmirror.gnu.org/gcc/gcc-5.5.0/gcc-5.5.0.tar.xz"
sha256 "530cea139d82fe542b358961130c69cfde8b3d14556370b65823d2f91f0ced87"
revision OS.mac? ? 6 ... | 37.918819 | 140 | 0.663293 |
e92d04716ad7861a0a4203482fa37ba47d2944c1 | 807 | require 'test_helper'
require 'tins'
class DynamicScopeTest < Test::Unit::TestCase
include Tins::DynamicScope
def test_dynamic_scoping
assert_raise(NameError) { foo }
assert_equal false, dynamic_defined?(:foo)
dynamic_scope do
assert_raise(NameError) { foo }
assert_equal false, dynamic_def... | 25.21875 | 49 | 0.655514 |
e985be6035edac6eb693becead2920c8cf429359 | 199 | class Review < ApplicationRecord
belongs_to :restaurant
validates :name, :rating, :content, presence: true
validates :rating, numericality: { greater_than: 0, less_than_or_equal_to: 5}
end
| 28.428571 | 80 | 0.758794 |
e94f5cbb4a31b368ed493eeea9bd10f7f6d6145c | 447 | include_recipe 'logstash'
logstash_input 'test_input' do
plugin 'tcp'
type 'syslog'
options(port: '80')
end
logstash_input 'stdin' do
plugin 'stdin'
end
logstash_filter 'sample_filter' do
plugin 'syslog_pri'
add_tag 'syslog'
end
logstash_filter 'grok_filter' do
plugin 'grok'
type 'syslog'
options(... | 15.964286 | 45 | 0.731544 |
87d246a96a02870dd0ba80173d3e6c90cc26f9dc | 3,301 | # frozen_string_literal: true
require "rails_helper"
RSpec.describe "Project Comparisons", type: :feature, js: true do
before do
Factories.project("acme", score: 25, downloads: 25_000, first_release: 3.years.ago)
Factories.project("widget", score: 20, downloads: 50_000, first_release: 2.years.ago)
Facto... | 33.683673 | 90 | 0.71342 |
6a00a2d7356cf806fa0e5fe89d19a2d9c122c0cb | 292 | class DefaultAreaDestroyer
attr_reader :area
def initialize(area:)
@area = area
end
def destroy
if area.last_for_organization?
raise LastObjectInCollectionDeletionError
end
area.destroy!
end
def self.destroy(area:)
new(area: area).destroy
end
end
| 13.904762 | 47 | 0.69863 |
01688cfa8a895dc40788c0ab8e4895eaeac2ce55 | 5,366 | name "openssl"
dependency "zlib"
dependency "cacerts"
dependency "libgcc"
dependency "makedepend"
default_version "1.0.2k"
source url: "https://www.openssl.org/source/openssl-#{version}.tar.gz"
version("1.0.2k") { source md5: "f965fc0bf01bf882b31314b61391ae65" }
relative_path "openssl-#{version}"
build do
env ... | 40.044776 | 175 | 0.469996 |
79b15ef68c0d32612df06ddc75569fed8e9dfa08 | 168 | Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
root 'landing_page#index'
end
| 24 | 101 | 0.779762 |
f7d21ae3bf26697ccbc6fadfa180c8c534632a9f | 1,009 | cask 'appcode' do
version '2019.3.1,193.5233.146'
sha256 '170d1f4ea8e82a963ab90bf5e0cd74c15b6f6554a6fc41b4fcc998d4967cb525'
url "https://download.jetbrains.com/objc/AppCode-#{version.before_comma}.dmg"
appcast 'https://data.services.jetbrains.com/products/releases?code=AC&latest=true&type=release'
name 'AppC... | 40.36 | 252 | 0.691774 |
031838ec34ba22dcb9f8f0ab249158a8c0c06ce2 | 1,510 | #
# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | 28.490566 | 74 | 0.658278 |
879cc8b514e2f3b03f5bcdbc50215a7c6d1eaecc | 1,148 | require 'spec_helper'
describe Fastlane do
describe Fastlane::CommandLineHandler do
it "properly handles default calls" do
expect(Fastlane::LaneManager).to receive(:cruise_lane).with("ios", "deploy", {}, nil)
Fastlane::CommandLineHandler.handle(["ios", "deploy"], {})
end
it "properly handles... | 45.92 | 104 | 0.523519 |
8763888d05c745e1d21472dfaca19be11826cfa7 | 3,387 | module KOSapiCLI
module Commands
module Resources
# Represents KOSapi courses resource
class Courses < BaseResource
class_option :detail,
aliases: ['-d'],
type: :numeric,
desc: 'specify the detail of infromation'
class_opt... | 26.880952 | 72 | 0.569826 |
18c73f43092954c5065bd39762bd666e46b291c5 | 223 | class OrdersController < ApplicationController
add_breadcrumb '历史订单', :orders_path
def index
@orders = current_user.orders
end
def show
add_breadcrumb '订单详情'
@order = Order.find(params[:id])
end
end
| 17.153846 | 46 | 0.713004 |
79d2d43deb70b71929c79bcf500c35befd9971a8 | 3,061 | require('sinatra')
require('sinatra/reloader')
require('sinatra/activerecord')
also_reload('lib/**/*.rb')
require('pg')
require('pry')
require('./lib/actor')
require('./lib/movie')
require('rest-client')
require('json')
get("/") do
@movies = (Movie.all()).sort
@actors = Actor.all()
erb(:index)
end
get("/movies"... | 21.864286 | 71 | 0.624632 |
3835fe27663f5b07e2a77a6358df85e3118cd9f8 | 704 | # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "simple_role/version"
Gem::Specification.new do |s|
s.name = "simple_role"
s.version = SimpleRole::VERSION
s.authors = ["Yoshiyuki Hirano"]
s.email = ["yhirano@me.com"]
s.homepage = 'https://github.com/yhir... | 37.052632 | 83 | 0.62642 |
03029468b34d4fa75d61faedfd4ad43a4f87efd2 | 239 | #contain all the relations between files
require 'bundler/setup'
Bundler.require(:default)
require_relative "./htem_cli/version"
require_relative "./htem_cli/cli"
require_relative "./htem_cli/scraper"
require_relative "./htem_cli/article"
| 29.875 | 40 | 0.811715 |
87d1608d81620e2eb56ea4e25ef00b6b7e927a1b | 109 | class PossibleAnswer < ApplicationRecord
belongs_to :question
has_many :answers, dependent: :destroy
end
| 21.8 | 40 | 0.807339 |
18c66a8778f1cac9e2feec954655b26dccd8c191 | 2,316 | module Buyers::ApplicationsHelper
def metadata_new_app(buyer, provider)
"<div id='metadata-form'
data-services_contracted='#{ services_contracted(buyer) }'
data-service_plan_contracted_for_service='#{ service_plan_contracted_for_service(buyer) }'
data-relation_service_and_service_plans='#{ rel... | 34.567164 | 105 | 0.71848 |
1c9dd49165214c3f16f2c39e83776e1c16236033 | 142 | # frozen_string_literal: true
module FeatureFlags
class ScopeEntity < Grape::Entity
expose :id
expose :environment_scope
end
end
| 15.777778 | 35 | 0.753521 |
18e65424ce4269c92a7f662489f09dc805f0255e | 3,510 | #
# Copyright:: Copyright (c) 2017 Chef Software 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.... | 29.25 | 107 | 0.636182 |
5d0f023895c7370ba421f4bf5e66ccffbcdb5640 | 796 | Pod::Spec.new do |s|
s.name = 'Alley'
s.version = '2.0'
s.summary = 'URLSessionDataTask with automatic retry mechanism.'
s.description = 'An extension for URLSession to perform automatic retries of request towards HTTP(S) web services.'
s.homepage = 'https://github.com/radianttap/Alley... | 36.181818 | 118 | 0.633166 |
acdd200ac31eb61ebf0d785ef231819a6fe9382b | 5,174 | #!/opt/puppetlabs/puppet/bin/ruby
require 'json'
require 'puppet'
def cluster_versions_get(*args)
header_params = {}
argstring = args[0].delete('\\')
arg_hash = JSON.parse(argstring)
# Remove task name from arguments - should contain all necessary parameters for URI
arg_hash.delete('_task')
operation_ver... | 32.540881 | 212 | 0.661577 |
bf849d8364351bc9023bf0d03962e9a641be33d5 | 5,177 | module NetSuite
module Records
class InventoryItem
include Support::Fields
include Support::RecordRefs
include Support::Records
include Support::Actions
include Namespaces::ListAcct
# NOTE NetSuite doesn't have a InventoryItemSearch object. So we use
# the ItemSearch ins... | 61.630952 | 129 | 0.749082 |
6a3c8f6b8baae53fb304e0218cd061a3b7486085 | 28,505 | =begin
#NSX-T Manager API
#VMware NSX-T Manager REST API
OpenAPI spec version: 2.3.0.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.3.1
=end
require "uri"
module NSXT
class OperationsApi
attr_accessor :api_client
def initialize(api_client = ApiClient.def... | 45.46252 | 170 | 0.699877 |
083ed297613aab8e48bea446a180b65af5bd35de | 5,715 | # Copyright 2015 Google 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 writing,... | 32.471591 | 178 | 0.637795 |
bb06d4b8b3eab11445c94cc5bee767e36ce99763 | 1,206 | #!/usr/bin/env ruby
BEGIN {
require 'pathname'
basedir = Pathname.new( __FILE__ ).dirname.parent
require basedir + 'utils.rb'
$LOAD_PATH.unshift( basedir + 'lib' )
$LOAD_PATH.unshift( basedir + 'ext' )
include UtilityFunctions
}
require 'linkparser'
require 'text/format'
dict = LinkParser::Dictionary.new( :... | 22.754717 | 73 | 0.6733 |
e227ad2229f29d50f52194630cd08d0f17205710 | 289 | class CreateSpreeBrands < SpreeExtension::Migration[5.1]
def change
create_table :spree_brands do |t|
t.string :name
t.string :permalink
t.string :logo
t.text :description
t.integer :status, default: 0, null: false
t.timestamps
end
end
end
| 20.642857 | 56 | 0.650519 |
ace138338edb1a6d648a67408084b7ad18bd304b | 5,829 | require 'spec_helper'
require 'couchbase_lite/server'
require 'rack'
RSpec.describe CouchbaseLite::Server do
include_context 'CBLite db test'
include_context 'CBLite db', :db_replica
subject(:server) { CouchbaseLite::Server.new { |_| db } }
let(:port) { 4668 }
let(:client_socket_factory) { CouchbaseLite::Re... | 37.365385 | 103 | 0.571453 |
ff7f41c84c8e5715b0867249597b3a8aeb5811b7 | 2,669 | class Openimageio < Formula
desc "Library for reading, processing and writing images"
homepage "https://openimageio.org/"
url "https://github.com/OpenImageIO/oiio/archive/Release-2.2.13.1.tar.gz"
sha256 "7f810124e866ac14ad9c11b0ab528a6ed4c8e62a190cc44a77eed8159f57405c"
license "BSD-3-Clause"
head "https://g... | 31.034884 | 112 | 0.693893 |
6ab886aec580e0b95e5b6f1ac36f735a02f1f17a | 632 | # frozen_string_literal: true
require 'spec_helper'
module Synvert::Core
describe Rewriter::InsertAfterAction do
subject {
source = ' include Foo'
node = Parser::CurrentRuby.parse(source)
instance = double(current_node: node)
Rewriter::InsertAfterAction.new(instance, 'include Bar').proc... | 23.407407 | 70 | 0.674051 |
1c6b9da28ea4b42d285f76cf59a557eeb609068b | 1,090 | # frozen_string_literal: true
require_relative "lib/fami_pay/version"
Gem::Specification.new do |spec|
spec.name = "fami_pay"
spec.version = FamiPay::VERSION
spec.authors = ["Wells"]
spec.email = ["chawkeye@gmail.com"]
spec.summary = "API wrapper for FamiPay"
spec.licen... | 36.333333 | 88 | 0.662385 |
f7b436658efa1a7651de353965c2676d1100281b | 46 | require 'genie/genie'
require 'genie/version'
| 15.333333 | 23 | 0.782609 |
1dbad210c79a549d185c5c789979200fc177bb18 | 4,997 | class PostgresqlAT10 < Formula
desc "Object-relational database system"
homepage "https://www.postgresql.org/"
url "https://ftp.postgresql.org/pub/source/v10.13/postgresql-10.13.tar.bz2"
sha256 "4d701f450cd92ffb123cf6c296e9656abbc2ab7ea6507894ff1e2475ae0754e1"
bottle do
sha256 "a492473bd3854a2eaa0836c84d... | 34.226027 | 108 | 0.644387 |
6ad2abf850a50bd23e2c88448bd6d6d6dc80296b | 888 | #
# Be sure to run `pod spec lint APTools.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.com... | 35.52 | 98 | 0.640766 |
7937e43a9e3f3c329e7ec2c10a57414d8e3586b0 | 551 | module SlackRubyBot
module Hooks
class Message
# HACK: order command classes predictably
def command_classes
[
SlackSup::Commands::Help,
SlackSup::Commands::About,
SlackSup::Commands::Subscription,
SlackSup::Commands::Unsubscribe,
SlackSup::Com... | 25.045455 | 47 | 0.584392 |
2127468fa528553b5b98cbe7c2a988e6ddd505cb | 4,038 | ##
# 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::Remote::HttpClient
def initialize(info = {})
super(update_info(info,
'N... | 35.734513 | 103 | 0.611194 |
bf61ff935de4d25e4ffbcda94d77be2654cea616 | 3,803 | require "set"
require "nidyx/objc/utils"
require "nidyx/objc/constants"
module Nidyx
class ObjCProperty
include Nidyx::ObjCConstants
class UnsupportedEnumTypeError < StandardError; end
attr_reader :name, :attributes, :type, :type_name, :desc, :getter_override,
:protocols
# @param ... | 27.963235 | 114 | 0.652906 |
1d8ccece4d4227545e9cc3096eaebc9f6a612ffd | 70 | json.partial! @adoption, partial: 'adoptions/adoption', as: :adoption
| 35 | 69 | 0.757143 |
39148b40619abb3f0eac9787ec90f29f652203cf | 1,399 | # frozen_string_literal: true
# WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
require 'aws-sdk-core'
require 'aws-sigv4'
require_relative 'aws-sdk-route53... | 25.436364 | 83 | 0.742673 |
7a35576f11786647aa40f7678ac608cf39312b94 | 1,193 | # WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
require 'aws-sdk-core'
require 'aws-sigv4'
require_relative 'aws-sdk-firehose/types'
require_relative 'aws-sdk-... | 24.854167 | 91 | 0.746857 |
9156e72440680abe08b8a6d98fa2777bf5896ec7 | 955 | =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::SignatureId
# Automaticall... | 23.292683 | 102 | 0.725654 |
0335161e0dcf851cdc8fef904fe3ffc115810cb8 | 3,503 | module ThinkingSphinx
class FacetSearch < Hash
attr_accessor :args, :options
def initialize(*args)
@options = args.extract_options!
@args = args
set_default_options
populate
end
def for(hash = {})
for_options = {:with => {}}.merge(opti... | 25.948148 | 82 | 0.5835 |
6250c1f7f88064334bb6833cfdae4002277dd140 | 1,081 | # -*- encoding : utf-8 -*-
module GlobalCollect::Responses::InsertOrderWithPayment
# WDL §5.28.2 TABLE 115 specifies the possible return keys
module MoneybookersOnlinePaymentResponseMethods
[
"PAYMENT REFERENCE" ,
"ADDITIONAL REFERENCE" ,
"EXTERNAL REFERENCE" ,
"ORDER ID" ... | 28.447368 | 62 | 0.464385 |
e8485ab30c9f7e763d59d2d00099c2ae4d1e2e71 | 353 | module OneLogin
module Api
module Models
class SAMLEndpointResponse
attr_accessor :type, :message, :mfa, :saml_response
def initialize(status_type, status_message)
@type = status_type
@message = status_message
@saml_response = nil
@mfa = nil
... | 18.578947 | 59 | 0.597734 |
bfd9132aa523ead3957aa32ed56a576554b3357b | 67 | FactoryGirl.define do
factory :transaction_endpoint do
end
end | 13.4 | 34 | 0.80597 |
33f8756eedc862db4cc5aede62679767a6770129 | 13,129 | # 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|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render invalid all existing
# confirmat... | 49.543396 | 154 | 0.752533 |
0874ac78f7e768da135914e9daeaa173f7923959 | 1,186 | require 'rails_helper'
RSpec.describe User, type: :model do
context 'validation tests' do
it 'is valid with valid attributes' do
expect(User.new(username: 'Keli', email: 'kbooster17@gmail.com')).to be_valid
end
it 'ensures username is present' do
user = User.new(email: 'kbooster27@gmail.com'... | 28.926829 | 83 | 0.65683 |
e826c43d76b80bcdb710963cfb459f6c7146ae94 | 982 | require './spec/spec_helper'
describe TokenParser do
let(:parser) { TokenParser.new }
def returns(string, tokens)
expect(parser.parse(string)).to eq tokens
end
it 'empty input' do
returns '', []
end
it 'single token' do
returns 'attribute', %w(attribute)
end
it 'simple assertions' do
... | 24.55 | 116 | 0.565173 |
e24f637f61740dc702dfb976042996e509d9fea9 | 16,079 | require 'json/version'
require 'json/generic_object'
module JSON
class << self
# If _object_ is string-like, parse the string and return the parsed result
# as a Ruby data structure. Otherwise generate a JSON text from the Ruby
# data structure object and return it.
#
# The _opts_ argument is pas... | 33.152577 | 95 | 0.667952 |
e2f89bb64aeafe1adfa029b37a5f28e5fc6a5604 | 10,249 | require 'dynamoid/adapter/local'
require File.expand_path(File.dirname(__FILE__) + '../../../spec_helper')
describe Dynamoid::Adapter::Local do
before(:all) do
Dynamoid.configure { |config| config.adapter = 'local' }
end
after(:all) do
Dynamoid.configure { |config| config.adapter = 'aws_sdk' }
end
... | 41.662602 | 204 | 0.619768 |
e26d0b05a61f54f9e46cf566bdb9e2fb08e6ddaf | 172 | name "heat-server"
description "Heat Server Role"
run_list(
"recipe[heat::server]",
"recipe[heat::monitor]"
)
default_attributes()
override_attributes()
| 17.2 | 32 | 0.680233 |
6afa6cc11baa7a84bbdcdb7700a64875b8d3cdf1 | 285 | require 'eidolon/rgss3/rpg/usable_item'
module RPG
# == RGSS3
# This data structure is specific to RGSS3 (VX Ace).
#
# == Item
# The data class for items.
class Item < UsableItem
attr_accessor :itype_id
attr_accessor :price
attr_accessor :consumable
end
end | 20.357143 | 54 | 0.691228 |
e8c7ce088e273f51304c1819e124eaeeddd5cd04 | 493 | # frozen_string_literal: true
require 'spec_helper'
describe Ci::PipelineVariable do
subject { build(:ci_pipeline_variable) }
it_behaves_like "CI variable"
it { is_expected.to validate_uniqueness_of(:key).scoped_to(:pipeline_id) }
describe '#hook_attrs' do
let(:variable) { create(:ci_pipeline_variable,... | 23.47619 | 78 | 0.697769 |
ff429eed07b3569c149f3f7cce9618b7eccb6710 | 142 | class AddAdminNotesToBalanceTransfers < ActiveRecord::Migration
def change
add_column :balance_transfers, :admin_notes, :text
end
end
| 23.666667 | 63 | 0.802817 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.