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 |
|---|---|---|---|---|---|
038426da93ba8beea62f53eebd594058dc44d8d5 | 790 | #
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
# Run `pod lib lint file_drag_and_drop.podspec' to validate before publishing.
#
Pod::Spec.new do |s|
s.name = 'file_drag_and_drop'
s.version = '0.0.1'
s.summary = 'A new flutter plugin project.'
... | 34.347826 | 84 | 0.574684 |
8755aa5486b0ea27dd77fe2f16a6a43410d13b5f | 1,358 | require 'spec_helper'
describe 'rbenv::definition', :type => :define do
let(:user) { 'tester' }
let(:ruby_version) { '1.9.3-p125' }
let(:title) { "rbenv::definition::#{user}::#{ruby_version}" }
let(:dot_rbenv) { "/home/#{user}/.rbenv" }
let(:target_path) { "#{dot_rbenv}/plugins/ruby-build/... | 33.121951 | 91 | 0.600884 |
334af1ab86633596ae8f8d79171d30948b7bb00f | 46 | module PossibleEmail
class Phone
end
end
| 7.666667 | 20 | 0.76087 |
610c50ed97d3d1cad3abab6534b44116f747c2cd | 8,767 | require File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper")
module RR
describe DoubleInjection do
attr_reader :space, :subject, :double_injection
it_should_behave_like "Swapped Space"
before do
@subject = Object.new
subject.methods.should_not include(method_name.to_s)
@doubl... | 35.783673 | 117 | 0.638987 |
01f21deb3f58360d9ca69c89efd49abe952c69c0 | 3,973 | require 'helper'
class TestDataset < Test::Unit::TestCase
def setup
super
end
def test_all
sleep 1
data = NoaaNceiWeather::Dataset.all
assert_not_nil data, "data category .all class method returning nil"
assert data.kind_of?(Array), "data category .all is returning an empty array"
assert... | 35.473214 | 116 | 0.738233 |
628f12ac72fdf8d5fc9535ae9157039243cc1d60 | 6,403 | require 'nexus_cli'
describe NexusCli::ProRemote do
let(:remote) do
NexusCli::ProRemote.new(
'url' => 'http://localhost:8081/nexus',
'repository' => 'releases',
'username' => 'admin',
'password' => 'admin123'
)
end
it "gives you errors when you attempt to get an artifact's custom... | 57.684685 | 169 | 0.776667 |
bf455307c09b212a499447723a5d1b777b6038e6 | 2,827 | #!/usr/bin/env ruby
# Encoding: utf-8
#
# Author:: api.dklimkin@gmail.com (Danial Klimkin)
#
# Copyright:: Copyright 2012, Google Inc. All Rights Reserved.
#
# License:: Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# ... | 32.494253 | 79 | 0.694376 |
1a73045f51cf63930311e49dea74b63339a25f81 | 973 | module OData
module Edm
class DataServices
# Initial schemas that can be added statically.
cattr_accessor :schemas
@@schemas = []
attr_accessor :entity_types, :schemas
def initialize(schemas = @@schemas)
@entity_types = []
@schemas = []
append_schemas(schema... | 22.113636 | 79 | 0.582734 |
1df6fceeb5b4f685911725b8ca3a3020b83129b1 | 4,133 | # -*- encoding: utf-8 -*-
# Tests of an executable.
#
# @author M. Sakano (Wise Babel Ltd)
require 'open3'
$stdout.sync=true
$stderr.sync=true
# print '$LOAD_PATH=';p $LOAD_PATH
#################################################
# Unit Test
#################################################
gem "minitest"
# require ... | 32.801587 | 122 | 0.604404 |
01e351ca14eb94bb54af7148ab32e9c2cef3cad5 | 6,056 |
SQLSERVER_TEST_ROOT = File.expand_path(File.join(File.dirname(__FILE__),'..'))
SQLSERVER_ASSETS_ROOT = File.expand_path(File.join(SQLSERVER_TEST_ROOT,'assets'))
SQLSERVER_FIXTURES_ROOT = File.expand_path(File.join(SQLSERVER_TEST_ROOT,'fixtures'))
SQLSERVER_MIGRATIONS_ROOT = File.expand_path(File.join(SQLSE... | 43.884058 | 144 | 0.76288 |
f8371befdce5bb712f3f2fa90f5dc58da2116dda | 410 | Rails.application.config.middleware.insert_before 0, Rack::Cors do
allow do
origins "http://localhost:3000"
resource "*", headers: :any, methods: [:get, :post, :put, :delete, :options, :head], credentials: true
end
allow do
origins "https://archonnect-mvp.herokuapp.com"
resource "*", headers: :a... | 31.538462 | 107 | 0.668293 |
e80e8b5c68708b95b737d5af3233c43acf61a393 | 858 | module Fog
module SharedFileSystem
class TeleFonica
class Real
def update_share_network(id, options = {})
request(
:body => Fog::JSON.encode('share_network' => options),
:expects => 200,
:method => 'PUT',
:path => "share-networks/#{id}... | 26.8125 | 92 | 0.531469 |
28c4a3947f53f45526ec514ec8ea61af55ce95c5 | 635 | module Plangrade
module Resources
class User < Plangrade::Resources::Base
attr_accessor_deffered :name, :email
def self.current_user
result = api_handler.current_user.body
new(:id => result[:id], :name => result[:name], :email => result[:email])
end
def self.create(email... | 26.458333 | 81 | 0.612598 |
33d0ea4d630216f1401c0525d5197f53c37c053c | 638 | ActiveRecord::Base.connection.create_table :betas, :force => true do |t|
t.column :name, :string, :null => false
t.column :value, :integer, :null => false
t.column :delta, :boolean, :null => false, :default => false
end
Beta.create :name => "one", :value => 1
Beta.create :name => "two", :value => 2
Beta.create ... | 37.529412 | 72 | 0.61442 |
1163ca15f4f57801441b4782271b8b347b174eee | 83 | require "pathological/base"
Pathological.excluderoot_mode
Pathological.add_paths!
| 16.6 | 29 | 0.86747 |
26eb8371168a0e16d47c17c4ef3e139cdea30425 | 204 | PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__)))
require 'middleman-core'
require 'middleman-core/step_definitions'
require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-bowerify')
| 40.8 | 70 | 0.813725 |
edd225db6ba4c0f56267eb4912464060c1e17198 | 1,125 | class Bluepill < Formula
desc "iOS testing tool that runs UI tests using multiple simulators"
homepage "https://github.com/linkedin/bluepill"
url "https://github.com/linkedin/bluepill/archive/1.1.0.tar.gz"
sha256 "50c33976865244c1ebd181c374218bfa75d79f22baec3e16319250640f8625b7"
head "https://github.com/linke... | 34.090909 | 92 | 0.701333 |
bffa5fcfd6920b696f4af2e2c7e9daddfa443f6e | 506 | require 'spec_helper'
describe UserObserver do
subject { UserObserver.instance }
it 'calls #after_create when new users are created' do
new_user = build(:user)
subject.should_receive(:after_create).with(new_user)
new_user.save
end
context 'when a new user is created' do
it 'sends an email' do... | 21.083333 | 56 | 0.689723 |
626cd6a8fc3e4b3d401b7edaff7916acf11e547c | 5,797 | #
# 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, software
# distributed under ... | 34.301775 | 109 | 0.672762 |
4a387ff5c571ebad1f5da10a55285626583e0319 | 1,046 | # frozen_string_literal: true
module TabsPanesHelper
Struct.new('TabPanes', :panes) do
def add(name, &content)
panes << {name: name, content: content}
end
end
#
# Create bootstrap 3 panes menu to use with
# tabs helper
# ==== Attributes
# * +active_pane+ - Current active pane name (symbol =... | 28.27027 | 75 | 0.606119 |
1c0baf4f7c044076c3b9d8095d28400644519bea | 2,206 | ###########################################
# Refs
# http://stackoverflow.com/questions/10584638/setting-up-configuration-settings-when-writing-a-gem
# http://robots.thoughtbot.com/mygem-configure-block
###########################################
module ExceptionHandler
class Config
#Instace Objects
attr_... | 32.441176 | 144 | 0.503173 |
3859c24464a81f7cfab1963df33e8e12e2fe53ef | 2,580 | # frozen_string_literal: true
require "rails_helper"
module WasteCarriersEngine
RSpec.describe "RegistrationReceivedPendingWorldpayPaymentForm", type: :request do
describe "GET new_registration_received_pending_worldpay_payment_form_path" do
context "when no new registration exists" do
it "redirec... | 41.612903 | 132 | 0.721705 |
ab76b18b1012af97eb54dd0d108a3693afee17e2 | 932 | # -*- encoding: utf-8 -*-
require 'json'
require 'qiniu/tokens/access_token'
require 'qiniu/utils'
### DownloadToken 类已经过时,请改用 Qiniu::Auth.authorize_download_url 方法 ###
### 或 Qiniu::Auth.authorize_download_url_2 方法 ###
module Qiniu
class DownloadToken < AccessToken
include ... | 26.628571 | 77 | 0.612661 |
e2396386a6bd908fa8bfacb93b4af7a51110f1ec | 502 | require "impostor-ruby/version"
module Impostor
require 'faker'
require 'mysql2'
require 'active_support/all'
require 'twilio-ruby'
require 'uri'
require 'impostor-ruby/address'
require 'impostor-ruby/internet'
require 'impostor-ruby/personal'
require 'impostor-ruby/phone'
require 'impostor-ruby/p... | 20.08 | 53 | 0.709163 |
1cdf23e7306e0720c21c74187a133a68da1c8ccb | 13,412 | # encoding: utf-8
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
require 'azure_mgmt_sqlvirtualmachine'
module Azure::Sqlvirtualmachine::Profiles::Latest
module Mgmt
AvailabilityGroupListeners = Azure::Sq... | 54.080645 | 164 | 0.768938 |
61ce63aa78e714c17e37943d8f49684500240f2a | 785 | cask 'macs-fan-control' do
version '1.5.5'
sha256 'e690a95e4c27d8892f6a9f89016765b3f665c4ba11475dc9b71f2cc51bb2bc85'
# github.com/crystalidea/macs-fan-control was verified as official when first introduced to the cask
url "https://github.com/crystalidea/macs-fan-control/releases/download/v#{version.major_minor... | 37.380952 | 122 | 0.771975 |
e8ab6018e2add2ac3fa5476f01d73f5d018ab132 | 1,274 | require 'faraday'
require 'json'
module Cryptocompare
module Stats
RATE_LIMIT_API_URL = 'https://min-api.cryptocompare.com/stats/rate/limit'.freeze
private_constant :RATE_LIMIT_API_URL
# Find out how many calls you have left in the current month, day, hour, minute and second
#
# ==== Returns
... | 24.5 | 103 | 0.507064 |
ed80f71143f5b9c32adedf7f2996ab50603b2961 | 1,525 | # frozen_string_literal: true
class DeviseCreateUsers < ActiveRecord::Migration[5.2]
def change
create_table :users do |t|
## Database authenticatable
t.string :name, null: false, default: ""
t.boolean :active, null: false, default: true
t.string :email, ... | 32.446809 | 104 | 0.638033 |
ff14de5b45ae396259bbbf8a38abb4c36791b5fd | 289 | # This migration comes from odania_core_engine (originally 20141016214225)
class AddWidgetIdToContentAndSite < ActiveRecord::Migration
def change
add_column :odania_contents, :widget_id, :integer, null: true
add_column :odania_sites, :default_widget_id, :integer, null: true
end
end
| 36.125 | 74 | 0.813149 |
f794e3f2b51c786b98eb12756898e9ffea0db85a | 210 | class Accion < ActiveRecord::Base
attr_accessible :controlador_id, :descripcion
scope :orden_id, -> {order("id")}
belongs_to :controlador
has_many :accesos, :dependent => :restrict_with_error
end | 19.090909 | 55 | 0.733333 |
28e7c1fc02efd4f4aecde598665f515ba5a24666 | 1,116 | require "application_system_test_case"
class CarsTest < ApplicationSystemTestCase
setup do
@car = cars(:one)
end
test "visiting the index" do
visit cars_url
assert_selector "h1", text: "Cars"
end
test "creating a Car" do
visit cars_url
click_on "New Car"
fill_in "Ayear", with: @car... | 22.32 | 65 | 0.680108 |
bbc8cea153020984fb46b3c80237a3804d980571 | 259 | class CreateAnnouncements < ActiveRecord::Migration[6.0]
def change
create_table :announcements do |t|
t.text :content
t.string :url
t.boolean :visible_logged_out
t.timestamp :deactivated_at
t.timestamps
end
end
end
| 19.923077 | 56 | 0.679537 |
bba1133851ec5d09de869195c3e139aa5f7a53c6 | 394 | module Octokit
class EnterpriseAdminClient
# Methods for the Enterprise License API
#
# @see https://developer.github.com/v3/enterprise/license/
module License
# Get information about the Enterprise license
#
# @return [Sawyer::Resource] The license information
def license_in... | 20.736842 | 62 | 0.672589 |
268644eb27b8f46963285fdc2d068857865dbb3c | 10,392 | # 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::Network::Mgmt::V2020_05_01
module Models
#
# Information about the connection monitor.
#
class ConnectionMonitorResult
... | 33.095541 | 87 | 0.475847 |
ff47d8d1045f02b1390e9512be66cf35017c5cc6 | 1,404 | class AnnotationsController < ApplicationController
before_action :doorkeeper_authorize!, if: ->{ authenticate_with_oauth? }
before_filter :authenticate_user!, unless: ->{ authenticated_with_oauth? }
before_filter :load_annotation, only: [:update, :destroy]
def create
p = annotation_params(params[:annotati... | 23.79661 | 76 | 0.655271 |
4a8b767c594175eb9687af9103bffce94df96b4f | 3,906 | # 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::DataFactory::Mgmt::V2018_06_01
module Models
#
# A copy activity Dynamics sink.
#
class DynamicsSink < CopySink
inclu... | 29.368421 | 77 | 0.455453 |
bb00427da8ca9eab2a6b51485b654985ed6cd66d | 1,069 | # frozen_string_literal: true
class StockSymbolsController < ApplicationController
before_action :set_stock_symbol, only: %i[edit update destroy]
# GET /stock-symbols
def index
@symbols = StockSymbol.paginate(page: params[:page], per_page: 10)
end
# GET /stock-symbols/
def new
@stock_symbol = Sto... | 22.270833 | 86 | 0.714687 |
4ab011c34f564f9b4cdc4858471674685922baa4 | 5,252 | # frozen_string_literal: true
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'simplecov'
require 'coveralls'
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
SimpleCo... | 38.335766 | 140 | 0.706969 |
9148e7b57e8dfc74f1520c728ce2500edd8537c4 | 762 | class AddNodePathIdToCoinPayments < ActiveRecord::Migration[5.1]
def change
add_column :coin_payments, :node_path_id, :integer
ActiveRecord::Base.connection.add_index :coin_payments, ['coin_type', 'node_path_id', 'created_at'], order: {'coin_type'=>:asc, 'node_path_id'=>:asc, 'created_at'=>:desc}, name: ... | 44.823529 | 254 | 0.729659 |
1ce04c26df845d446c41c4bf3f5ec9bad7c20a8d | 1,398 | class Friendship < ActiveRecord::Base
belongs_to :user
belongs_to :friend, class_name: "User", foreign_key: "friend_id"
validates_uniqueness_of :friend_id, scope: :user_id
validates_presence_of :friend_id
validates_presence_of :user_id
validate :no_self_love
auto_subscribes :user, to: :friend, if: P... | 33.285714 | 109 | 0.76681 |
019c6fe7c6f2a62a5f716f590ce75ee339f75d76 | 208 | Rails.application.routes.draw do
get 'welcome/index'
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
resources :articles
root 'welcome#index'
end
| 26 | 102 | 0.764423 |
1dd9516c26d43bbaf152bae4b63a241e6924ab4c | 3,684 | require_relative "./spec_helper.rb"
class TestingUtilities
require_relative '../app/lib/utilities'
include Utilities
end
describe "Utilities" do
subject do
TestingUtilities.new
end
before do
disable_github_calls_for(subject)
end
describe "#clone_repo" do
it "should return true when succes... | 35.76699 | 101 | 0.62215 |
26852efd788e18e2d75eaf8b38977b64b1f7cdd2 | 3,077 | # frozen_string_literal: true
require "json"
require "active_support/core_ext/object/to_query"
module ZohoSign
# The main class for record classes
class BaseRecord
# Default number of records when fetching all.
DEFAULT_RECORDS_PER_REQUEST = 100
# Default starting index point when fetching all.
DE... | 32.052083 | 144 | 0.659734 |
4a0b68cf5e531e6cf9e109023a1ab2aaa187bce7 | 213 | # frozen_string_literal: true
FactoryBot.define do
factory :recommendation do
title { Faker::Superhero.name }
reference { "1" }
trait :without_category do
categories { [] }
end
end
end
| 16.384615 | 35 | 0.661972 |
d55f66be1b5412c1f7ae892890366c420a7934b0 | 3,011 | require 'simplecov'
SimpleCov.start 'rails' do
add_filter "/lib/"
end
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
# It is recommended to regenerate this file in the future when you upgrade to a
# newer version of cucumber-rails. Consider adding your own code to a new file
# instea... | 37.17284 | 113 | 0.75988 |
2646d44d24e5f38cf52e18cf7e001e55f6ea91f0 | 4,095 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Compute::Mgmt::V2019_03_01
module Models
#
# Describes a virtual machine scale set data disk.
#
class VirtualMachineScaleSetDataDisk
in... | 32.5 | 78 | 0.529426 |
5dfd49fb38ad8aa49de4c40a8e5930252a17db3b | 1,502 | # frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# Activate the gem you are reporting the issue against.
gem "activerecord", "5.2.0"
gem "sqlite3"
end
require "active_record"
require "mini... | 24.622951 | 100 | 0.72237 |
0146d27cbbcf40548ce7c508955b8e59821f8dd5 | 1,944 | module Admin
class SalesTermsAndConditionsDocumentsController < BaseController
before_action :set_sales_terms_and_conditions_document, only: [:show, :edit, :update, :destroy]
def index
@sales_terms_and_conditions_documents = SalesTermsAndConditionsDocument.all
authorize @sales_terms_and_condition... | 34.714286 | 148 | 0.777778 |
1d8ecf7b6ed5c66a24f719f5ce31762803c0618b | 1,059 | class Mdp < Formula
desc "Command-line based markdown presentation tool"
homepage "https://github.com/visit1985/mdp"
url "https://github.com/visit1985/mdp/archive/1.0.14.tar.gz"
sha256 "8dc6313dc8d1821df4818fce6443b71e266dddc80f1db1d2cb4877d35b947806"
head "https://github.com/visit1985/mdp.git"
bottle do
... | 36.517241 | 94 | 0.782814 |
bf5ca8c971304b7f04c45948a96f5328b79b4b1e | 1,077 | # 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... | 43.08 | 86 | 0.740947 |
2162ddcb7caf70cef12050464e8acc631f25d994 | 315 | class Admin::ApplicationsController < AdminController
include Pagy::Backend
def index
@pagy, @applications = pagy(scope)
end
def show
@application = Application.includes(:user).find(params[:id])
end
private
def scope
Services::Admin::ApplicationsSearch.new(q: params[:q]).call
end
end
| 17.5 | 64 | 0.711111 |
d51bdeb6e433a198cb4cf7e3ebbaf3885f8df974 | 1,120 | cask 'unity-android-support-for-editor@2019.3.7f1' do
version '2019.3.7f1,6437fd74d35d'
sha256 :no_check
url "https://download.unity3d.com/download_unity/6437fd74d35d/MacEditorTargetInstaller/UnitySetup-Android-Support-for-Editor-2019.3.7f1.pkg"
name 'Android Build Support'
homepage 'https://unity3d.com/unit... | 31.111111 | 142 | 0.716964 |
fff05ea8892eafcaba8b018195f3f8cdd010e88c | 3,961 | require 'helper'
class TestJimIndex < Test::Unit::TestCase
context "Jim::Index" do
setup do
# clear the tmp dir
FileUtils.rm_rf(tmp_path) if File.directory?(tmp_path)
root = File.dirname(__FILE__)
@directories = [File.join(root, 'fixtures'), File.join(root, 'tmp', 'lib')]
@index = ... | 32.203252 | 103 | 0.616763 |
28100a2251a02735ea78724ddca2f77c1df7c5d5 | 2,091 | class Scraper
URL = "https://www.purina.com/dogs/dog-breeds"
def self.scrape_dogs
doc = Nokogiri::HTML(open(URL))
dogs = doc.css("#breed-listing > div.views-view-grid > div > article")
dogs.each do |dog|
name = dog.css("div.callout-label > h4").text
... | 58.083333 | 142 | 0.543759 |
bb43302c5aa867bae8eba4561783487fa26b00d0 | 603 | require 'rails_helper'
RSpec.feature "UsersIndex", type: :feature do
scenario "it should redirect index when not logged in" do
visit users_path
expect(page).to have_content("Log in")
end
scenario "index includes pagination" do
@user = create(:user)
visit login_path
fill_in "Email", with: @... | 26.217391 | 59 | 0.691542 |
1dac64b95f96d89c266f4246549e1bdb2425594c | 890 | # Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
require 'backtracefilter'
class Failure
include BacktraceFilter
attr_reader :location, :message
# Creates a new Failure with the given location and
# message.
def initialize(name, location, mess... | 22.820513 | 111 | 0.665169 |
08d53b2922a36c9b4cd7bc25ee3b65b5bf573eeb | 7,869 | # frozen_string_literal: true
require 'component/component_spec_helper'
require 'component/models/shared_examples_for_an_application_record'
describe 'the committee_memberships table', type: :model do
subject { CommitteeMembership.new }
it { is_expected.to have_db_column(:etd_id).of_type(:integer).with_options(n... | 36.430556 | 96 | 0.656881 |
621310d009c5ec4e16b3ed55c15b342fca7cb24b | 2,113 | class Packer < Formula
desc "Tool for creating identical machine images for multiple platforms"
homepage "https://packer.io"
url "https://github.com/hashicorp/packer.git",
:tag => "v1.2.1",
:revision => "0b740f508f4f9b63442879a8c8f7a197b9a83dc1"
head "https://github.com/hashicorp/packer.git"
bott... | 29.347222 | 93 | 0.615239 |
1dfd2494a0b6e4cb228f9a6ef82e890b70c8a8ff | 282 | module Presenting::Defaults
# Whether the columns in the Grid should be sortable by default
mattr_accessor :grid_is_sortable
self.grid_is_sortable = true
# Whether fields should be sanitized by default
mattr_accessor :sanitize_fields
self.sanitize_fields = true
end
| 25.636364 | 65 | 0.79078 |
28c8abf105e2e41db985e55db8bf64d8a1d08178 | 471 | class Micropost < ApplicationRecord
belongs_to :user
default_scope -> { order(created_at: :desc) }
mount_uploader :picture, PictureUploader
validates :user_id, presence: true
validates :content, presence: true, length: { maximum: 140 }
validate :picture_size
private
# Validates the size of an up... | 26.166667 | 62 | 0.698514 |
08eb5f28596cb662fcf47e9499bd604b3e66f543 | 1,160 | #!/usr/bin/env oo-ruby
#American Express Specific delete user(Not for other Openshift engagements)
require 'rubygems'
require 'json'
require "#{ENV['OPENSHIFT_BROKER_DIR'] || '/var/www/openshift/broker'}/config/environment"
brokerhost="localhost"
logfile="/var/log/openshift/broker/ose-utils.log"
def usage()
puts "Usa... | 23.2 | 183 | 0.697414 |
abc2f615f3f0d33dfb26caaa5271f9fc0ef1aae8 | 87 | INFO = YAML::load(ERB.new(IO.read(File.join(Rails.root, 'config', 'info.yml'))).result) | 87 | 87 | 0.689655 |
1d8b36ee54d12b67c472e380d8b1f23c699c6ed2 | 1,157 | # coding: utf-8
Gem::Specification.new do |s|
s.name = "bigdecimal"
s.version = "3.1.0.dev"
s.authors = ["Kenta Murata", "Zachary Scott", "Shigeo Kobayashi"]
s.email = ["mrkn@mrkn.jp"]
s.summary = "Arbitrary-precision decimal floating-point number library."
s.description... | 29.666667 | 100 | 0.665514 |
112e20a61e8704f519570e9b25de5103bc84db98 | 106 | module Vagrant
module Config
class PackageConfig < Base
attr_accessor :name
end
end
end
| 13.25 | 30 | 0.688679 |
f83914feab6f0c036be1ba77a0568960d9e1e7f1 | 1,520 | lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'db_text_search/version'
Gem::Specification.new do |s|
s.name = 'db_text_search'
s.version = DbTextSearch::VERSION
s.authors = ['Gleb Mazovetskiy']
s.email = ['glex.spb@gmail.com']
s.summary =... | 43.428571 | 111 | 0.667105 |
281607f085f9d107f635c6a40256bd32af535ef2 | 159 | class AddCustomGroupsAssetFleetTypes < ActiveRecord::Migration
def change
add_column :asset_fleet_types, :custom_groups, :text, after: :groups
end
end
| 26.5 | 72 | 0.792453 |
edd299c4717f982131f1bac5ae0537e1b2ba73d5 | 2,874 | ##
# This code was generated by
# \ / _ _ _| _ _
# | (_)\/(_)(_|\/| |(/_ v1.0.0
# / /
#
# frozen_string_literal: true
require 'spec_helper.rb'
describe 'WorkersCumulativeStatistics' do
it "can fetch" do
@holodeck.mock(Twilio::Response.new(500, ''))
expect {
@client.taskrouter.v1.... | 32.659091 | 127 | 0.499652 |
aba4df56c5481bfd62c61698f0a0557daa8666d2 | 764 | # frozen_string_literal: true
require 'ttfunk'
def get_fonts_in_dir(dir)
Dir
.entries(dir)
.select { |filename| /.*(\.ttf|\.otf)/.match(filename) }
end
def get_font_name(font_file_name)
font = TTFunk::File.open(font_file_name)
font.name.postscript_name.to_s
end
def make_stage2_yml_entry(dir, font_file... | 22.470588 | 74 | 0.706806 |
79fa7ee23fe8088c9379f05c55667d1fc1854c68 | 1,302 | module People
module Associations
module GroupedBy
class FormalBodiesController < ApplicationController
before_action :data_check, :build_request
ROUTE_MAP = {
index: proc { |params| Parliament::Utils::Helpers::ParliamentHelper.parliament_request.person_associations_grouped_by_f... | 39.454545 | 196 | 0.673579 |
08d94b133ec76e82a8f0ac37b1d551b7e91928dd | 1,436 | # -*- coding: binary -*-
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# https://metasploit.com/framework/
##
module Msf
module Sessions
module C... | 27.09434 | 117 | 0.707521 |
1aa49ca9b512c02783738359912ef9896b638c14 | 1,601 | # == Schema Information
#
# Table name: content.posts
#
# id :integer not null, primary key
# title :text not null
# date :datetime not null
# post_url :text not null
# state :integer default(0), not... | 32.02 | 76 | 0.613367 |
1ae9e873942d18527b8adfef9d9aeaa4bb9100f6 | 1,161 | class RubyConfigBuilder
HOUND_DEFAULTS_FILENAME = "ruby.yml".freeze
VIRTUAL_FILENAME = "".freeze
def initialize(overrides = {}, repository_owner_name = nil)
@overrides = overrides
@repository_owner_name = repository_owner_name
end
def config
RuboCop::ConfigLoader.merge_with_default(
combin... | 22.326923 | 78 | 0.766581 |
38754a3d8d8877ddbde00aa0588e59f362a84ca2 | 89 | # desc "Explaining what the task does"
# task :extjs_rails do
# # Task goes here
# end
| 17.8 | 38 | 0.685393 |
2184b86e3ce54f8f43803e70615a5f967706faf3 | 1,236 | class Ncompress < Formula
desc "Fast, simple LZW file compressor"
homepage "https://github.com/vapier/ncompress"
url "https://github.com/vapier/ncompress/archive/v4.2.4.6.tar.gz"
sha256 "112acfc76382e7b631d6cfc8e6ff9c8fd5b3677e5d49d3d9f1657bc15ad13d13"
license "Unlicense"
head "https://github.com/vapier/nco... | 36.352941 | 122 | 0.742718 |
b9aa95c2896c49b2f8f7a3d9b8f14003bd910b7d | 2,630 | module CloudModel
# Handle certificates
class Certificate
include Mongoid::Document
include Mongoid::Timestamps
include CloudModel::Mixins::UsedInGuestsAs
include CloudModel::Mixins::HasIssues
prepend CloudModel::Mixins::SmartToString
# Add guests connected via GuestCertificates
module C... | 28.27957 | 79 | 0.658935 |
d5c35247529574eb65aede24793a1e4ba9301187 | 332 | class AdminUser < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
devise :database_authenticatable,
:recoverable, :rememberable, :trackable, :validatable
has_many :mutes
has_many :error_... | 30.181818 | 62 | 0.756024 |
bf8411b18940f73c7ff9925fb72da153dc465a04 | 1,119 | FactoryBot.define do
factory :event do
project
author(factory: :user) { project.creator }
action Event::JOINED
trait(:created) { action Event::CREATED }
trait(:updated) { action Event::UPDATED }
trait(:closed) { action Event::CLOSED }
trait(:reopened) { action Event::REOPENED }
... | 27.975 | 56 | 0.660411 |
f7e69bc911f83838cb61fd185100abcf14a751a7 | 139 | World(FactoryGirl::Syntax::Methods)
begin
DatabaseCleaner.start
FactoryGirl.lint
ensure
DatabaseCleaner.clean_with(:truncation)
end
| 15.444444 | 41 | 0.81295 |
d54029d3fc942ca15982007813aee1943cacb5cd | 920 | # The Book of Ruby - http://www.sapphiresteel.com
# String concatenation
# << string concatenation method << converts FixNum integers (but not floats) to string
# Valid Fixnums are in the range 0 to 255
s1 = "This " << "is" << " a string " << 10 # try a float such as 10.5 or an int such as 256
# + method concatenate... | 32.857143 | 91 | 0.638043 |
037133f8ed2f82b085f6f7469605f619d6ab8485 | 1,225 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/googleads/v8/resources/campaign_asset.proto
require 'google/protobuf'
require 'google/ads/google_ads/v8/enums/asset_field_type_pb'
require 'google/ads/google_ads/v8/enums/asset_link_status_pb'
require 'google/api/field_behavior_pb'
requir... | 36.029412 | 142 | 0.755918 |
5dd92b6a85d4ffc7547f769f27795bb3a2520abe | 527 | Gem::Specification.new do |s|
s.name = 'omglog'
s.version = '0.0.10'
s.summary = "Live git logging using fseventsd."
s.description = "Live git logging using fseventsd. omg!"
s.license = 'BSD'
s.authors = ["Ben Hoskings"]
s.email = 'ben@hoskings.net'
s.files = `git ls-f... | 32.9375 | 58 | 0.59962 |
d59ebaf75bb8a66183e0e3220a9b83d5cd8dd0e5 | 1,607 | class SourceResolver
def self.resolve(adjusted_source)
new(adjusted_source).resolve
end
def initialize(adjusted_source)
@adjusted_source = adjusted_source
end
def resolve
return if @adjusted_source.save
adjust_ranks
@adjusted_source.save
end
private
def conflicted_rank_types
... | 24.723077 | 80 | 0.725576 |
b9555d8b61c306c99ccb2c3450c9d1fc81e785d7 | 85 | require 'rails_helper'
RSpec.describe PostsController, :type => :controller do
end
| 14.166667 | 55 | 0.776471 |
e2c892ddf17bcb3503e4357576f05081ccd32cff | 1,015 | class Design < ApplicationRecord
belongs_to :user
belongs_to :stone
validates :model, :metal, :stone_id, presence: true
def stone_attributes=(attributes)
@stone = self.build_stone(name: attributes[:name], weight: attributes[:weight], cost: attributes[:cost])
end
def price
(self.metal_cost * self... | 15.859375 | 108 | 0.612808 |
acdfcb7e7818cbc75143f7b65f04567626eb8e0e | 197 | require 'spec_helper'
class Bash
VERSION = '4.1.2'
RELEASE = '29.el6'
end
describe package('bash') do
it { should be_installed.with_version(Bash::VERSION + '-' + Bash::RELEASE) }
end
| 17.909091 | 80 | 0.659898 |
28342d4d665a6603ae9bdbc2bfa10f0a6d7e1996 | 456 | control 'cis-docker-benchmark-2.10' do
impact 1.0
title 'Do not change base device size until needed'
desc 'In certain circumstances, you might need containers bigger than 10G in size. In these cases, carefully choose the base device size.'
ref 'https://docs.docker.com/engine/reference/commandline/daemon/#stora... | 45.6 | 140 | 0.739035 |
ab4eafed5e614198d115a14b982053ca70bba8d4 | 19,974 | require 'spec_helper'
describe MergeRequests::UpdateService, :mailer do
let(:project) { create(:project, :repository) }
let(:user) { create(:user) }
let(:user2) { create(:user) }
let(:user3) { create(:user) }
let(:label) { create(:label, project: project) }
let(:label2) { create(:label) }
let(:merge_req... | 32.425325 | 122 | 0.628918 |
9152a753d003d2cfffc8ac3ad20141cb3b5a6147 | 2,775 | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded any time
# it changes. This slows down response time but is perfect for develo... | 35.576923 | 87 | 0.770811 |
aba35aebbfc6f5da47f3a28be2eddbe2f8e5e9de | 1,448 | Pod::Spec.new do |s|
s.name = "DLPDFRenderer"
s.version = "1.1.2"
s.summary = "Lightweight solution for generating multi-page PDFs from arbitrary HTML input."
s.description = <<-DESC
DLPDFRenderer is a lightweight solution for generating multi-page PDFs from arbitrary HTM... | 42.588235 | 116 | 0.639503 |
017a3b4616d9928f01037e503034afeca181cc29 | 845 | require_relative '../../../lib/application_insights/channel/sender_base'
require_relative '../../../lib/application_insights/channel/synchronous_queue'
require_relative '../mock_sender'
require 'test/unit'
include ApplicationInsights::Channel
class TestSynchronousQueue < Test::Unit::TestCase
def test_initialize
... | 30.178571 | 78 | 0.72071 |
7adcbefc2912ce87f3740a49b03a7085f5302d3a | 2,867 | require 'test_helper'
class PasswordResetsTest < ActionDispatch::IntegrationTest
def setup
ActionMailer::Base.deliveries.clear
@user = users(:michael)
end
test "password resets" do
get new_password_reset_path
assert_template 'password_resets/new'
assert_select 'input[name=?]', 'password_res... | 36.291139 | 72 | 0.655738 |
4ab671dd68e122b5b67cd12feb8e77228807d2a5 | 2,466 | class Zsh < Formula
desc "UNIX shell (command interpreter)"
homepage "http://www.zsh.org/"
url "https://downloads.sourceforge.net/project/zsh/zsh/5.2/zsh-5.2.tar.gz"
mirror "http://www.zsh.org/pub/zsh-5.2.tar.gz"
sha256 "fa924c534c6633c219dcffdcd7da9399dabfb63347f88ce6ddcd5bb441215937"
bottle do
sha256... | 30.444444 | 100 | 0.679643 |
2187297bc79def265baf89a5d5c7950bc422a6fb | 581 | class ProtocolRelationship < ApplicationRecord
include Housekeeping
include Shared::IsData
include Shared::PolymorphicAnnotator
polymorphic_annotates(:protocol_relationship_object)
acts_as_list scope: [:protocol_id, :project_id]
belongs_to :protocol, inverse_of: :protocol_relationships
# Do not include... | 34.176471 | 95 | 0.834768 |
1ccffb8d63cbab051700dec284b0a77215a6ac94 | 33 | require 'rubygems/backup/version' | 33 | 33 | 0.848485 |
ff9585db9598dc732cf66bd75d823493bdad9165 | 1,483 | # config valid only for current version of Capistrano
lock '3.3.5'
set :application, 'hbx_documents'
set :repo_url, 'git@github.com:dchbx/hbx_documents.git'
# Default branch is :master
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call
# Default deploy_to directory is /var/www/my_app_name
set :depl... | 25.135593 | 93 | 0.695212 |
bbec9457fde5d78009d00b323ffa6f50a187280f | 311 | # frozen_string_literal: true
module Thy
module Types
module Boolean
def self.check(value)
if value == true || value == false
Result::Success
else
Result::Failure.new("Expected a boolean value, but got: #{value.inspect}")
end
end
end
end
end
| 19.4375 | 84 | 0.588424 |
7917bb32034c383423c3bf4961548c9ede83cf1b | 659 | package 'zsh'
if node[:platform] == 'darwin'
package 'zsh-completions'
else
git "#{default_prefix}/share/zsh-completions" do
repository 'https://github.com/zsh-users/zsh-completions'
revision '0.32.0'
user node[:user]
end
end
dotfile '.zshenv'
dotfile '.zshrc'
dotfile '.zsh'
zsh_path = node[:platfo... | 23.535714 | 102 | 0.663126 |
ac3bf5a81c468dca08708d51babc1842961d4344 | 691 | require "wave_int/version"
class WaveInt
# Set WaveInt Range.
def initialize(limit1, limit2=0)
@min, @max = [limit1.to_i, limit2.to_i].sort
@value = @min
end
# Get WaveInt Value.(default: return now value)
def value(number = @value)
n = (number.to_i - offset) % cycle
offset + (n < wave_max ?... | 17.275 | 52 | 0.629522 |
1c4c175061d42d3e0517d3d7a3beb8cbac814671 | 5,297 | class JenkinsJobBuilder < Formula
desc "Configure Jenkins jobs with YAML files stored in Git"
homepage "https://docs.openstack.org/infra/system-config/jjb.html"
url "https://files.pythonhosted.org/packages/fb/23/c21eb18f95c1298277de32ccd2b5a7e1d8e274170052414e370a2f447fca/jenkins-job-builder-2.0.11.tar.gz"
sha2... | 46.876106 | 148 | 0.807438 |
033f25f1474b12536d5199f661233fa32be1c57a | 15,557 | # frozen_string_literal: true
RSpec.describe 'register_file/sv_rtl_top' do
include_context 'sv rtl common'
include_context 'clean-up builder'
before(:all) do
RgGen.enable(:global, [:bus_width, :address_width, :array_port_format])
RgGen.enable(:register_block, [:name, :byte_size])
RgGen.enable(:regis... | 39.992288 | 117 | 0.423089 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.