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 |
|---|---|---|---|---|---|
b9f78b350ef9a08ef5a8e7cbdd1f41b5ae1e0039 | 139 | class AddAprilFoolsFlagToUsers < ActiveRecord::Migration[6.0]
def change
add_column :users, :enabled_april_fools, :boolean
end
end
| 23.166667 | 61 | 0.776978 |
79edba8ab16e2edba0ec24aeeaabd487ed500480 | 1,848 | #!/bin/env ruby
require 'pathname'
# Minimum images
@MIN = 100
# Thresholds
# Young - Keep all builds
@YOUNG_THRESH = 200
# Then, only keep odd hrev numbers
if ARGV.count != 1
puts "Usage: nightly-reaper.rb <ARCH_PATH>"
exit 1
end
@target = Pathname.new(ARGV.first)
stage0 = []
Dir.foreach(@target) do |item|
... | 22.536585 | 77 | 0.661797 |
1c9174f8783b68a20069ec1d8c9a365b7f95180f | 2,869 | # frozen_string_literal: true
Capybara::SpecHelper.spec '#has_button?' do
before do
@session.visit('/form')
end
it 'should be true if the given button is on the page' do
expect(@session).to have_button('med')
expect(@session).to have_button('crap321')
expect(@session).to have_button(:crap321)
... | 32.602273 | 81 | 0.722203 |
796e32d281e5e84b2e039c94de36f600a3c3ae79 | 5,281 | require "test_helper"
class ApplicationControllerTest < ActionDispatch::IntegrationTest
context "The application controller" do
should "return 406 Not Acceptable for a bad file extension" do
get posts_path, params: { format: :jpg }
assert_response 406
get posts_path, params: { format: :blah }
... | 35.206667 | 143 | 0.631699 |
035bb7bbc067bf68e81fa26a6215c37e639190ab | 2,068 | class FavoriteGroupsController < ApplicationController
before_filter :member_only, :except => [:index, :show]
respond_to :html, :xml, :json, :js
def index
@favorite_groups = FavoriteGroup.search(params[:search]).order("updated_at desc").paginate(params[:page], :limit => params[:limit], :search_count => param... | 27.945946 | 169 | 0.703578 |
7a5f8e0e02bcc4ccbda84a3837c31d1cec1a2a15 | 50 | module CuisineInspoDishes
VERSION = "0.1.0"
end
| 12.5 | 25 | 0.74 |
6241b53c3a9fc982f6324d2f3fdea71dc52041be | 326 | class Piano
def keys
'32'
end
def pedals
# return nil
end
end
piano = Piano.new
puts piano.keys.length
# safe navigation
# method pedals - will return nil and there is no 'length' - will be error without &.
puts piano.pedals&.length
piano2 = nil
# will return nil without errors
puts piano2&.keys&.... | 14.818182 | 85 | 0.702454 |
abbb120ef883b306a037ed162da4e1305c630a78 | 4,057 | # frozen_string_literal: true
require 'aws_backend'
class AwsIamUsers < AwsResourceBase
name 'aws_iam_users'
desc 'Verifies settings for a collection of AWS IAM Users'
example "
describe aws_iam_user(user_name: 'psmith') do
it { should exist }
end
"
attr_reader :access_keys, :attached_policy... | 39.009615 | 176 | 0.647769 |
ffbbc3a91c1722c57e61b0c0a313bbbb59eb00e0 | 3,395 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... | 41.402439 | 102 | 0.759941 |
ac07e6871736c9a728aa1061d7ce1c7198ddcce6 | 60 | require_relative 'spec_helper'
describe "DiffLint" do
end
| 10 | 30 | 0.8 |
7ab500923c06ffb9d254a968a84f44644dd3be8b | 512 | require 'rrreader/version'
require 'rrreader/parser'
require 'colorize'
module Rrreader
def self.XML(xml_str)
parser = Rrreader::Parser.new
parser.xml(xml_str)
end
def self.PRINT(xml_str)
channel = XML(xml_str)
puts
puts "#{channel.title}\n#{channel.description}".colorize(:light_green)
... | 19.692308 | 74 | 0.658203 |
f8d1684ea06ccacd57fc858b421eb5dbf65c24fa | 913 | class GroupsController < ApplicationController
# GET /groups.json
def index
render json: Group.all
end
# GET /groups/1.json
def show
group = Group.find params[:id]
render json: group
end
# POST /groups.json
def create
client_id = params[:group][:client_id]
group = Group.new params... | 20.75 | 74 | 0.657174 |
ff6261aef893b70075846bce636445b71045e2f7 | 7,128 | require 'rails_helper'
RSpec.describe 'meter_reviews', type: :system do
let!(:school) { create(:school) }
let!(:reviewed_school) { create(:school) }
let!(:other_school) { create(:school) }
let!(:dcc_meter) { create(:electricity_meter, school: school, dcc_meter: true, ... | 31.400881 | 126 | 0.650814 |
6a3d5233a69e5d3e3cbff1e31a10f14973377725 | 7,336 | #!/usr/bin/env ruby
#----------------------------------------------------------------@@@ Copyright
# Copyright: Mike 'Fuzzy' Partin 2012
#----------------------------------------------------------------@@@ License
# Licensed under the BSD License (Any version you like)
#-----------------------------------------... | 30.823529 | 79 | 0.444929 |
1d531b6a47a1ae84b7c1b8255af573cb595034bc | 232 | def square(x)
#la palabra reservada return se utiliza solo para terminar la ejecucion
return 0 unless x.is_a? Integer
x * x
end
def saludar
puts "Hola desde un metodo"
end
puts square(3)
puts square("sas")
saludar | 17.846154 | 75 | 0.711207 |
4a4ea9875215455ea2830d7d0f75941eef7c85f9 | 251 | require 'rails_helper'
RSpec.describe DashboardController, type: :controller do
describe "GET #admin_dashboard" do
it "returns http success" do
get :admin_dashboard
expect(response).to have_http_status(:success)
end
end
end
| 19.307692 | 56 | 0.729084 |
e8cea05bdcee900fe9a8e45712bd3e5230b1d3d7 | 3,442 | # frozen_string_literal: true
::File.expand_path("../lib", __FILE__).tap do |directory|
$LOAD_PATH.include? directory or $LOAD_PATH.unshift directory
end
require "kitchen/terraform/version.rb"
require "rubygems"
version_parts_strings = RUBY_VERSION.split('.')
version_parts = []
version_parts_strings.each { |vp| ve... | 49.884058 | 118 | 0.728356 |
f8d55fc97c30829d1d12003127dadbe4b954aea0 | 947 | require 'spec_helper'
describe 'Groups (JavaScript fixtures)', type: :controller do
include JavaScriptFixturesHelpers
let(:admin) { create(:admin) }
let(:group) { create(:group, name: 'frontend-fixtures-group' )}
render_views
before(:all) do
clean_frontend_fixtures('groups/')
end
before do
gr... | 24.921053 | 90 | 0.703273 |
6a885e1ace012f29ab404d24b4693fbf83afe070 | 455 | class CreateAssets < ActiveRecord::Migration
def change
create_table :assets do |t|
t.string :attachment_file_name
t.integer :uploadable_id
t.string :uploadable_type, limit: 25
t.string :type, limit: 25
t.integer :position
t.text :description
... | 25.277778 | 64 | 0.626374 |
6218528699f969481c66747277dcaf7162457bfd | 663 | require 'rubygems'
HAML_GEMSPEC = Gem::Specification.new do |spec|
spec.name = 'make_resourceful'
spec.summary = "An elegant, structured way to build ActionPack Controllers"
spec.version = File.read(File.dirname(__FILE__) + '/VERSION').strip
spec.authors = ['Hampton Catlin']
spec.email = 'hcatlin@gmail.com'
... | 36.833333 | 103 | 0.702866 |
26ab91ea1cd1cf554ebca98d4435c08b375709f8 | 68 | class PermitController < ApplicationController
def index; end
end
| 17 | 46 | 0.823529 |
ac2836d1cf444450304291c4e90cba9fcf9c0bf9 | 3,930 | require File.expand_path('../../spec_helper', __FILE__)
describe ExternalReport do
let(:logging) { false }
let(:clazz) { FactoryBot.create(:portal_clazz, logging: logging) }
let(:offering) { FactoryBot.create(:portal_offering, {runnable: FactoryBot.create(:external_activity), clazz: claz... | 36.055046 | 128 | 0.668702 |
ffe6f271fd4fe3b957fb04d788bdc0fcd83f6500 | 269 | require "formatador"
module Sakuvm
class Table
def self.display(title, table_data)
new.display(title, table_data)
end
def display(title, table_data)
Formatador.display_line(title)
Formatador.display_table(table_data)
end
end
end
| 17.933333 | 42 | 0.70632 |
080b0948a553337cb04e3388088b4834fc1b0215 | 527 | # frozen_string_literal: true
module Bunq
##
# https://doc.bunq.com/api/1/call/session-server
class SessionServers
def initialize(client)
@resource = Bunq::Resource.new(client, '/v1/session-server')
@api_key = client.configuration.api_key
end
##
# https://doc.bunq.com/api/1/call/sess... | 25.095238 | 96 | 0.683112 |
bbbf32519af6c4aa70932acaa219b86fe197e52a | 948 | class Cms::Apis::UserFilesController < ApplicationController
include Cms::BaseFilter
include Cms::CrudFilter
include SS::FileFilter
include SS::AjaxFileFilter
model SS::UserFile
private
def fix_params
{ cur_user: @cur_user }
end
def set_items
@items ||= @model.user(@cur_user)
end
def ... | 17.886792 | 63 | 0.652954 |
7a3808c3f90f820d3eea8b29152307a66b5d3d99 | 1,025 | cask 'datagrip' do
version '2019.3.2,193.6015.44'
sha256 '48854e2f5b29b14231b521dee0d28e4c04e0b7789242a8c2d8de86c07997d8db'
url "https://download.jetbrains.com/datagrip/datagrip-#{version.before_comma}.dmg"
appcast 'https://data.services.jetbrains.com/products/releases?code=DG&latest=true&type=release'
name ... | 41 | 253 | 0.696585 |
33e1001334e936355c937a2fdb8509de8c46870b | 498 | module BaseForm
extend ActiveSupport::Concern
included do
include ActiveModel::Validations
include ActiveModel::Validations::Callbacks
include ActiveModel::Conversion
extend ActiveModel::Naming
end
def persisted?
false
end
def submit(attributes = {})
attributes.each do |name, va... | 16.6 | 69 | 0.674699 |
26a943d99c4736da31cc85463791cabc4df76763 | 2,038 |
#
# This file is part of the "Teapot" project, and is released under the MIT license.
#
teapot_version "3.0"
# Project Metadata
define_project "async" do |project|
project.title = "Async"
project.summary = 'Implements the reactor pattern using fibers.'
project.license = "MIT License"
project.add_author 'Sa... | 25.160494 | 96 | 0.759568 |
03df944623b30ebce682937f2c4dbda08762ab6f | 133 | class AddAdminToUsers < ActiveRecord::Migration[5.1]
def change
add_column :users, :admin, :boolean, default: :false
end
end
| 22.166667 | 56 | 0.729323 |
08b5d95000dd82dab0dd3cee2eac0e2410d1d9fd | 1,392 | # frozen_string_literal: true
require_relative "keys"
module TTY
class Reader
# Responsible for meta-data information about key pressed
#
# @api private
class Key < Struct.new(:name, :ctrl, :meta, :shift)
def initialize(*)
super(nil, false, false, false)
end
end
# Repres... | 23.59322 | 61 | 0.51796 |
61beafc2f745bf9f6aa9e544e04dda27cf6cded9 | 11,196 | require './spec/factories'
module Seeding
class Seeder
class << self
def seed!
Db::Membership::Fee.destroy_all
Factories::Membership::Fee.mass_create!(range: (1..20), state: 'prepaid', cash: false)
Factories::Membership::Fee.mass_create!(range: (21..40), state: 'unpaid', cash: true)... | 45.145161 | 157 | 0.585477 |
79bc249561ba0c4649b2519d4e665b88f1d75fb1 | 1,542 | class ActivemqCpp < Formula
desc "C++ API for message brokers such as Apache ActiveMQ"
homepage "https://activemq.apache.org/components/cms/"
url "https://www.apache.org/dyn/closer.lua?path=activemq/activemq-cpp/3.9.5/activemq-cpp-library-3.9.5-src.tar.bz2"
mirror "https://archive.apache.org/dist/activemq/activ... | 45.352941 | 123 | 0.767834 |
1a55adbf5f1de0aa772cbfe714582883bae32128 | 2,910 | class Erlang < Formula
desc "Programming language for highly scalable real-time systems"
homepage "https://www.erlang.org/"
# Download tarball from GitHub; it is served faster than the official tarball.
url "https://github.com/erlang/otp/archive/OTP-22.3.tar.gz"
sha256 "886e6dbe1e4823c7e8d9c9c1ba8315075a1a9f7... | 33.068182 | 93 | 0.698282 |
33f94928e36a72f549e0b1b994a8d70c2d4829cd | 470 | # # encoding: utf-8
# Inspec test for recipe artifactory::apache_proxy
# The Inspec reference, with examples and extensive documentation, can be
# found at http://inspec.io/docs/reference/resources/
unless os.windows?
# This is an example test, replace with your own test.
describe user('root'), :skip do
it {... | 24.736842 | 73 | 0.72766 |
3329971a782880c742fc9f3ec7f185923477f05b | 1,767 | # -*- ruby -*-
# encoding: utf-8
require File.expand_path("lib/google/cloud/memcache/v1beta2/version", __dir__)
Gem::Specification.new do |gem|
gem.name = "google-cloud-memcache-v1beta2"
gem.version = Google::Cloud::Memcache::V1beta2::VERSION
gem.authors = ["Google LLC"]
gem.email ... | 46.5 | 333 | 0.677985 |
f89361c49167929b792b39b70fc48706067597b8 | 3,718 | # encoding: UTF-8
module TZInfo
module Definitions
module America
module Argentina
module Cordoba
include TimezoneDefinition
timezone 'America/Argentina/Cordoba' do |tz|
tz.offset :o0, -15408, 0, :LMT
tz.offset :o1, -15408, 0, :CMT
... | 43.741176 | 56 | 0.539268 |
acc421106e25838bc4b3b894056a6b411321d0ce | 171 | # frozen_string_literal: true
RSpec.describe RSpecJSONAPISerializer do
it "has a version number" do
expect(RSpecJSONAPISerializer::VERSION).not_to be nil
end
end
| 21.375 | 57 | 0.789474 |
e2b8cfa1f2ad92f816dd3c1b025de2b565bbc1fb | 265 | #!/usr/bin/ruby
require 'json'
runtime = JSON.parse(%x{xcrun simctl list devices --json})['runtimes']
.select{|x| (x['identifier'].include? 'com.apple.CoreSimulator.SimRuntime.iOS') &&
(x['availability'] == "(available)")}[0]["identifier"]
puts runtime
| 26.5 | 86 | 0.660377 |
e2c65bba804dbab8aa86ec02d82faeb2ef70ecda | 45,474 | //
// 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 ... | 40.63807 | 137 | 0.569446 |
1c2d06451d99a604403d36299d4ddf0a2ddd4ff5 | 3,313 | require_relative '../../../../spec_helper'
describe 'govuk::app::envvar::redis', :type => :define do
let(:title) { 'giraffe' }
context 'with empty parameters' do
let(:params) { {} }
it 'sets the Redis host to 127.0.0.1 by default' do
is_expected.to contain_govuk__app__envvar("#{title}-redis_host")
... | 33.13 | 74 | 0.561123 |
acbc2a4ec60d72895efc292cf8a237feb1223c68 | 2,434 | # frozen_string_literal: true
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "sassc/version"
Gem::Specification.new do |spec|
spec.name = "sassc"
spec.version = SassC::VERSION
spec.authors = ["Ryan Boland"]
spec.email = ... | 34.771429 | 75 | 0.668036 |
91a63344a8a9e491a9a21f71fac6c0c3d7622fa0 | 241,742 | # 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/master/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
require 'seahorse/client/plugins/content_length.rb'
require 'aws-sdk-core/plugins... | 47.031518 | 542 | 0.657602 |
1ae2363185a5868b3f575223939f1f55e7bbd49a | 1,147 | require "spec_helper"
RSpec.describe FakeCloudinary::Overrides do
describe ".stub_download_prefix" do
it "allows to use custom host for cloudinary cdn" do
host = "http://localhost:3001"
cloud_name = "test"
allow(FakeCloudinary).to receive(:host).and_return(host)
described_class.stub_dow... | 26.674419 | 64 | 0.691369 |
b9c2d8feee1e0a4bbab05c8004d49d3ac13b8528 | 42,739 | require 'date'
require 'fileutils'
module TZInfo
module Data
# Utility methods used by TZDataParser and associated classes.
#
# @private
module TZDataParserUtils #:nodoc:
# Wrapper for File.open that supports passing hash options for specifying
# encodings on Ruby 1.9+. The options are... | 32.775307 | 296 | 0.505112 |
9188f27729a3a48bc6bc97f7bb81e12610965566 | 155 | class ChangeQuantityToBeStringInRecipeFoodsTable < ActiveRecord::Migration[7.0]
def change
change_column :recipe_foods, :quantity, :string
end
end
| 25.833333 | 79 | 0.8 |
269864e56730ab62cc3d971f5120817d4aac35da | 1,796 | ActiveRecord::Schema.define(:version => 0) do
# Users are created and updated by other Users
create_table :users, :force => true do |t|
t.column :name, :string
t.column :creator_id, :integer
t.column :created_on, :datetime
t.column :updater_id, :integer
t.column :updated_at... | 33.259259 | 48 | 0.628062 |
08abd1c6857cc8ddd8c047bb3823aa30a7a7979c | 560 | cask 'darktable' do
version '2.0.0'
sha256 '1019646522c3fde81ce0de905220a88b506c7cec37afe010af7d458980dd08bd'
# github.com is the official download host per the vendor homepage
url "https://github.com/darktable-org/darktable/releases/download/release-#{version}/darktable-#{version}.dmg"
appcast 'https://gith... | 37.333333 | 112 | 0.773214 |
39b911304dab722b77173b8a1da74bb26238a99a | 277 | class InspectionResult < ActiveRecord::Base
belongs_to :user
belongs_to :inspection_schedule
has_one :check
has_one :measurement
has_one :note
has_one :approval
accepts_nested_attributes_for :measurement, :check, :note
include Common
after_commit :dump
end
| 19.785714 | 59 | 0.783394 |
39af36ff77a454511ccf44f8af381f8e707017b2 | 4,305 | # encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
module NewRelic
module Agent
module Database
module ObfuscationHelpers
COMPONENTS_REGEX_MAP = {
:single_quotes => /'(... | 42.205882 | 122 | 0.574448 |
6ab6a3e19727803fca7bfcf15153cfd54c71fc82 | 3,114 | # 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::MediaServices::Mgmt::V2018_06_01_preview
module Models
#
# Describes all the filtering operations, such as de-interlacing, rotation
... | 31.454545 | 78 | 0.498073 |
bf57758b21ef062d8e1ffe5a9bb4dd4c37488feb | 4,673 | class MathUtils
def vectors_add(vector1, vector2)
result = Array.new
if vector1.size == vector2.size
for i in 0...vector1.size
result[i] = vector1[i] + vector2[i]
end
else
puts 'ERROR VECTOR ADD: Vectors size is not equal.'
end
result
end
def vectors_s... | 24.465969 | 91 | 0.55703 |
ed5cf2878b60ff4018c11db59e97b72f74d510ba | 31,522 | #
#--
# Copyright (c) 2006-2008, John Mettraux, jmettraux@gmail.com
#
# 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, co... | 23.700752 | 79 | 0.591587 |
39e913752f931786e48ff1368f2f121ae2ba7aaf | 198 | require 'spec_helper'
describe CakeWalk do
it 'has a version number' do
expect(CakeWalk::VERSION).not_to be nil
end
it 'does something useful' do
expect(false).to eq(true)
end
end
| 16.5 | 43 | 0.707071 |
621a1a48aa234a63b030d34c0d78db77fd350b90 | 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 |
bfd9cd044798b64f4d93b9bb8a5ab188bce7559a | 859 | class Apktool < Formula
desc "Tool for reverse engineering 3rd party, closed, binary Android apps"
homepage "https://github.com/iBotPeaches/Apktool"
url "https://github.com/iBotPeaches/Apktool/releases/download/v2.4.1/apktool_2.4.1.jar"
sha256 "bdeb66211d1dc1c71f138003ce35f6d0cd19af6f8de7ffbdd5b118d02d825a52"
... | 33.038462 | 89 | 0.743888 |
bb2d02e81c066964eb0df34dd97aed3d47bbadb7 | 450 | class NotesController < ApplicationController
before_action :require_user!
def create
note = current_user.notes.new(note_params)
note.save
flash[:errors] = note.errors.full_messages
redirect_to track_url(note.track_id)
end
def destroy
note = current_user.notes.find(params[:id])
redire... | 20.454545 | 53 | 0.733333 |
bbf7dcc2de6a1c49027454a29ca4ac8da86feccb | 3,559 | require_relative '../../spec_helper_min'
require 'models/user_table_shared_examples'
describe Carto::UserTable do
include UniqueNamesHelper
let(:user) { create(:carto_user) }
before(:all) do
@user = user
@carto_user = user
@user_table = Carto::UserTable.new
@user_table.user = user
@user_tab... | 32.354545 | 116 | 0.716493 |
28ee33497d6a051054dbb746f19d997c8297c09e | 2,506 | module Mhc
module PropertyValue
class Range < Base
include Comparable
ITEM_SEPARATOR = "-"
attr_reader :first, :last
def initialize(item_class, prefix = nil, first = nil, last = nil)
@item_class, @prefix = item_class, prefix
@first, @last = first, last
end
# ... | 24.811881 | 73 | 0.501995 |
26eb28bb99ac971c28817abdcdc23d996bcad4ef | 606 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 37.875 | 74 | 0.762376 |
e9f7d4646c16869adb08f39cde0bd430095ac2b4 | 527 | # frozen_string_literal: true
Rails.application.routes.draw do
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
root "test#index"
namespace "api" do
namespace "v1" do
post "image_annotate", to: "image_annotate#show"
resources :users do
... | 25.095238 | 102 | 0.641366 |
91e5381c9667f21cec6a3f59a76c0a4906e50c83 | 1,034 | # -*- encoding: utf-8 -*-
require File.expand_path('../lib/reditor/version', __FILE__)
Gem::Specification.new do |gem|
gem.authors = ['hibariya']
gem.email = ['celluloid.key@gmail.com']
gem.description = %q{Open a ruby library with $EDITOR. Reditor supports rubygems, bundler, and stdlib (pure rub... | 39.769231 | 119 | 0.634429 |
01b123a552ee8f54547fca4cccb107dda0542e38 | 1,427 | require File.dirname(__FILE__) + '/../../spec_helper'
require File.dirname(__FILE__) + '/fixtures/classes'
describe "Math.tan" do
it "returns a float" do
Math.tan(1.35).class.should == Float
end
it "returns the tangent of the argument" do
Math.tan(0.0).should == 0.0
Math.tan(-0.0).should == -0.0
... | 30.361702 | 82 | 0.683252 |
1ab2a17b260b96159899502cd12a9f9628bb81a5 | 1,890 | # -*- encoding : utf-8 -*-
module TextExtractor
module Formats
module Pdf
extend ActiveSupport::Concern
def extract_text_from_pdf(original_file_path)
parsed_text = extract_as_text_from_pdf(original_file_path)
if parsed_text.length < TextExtractor.configuration.min_text_length
... | 28.636364 | 120 | 0.627513 |
2812901f0414f3d8142077e010f76cc30c3ce488 | 11,469 | require 'spec_helper'
require 'ddtrace'
require 'ddtrace/propagation/http_propagator'
RSpec.describe Datadog::HTTPPropagator do
around do |example|
# Reset before and after each example; don't allow global state to linger.
Datadog.configuration.reset_options!
example.run
Datadog.configuration.reset_... | 29.407692 | 105 | 0.499259 |
085c84394233c9e5927b41fe8ccd1f46329c65c1 | 2,419 | module Spree
module Api
class PaymentsController < Spree::Api::BaseController
before_filter :find_order
before_filter :find_payment, only: [:update, :show, :authorize, :purchase, :capture, :void, :credit]
def index
@payments = @order.payments.ransack(params[:q]).result.page(params[:pag... | 25.463158 | 106 | 0.600661 |
bf5793e75e4b69268ba94c07c9f48422e4ca2dd0 | 732 | class Content < ActiveRecord::Base
mount_uploader :file, FileUploader
belongs_to :owner, class_name: 'User'
module Kind
Text = :text
Image = :image
Binary = :binary
end
def kind
@kind ||=
if not file.content_type.blank?
kind_from_content_type(file.content_type)
else
... | 16.636364 | 49 | 0.606557 |
081718d2b6e8f2e817e81ecc0e31a16927bc67ae | 4,857 | # encoding: UTF-8
# require 'squib'
require_relative '../../lib/squib'
data = { 'name' => ['Thief', 'Grifter', 'Mastermind'],
'level' => [1, 2, 3] }
longtext = "This is left-justified text, with newlines.\nWhat do you know about tweetle beetles? well... When tweetle beetles fight, it's called a tweetle beetle ... | 46.701923 | 538 | 0.634754 |
ff1ae34e141d11395416a37c9bcecaeb4198d6eb | 3,929 | __END__
require "spec_helper"
require 'css_sanitize.rb'
# TODO: this file isn't actually used in the system. Either use it or get rid of it
# TODO: would like to use some kind of generic, databaseless, ActiveRecord::Base derived class here, rather than User.
# some ideas for this: http://stackoverflow.com/question... | 31.685484 | 118 | 0.620514 |
18f282cff44138ac5bac6b033f6248fd65f670f5 | 337 | participant_ids = []
direct_message.participants.each do |participant|
if participant.id != current_user.id
participant_ids.push(participant.id)
end
end
json.id direct_message.id
json.createdAt direct_message.created_at
json.updatedAt direct_message.updated_at
json.participantIds do
json.array! pa... | 25.923077 | 49 | 0.795252 |
5db4a907c390eb19b325d168f275ec3b34feca75 | 1,347 | #
# Copyright 2015, Noah Kantrowitz
#
# 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 writin... | 32.071429 | 74 | 0.715664 |
3995243b7032c610fc3c4ee11674517e22433797 | 776 | require 'lims-laboratory-app/organization/location'
require 'models/actions/spec_helper'
require 'models/actions/action_examples'
shared_examples_for "creating a resource with a location" do |resource_class|
it_behaves_like "an action"
it "creates a resource with a location" do
Lims::Core::Persistence::Sess... | 36.952381 | 77 | 0.764175 |
1a94fb834adc2f126892ac90a929972e19f34755 | 19,047 | # This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Ch... | 45.35 | 123 | 0.676852 |
1cefe681909a2712b08a50f50f758fd4235c497c | 3,810 | module Pod
module Generator
module XCConfig
# Generates the private xcconfigs for the pod targets.
#
# The xcconfig file for a Pod target merges the pod target
# configuration values with the default configuration values
# required by CocoaPods.
#
class PodXCConfig
... | 41.868132 | 155 | 0.630184 |
e9711fcd727e910cf106365ad2830c750c186cd8 | 437 | cask 'qlimagesize' do
version '2.6.1'
sha256 '466c18539653056ccf7eb09eb6c68689fd9a8280a3c2ade9f2d457de53504821'
url "https://github.com/Nyx0uf/qlImageSize/releases/download/#{version}/qlImageSize.qlgenerator.zip"
appcast 'https://github.com/Nyx0uf/qlimagesize/releases.atom'
name 'qlImageSize'
homepage 'htt... | 31.214286 | 102 | 0.782609 |
1dde656843f63569d846aead54950dc140a90b22 | 2,174 | 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 on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web serv... | 35.639344 | 86 | 0.76219 |
f82c13e15d44c7ffe42f8e74ed73e4a55ca269e6 | 3,177 | require_relative 'base_decorator'
require 'pact_broker/api/decorators/webhook_request_template_decorator'
require 'pact_broker/api/decorators/timestamps'
require 'pact_broker/webhooks/webhook_request_template'
require 'pact_broker/webhooks/webhook_event'
require 'pact_broker/api/decorators/basic_pacticipant_decorator'
... | 32.418367 | 139 | 0.626377 |
f8e21a89f1c251da5e1b7f10558c34e6ddaba8ea | 1,115 | # frozen_string_literal: true
##
# This file is part of WhatWeb and may be subject to
# redistribution and commercial restrictions. Please see the WhatWeb
# web site for more information on licensing and terms of use.
# http://www.morningstarsecurity.com/research/whatweb
##
# Version 0.2 #
# Updated regex matches and ... | 28.589744 | 81 | 0.684305 |
1a7d7ee784dd1ccd536d66feef5e7b0f41e2329c | 561 | require 'fog/vmfusion/core'
module Fog
module Compute
class Vmfusion < Fog::Service
model_path 'fog/vmfusion/models/compute'
model :server
collection :servers
class Mock
def initialize(options={})
Fog::Mock.not_implemented
end
end
class Re... | 16.5 | 46 | 0.540107 |
2158536e6c3867c7661282687ca2f5402a51d31d | 2,329 | ActiveAdmin.register AdminUser do
# See permitted parameters documentation:
# https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
#
permit_params :email, :password, :password_confirmation
menu priority: 6, label: "管理员"
actions :all, except: [:destroy]
... | 29.481013 | 118 | 0.680979 |
399db4ac2593acf5888ff11fb5d023ae756c5353 | 2,444 | # frozen_string_literal: true
require 'spec_helper'
require Rails.root.join('db', 'post_migrate', '20190527194900_schedule_calculate_wiki_sizes.rb')
describe ScheduleCalculateWikiSizes, :migration, :sidekiq do
let(:migration_class) { Gitlab::BackgroundMigration::CalculateWikiSizes }
let(:migration_name) { migrat... | 37.6 | 96 | 0.693535 |
3929880e7660845eded78c8685cd714ed38e46dd | 3,645 | require 'optparse'
require 'simplecli'
class String
def indent number_of_spaces = 1
self.gsub(/^(.*)$/, (' ' * number_of_spaces) + '\1')
end
end
class RackBox::Bin
include SimpleCLI
def initialize *args
@default_command = :request
super
end
def usage *args
puts <<doco
rackbox == %{ Fo... | 27.406015 | 113 | 0.582167 |
18c943a645e3a59d51db521ad20b28b5cebccea9 | 1,278 | require 'uri'
module OpenAPIParser::Findable
# @param [String] reference
# @return [OpenAPIParser::Findable]
def find_object(reference)
return self if object_reference == reference
remote_reference = !reference.start_with?('#')
return find_remote_object(reference) if remote_reference
return nil u... | 24.576923 | 74 | 0.701878 |
ab44e8fdc6961e552572dcebe2387e785d1cc2be | 5,313 | # Copyright (c) 2009-2012 VMware, Inc.
module Bosh::Agent
module Message
class Apply < Base
def self.long_running?; true end
def self.process(args)
self.new(args).apply
end
def initialize(args)
@platform = Bosh::Agent::Config.platform
if args.size < 1
... | 28.411765 | 89 | 0.571617 |
f8d4aa78a3d3a095b601b0a17438db8b924693fa | 933 | cask 'lando' do
version '3.0.0-rc.13'
sha256 'd97805e556e086fe0b1f9f8083f95ed918a2ac92bcff4792a047d0ab52fe875d'
# github.com/lando/lando was verified as official when first introduced to the cask
url "https://github.com/lando/lando/releases/download/v#{version}/lando-v#{version}.dmg"
appcast 'https://github.... | 32.172414 | 90 | 0.566988 |
3871c628fe46b5015f4548e0b34142f038940cb0 | 5,002 | # -*- mode: ruby; ruby-indent-level: 4 -*- vim: sw=4
#
# Classes required by the full core typeset
#
module YAML
#
# Default private type
#
class PrivateType
def self.tag_subclasses?; false; end
verbose, $VERBOSE = $VERBOSE, nil
def initialize( type, val )
@type_id ... | 25.917098 | 94 | 0.419032 |
f893f7444e108036bfdb94da0f824bab2fc7e859 | 1,024 | Rails.application.routes.draw do
root 'needs#index'
resources :contacts, only: [:index, :show, :edit, :update, :new, :create] do
resources :needs, only: [:new, :create]
resources :assessments, only: [:new, :create]
# collection do
# get 'call-list'
# end
get 'triage', to: 'triage#edit', a... | 35.310345 | 78 | 0.655273 |
6abf4e09a16dd61e90a577b1463ce15b97503290 | 138 | source 'https://rubygems.org'
gemspec path: '..'
gem 'activemodel', '~> 6.0.0'
gem 'activerecord', '~> 6.0.0'
gem 'sqlite3', '~> 1.4.1'
| 17.25 | 30 | 0.586957 |
91c5c93e9a1bdb3ec02e691249bfe380b4c8a151 | 381 | # frozen_string_literal: true
module Types
class MutationType < Types::BaseObject
field :update_task, mutation: Mutations::UpdateTask
field :create_task, mutation: Mutations::CreateTask
field :create_like, mutation: Mutations::CreateLike
field :create_comment, mutation: Mutations::CreateComment
f... | 31.75 | 61 | 0.774278 |
614f7d8a7f6aa41d7f8224f28c10b7a480f624ca | 682 | require 'spec_helper'
RSpec.describe Openapi2ruby::Generator do
let(:generator) { Openapi2ruby::Generator.new(schema) }
let(:schema) { Openapi2ruby::Parser.parse(schema_path).schemas.first }
let(:schema_path) { 'spec/fixtures/files/petstore.yaml' }
let(:output_path) { 'spec/tmp' }
describe '#generate' do
... | 32.47619 | 72 | 0.715543 |
87285df8e76f815d01b51a6da8e1404595d2c9c1 | 6,882 | # 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_12_01
module Models
#
# Specifies information about the operating system disk used by the virtual
# machine. <br><br> For mor... | 36.031414 | 162 | 0.540105 |
797f834cb4f9476219aae2dfb30beea1747d23f1 | 29,091 | # 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,... | 58.415663 | 148 | 0.668282 |
28db5c5bd99790a9864ecc3215bf267a3fdc1902 | 4,320 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Deployments::AutoRollbackService, :clean_gitlab_redis_rate_limiting do
let_it_be(:maintainer) { create(:user) }
let_it_be(:project, refind: true) { create(:project, :repository) }
let_it_be(:environment, refind: true) { create(:environment, proj... | 30.857143 | 124 | 0.677546 |
e2d64f491f19680a534057411c2705e568e5bc6d | 4,250 | # 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 data... | 37.610619 | 105 | 0.608471 |
875f924770c0ee840c4b243d1bbd798ed04a46c2 | 2,941 | {
name: 'UTEP',
num_matrices: '3',
notes: 'Matrices from Lenka Dubcova, Jakub Cerveny, and Pavel Solin
Univ. of Texas at El Paso. From a PDE solver. The fill-in when working on
a leading submatrix can be higher than for the whole matrix.
Subsets of interest are the first k rows and columns where:
m... | 31.287234 | 76 | 0.609997 |
01aa3d11d80ad1b116c95a6e3056490db5ee9430 | 1,349 | describe 'Search Result Block', type: :feature, js: true do
let(:exhibit) { FactoryBot.create(:exhibit) }
let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
let!(:feature_page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
let!(:alt_search) { FactoryBot.create(:search, tit... | 32.902439 | 94 | 0.716827 |
91d53530980627692cd13590f53ca9f3ad4e464d | 270 | class CreateBarbers < ActiveRecord::Migration[6.0]
def change
create_table :barbers do |t|
t.text :name
t.timestamps
end
Barber.create :name => 'Jessie Pinkman'
Barber.create :name => 'Walter White'
Barber.create :name => 'Gus Fring'
end
end
| 18 | 50 | 0.67037 |
210ea75d378d2982e109629fd1cc0a854aa476b1 | 253 | module TZInfo
module Definitions
module Etc
module GMT__p__10
include TimezoneDefinition
timezone 'Etc/GMT+10' do |tz|
tz.offset :o0, -36000, 0, :'GMT+10'
end
end
end
end
end
| 16.866667 | 45 | 0.533597 |
39d06066a14c2e43c8ca6a25781138f2ce0d1c6a | 2,088 | class Okteta < Formula
desc "KDE hex editor for viewing and editing the raw data of files"
homepage "https://www.kde.org"
url "https://download.kde.org/stable/okteta/0.26.2/src/okteta-0.26.2.tar.xz"
sha256 "bb8d819af1d2d7ebb286542918985afcd1937f0ec6172180ff5b1acc5383684c"
head "git://anongit.kde.org/okteta.gi... | 35.389831 | 109 | 0.693008 |
f82ee3772f162be26dd0d7e5a2067a520a445d3e | 1,036 | #
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may n... | 34.533333 | 62 | 0.734556 |
ac04418cfc568fef5956466f6e70665db44b4d1c | 9,228 | =begin
#MailSlurp API
#MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - G... | 30.76 | 470 | 0.613459 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.