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 |
|---|---|---|---|---|---|
1aa00216a01f2d03eb81c64ffb0cb081884d517f | 2,063 | # Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "varnish-rb"
s.version = "0.2.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubyg... | 30.338235 | 105 | 0.619971 |
bf2dac1597c16d225a9e9101b937aa456b6f20ec | 1,026 | require_relative './answer_formatter.rb'
module BaseballNews
class Answerer
def answer(*arg)
msg = arg[0]
return unless msg =~ /\A野球(|速報)/
msg_a = msg.split
return AnswerFormatter.day_all_game if msg_a[1].nil?
teamnum = fetcher msg_a.last
date = AnswerFormatter.make_date teamn... | 27.72973 | 63 | 0.546784 |
111f3855835c0efe487509ba56206012b0f11d12 | 3,782 | # frozen_string_literal: true
require "spec_helper"
describe Innodb::Page::Index do
before :all do
@space = Innodb::Space.new("spec/data/t_empty.ibd")
@page = @space.page(3)
end
describe "class" do
it "registers itself as a specialized page type" do
Innodb::Page.specialization_for?(:INDEX).s... | 29.546875 | 84 | 0.690904 |
f8050b874b4d96c533e0b9d5ac5f68896223ed9c | 362 | # frozen_string_literal: true
class NewestWorksController < ApplicationV6Controller
include WorkListable
def index
set_page_category PageCategory::NEWEST_WORK_LIST
@works = Work
.only_kept
.preload(:work_image)
.order(id: :desc)
.page(params[:page])
.per(display_works_count)... | 19.052632 | 53 | 0.707182 |
5d7b0b5ce1422028d282bd2cd16db47a38057e55 | 623 | $LOAD_PATH << File.expand_path("../lib", __FILE__)
require 'slice_rename'
Gem::Specification.new do |s|
s.name = 'slice_rename'
s.version = SliceRename::VERSION
s.executables << 'slice_rename'
s.authors = ['Zoee Silcock']
s.email = %q{mrzoee@gmail.com}
s.homepage = %q{https://github.com/rocketpants/slice_... | 31.15 | 73 | 0.672552 |
918b03dbff5dfa955126c4105a56a51083e9db39 | 3,221 | # 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_06_01
module Models
#
# Private dns zone group resource.
#
class PrivateDnsZoneGroup < SubResource
... | 30.971154 | 78 | 0.502639 |
1c5437f1a93c4857bab2583944cbb9e66215a227 | 2,512 | class NewHermes
attr_reader :sell_price, :notifier, :pair, :poloniex_clazz, :redis
attr_accessor :last_buy_usd, :profit_sum
def initialize(pair, poloniex_clazz, redis)
@pair = pair
@profit_sum = 0.0
@poloniex_clazz = poloniex_clazz
@redis = redis
end
def last_buy_price
@last_buy_price ||... | 23.698113 | 245 | 0.663615 |
4ae3798fceea4ff60964f07ae7058932063908ca | 649 | class API
def self.tequila_drinks
response = HTTParty.get("https://www.thecocktaildb.com/api/json/v1/1/filter.php?i=tequila")
response["drinks"].each do |arr|
arr.reject! {|attr| attr == "strDrinkThumb"}
TequilaDrink.new(arr)
end
end
def self.tequila_by_id(t... | 25.96 | 99 | 0.604006 |
bfbb195690938402abad95a960c9e7b0577c0a2a | 39,331 | # Copyright 2014-2015 Taxamo, Ltd.
# 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 [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
#
# Unless required by applicab... | 32.264971 | 389 | 0.626452 |
0366ae87ff46296aa145d7efb776a935f59896cb | 122 | # frozen_string_literal: true
class ChannelsWebHook < ApplicationRecord
belongs_to :channel
belongs_to :web_hook
end
| 17.428571 | 41 | 0.819672 |
030e5e6c9c767f911394a2045fc55aee2e85b878 | 4,538 | # 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
#
# Describes a virtual machine scale set network profile's network
# configurations.
#
class Vir... | 33.367647 | 96 | 0.529749 |
6a370a59e1937149231770a6017a7d83a39189a9 | 112 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'rake-multifile'
require 'minitest/autorun'
| 22.4 | 58 | 0.75 |
33136b6c9d4e4dfb8fc12d16eba71d2b2b906e66 | 861 | module YeetDba
class VerifyData
attr_accessor :column
def initialize(column:)
@column = column
end
def orphaned_rows?
orphaned_rows.first
end
def orphaned_rows_count
orphaned_rows.count
end
def query
orphaned_rows.to_sql
end
def orphaned_rows
... | 21.525 | 129 | 0.650407 |
e202f5a1632e70ff3729f0cca6a887ad595ca3fb | 275 | cask 'auto-updates' do
version '2.57'
sha256 'e44ffa103fbf83f55c8d0b1bea309a43b2880798dae8620b1ee8da5e1095ec68'
url "file://#{TEST_FIXTURE_DIR}/cask/transmission-2.61.dmg"
homepage 'http://example.com/auto-updates'
auto_updates true
app 'Transmission.app'
end
| 22.916667 | 75 | 0.770909 |
382e625c0378d0549b9465eafde6cc1ea2fb4b66 | 2,803 | # frozen_string_literal: true
#
# Copyright:: 2019, Chef Software, Inc.
# Author:: Tim Smith (<tsmith@chef.io>)
#
# 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/licen... | 33.771084 | 113 | 0.617196 |
086fbb9deebead3c9b97273a44041bfab3be113a | 540 | # frozen_string_literal: true
module GraphQL8
module Types
module Relay
# This can be used for Relay's `Node` interface,
# or you can take it as inspiration for your own implementation
# of the `Node` interface.
module Node
include Types::Relay::BaseInterface
default_relay... | 28.421053 | 70 | 0.646296 |
616e89a0d895055a0b751add5aef69c8093c5798 | 292 | class CreateLicenses < ActiveRecord::Migration
def self.up
create_table :licenses do |t|
t.column :name, :string
t.column :short_name, :string
t.column :url, :string
t.column :identifier, :string
end
end
def self.down
drop_table :licenses
end
end
| 19.466667 | 46 | 0.657534 |
ed397735586bbc22baeb56b55625a816f3eb395b | 6,387 | #
# Copyright 2011-2013, Dell
# Copyright 2013-2014, SUSE LINUX Products GmbH
#
# 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 requi... | 29.164384 | 96 | 0.655394 |
bf2e2cee51ffdfa18f1aba9ad01e6610381c38f7 | 778 | Pod::Spec.new do |s|
s.name = "WJNetworkContextService"
s.version = "1.0.1"
s.summary = "network context service."
s.description = <<-DESC
网络环境服务,网络连接状态、通知等
DESC
s.homepage = "https://github.com/yunhaiwu"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "吴云海" =... | 21.027027 | 117 | 0.620823 |
e2781c80c948b8fa795080885ea076bd347fd74c | 5,555 | =begin
#Square Connect API
OpenAPI spec version: 2.0
Contact: developers@squareup.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end
require 'date'
module SquareConnect
#
class BatchDeleteCatalogObjectsRequest
# The IDs of the [CatalogObject](#type-catalogobject)s to be deleted. When... | 29.391534 | 306 | 0.626643 |
ff678477368f9480ab5760dabae7bb105376c9a3 | 2,125 | require 'uri'
module RHC
module Rest
class Base
include Attributes
extend AttributesClass
define_attr :messages
URI_ESCAPE_REGEX = Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")
def initialize(attrs=nil, client=nil)
@attributes = (attrs || {}).stringify_keys!
@attri... | 26.234568 | 128 | 0.519529 |
792e38e2aead129a69936c53c75bf09b8a80e3bd | 932 | # frozen_string_literal: true
require "spec_helper"
require "net/http"
describe "health server" do
before(:all) do
@server = Object.new.tap do |obj|
obj.define_singleton_method(:running?) { true }
end
@health_server = AnyCable::HealthServer.new(
@server,
port: 54_321
)
@health... | 23.897436 | 72 | 0.654506 |
bffb70a564fe4e88de8d69a9d2e7a5b4a8aece1e | 175 | FactoryBot.define do
factory :project_transition do
association :project
most_recent { true }
to_state { 'online' }
sort_key { generate(:serial) }
end
end
| 19.444444 | 34 | 0.685714 |
18c603c3d4d733dc1fd1b961ebdd903c6cc3b7f9 | 494 | class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
helper :all
def authenticate_active_admin_user!
authenticate_user!
unless current_user
flash[:alert]... | 23.52381 | 56 | 0.736842 |
392d77fd7a1ba0264f1bbb332190bb48200797fc | 3,257 | module HappyMapper
module SupportedTypes
extend self
#
# All of the registerd supported types that can be parsed.
#
# All types defined here are set through #register.
#
def types
@types ||= []
end
#
# Add a new converter to the list of supported types. A converter
... | 23.264286 | 76 | 0.610685 |
1d4f2a8d9436603e5a2aa1379b8f9226a59307b2 | 942 | require 'perigren_github_webhooks'
RSpec.describe PerigrenGithubWebhooks::CreateEventService, type: :service do
let(:test_data) { JSON.parse(File.read('spec/test_data/webhooks/event-create.json')) }
describe '#perform' do
event = nil
before do
event = described_class.new(test_data).perform
end... | 30.387097 | 88 | 0.694268 |
5d048610b2bc7d2dc49ff015728638cde30f10ce | 1,703 | require 'rails_admin/config/fields/association'
module RailsAdmin
module Config
module Fields
module Types
class BelongsToAssociation < RailsAdmin::Config::Fields::Association
RailsAdmin::Config::Fields::Types.register(self)
register_instance_option :formatted_value do
... | 34.06 | 285 | 0.665884 |
39c88b349b852bed630eef2561a8de223361dc76 | 82 | class ApplicationController < ActionController::Base
include LogQueryParams
end
| 20.5 | 52 | 0.853659 |
792640fb0275d28363aec1b4299b2a8a7d0c8ff2 | 361 | class AddUsaMembershipConfigToEventConfigurations < ActiveRecord::Migration[4.2]
def up
add_column :event_configurations, :usa_membership_config, :boolean, default: false
execute "UPDATE event_configurations SET usa_membership_config = true WHERE usa = true"
end
def down
remove_column :event_configur... | 32.818182 | 91 | 0.800554 |
e8a2a1a0d593c9b12287a37c0ce863689ac7b9bc | 4,310 | require File.expand_path(File.dirname(__FILE__) + '/neo')
# Project: Create a Proxy Class
#
# In this assignment, create a proxy class (one is started for you
# below). You should be able to initialize the proxy object with any
# object. Any messages sent to the proxy object should be forwarded
# to the target objec... | 21.767677 | 91 | 0.697912 |
ffba30bb93a954f52b0a4be9b18bb8fe7ef40da1 | 444 | module Lolita
module Configuration
class FieldSet
@@last_fieldset=0
attr_reader :parent
attr_accessor :name
def initialize parent,name=nil
@parent=parent
self.name=name || "fieldset_#{next_fieldset}"
end
def fields
self.parent.fields.reject{|f|... | 17.076923 | 56 | 0.596847 |
219120587cb3f925731a585af05d2f476fe81e64 | 319 | module CompareFiles
class DiffTools
# pass in arrays of filtered items to compare against one another
def self.new_right(left, right)
left ||= []
right ||= []
right - left
end
def self.new_left(left, right)
left ||= []
right ||= []
left - right
end
end
end
| 17.722222 | 69 | 0.570533 |
ab93b49c840789240b6fddbd36fc7727f59e2e54 | 312 | cask :v1 => 'air-video-server' do
version '2.4.6-beta3u2'
sha256 '479af913987a4cc8414969a8d4a4c164a4bd0a22d156829a983b4c58e9dd3f6e'
url "https://s3.amazonaws.com/AirVideo/Air+Video+Server+#{version}.dmg"
homepage 'http://www.inmethod.com/air-video/'
license :unknown
app 'Air Video Server.app'
end
| 28.363636 | 75 | 0.75 |
1c542f5767a74a17cd7d191707cd5245605df8d4 | 2,176 | ActiveRecord::Migration.suppress_messages do
%w{gates multiple_gates readers writers transients simples no_scopes multiple_no_scopes no_direct_assignments multiple_no_direct_assignments thieves multiple_thieves localizer_test_models persisted_states provided_and_persisted_states with_enums with_enum_without_columns m... | 36.881356 | 481 | 0.753217 |
61af8354f1ba50b6b18be41b7941093d485b57ea | 147 | module EShipper
class Status < OpenStruct
POSSIBLE_FIELDS = [ :name, :date, :assigned_by, :comments ]
REQUIRED_FIELDS = []
end
end | 21 | 63 | 0.666667 |
e9b5dfaeacb8093ada353b9ce009f74fe3eb39ce | 12,845 | LightweightStandalone::Application.routes.draw do
resources :approved_scripts
resources :projects do
member do
get :about
get :help
get :contact_us
end
end
resources :themes
root :to => 'home#home'
resources :question_trackers do
member do
post 'add_embeddable'
... | 51.794355 | 256 | 0.672168 |
e290904d7416b72959c203f46b57230bf06c8e1c | 209 | class AddNotNullToTransactionUuids < ActiveRecord::Migration[4.2]
def change
change_column_null :transactions, :listing_uuid, false
change_column_null :transactions, :community_uuid, false
end
end
| 29.857143 | 65 | 0.799043 |
e925ae0c3fd8e255b17d58cd0d1843c813e9d9d9 | 401 | class ChangeImageSearchLabelToNullableOnAffiliates < ActiveRecord::Migration
def self.up
change_column_null :affiliates, :image_search_label, true
rename_column :affiliates, :image_search_label, :old_image_search_label
end
def self.down
rename_column :affiliates, :old_image_search_label, :image_searc... | 33.416667 | 76 | 0.812968 |
ab02f7948e09b1305cb18ad6790d9819f8391bf5 | 809 | module Twine
@@stdout = STDOUT
@@stderr = STDERR
def self.stdout
@@stdout
end
def self.stdout=(out)
@@stdout = out
end
def self.stderr
@@stderr
end
def self.stderr=(err)
@@stderr = err
end
class Error < StandardError
end
require 'twine/version'
require 'twine/plugin'
... | 19.261905 | 37 | 0.710754 |
87a83dc96d36ad9d94d0a1b31d894629512971ec | 385 | # 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
#
# Defines values for ConnectionMonitorEndpointFilterItemType
#
module ConnectionMonitorEndpointFilt... | 25.666667 | 70 | 0.755844 |
1a2aae1e3ca85118a1fa5c7a8740adc2aa074f52 | 12,608 | module Blacklight
##
# This module contains methods that are specified by SolrHelper.solr_search_params_logic
# They transform user parameters into parameters that are sent as a request to Solr when
# RequestBuilders#solr_search_params is called.
#
module RequestBuilders
extend ActiveSupport::Concern
... | 43.32646 | 230 | 0.668544 |
0861de53695a1deaae8dc4a2ee1815a41f68c6d3 | 4,473 | # coding: utf-8
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'alchemy/version'
Gem::Specification.new do |gem|
gem.name = 'alchemy_cms'
gem.version = Alchemy::VERSION
gem.platform = Gem::Platform::RUBY
gem.aut... | 55.222222 | 144 | 0.539235 |
28faef7a669fe0ea5f09e7bad4acc9e6e828833e | 2,684 | require 'middleman-core'
module Middleman
module Cells
class Extension < ::Middleman::Extension
option :cells_dir, 'cells', 'Directory where to place cells'
option :autoload, true, 'Whether to autoload cells or not'
def initialize(app, options_hash={}, &block)
super
require 'c... | 34.410256 | 94 | 0.616617 |
acf034d294d96a0618d025f209b63061cb5116cc | 179 | class AddButtonFields < ActiveRecord::Migration[5.1]
def change
add_column :applications, :button_url, :string
add_column :applications, :button_text, :string
end
end
| 25.571429 | 52 | 0.75419 |
1892365f12c0a96ecd0137f94d56a71377ec2553 | 131 | class AddQuantityIntegerToColors < ActiveRecord::Migration[5.2]
def change
add_column :colors, :quantity, :integer
end
end
| 21.833333 | 63 | 0.763359 |
616423c8e0fe3be17f175ef69ae896d19cefad8e | 503 | module Api
module V1x0
module Mixins
module IndexMixin
def index
raise_unless_primary_instance_exists
render :json => Insights::API::Common::PaginatedResponseV2.new(
:base_query => scoped(filtered.where(params_for_list)),
:request => request,
... | 26.473684 | 73 | 0.5666 |
18425a77a30a821a027890c0090fd8a23aadfeb4 | 379 | # Program logger - method puts bookends on block, and the returned data
def log description, &block
puts "Beginning '#{description}'"
response = block.call
puts "Finished '#{description}' returning:"
puts response
end
log 'outer block' do
log 'some little block' do
5
end
log 'yet anothe... | 19.947368 | 72 | 0.656992 |
d5aefa3343ae0f2545301006853de1737ddd5bf2 | 1,706 | require 'test_helper'
class UsersLoginTest < ActionDispatch::IntegrationTest
def setup
@user = users(:michael)
end
test "login with valid email/invalid password" do
get login_path
assert_template 'sessions/new'
post login_path, params: { session: { email: @user.email,
... | 31.018182 | 66 | 0.662368 |
912b67678ef00edbab1df74cbb7a9a4369172f17 | 1,456 | module Payments
AlreadyAuthorized = Class.new(StandardError)
NotAuthorized = Class.new(StandardError)
AlreadyCaptured = Class.new(StandardError)
AlreadyReleased = Class.new(StandardError)
class Payment
include AggregateRoot
def authorize(transaction_id, order_id)
raise AlreadyAuthorized if aut... | 21.731343 | 57 | 0.65522 |
e88e3d74905bf7747df53217c574c1d47a019b3e | 4,646 | # encoding: UTF-8
# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0
require 'spec_helper'
describe TwitterCldr::Localized::LocalizedDateTime do
let(:date_time) { DateTime.new(1987, 9, 20, 22, 5) }
describe '#initialize' do
it 'sets calendar type' do
expect(date_time.localize(... | 34.932331 | 104 | 0.690486 |
b9947b91f114f5f161046ca6aeff621f0eaf1be9 | 205 | class WikipediaController < ApplicationController
include WikipediaHelper
def manufacturer
render plain: get_manufacturer_summary
end
def model
render plain: get_model_summary
end
end
| 18.636364 | 49 | 0.790244 |
3980cc07b8dd0d9dbfbf606ef374a7af551d92ea | 610 | require "test_helper"
class ServicesAndInformationFinderTest < ActiveSupport::TestCase
test "#find searches rummager for the services and information for an org" do
organisation = build_stubbed(:organisation)
search_client = mock()
expected_search_query = {
count: "0",
filter_organisations: [... | 32.105263 | 89 | 0.759016 |
331deae894f91986a221440978f8f618eebc91e2 | 2,691 | require "formula"
class Babl < Formula
desc "Dynamic, any-to-any, pixel format translation library"
homepage "http://www.gegl.org/babl/"
stable do
# The official url is unreliable. Use Debian instead.
url "https://mirrors.kernel.org/debian/pool/main/b/babl/babl_0.1.10.orig.tar.bz2"
mirror "http://ft... | 29.9 | 104 | 0.677443 |
b920b880db23c21571e87629812c61af1c382223 | 1,802 | require 'active_support/callbacks'
require 'active_support/core_ext/module/attribute_accessors_per_thread'
require 'concurrent'
module ActionCable
module Server
# Worker used by Server.send_async to do connection work in threads.
class Worker # :nodoc:
include ActiveSupport::Callbacks
thread_mat... | 25.027778 | 99 | 0.617092 |
e2e7ec40a2a478eef983059d238314ffec514e82 | 1,825 | class K3d < Formula
desc "Little helper to run Rancher Lab's k3s in Docker"
homepage "https://k3d.io"
url "https://github.com/rancher/k3d/archive/v3.1.5.tar.gz"
sha256 "1e4b88265c697704e5b0d12b167b41add73e327644ee1b27ec813590cd5170df"
license "MIT"
livecheck do
url :stable
regex(/^v?(\d+(?:\.\d+)+)... | 38.829787 | 110 | 0.700822 |
21d00c7ff78f703f398b1a3e957a95687e86f776 | 2,883 | # frozen_string_literal: true
module RuboCop
module Cop
module Style
# This cop checks for the formatting of empty method definitions.
# By default it enforces empty method definitions to go on a single
# line (compact style), but it can be configured to enforce the `end`
# to go on its o... | 24.853448 | 80 | 0.53035 |
e9f00a900dfddf76bfd298634fa6e62198fe6774 | 2,435 | class KeystoneDevelop < Formula
desc 'Securely share application secret with your team'
homepage 'https://keytone.sh'
head 'https://github.com/wearedevx/keystone.git', branch: 'develop'
url 'https://github.com/wearedevx/keystone/archive/develop.tar.gz'
sha256 '4c43cc962976c6b91f0c74a789ebdde6dd08bf147a4390aab... | 36.343284 | 138 | 0.67269 |
bbcbc439ab7ea1d4bf88bec2dae5a316fd131a31 | 1,002 | require "rails_helper"
if ExchangeTestingConfigurationHelper.individual_market_is_enabled?
require File.join(Rails.root, "app", "data_migrations", "deactivate_consumer_role")
describe DeactivateConsumerRole, dbclean: :after_each do
let(:given_task_name) { "deactivate_consumer_role" }
subject { DeactivateConsum... | 29.470588 | 90 | 0.733533 |
1cb98da5535694bffdfb64713c19346301b8bfdd | 2,916 | module Pry::Config::Behavior
ASSIGNMENT = "=".freeze
NODUP = [TrueClass, FalseClass, NilClass, Symbol, Numeric, Module, Proc].freeze
INSPECT_REGEXP = /#{Regexp.escape "default=#<"}/
module Builder
def from_hash(hash, default = nil)
new(default).tap do |config|
config.merge!(hash)... | 20.828571 | 106 | 0.622428 |
91bb84dd50f7d730d7123c7e6d31a7e1e9288557 | 1,523 | # Copyright (c) 2018 Public Library of Science
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, pub... | 41.162162 | 76 | 0.772817 |
216d53a1371af0b78a65d2ca5668f127bac35442 | 1,977 | <% if namespaced? -%>
require_dependency "<%= namespaced_path %>/application_controller"
<% end -%>
<% module_namespacing do -%>
class <%= controller_class_name %>Controller < ApplicationController
before_action :set_<%= singular_table_name %>, only: [:show, :edit, :update, :destroy]
# GET <%= route_url %>
def ... | 28.652174 | 118 | 0.614062 |
e8a9ea4bbd0f80b2bb45d07d5a0afea5b150f401 | 990 | $:.unshift File.expand_path("../lib", __FILE__)
require 'sinatra/asset_pipeline/version'
Gem::Specification.new do |gem|
gem.name = "sinatra-asset-pipeline"
gem.version = Sinatra::AssetPipeline::VERSION
gem.authors = ["Joakim Ekberg"]
gem.email = ["jocke.ekberg@gmail.com"]
gem.description = "An asset pipeli... | 39.6 | 130 | 0.70404 |
f897a38b14aa90ec4125afe11ae4c34a5ff4e629 | 353 | require 'rspotify/oauth'
#includes client id, client secret, and the scopes specified grants access to a user's country as well as "Your Music" library
Rails.application.config.middleware.use OmniAuth::Builder do
provider :spotify, "b9e86650cc7a4733a7e24180f5b9014a", "e47d7214bf674d5586916f70b0bc68bd", scope: 'user-... | 58.833333 | 135 | 0.813031 |
f70291d363271f9afb07b7b7d421362216695481 | 1,419 | class AmazonCharts::CLI
def call
greeting
menu
end
def greeting
puts <<~DOC
Welcome to the Amazon Charts App!
Here are the top selling books for:
*** #{AmazonCharts::Scraper.date} ***
DOC
end
def menu
input = nil
while input != "exit"
puts <<~DOC
Please select [1] to see the top 20 b... | 19.708333 | 73 | 0.591261 |
1ad763158ecddd62fe54d1640626db548417b27e | 615 | module Disposable009
class Twin
# hash for #update_attributes (model API): {title: "Future World", album: <Album>}
def self.save_representer
# TODO: do that only at compile-time!
save = Class.new(write_representer) # inherit configuration
save.representable_attrs.
find_all { |attr| a... | 29.285714 | 86 | 0.604878 |
1cde3a15ab860edab48d067cee19f9d7a6d27223 | 319 | class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
include SessionsHelper
private
# confirms a logged in user
def logged_in_user
unless logged_in?
store_location
flash[:danger] = "Please log in"
redirect_to login_url
end
end
end
| 17.722222 | 52 | 0.705329 |
bbecf1130668ea083fb899b34235d5d6b8c2dcf6 | 345 | require 'rails_helper'
RSpec.feature "Quick Reference" do
describe "pipelines" do
it "should render valid json" do
visit "/docs/quick-reference/pipelines.json"
body = JSON.parse(page.body)
expect(body).to be_a Hash
expect(body["steps"]).to be_an Hash
expect(body["notify"]).to be_a... | 21.5625 | 50 | 0.666667 |
ffb036de1075714c283719df8ee8385ca8ab0140 | 5,769 | #
# Whimsy pubsub support: watches for updates to the whimsy repository,
# fetches the changes and deploys them.
#
# For usage instructions, try
#
# ruby pubsub.rb --help
#
require 'optparse'
require 'ostruct'
require 'etc'
require 'net/http'
require 'json'
require 'fileutils'
# extract script name
script = File.ba... | 24.341772 | 78 | 0.651759 |
ac2b0602d525ce8620eabc15bf2586e75337c88e | 514 | module ActionText
module Serialization
extend ActiveSupport::Concern
class_methods do
def load(content)
new(content) if content
end
def dump(content)
case content
when nil
nil
when self
content.to_html
else
new(content).... | 15.575758 | 33 | 0.568093 |
1d10ab576b2d412e0fc2830d1f0122f5d5050164 | 217 |
namespace :ofac do
desc "Loads the current file from http://www.treas.gov/offices/enforcement/ofac/sdn/delimit/index.shtml."
task :update_data => :environment do
OfacSdnLoader.load_current_sdn_file
end
end | 27.125 | 107 | 0.769585 |
e2bfa19ec180016095918bda42d379f22d695354 | 914 | # frozen_string_literal: true
module SecurityHelper
def instance_security_dashboard_data
{
dashboard_documentation: help_page_path('user/application_security/security_dashboard/index', anchor: 'instance-security-dashboard'),
empty_dashboard_state_svg_path: image_path('illustrations/security-dashboard... | 50.777778 | 139 | 0.821663 |
11003c2fb243ed577568354b0192db3ed6fca77a | 10,644 | # This script takes a class name, an investigation, study, and assay xml configuration file as its arguments and generates
# a java class representing and validating that configuration in isa4j
require "nokogiri"
class_name = ARGV[0]
investigation_xml = Nokogiri::XML(File.open(ARGV[1])) { |conf| conf.noblanks }
study... | 37.216783 | 171 | 0.721533 |
38e9e6a71ef5c3b517ea047424667d87ca186cb3 | 502 | class CreateConfigurations < ActiveRecord::Migration
def up
create_table :configurations do |t|
t.references :customer, index: true
t.boolean :send_birthdays, null: false, default: false
t.string :text_birthdays
end
add_foreign_key :configurations, :customers
Customer.find_each do... | 22.818182 | 60 | 0.7251 |
ab1353e3369d0540f1c40d67c2f8afac98d1f567 | 9,453 | require 'rails_helper'
describe 'Merge request', :js do
let(:user) { create(:user) }
let(:project) { create(:project, :repository) }
let(:project_only_mwps) { create(:project, :repository, only_allow_merge_if_pipeline_succeeds: true) }
let(:merge_request) { create(:merge_request, source_project: project) }
l... | 32.262799 | 111 | 0.655665 |
1d4489acc37b330629084a316d44cfdb7c2b8604 | 925 | # frozen_string_literal: true
RSpec.describe "bundle command names" do
it "work when given fully" do
ensure_no_gemfile
bundle "install"
expect(err).to eq("Could not locate Gemfile")
expect(last_command.stdboth).not_to include("Ambiguous command")
end
it "work when not ambiguous" do
ensure_no... | 28.90625 | 83 | 0.711351 |
91963bba7381d15b9f9d097e2d09fd866248745c | 1,623 | require 'English'
require 'rubygems/command'
require 'rubygems/version_option'
require 'rubygems/util'
class Gem::Commands::OpenCommand < Gem::Command
include Gem::VersionOption
def initialize
super 'open', 'Open gem sources in editor'
add_option('-e', '--editor EDITOR', String,
"Opens ge... | 21.64 | 74 | 0.655576 |
289ef3667eae48c29cbf7e2ddd4f148c24e557dd | 3,844 | require "test_helper"
require "mediainfo_test_helper"
class MediainfoTest < ActiveSupport::TestCase
supported_attributes = [
:codec_id,
:duration,
:format,
:format_profile,
:format_info,
:overall_bit_rate,
:writing_application,
:writing_library,
:mastered_date,
:tagged_da... | 25.124183 | 97 | 0.699792 |
4a36c6776e99e7f28ce61ebad8026fdf0fb42f70 | 1,871 | #
# Cookbook Name:: hue
# Recipe:: default
#
# Copyright 2019, Zyelabs
#
# All rights reserved - Do Not Redistribute
#
include_recipe 'yum'
include_recipe 'java'
include_recipe 'git'
group node[:hue][:group] do
action :create
end
user node[:hue][:user] do
gid node[:hue][:group]
shell '/bin/bash'
manage_home t... | 21.505747 | 103 | 0.697488 |
ed5dcaca8349628eaa34449301c47a44d62df7b8 | 284 | class Texnicle < Cask
url 'http://www.bobsoft-mac.de/resources/TeXnicle/2.2/TeXnicle.app.2.2.9.zip'
homepage 'http://www.bobsoft-mac.de/texnicle/texnicle.html'
version '2.2.9'
sha256 '2076a2922bd156ac6e6af1afbb58bd928579a457f500fae40024f24f65a5e5dd'
link 'TeXnicle.app'
end
| 35.5 | 79 | 0.774648 |
332f4c480993bf6a18aa6bede7a80defc18a55e0 | 101 | # frozen_string_literal: true
module QuetzalDbPipeline
module Cfn
VERSION = '0.1.0'
end
end
| 12.625 | 29 | 0.722772 |
ed05cedd2f3aa38bc0ce3057f559ae28ce7402bd | 3,222 | require 'spec_helper'
describe 'java::ibm' do
before do
Chef::Config[:file_cache_path] = '/var/chef/cache'
end
let(:chef_run) do
runner = ChefSpec::ServerRunner.new
runner.node.override['java']['install_flavor'] = 'ibm'
runner.node.override['java']['ibm']['url'] = 'http://example.com/ibm-java.bi... | 35.406593 | 97 | 0.673805 |
26beda5c4a16b3408db63138dba0510585dec2ce | 745 | module Datastore
module User
class Update < Datastore::Update
context_with User::Context
UpdateUserSchema = Dry::Validation.Schema do
optional(:email, Types::Email) { filled? & format?(Types::EMAIL_REGEXP) }
optional(:role, Types::Role) { filled? & included_in?(Types::USER_ROLES.value... | 33.863636 | 89 | 0.653691 |
019cc765070b0f2beccf297189e5e8fb5e275e5b | 1,322 | require 'spec_helper'
module VCAP::CloudController
module Jobs::Runtime
RSpec.describe AppUsageEventsCleanup, job_context: :worker do
let(:cutoff_age_in_days) { 30 }
let(:logger) { double(Steno::Logger, info: nil) }
let!(:event_before_threshold) { AppUsageEvent.make(created_at: (cutoff_age_in_d... | 29.377778 | 105 | 0.642209 |
21770420814a75188ff317906a148376fe5c7183 | 316 | cask :v1 => 'proximity' do
version '1.5'
sha256 '3ac0e90ffee62a6fadf2bb697393442f3cd87f4084ffdccf9cccf10cb86b3203'
url "https://reduxcomputing-proximity.googlecode.com/files/Proximity%20#{version}.zip"
homepage 'https://code.google.com/p/reduxcomputing-proximity/'
license :oss
app 'Proximity.app'
end
| 28.727273 | 88 | 0.772152 |
21aa5f4d7bc196b4b37bee55215792505b26750a | 501 | cask 'squire' do
version '1.5.7'
sha256 '36b5b895c287f3579839c42a20bc85b1ef2489d630881c533b440020f6a30375'
# amazonaws.com/squire was verified as official when first introduced to the cask
url 'https://s3.amazonaws.com/squire/builds/Squire.dmg'
appcast 'http://www.sylion.com/squireapp/sparkle/SquireMac/appca... | 35.785714 | 88 | 0.782435 |
bb5e5b7a31a36745af44a0a154af3028afa47467 | 696 | begin
require "yui/compressor"
rescue LoadError
puts "YUI-Compressor not available. Install it with: gem install yui-compressor"
end
class Middleman::Rack::MinifyJavascript
def initialize(app, options={})
@app = app
end
def call(env)
status, headers, response = @app.call(env)
if env["PATH... | 27.84 | 94 | 0.678161 |
e82e303b397f6a4310d5d64d38ca62610d064879 | 668 | require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module DosamigosFootball
class Application < Rails::Application
# Initialize configuration defaults for originally generat... | 33.4 | 82 | 0.767964 |
62b11ae71990eaae4e189672ca0564b60c898d12 | 1,076 | require 'test_helper'
class RowsControllerTest < ActionController::TestCase
setup do
@row = rows(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:rows)
end
test "should get new" do
get :new
assert_response :success
end
test "shoul... | 21.52 | 111 | 0.678439 |
ac4b81161c8979639fabe7ae7626a74286456aa5 | 298 | module Admins
class DashboardsController < BaseController
# TODO: when we start exposing more things here, we should probably refactor
# this, maybe with a view object or something
expose :prizes, -> { Prize.all }
expose :stations, -> { Station.all }
def show; end
end
end
| 27.090909 | 80 | 0.694631 |
aba9e5d39a7eb60bc5809e37dd455307cba93136 | 106 | class Api::Users::Posts::Controversial::DayPolicy < ApplicationPolicy
def index?
!exiled?
end
end
| 17.666667 | 69 | 0.726415 |
79ba62ced99de094c9b4e220cadb13593a816d7a | 312 | class CreateLessons < ActiveRecord::Migration
def change
create_table :lessons do |t|
t.text :description
t.integer :room_id
t.integer :host_id
t.datetime :schedule
t.timestamps null: false
end
add_index :lessons, :room_id
add_index :lessons, :host_id
end
end
| 19.5 | 45 | 0.666667 |
bbbcd4c0880e121711fa207f767474c74315205c | 333 | RSpec::Matchers.define :be_subclass_of do |super_class|
match do |child_class|
child_class.superclass == super_class
end
failure_message do |child_class|
"expected the #{child_class} class to be a subclass of #{super_class}"
end
description do
"expected a class to be a subclass of #{super_class}... | 23.785714 | 74 | 0.726727 |
1a365bb9ebd7e423b72c5587f55c7ee7350257eb | 10,667 | #
# Cookbook Name:: ark
# Provider:: Ark
#
# Author:: Bryan W. Berry <bryan.berry@gmail.com>
# Author:: Sean OMeara <someara@opscode.com
# Copyright 2012, Bryan W. Berry
# Copyright 2013, Opscode, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance w... | 29.144809 | 116 | 0.70929 |
ffef3c59e9249d7570eddb8e870e80703e22d9d3 | 515 | require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../shared/rest_size.rb', __FILE__)
require 'strscan'
describe "StringScanner#restsize" do
it_behaves_like :strscan_rest_size, :restsize
it "warns in verbose mode that the method is obsolete" do
s = StringScanner.new("abc")
... | 24.52381 | 60 | 0.687379 |
f8472678354a012851cd94ae574399fe2696e366 | 27 | module HelloPageHelper
end
| 9 | 22 | 0.888889 |
6a8f58d5d73fbdcd9b25611aaa5cf6b48355889d | 3,286 | describe SessionsController do
let(:cookie_hash) { {} }
let(:response_body) { nil }
describe '#lookup' do
let(:omniauth_auth) do
{
'uid' => user_id
}
end
before(:each) do
@request.env['omniauth.auth'] = omniauth_auth
cookie_hash = {}
:logout
end
context ... | 31.902913 | 108 | 0.643944 |
ed6b0a440f1fb3cb232f0492e08311b67cbe4c76 | 150 | # frozen_string_literal: true
class Exercises::Card::Component < ApplicationComponent
def initialize(exercise:)
@exercise = exercise
end
end
| 18.75 | 55 | 0.766667 |
b9098795d4a92d82cebfedeaf24aa8a63102be09 | 3,803 | require 'test/helper.rb'
class PaperclipTest < Test::Unit::TestCase
context "An ActiveRecord model with an 'avatar' attachment" do
setup do
rebuild_model :path => "tmp/:class/omg/:style.:extension"
@file = File.new(File.join(FIXTURES_DIR, "5k.png"))
end
context "that is attr_protected" do
... | 30.669355 | 104 | 0.534315 |
1aec25714cbd553c26e06aad80fb09eee332e5db | 954 | module VagrantPlugins
module VagrantCPUBurn
class Provisioner < Vagrant.plugin("2", :provisioner)
def provision
command = ''
if @config.block_all_network
#TODO implement this!
end
if @config.cpu_burn
command << cpu_burn_command(@config)
end
... | 26.5 | 68 | 0.593291 |
acb34f780d988d54b0904b27e2074f7b61c2180a | 501 | # 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.625 | 176 | 0.834331 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.