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 |
|---|---|---|---|---|---|
11026b7400d0367cd5884448b81876f6e46167fb | 5,918 | # The MIT License (MIT)
# Copyright (c) 2018 Mike DeAngelo Looker Data Sciences, Inc.
# 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 r... | 44.164179 | 434 | 0.586854 |
ff99a5dccecd859fcc85f46a60a2c8bd458124f6 | 499 | # frozen_string_literal: true
class Employee
attr_accessor :first_name, :last_name, :age, :gender
def initialize(f_name, l_name, age, gender)
@first_name = f_name
@last_name = l_name
@age = age
@gender = gender
end
def to_a
[@first_name, @last_name, @age, @gender]
end
end
class Shift
... | 19.192308 | 54 | 0.661323 |
ab590919ee46cc097c12b82725824c0be9b211ce | 730 | class HomeController < ApplicationController
before_action :set_s3_direct_post
COUNT_THANKS = 10
def index
@thanks = Thanks.published_thanks.order('created_at desc').limit(COUNT_THANKS).to_a
@thanks_count = Thanks.published_thanks.count
end
def set_s3_direct_post
HomeController.set_s3_direct_p... | 31.73913 | 87 | 0.756164 |
382799d89a099437224a1b4f7c93e8b1cc3da566 | 565 | # frozen_string_literal: true
class CreateIncomingEmails < ActiveRecord::Migration[4.2]
def change
create_table :incoming_emails do |t|
t.integer :user_id
t.integer :topic_id
t.integer :post_id
t.text :raw
t.text :error
t.text :message_id
t.text :from_address
t.t... | 20.925926 | 57 | 0.672566 |
e28246c381e520d12bc62de38326b0e5c04f5b7e | 3,456 | require 'spec_helper'
describe ActiveData::Model::Dirty do
before do
stub_class(:author, ActiveRecord::Base) {}
stub_model :premodel do
include ActiveData::Model::Persistence
include ActiveData::Model::Localization
include ActiveData::Model::Associations
attribute :age, Integer, defa... | 40.658824 | 113 | 0.644387 |
183c764e4435a7d2d4fc48de5ce26985ca258fe5 | 2,611 | class Sbcl < Formula
desc "Steel Bank Common Lisp system"
homepage "http://www.sbcl.org/"
url "https://downloads.sourceforge.net/project/sbcl/sbcl/2.0.1/sbcl-2.0.1-source.tar.bz2"
sha256 "8450d60b7264a34158f8811d46dc6e74ff855bbd1227752572877e6604ce56e8"
bottle do
sha256 "481a9512dd731873704c8595bc97a3b8b... | 35.283784 | 109 | 0.690157 |
ab62ee155217a441aec4856d57062fa88ac8d4aa | 785 | #
# Common API responses.
#
# Use them like this:
#
# subject { response }
#
# context 'whoops no authentication' do
# it_behaves_like 'unauthorized'
# end
#
RSpec.shared_examples 'no content' do
its(:status) { should eq 204 }
its(:body) { should be_empty }
end
RSpec.shared_examples 'unauthorized' do
... | 21.216216 | 47 | 0.677707 |
e9ba5bcedb4750b0d69c25950b7d7a7955895521 | 68 | require 'bundler/setup'
Bundler.require
require 'minitest/autorun'
| 13.6 | 26 | 0.808824 |
f87614130bab0ee2130a615bdf05fcc09336f553 | 404 | module API
class UsersController < API::BaseController
private
def find_resources_association_chain
association_chain
end
def association_chain
specified_or_current_account.users.all
end
def filter_class
Filter::Resource::User
end
def permitted_params
params... | 18.363636 | 77 | 0.700495 |
1c4b190e73a120cf8bac01204a6d9d2b55137b30 | 319 | class ColoradoHikes::Hike
attr_accessor :name, :url, :info1, :info2, :info3, :info4, :info5
@@all = []
def initialize(name=nil, url=nil)
@name = name
@url = url
@@all << self
end
def self.all
@@all
end
def save
@@all << self
end
def self.find(id)
self.all[id-1]
end
end
| 13.291667 | 67 | 0.570533 |
bf01a27ad31b94c0ac82ff098a20a762e2f7fd23 | 5,101 | #
# Copyright (C) 2008, 2009 Wayne Meissner
#
# This file is part of ruby-ffi.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyrigh... | 27.424731 | 98 | 0.651441 |
ab3d0827ed91cf849c733daf683aff37d2db6e9e | 1,674 | require 'spec_helper'
module RailsConfig::Sources
describe YAMLSource do
it "should take a path as initializer" do
source = YAMLSource.new "somepath"
source.path.should == "somepath"
end
context "basic yml file" do
let(:source) do
YAMLSource.new setting_path("development.yml")... | 24.26087 | 62 | 0.601553 |
79dc9587bad3a3d85ed562b7324cf05273d0e9e9 | 768 | class IframeEmbed::Kickstarter < IframeEmbed
def self.supported_urls
[
%r{.*?//www\.kickstarter\.com/projects/(.*?)/(.*?)/widget/video\.html}
]
end
def oembed_url
@oembed_url ||= "https://www.kickstarter.com/services/oembed"
end
def oembed_params
{url: canonical_url, format: "json"}
... | 20.756757 | 84 | 0.625 |
e9f1f23557244c6eb00ac52b94536028e0b22ce0 | 497 |
describe ApplicationController, :type => :controller do
describe "GET #home" do
it 'returns http success' do
get :home
expect(response).to have_http_status(:success)
end
end
describe "GET #about" do
it 'returns http success' do
get :about
expect(response).to have_http_status(... | 20.708333 | 55 | 0.661972 |
f802413517e88bf3a92f77f7dc2f6e7b9e5f7702 | 796 | class ApplicationController < ActionController::Base
helper_method :current_user, :logged_in?, :brand_link
protect_from_forgery with: :exception
def current_user
return nil unless session[:token]
@current_user ||= User.find_by(session_token: session[:token])
end
def brand_link
if request.origina... | 20.410256 | 66 | 0.702261 |
e2eb4ab115e925df09e931a13f69af5fd1d73f1c | 1,790 | # frozen_string_literal: true
require 'test_helper'
class ServiceTest < Test::Unit::TestCase
def test_creation
refute_nil K8sInternalLb::Service.new name: 'test', ports: []
refute_nil K8sInternalLb::Service.new name: 'test', ports: [], interval: 4
refute_nil K8sInternalLb::Service.new name: 'test', name... | 35.8 | 134 | 0.675978 |
acaf08e63a9886b2ef1bb5af36d86ddc4481d117 | 3,282 | require 'spec_helper'
require 'json'
describe Cetacean do
let(:api) do
Faraday.new('http://api.example.com') do |f|
f.headers['Accept'] = 'application/hal+json'
f.adapter Faraday.default_adapter
end
end
context "when fed a valid HAL response" do
before do
stub_service 'http://api.e... | 24.676692 | 81 | 0.558806 |
0333d7d0d2bd4e98aaab250e83f465200919f66f | 265 | class Settings
def get_players(player_one)
if player_one == 'O'
'X'
else
'O'
end
end
def make_board
first_line = [1, 2, 3]
second_line = [4, 5, 6]
third_line = [7, 8, 9]
[first_line, second_line, third_line]
end
end
| 15.588235 | 41 | 0.573585 |
1c4c474a095a4807bef8ea2cc1c323335da9e54f | 1,921 | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... | 35.574074 | 73 | 0.692868 |
1ca6cc943dc4495a6fe632fe4f495a9a0aa7fad0 | 3,205 | require "chef/provisioning/aws_driver"
with_driver "aws::eu-west-1"
vpc = aws_vpc "test-vpc" do
cidr_block "10.0.0.0/24"
internet_gateway true
end
# Empty
aws_security_group "test-sg" do
vpc "test-vpc"
action :delete
end
aws_security_group "test-sg" do
vpc "test-vpc"
end
aws_security_group "test-sg" do
... | 26.708333 | 86 | 0.55975 |
189a93cddf41c31fc64335acdd816144e753273b | 11,656 | # frozen_string_literal: true
require_relative "acidic_job/version"
require_relative "acidic_job/errors"
require_relative "acidic_job/no_op"
require_relative "acidic_job/recovery_point"
require_relative "acidic_job/response"
require_relative "acidic_job/key"
require_relative "acidic_job/staged"
require_relative "acidi... | 34.383481 | 114 | 0.688916 |
f874493bb1eeaa57d6068f46d34ec5f09fd7bf02 | 454 | require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the FeedbackFormsHelper. For example:
#
# describe FeedbackFormsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# ... | 28.375 | 71 | 0.720264 |
5d989024aa89e5dde0bf96788c019cd0edcc9db7 | 3,635 | require "uri"
class EmailApi
basePath = "https://api.transmitsms.com/"
# apiInvoker = APIInvoker
def initialize(api_key, api_secret)
@api_key = api_key
@api_secret = api_secret
@sms_api = SmsApi
@api_key_secret = create_api_key_secret()
config_swagger()
end
def create_api_key_secret()... | 26.34058 | 145 | 0.647868 |
e8d6d5bba8946f41eef7fc203c359477795f3e5d | 120 | class DMARCInspector
module DMARC
class Error < StandardError; end
class InvalidRecord < Error; end
end
end
| 17.142857 | 36 | 0.733333 |
ab6911a01a25c7a1540cf339a2591d662ca91941 | 2,451 | class Libhid < Formula
desc "Library to access and interact with USB HID devices"
homepage "https://libhid.alioth.debian.org/"
url "http://distcache.freebsd.org/ports-distfiles/libhid-0.2.16.tar.gz"
sha256 "f6809ab3b9c907cbb05ceba9ee6ca23a705f85fd71588518e14b3a7d9f2550e5"
bottle do
cellar :any
rebuil... | 36.58209 | 124 | 0.717666 |
bb684e3111c47733e4d4c3b8c8a9ac33c69bccc1 | 6,641 | =begin
#Topological Inventory
#Topological Inventory
The version of the OpenAPI document: 1.0.0
Contact: support@redhat.com
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.2.1
=end
require 'date'
module TopologicalInventoryApiClient
class TagsCollection
attr_accessor :meta
attr... | 29.255507 | 223 | 0.615871 |
d5be298f09a6b68e73f54b70963a15f9e718ef87 | 178 | # frozen_string_literal: true
module RuboCop
module RSpec
# Version information for the RSpec RuboCop plugin.
module Version
STRING = '1.39.0'
end
end
end
| 16.181818 | 55 | 0.691011 |
03a3b124522cb30ab639e702bf32c0cc87311ccf | 2,463 | ##########################GO-LICENSE-START################################
# Copyright 2014 ThoughtWorks, 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/li... | 41.05 | 218 | 0.698335 |
28de6cbb346d37b7f30040cedb749815b833d17c | 63 | module RequisitionCheckoutx
module CheckoutsHelper
end
end
| 12.6 | 27 | 0.84127 |
b96c0ce18fa745dc23b977bff3125f775db4bf5c | 173 | # frozen_string_literal: true
require 'spec_helper'
describe GitlabSchema.types['VulnerablePackage'] do
it { expect(described_class).to have_graphql_fields(:name) }
end
| 21.625 | 62 | 0.797688 |
3335896315ae2aa592f16aa3a21f76567acfb477 | 1,668 | module WebConsole
# A session lets you persist wrap an +Evaluator+ instance in memory
# associated with multiple bindings.
#
# Each newly created session is persisted into memory and you can find it
# later its +id+.
#
# A session may be associated with multiple bindings. This is used by the
# error pag... | 24.895522 | 76 | 0.654077 |
1c53f3dacac87368a0503c12533e604dcec3c3d3 | 240 | class CreateChessBoardRows < ActiveRecord::Migration
def change
create_table :chess_board_rows do |t|
t.references :chess_game, null: false
t.integer :row_index, null: false
t.timestamps null: false
end
end
end
| 21.818182 | 52 | 0.7125 |
edf674bb292c1d893824f74def6f64ee9078adf8 | 7,913 | require 'pathname'
Puppet::Type.newtype(:dsc_xvmswitch) do
require Pathname.new(__FILE__).dirname + '../../' + 'puppet/type/base_dsc'
require Pathname.new(__FILE__).dirname + '../../puppet_x/puppetlabs/dsc_type_helpers'
@doc = %q{
The DSC xVMSwitch resource type.
Automatically generated from
'xHype... | 32.297959 | 148 | 0.657652 |
edea26cf25e20855f6de5eba7f185091d74dde24 | 223 | # frozen_string_literal: true
require 'faraday'
require 'json'
require 'pg'
require_relative "inkstats/version"
require_relative "inkstats/extractor"
require_relative "inkstats/parser"
require_relative "inkstats/storage"
| 20.272727 | 37 | 0.825112 |
d5095cde4c8dce904d34a6f9e163a7cacbedecb8 | 734 | cask 'macupdater' do
version '1.4.16'
sha256 'ba657a634720eda94aeb0ae672a25ac65e7859b0cea4a06e476ca6f6dc879737'
url "https://www.corecode.io/downloads/macupdater_#{version}.zip"
appcast 'https://www.corecode.io/macupdater/macupdater.xml'
name 'MacUpdater'
homepage 'https://www.corecode.io/macupdater/index.... | 36.7 | 84 | 0.685286 |
87cb649ebf7f64dd4c1736ca8c91037768630fa9 | 680 | require 'rubygems'
require 'bundler/setup'
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
ENV["RAILS_ENV"] = "test"
require 'rails/all'
require 'mongoid'
require 'mongo_mapper'
require 'shoulda'
require 'rr'
require 'rails/test_help'
require 'rails3-jque... | 21.25 | 94 | 0.775 |
ed627cb9cf32eb285b4c55b295d094b797c5c3ed | 275 | class ApplicationController < ActionController::Base
include SessionsHelper
private
# ユーザーのログインを確認する
def logged_in_user
unless logged_in?
store_location
flash[:danger] = "Please log in."
redirect_to login_url
end
end
end | 18.333333 | 52 | 0.672727 |
010f9349940d4adb6963eef008cced1e9ced9011 | 227 | class ChangePostalcodeFormatInVenues < ActiveRecord::Migration
def up
change_column :venues, :postalcode, :string
end
def down
raise ActiveRecord::IrreversibleMigration.new('Cannot reverse migration.')
end
end
| 22.7 | 78 | 0.770925 |
4acbc2d41969337b500bac6bd57a5fddc879bbdd | 1,826 | class Libtiff < Formula
desc "TIFF library and utilities"
homepage "https://libtiff.gitlab.io/libtiff/"
url "https://download.osgeo.org/libtiff/tiff-4.1.0.tar.gz"
mirror "https://fossies.org/linux/misc/tiff-4.1.0.tar.gz"
sha256 "5d29f32517dadb6dbcd1255ea5bbc93a2b54b94fbf83653b4d65c7d6775b8634"
license "libt... | 30.433333 | 95 | 0.673056 |
61c969fbfe0ba60ff02a1427178f58754731d47e | 4,041 | module Glueby
class UtxoProvider
class Tasks
include Glueby::Contract::TxBuilder
attr_reader :utxo_provider
STATUS = {
# UtxoProvider is ready to pay tpcs.
ready: 'Ready',
# UtxoProvider is ready to pay tpcs, but it doesn't have enough amount to fill the UTXO pool by UT... | 34.538462 | 135 | 0.630784 |
21603998dba3e7e6fc8de86dd61479060fdf839b | 4,492 | # frozen_string_literal: true
class Facility < ApplicationRecord
before_validation :set_journal_mask, on: :create
has_many :bundles, inverse_of: :facility
has_many :director_and_admin_roles, -> { merge(UserRole.director_and_admins) }, class_name: "UserRole"
has_many :director_and_admins, -> { distinct }, thr... | 28.611465 | 141 | 0.712823 |
abca7508f47b7274ca4977c24b4963ffe29a1e0c | 414 | class CreateFscdAnnualPlans < ActiveRecord::Migration[5.0]
def change
create_table :fscd_annual_plans do |t|
t.string :name, null: false
t.string :code
t.string :year
t.integer :duration
t.integer :status, default: 0, null: false
t.boolean :archive
t.integer :ration_id
... | 23 | 58 | 0.654589 |
6a053eecedc027b6fe462818278f9502450f038d | 473 | module TaoForm
module Inputs
class CollectionCheckBoxesInput < ::SimpleForm::Inputs::CollectionCheckBoxesInput
def input(wrapper_options = nil)
template.content_tag(:div, super, class: 'group-field checkbox-group-field')
end
protected
def build_nested_boolean_style_item_tag(coll... | 23.65 | 85 | 0.701903 |
e826981dffa1562d425f042997f1d1c6d44a875e | 151 | class AddNumberToSubjects < ActiveRecord::Migration
def change
add_column :subjects, :number, :string
add_index :subjects, :number
end
end
| 21.571429 | 51 | 0.748344 |
620dd908fd21a627722a0d0d34c7d8afd4182578 | 3,109 | # -*- ruby -*-
# frozen_string_literal: true
require 'pg' unless defined?( PG )
# Simple set of rules for type casting common PostgreSQL types to Ruby.
#
# OIDs of supported type casts are not hard-coded in the sources, but are retrieved from the
# PostgreSQL's +pg_type+ table in PG::BasicTypeMapForResults.new .
#
# ... | 37.914634 | 189 | 0.724992 |
266dd8d0972e71e749cced63f71f878d7db000ef | 442 | # coding: UTF-8
# Salor -- The innovative Point Of Sales Software for your Retail Store
# Copyright (C) 2012-2013 Red (E) Tools LTD
#
# See license.txt for the license applying to all files within this software.
class StockLocation < ActiveRecord::Base
include SalorBase
include SalorScope
belongs_to :vendor
... | 23.263158 | 77 | 0.746606 |
4aa94689f4e31f93d6df567b8321bbe35435830a | 1,327 | def youtube_player(id, list = '')
if list == '' then
url = "https://www.youtube.com/embed/#{id}?origin=https://promcon.io"
else
url = "https://www.youtube.com/embed/#{id}?list=#{list}&origin=https://promcon.io"
end
container %(<iframe id="ytplayer" type="text/html" src="#{url}" allowFullScreen="true" fr... | 45.758621 | 257 | 0.721929 |
39b19efb4f965edf361d9db930c4896e388e0d0a | 1,789 | module Synapse
module Domain
# Represents a historical stream of domain events in chronological order
#
# @example
# stream = SimpleDomainEventStream.new events
# until stream.end?
# puts stream.next_event
# end
#
# @example
# stream = SimpleDomainEventStream.new ev... | 24.175676 | 96 | 0.605925 |
edd8c59aa5f1c2f79ff6c7981a52d0282c3e0d73 | 1,151 | # frozen_string_literal: true
class JsRegex
#
# This class acts as a facade, passing a regex to the converters.
#
# ::of returns a source String, options String, and warnings Array.
#
class Conversion
require 'regexp_parser'
require_relative 'converter'
require_relative 'node'
require_relat... | 28.775 | 76 | 0.676803 |
bfeee429e8695cd24471b0b460531ca3d4e8f543 | 599 | desc 'update changelog'
task :changelog do
File.open('CHANGELOG', 'w+') do |changelog|
`git log -z --abbrev-commit`.split("\0").each do |commit|
next if commit =~ /^Merge: \d*/
ref, author, time, _, title, _, message = commit.split("\n", 7)
ref = ref[/commit ([0-9a-f]+)/, 1]
author = autho... | 31.526316 | 69 | 0.559265 |
e9d149ba6253b8dccb01153105e57bad05094a7a | 2,842 | # 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::V2015_06_15
module Models
#
# Response for the ListNetworkInterface API service call.
#
class NetworkInterfac... | 28.42 | 80 | 0.533427 |
4a4cfe6fb37b8ae84848d01b06ef771143e7cbf8 | 1,853 | class Openconnect < Formula
desc "Open client for Cisco AnyConnect VPN"
homepage "https://www.infradead.org/openconnect/"
url "ftp://ftp.infradead.org/pub/openconnect/openconnect-7.08.tar.gz"
mirror "https://fossies.org/linux/privat/openconnect-7.08.tar.gz"
sha256 "1c44ec1f37a6a025d1ca726b9555649417f1d31a46f7... | 32.508772 | 128 | 0.733405 |
e2829fcb650bddbe91f33e7fc9910a968ac7ccd5 | 835 | require "rmagick"
require "fakefs/rmagick/real_image"
module FakeFS
module Magick
module FakeImageInstance
def write(file)
m = file.match /(?:^([a-zA-Z0-9]+):)|(?:\.([a-zA-Z0-9]+)$)/
myformat = (m[1] || m[2]).sub("jpg", "jpeg").upcase if m
::File.write(file.sub(/^([a-zA-Z0-9]+):/, ''), to_blo... | 16.057692 | 65 | 0.576048 |
03e596e362e592778cbecedcddd03ad632629959 | 421 | require_relative "./process_observer/version"
require_relative "./process_observer/main"
require_relative "./process_observer/exceptions"
require_relative "./process_observer/process"
require_relative "./process_observer/os"
require_relative "./process_observer/windows"
require_relative "./process_observer/linux"
requi... | 32.384615 | 48 | 0.833729 |
28d5e66733113662f353108da0553a50242608e5 | 478 | require 'rails/generators'
class Rails::Generators::StimulusGenerator < Rails::Generators::NamedBase
source_root File.expand_path('templates', __dir__)
check_class_collision suffix: "Controller"
def create_controller_directory
empty_directory("app/javascript/controllers") unless File.directory?("app/javasc... | 29.875 | 102 | 0.788703 |
ed82b24a65b6981bd0a0aa857bab33f068d7be40 | 523 | # Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = (ENV['ASSETS_VERSION'] || '1.0')
# Add additional assets to the asset load path
# Rails.application.config.assets.paths << Emoji.images_pat... | 43.583333 | 93 | 0.76673 |
2670dc3826145e8cb331941dbf5aa3b354745276 | 963 | require 'brakeman/checks/base_check'
class Brakeman::CheckSessionManipulation < Brakeman::BaseCheck
Brakeman::Checks.add self
@description = "Check for user input in session keys"
def run_check
tracker.find_call(:method => :[]=, :target => :session).each do |result|
process_result result
end
en... | 26.75 | 100 | 0.654206 |
bffffd954b8bd18a20a2872d71866a9f3075d237 | 349 | # Conditions for which you don't need to run #search, #match? is enough
class ConditionSimple < Condition
def search(db)
# Set#select should return damn set, it's dumb that it returns Array
db.printings.select{|card| match?(card)}.to_set
end
def match?(card)
raise "SubclassResponsibility"
end
de... | 21.8125 | 72 | 0.704871 |
5dc3c1cc8f095883652ba4ad2f14e1054a7403e2 | 279,552 | # 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/credentials_configuration.rb'
... | 46.959852 | 945 | 0.660539 |
ff0cad9b2a51be94874f54152a173e8f887ed46a | 107 | # load schema to in memory sqlite
ActiveRecord::Migration.verbose = false
load Rails.root + 'db/schema.rb'
| 26.75 | 39 | 0.766355 |
ac8e990013d1fc193c76f4bd9b912a7c9089da79 | 5,047 | #
# Copyright (C) 2010-2016 dtk contributors
#
# This file is part of the dtk project.
#
# 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
#
# Unles... | 39.740157 | 125 | 0.680999 |
28f3cf720e55a28b988f8ce88ad7842a801449bc | 150 | require 'spec_helper'
describe 'role_cron' do
context 'with defaults for all parameters' do
it { should contain_class('role_cron') }
end
end
| 18.75 | 47 | 0.733333 |
e2a05a8b75dbd399dc575c4fd1aa059bfd49cfd1 | 1,641 | class AiInput < Component
# Dark red
NAME_COLOR = Gosu::Color.argb(0xeeb10000)
UPDATE_RATE = 10 # ms
attr_reader :name
attr_reader :stats
def initialize(name, object_pool)
super(nil)
@object_pool = object_pool
@stats = Stats.new(name)
@name = name
@last_update = Gosu.milliseconds
end
... | 23.112676 | 55 | 0.64351 |
ed275eb85adb38583a2cd85ef7818085c1f3ff14 | 206 | class AddIndexToWorld < ActiveRecord::Migration[5.2]
def change
add_index :worlds, [:result_no, :e_no, :generate_no], :unique => false, :name => 'resultno_eno'
add_index :worlds, :world
end
end
| 29.428571 | 99 | 0.699029 |
330c107e640bc8ba96009b82d4e341ad98873996 | 1,157 | class MupdfTools < Formula
desc "Lightweight PDF and XPS viewer"
homepage "http://mupdf.com"
url "http://mupdf.com/downloads/archive/mupdf-1.10a-source.tar.gz"
sha256 "aacc1f36b9180f562022ef1ab3439b009369d944364f3cff8a2a898834e3a836"
head "git://git.ghostscript.com/mupdf.git"
bottle do
cellar :any_skip... | 33.057143 | 92 | 0.703544 |
38749813269c9e179f971fa6a3db83da714fcc76 | 2,704 | #===============================================================================
# Elite Battle: DX
# by Luka S.J.
# ----------------
# System Settings
#===============================================================================
module EliteBattle
# Waiting period (in seconds) before battle "camera" starts ... | 35.116883 | 92 | 0.611317 |
21565bc0585f5323ad3341f69fc1250661ae352f | 1,240 | #
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
# Run `pod lib lint flutter_battery_optimize.podspec' to validate before publishing.
#
Pod::Spec.new do |s|
s.name = 'flutter_battery_optimize'
s.version = '0.0.1'
s.summary = 'Flutter plugin to ch... | 51.666667 | 200 | 0.658065 |
28e1750b4abf78039eb57664f798dc9950f53d5c | 1,830 | require 'honor_codes/core'
class License
OPEN_CHORUS = 'openchorus'
VENDOR_ALPINE = 'alpine'
VENDOR_PIVOTAL = 'pivotal'
LEVEL_EXPLORER = 'explorer'
LEVEL_BASECAMP = 'basecamp'
LEVEL_SUMMIT = 'summit'
def initialize(lic=nil)
unless lic
path = (File.exists?(license_path) ? license_path : default... | 17.102804 | 79 | 0.684699 |
018e2072713fa70d3b37ebd91c59660569b98fc1 | 3,164 | # -*- coding: utf-8 -*- #
# frozen_string_literal: true
module Rouge
module Lexers
class HyLang < RegexLexer
title "HyLang"
desc "The HyLang programming language (hylang.org)"
tag 'hylang'
aliases 'hy'
filenames '*.hy'
mimetypes 'text/x-hy', 'application/x-hy'
def se... | 33.305263 | 105 | 0.566056 |
7a25ba0dc0bd9c54cf7d6b6a0f199e4cdc817c47 | 1,644 | # -- Implementation
require 'yaml'
module Exemplor
extend self
def path(rel_path)
File.join(File.dirname(__FILE__), rel_path)
end
def version
File.read(path('/../VERSION'))
end
end
require Exemplor.path('/../vendor/orderedhash-0.0.6/lib/orderedhash')
require Exemplor.path('/ext')
require Exemp... | 24.176471 | 79 | 0.731144 |
acbf91ff9e51314d6cbc74db58f6fd43a53af752 | 8,647 | module Redom
class << self
def runtime
<<EOS
(function() {
var
TYPE_UNDEFINED = 0,
TYPE_PROXY = 1,
TYPE_ARRAY = 2,
TYPE_ERROR = 3,
TYPE_METHOD = 4,
REQ_HANDSHAKE = 0,
REQ_METHOD_INVOCATION = 1,
REQ_PROXY_RESULT = 2,
P_INFO_OID = 0,
P_INFO_RCVR = 1,
P_INFO_NAM... | 25.735119 | 102 | 0.461316 |
5d56cd0e4023e1b1fe37b8fbe73fb9adb54e318f | 1,048 | require_relative '../spec_helper'
describe Ravelry::YarnWeight do
it 'creates an instance of YarnWeight' do
yarn_weight = yw_initialize_with_data_and_id
expect(yarn_weight).to be_instance_of(Ravelry::YarnWeight)
end
context 'has and sets reader attributes for' do
before do
@yarn_weight = yw_in... | 24.952381 | 80 | 0.697519 |
e90d7c64cfc24f7eb23cd1d329ff06c84b334ad8 | 1,097 | require 'spec_helper'
describe Spree::Preferences::Store, :type => :model do
before :each do
@store = Spree::Preferences::StoreInstance.new
end
it "sets and gets a key" do
@store.set :test, 1
expect(@store.exist?(:test)).to be true
expect(@store.get(:test)).to eq 1
end
it "can set and get f... | 27.425 | 86 | 0.678213 |
39482ba6649a986a524410b9505c181fc9b592d2 | 238 | require "spec_helper"
describe Microkorg::Oscillator do
before :all do
@oscillator = Microkorg::Oscillator.new(1)
end
subject { @oscillator }
it { should respond_to :number } # 1, 2, 3
it { should respond_to :wave }
end
| 17 | 46 | 0.684874 |
ed6dd53dda5d34880d1cb8b2801e51a96b554530 | 1,576 | module Finicity::V1
module Request
class DiscoverAccountsWithMfa
include ::Finicity::Logger
extend ::HTTPClient::IncludeClient
include_http_client do |client|
client.receive_timeout = 180
client.cookie_manager = nil
end
##
# Attributes
#
attr_access... | 22.84058 | 92 | 0.536802 |
038eee9d1c50f10de65a951593fefea06adcb03a | 6,402 | # frozen_string_literal: true
# We don't use nokogiri because we use an alpine-based docker image
# And adding the required dependencies triples the size of the image
require 'rexml/document'
module TestSummaryBuildkitePlugin
module Input
WORKDIR = 'tmp/test-summary'
DEFAULT_JOB_ID_REGEX = /(?<job_id>[0-9a-... | 28.837838 | 106 | 0.573102 |
3360f2af039a6c90299dd7e65d959d9a2cacfcb1 | 29,250 | # frozen_string_literal: true
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 53.375912 | 336 | 0.561538 |
acc85d14119ef88afb905844a3ae4cd03ec9d4cb | 2,220 | # server-based syntax
# ======================
# Defines a single server with a list of roles and multiple properties.
# You can define all roles on a single server, or split them:
server "prep.mapc.org", user: "roadworks", roles: %w{app db web}
# server "example.com", user: "deploy", roles: %w{app web}, other_propert... | 33.134328 | 88 | 0.675225 |
e9c4ec49dbaf07c84f0894c496a2de560717f622 | 285 | class Bulletin < ApplicationRecord
belongs_to :user
belongs_to :board
validates :title, :content, presence: true
scope :alpha, -> { order(:title) }
def self.latest_bulletins
where("created_at >=?", Time.zone.today.beginning_of_day)
end
end
| 16.764706 | 63 | 0.649123 |
5d2e296794766047799d61542c41903bb7315e2a | 4,506 | # -*- coding: utf-8 -*-
require "spec_helper"
describe Mongoid::Equality do
let(:klass) do
Person
end
let(:person) do
Person.new
end
describe "#==" do
context "when comparable is not a document" do
let(:other) do
"Document"
end
it "returns false" do
expect(... | 18.619835 | 65 | 0.545939 |
f735c3d516c873b81874eac1861c11cf0bdd80a2 | 510,467 | # 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/credentials_configuration.rb'
... | 43.048322 | 612 | 0.65235 |
1a61259e0803162473b3edd9529706e50633aa5e | 2,135 | # rubocop:disable Style/FrozenStringLiteralComment
# We don't freeze strings here due to the PayPal SDK modifying string literals
module Area
class RafflesController < BaseController
before_action :verify_order_id, only: %i[create]
before_action :set_watched_area, only: %i[new]
before_action :set_meta, o... | 23.206522 | 78 | 0.650585 |
793c825931f7b157154315ead0c0c30c82b8cde3 | 492 | module SpreeActiveSale
class Engine < Rails::Engine
require 'spree/core'
isolate_namespace Spree
engine_name 'spree_active_sale'
# use rspec for tests
config.generators do |g|
g.test_framework :rspec
end
def self.activate
Dir.glob(File.join(File.dirname(__FILE__), '../../app/... | 23.428571 | 88 | 0.664634 |
bff851f86bff3f09ad61d0e83f1b79a06a64ea76 | 2,425 | require 'forwardable'
module Mhc
class Occurrence
include Comparable
extend Forwardable
def_delegators :@event,
:path,
:alarm,
:categories,
:description,
:body,
:location,
:priority,
:record_id,
:uid,
:subject,
:recurrence_tag,
:mission_tag,
:allday?,
... | 20.550847 | 154 | 0.57732 |
38cf33bc374a0b208f9918b6d3c0dbf5ce2a65ac | 1,359 | require 'rubygems'
require 'sinatra'
# require 'sinatra/reloader'
get '/' do
erb "Hello! <a href=\"https://github.com/bootstrap-ruby/sinatra-bootstrap\">Original</a> pattern has been modified for <a href=\"http://rubyschool.us/\">Ruby School</a>"
end
get '/about' do
erb :about
end
get '/visit' do
erb :visit
en... | 22.278689 | 173 | 0.635026 |
0107ee48c304d791a0fd105ae7f208405a95106b | 7,686 | =begin
#NSX-T Manager API
#VMware NSX-T Manager REST API
OpenAPI spec version: 2.5.1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.19
=end
require 'date'
module NSXT
# List all the peer endpoints.
class IPSecVPNPeerEndpointListResult
# Link to this resou... | 28.894737 | 107 | 0.608249 |
034c822177d4c1cba06ddbfd12164048a968352d | 416 | Rails.application.routes.draw do
get 'sessions/new'
get 'users/new'
root 'static_pages#home'
get '/help', to: 'static_pages#help'
get '/about', to: 'static_pages#about'
get '/contact', to: 'static_pages#contact'
get '/signup', to: 'users#new'
get '/login', to: 'sessions#new'
post '/lo... | 18.086957 | 45 | 0.641827 |
e9e09a45cc8d73e0f003b47b867d25896b845a00 | 9,832 | require 'hanami/utils'
module Hanami
# Registered components
#
# @since 0.9.0
# @api private
#
# @see Hanami::Components
module Components # rubocop:disable Metrics/ModuleLength
# Require the entire project
#
# @since 0.9.0
# @api private
register 'all' do
requires 'mailer', 'mo... | 24.216749 | 106 | 0.599471 |
21c8f636940c44424860e1c6a34c59e95e83221a | 314 | policy :hiera do
lookup :skip do
datasource :dummy, { :return => 'foo'}
confine request.key, 'never' # never use this lookup
end
lookup :default do
datasource :file, {
:format => :yaml,
:docroot => "/var/lib/hiera",
:searchpath => [
"common"
],
}
end
end
| 16.526316 | 56 | 0.544586 |
ab20bd3e2d1660d84bcc746891b630c87c75dca8 | 825 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'test_gem/version'
Gem::Specification.new do |spec|
spec.name = "test_gem"
spec.version = TestGem::VERSION
spec.authors = ["manga_osyo"]
spec.email = ["manga.o... | 33 | 74 | 0.64 |
f8d76b49bd03017ce7dc0414b86381af549ce6f9 | 127 | class AddNameColumnToLocations < ActiveRecord::Migration[5.2]
def change
add_column :locations, :name, :string
end
end
| 21.166667 | 61 | 0.755906 |
e22b808da134cc94d56034f7da7d87eb6f7092f4 | 10,099 | ##
# This code was generated by
# \ / _ _ _| _ _
# | (_)\/(_)(_|\/| |(/_ v1.0.0
# / /
#
# frozen_string_literal: true
module Twilio
module REST
class Pricing < Domain
class V1 < Version
class PhoneNumberList < ListResource
class CountryList < ListResource
... | 37.128676 | 114 | 0.528963 |
61548b85d8c1d9695b8a32c593f4bcc5a2bd535f | 1,349 | require 'test_helper'
class IngredientsControllerTest < ActionController::TestCase
setup do
@ingredient = ingredients(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:ingredients)
end
test "should get new" do
get :new
assert_response :... | 26.98 | 188 | 0.734618 |
613d8642e42843655d2b0309a5ad1f7965c1ac66 | 431 | # == Schema Information
#
# Table name: working_groups
#
# id :bigint not null, primary key
# local_group_id :bigint not null
# name :string
# created_at :datetime not null
# updated_at :datetime not null
# color :string
#
require 'test_h... | 21.55 | 57 | 0.587007 |
e83e425afe0345aba1b15bfe8ccf19f41afec6a6 | 6,200 | module RestClient
STATUSES = {100 => 'Continue',
101 => 'Switching Protocols',
102 => 'Processing', #WebDAV
200 => 'OK',
201 => 'Created',
202 => 'Accepted',
203 => 'Non-Authoritative Information', # http/1.1
204 => 'N... | 30.392157 | 161 | 0.591613 |
f705dafaf2adab1d63bcc6c67f82fb73521a1439 | 158 | # Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_rails4_crud_with_angularjs_session'
| 39.5 | 96 | 0.829114 |
011f6f35328acbbd371b6252a4736b78f9cf6d1e | 1,136 | Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = 'mongoid_rails_migrations'
s.version = '0.0.14'
s.summary = 'Data migrations for Mongoid in Active Record style, minus column input.'
s.description = 'Migrations for the migrator.'
# only tested with 1.9.1, but let's ... | 39.172414 | 139 | 0.631162 |
33ac03afaebed840628b8be80e1c42bb48665ebe | 308 | # frozen_string_literal: true
require_relative 'test_base'
class AliveTest < TestBase
def self.hex_prefix
'198'
end
# - - - - - - - - - - - - - - - - -
test '93b',
%w( its alive ) do
assert alive?
end
private
def alive?
JSON.parse(avatars.alive?[2][0])['alive?']
end
end
| 12.833333 | 46 | 0.571429 |
d521e00afe8f9961683149e659a811090c7009b4 | 283 | class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
helper_method :namespace
def namespace
names = self.class.to_s.split('::')
return "null" if names.length < 2
names[0..(names.length-2)].map(&:downcase).join('_')
end
end
| 23.583333 | 56 | 0.706714 |
ac862745a9449bc46ab10c4561a23ce8858bd60a | 254 | require 'preload/version'
require 'preload/array_mixin'
Array.send(:include, Preload::ArrayMixin)
begin
require 'will_paginate'
require 'will_paginate/collection'
WillPaginate::Collection.send(:include, Preload::ArrayMixin)
rescue LoadError
end
| 19.538462 | 62 | 0.795276 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.