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 |
|---|---|---|---|---|---|
4ad92b106ac28a3aac7682634ab6c3eece9eb9c9 | 1,276 | include_recipe "pivotal_workstation::git"
include_recipe "pivotal_workstation::apple_gcc42"
rvm_git_revision_hash = version_string_for("rvm")
::RVM_HOME = "#{WS_HOME}/.rvm"
::RVM_COMMAND = "#{::RVM_HOME}/bin/rvm"
pivotal_workstation_bash_it_enable_feature "plugins/rvm"
run_unless_marker_file_exists(marker_version_... | 27.73913 | 126 | 0.700627 |
ffedbc064f53238d89dbde027a5616156cf21dd0 | 1,502 | # SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
#
# Licensed to Elasticsearch B.V. under ... | 31.957447 | 82 | 0.733688 |
38057ddba87aa7d0dac301ebec9c99874252d45b | 3,097 | require "rails_helper"
RSpec.feature "Business listing", :with_opensearch, :with_stubbed_mailer, type: :feature do
let(:user) { create :user, :activated, has_viewed_introduction: true }
let!(:business_one) { create(:business, trading_name: "great value", created_at: 1.day.ago) }
let!(:business_tw... | 38.7125 | 101 | 0.711656 |
6a97bb741b6ae268dc8893ec42d271b3260a8b88 | 3,211 | class Hold < ApplicationRecord
HOLD_LENGTH = 7.days
has_many :appointment_holds
has_many :appointments, through: :appointment_holds
belongs_to :member
belongs_to :item, counter_cache: true
belongs_to :creator, class_name: "User"
belongs_to :loan, required: false
scope :active, ->(now = Time.current) ... | 25.895161 | 149 | 0.672376 |
265a4461fa55742b78a5adb565f647d4f57b00a3 | 2,539 | require 'zip/zip'
require 'fileutils'
require 'win32api'
require 'pp'
$ignore = [ '.git' ]
def zipfile(zipfile, filespec, dest, ignore=[])
spec = filespec
spec = "#{filespec}/**/**" if File.directory?(filespec)
Dir[spec].reject{ |f| f1=f.sub(dest+'/',''); ignore.count{|ig| File.fnmatch(ig,f1)} > 0 || f == zi... | 21.158333 | 144 | 0.592359 |
01eb9f9ed76e8a876410e9c3cb3b54ebae5c00bf | 2,662 | require 'manageiq-gems-pending'
require 'VMwareWebService/MiqVimBroker'
MAX_CLIENT = 6
BROKER_SERVER = "MiqVimBrokerServer.rb"
BROKER_SERVER_LOG = "./broker.log"
BROKER_SERVER_CMD = "ruby #{BROKER_SERVER} > #{BROKER_SERVER_LOG} 2>&1 &"
TESTS = [
"MiqVimBrokerClient.rb",
"browserTest.rb",
"brokerObjCo... | 21.467742 | 97 | 0.64012 |
21913e9974df75e316b83d74051939e77d4b3ed0 | 176 | require 'faker'
FactoryBot.define do
factory :section do
course { Course.order(:id).first || association(:course) }
sequence(:name) { |n| "Section #{n}" }
end
end
| 19.555556 | 62 | 0.647727 |
5d8cc8fc12bde89c5a0bf5754c0131538e7b79c1 | 66 | # frozen_string_literal: true
module ACE
VERSION = "0.9.1"
end
| 11 | 29 | 0.712121 |
26ad7210b03837e3e32a575931a789d870a23003 | 514 | cask :v1 => 'kobito' do
version '1.9.2'
sha256 '8129e70fda4595fe4e4be5406f2383f5900421da2bc9b7c53cd0e74762f42ba2'
url "http://kobito.qiita.com/download/Kobito_v#{version}.zip"
appcast 'http://kobito.qiita.com/appcast.xml',
:sha256 => 'd39ff5e2dbc54ed1d7d332e3c775107eabab2bc0f99a1b766f4a9fd7f9448e17'
... | 36.714286 | 115 | 0.749027 |
d55ebdf9f3c8a696ff11c8f392c74ce64193f8c3 | 691 | Pod::Spec.new do |s|
s.name = "AeroGear-Push"
s.version = "0.8.1"
s.summary = "AeroGear UnifiedPush Client Registration SDK."
s.homepage = "https://github.com/aerogear/aerogear-push-ios-registration"
s.license = 'Apache License, Version 2.0'
s.author = "Red Hat, Inc."
s.so... | 46.066667 | 126 | 0.642547 |
613c1acfd987203e5c4b904b939723e09bd303aa | 347 | # coding: utf-8
class ONIX::Prize < ONIX::Element
xml_name "Prize"
xml_accessor :prize_name, :from => "PrizeName"
xml_accessor :prize_year, :from => "PrizeYear"
onix_code_from_list :prize_country, "PrizeCountry", :list => 91
onix_code_from_list :prize_code, "PrizeCode", :list => 41
xml_accessor :prize_jury... | 31.545455 | 65 | 0.720461 |
03813a42cd7b062b3bb555dd71131afd950581c6 | 829 | require 'spec_helper'
describe Admin::CitesHashAnnotationsController do
login_admin
describe "index" do
before(:each) do
cop1 = create_cites_cop(:name => 'CoP1')
cop2 = create_cites_cop(:name => 'CoP2')
@annotation1 = create(
:annotation,
:parent_symbol => 'CoP2', :symbol => ... | 25.121212 | 71 | 0.603136 |
bf330738172a101c09cddf539cb0cdda8c74bd1c | 1,111 | class Ncspot < Formula
desc "Cross-platform ncurses Spotify client written in Rust"
homepage "https://github.com/hrkfdn/ncspot"
url "https://github.com/hrkfdn/ncspot/archive/v0.2.5.tar.gz"
sha256 "568e8a586f7a374ec15b57c442e5535ded10b5232da36d1a1692e793ca849faf"
license "BSD-2-Clause"
bottle do
cellar ... | 34.71875 | 103 | 0.736274 |
080558c89e27c505397333dea945d32e0774d734 | 4,692 | require "spec_setup"
require "fpm" # local
require "fpm/package/dir" # local
require "stud/temporary"
if RUBY_VERSION =~ /^1\.8/
# The following method copied from ruby 1.9.3
module SecureRandom
def self.uuid
ary = self.random_bytes(16).unpack("NnnnnN")
ary[2] = (ary[2] & 0x0fff) | 0x4000
ary... | 32.358621 | 101 | 0.626385 |
bb7527c3758f1006393bb2af09ecc9b72cd39fa1 | 831 | require 'chef/provisioning'
with_machine_options({
:bootstrap_options => {
:image_name => 'my-ubuntu-image-id',
:zone_name => 'europe-west1-d',
:machine_type => 'n1-standard-1',
:key_name => 'id_r... | 43.736842 | 137 | 0.487365 |
d5989d4497e6773b3c8e8fa29a804236c028a82f | 677 | # Helper class for storing values per locale. Used by Globalize::Adapter
# to stash and cache attribute values.
module Globalize
module ActiveRecord
class Attributes < Hash # TODO: Think about using HashWithIndifferentAccess ?
def [](locale)
locale = locale.to_sym
self[locale] = {} unless h... | 24.178571 | 81 | 0.624815 |
79646295aa25bc055fdcc83c9454b8928b158de4 | 71 | module ProtonBot
module Memos
VERSION = '0.1.1'.freeze
end
end
| 11.833333 | 28 | 0.676056 |
0119974f99fc2154bb5a7cd959ec718ad44158e1 | 622 | class Sponsor::Update < Sponsor::Base
required do
string :name
model :sponsor
model :current_user, class: User
end
optional do
file :image_file
string :url, empty: true, nils: true
string :description, empty: true, nils: true
end
required do
end
def execute
update... | 17.771429 | 70 | 0.680064 |
21d433ba3b5b306096714715cf2464959533792c | 2,044 | module Refinery
module Bits
class BootstrapMenuPresenter < ::Refinery::Pages::MenuPresenter
self.selected_css = :active
private
def render_menu(items)
buffer = ActiveSupport::SafeBuffer.new
buffer << render_menu_items(items, nil)
end
def render_menu_items(menu_items... | 30.058824 | 89 | 0.613992 |
e9013d44f2240cdecbd94a5eec02e3ed60860dca | 671 | class Api::V1::Scopes::SearchesController < Api::V1::ApplicationController
def index
scope = KatalogUbpb.config.find_scope(params[:scope_id])
call_service(SearchRecordsService,
adapter: scope.search_engine_adapter.instance,
facets: params[:facets].try(:downcase) == "false" ? nil : scope.facets,
... | 30.5 | 77 | 0.66766 |
5de3b12bfc2c3e65ca3a9328e1c06bbfc6688ba8 | 328 | unless String.method_defined? :blank?
String.class_eval do
def blank?
self == ""
end
end
end
unless Array.method_defined? :blank?
Array.class_eval do
def blank?
size == 0
end
end
end
unless NilClass.method_defined? :blank?
NilClass.class_eval do
def blank?
true
end
... | 14.909091 | 39 | 0.64939 |
e899bf6d8cc6692b053866c0951621c959c3aa46 | 1,558 | <% if false # the license inside this if block assertains to this file -%>
# Copyright 2017 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/LI... | 35.409091 | 74 | 0.70154 |
01628095c3351dd789ece90af7b12c70240e34ef | 930 | # -*- encoding: utf-8 -*-
# stub: nkf 0.1.0 ruby lib
Gem::Specification.new do |s|
s.name = "nkf".freeze
s.version = "0.1.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.metadata = { "homepage_uri" => "https://github.com/ruby/nkf", "source_co... | 40.434783 | 146 | 0.678495 |
ab2e83b475119f409653871cc712d0c2897b711e | 1,371 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'thunderbuddies/version'
Gem::Specification.new do |spec|
spec.name = "thunderbuddies"
spec.version = Thunderbuddies::VERSION
spec.authors = ["Tazro Inutano Ohta"]
spe... | 40.323529 | 108 | 0.68636 |
21759ba20e6b3c1520adc0de36cc90982a76a7c6 | 129 | json.athletes @athletes do |athlete|
json.id athlete.id
json.name "#{athlete.user.first_name} #{athlete.user.last_name}"
end
| 25.8 | 66 | 0.744186 |
03f7b5c211d2e0ea1ae4ef50cbb2176e29b0f18c | 4,360 | ##
## Copyright (c) 2015 SONATA-NFV [, ANY ADDITIONAL AFFILIATION]
## ALL RIGHTS RESERVED.
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICEN... | 40 | 137 | 0.670872 |
f7652a275317bece8f177b04bde9263c39221a85 | 211 | class AddRegionInfoWashMachine < ActiveRecord::Migration[4.2]
def change
change_table :wash_machines do |t|
t.references :province
t.references :city
t.references :area
end
end
end
| 21.1 | 61 | 0.696682 |
03c654b9b856f51431fbbc5e124055b8d34f3152 | 5,591 | class Nginx < Formula
desc "HTTP(S) server and reverse proxy, and IMAP/POP3 proxy server"
homepage "http://nginx.org/"
url "http://nginx.org/download/nginx-1.8.0.tar.gz"
sha256 "23cca1239990c818d8f6da118320c4979aadf5386deda691b1b7c2c96b9df3d5"
head "http://hg.nginx.org/nginx/", :using => :hg
bottle do
... | 32.317919 | 106 | 0.65051 |
08f4732c48170577a29a88d143e507add2f9c929 | 6,316 | # frozen_string_literal: true
require 'spec_helper'
require 'spree/event/adapters/default'
module Spree
module Event
module Adapters
RSpec.describe Default do
let(:counter) do
Class.new do
attr_reader :count
def initialize
@count = 0
end... | 29.376744 | 96 | 0.535624 |
87bdd4e139a7e38df73c7b3b84a05e770b24b8d1 | 1,126 | module ManageIQ::Providers::Lenovo
class PhysicalInfraManager::Parser::PhysicalDiskParser < PhysicalInfraManager::Parser::ComponentParser
class << self
# Mapping between fields inside a [XClarityClient::Storage] to a [Hash] with symbols of PhysicalDisk fields
PHYSICAL_DISK = {
:model ... | 30.432432 | 113 | 0.585258 |
f75be528b468c33c84bdf79b109c5fa9359a610e | 154 | require 'serverspec'
set :backend, :cmd
describe "provisioner" do
describe host('google.com') do
it { should be_resolvable.by('dns') }
end
end | 17.111111 | 41 | 0.688312 |
e9637902be34ecdf12c206ef2d7194f77da54865 | 368 | module VirtualBox
module COM
module Interface
module Version_4_0_X
class AudioAdapter < AbstractInterface
IID = "921873db-5f3f-4b69-91f9-7be9e535a2cb"
property :enabled, T_BOOL
property :audio_controller, :AudioControllerType
property :audio_driver, :AudioDri... | 23 | 58 | 0.657609 |
2637880a6e71e445270a53b965813d4e4c37d672 | 1,083 | class HeadersController < ApplicationController
before_action :set_header, only: [:show, :update, :destroy]
# GET /headers
def index
@headers = Header.all
render json: @headers
end
# GET /headers/1
def show
render json: @header
end
# POST /headers
def create
@header = Header.new(he... | 20.826923 | 75 | 0.669437 |
f840458937afa55018bae57fd9e63d0e2b703359 | 48 | module GoogleGenomics
class Reference
end
end
| 9.6 | 21 | 0.833333 |
1a262f80f6df5e6d2e07b1257f0dede723cba324 | 1,480 | # frozen_string_literal: true
require 'test_helper'
module EasyManageClient
class CoreTest < Minitest::Test
def setup
configure_default_profile
@core_object = ::EasyManageClient::Core.new
end
def test_an_error_must_occur_if_profile_not_defined
# We configured without specify a profile ... | 30.833333 | 63 | 0.712838 |
088361a9bd39e82a391f13ac346cde0b4492a793 | 418 | require 'active_support/all'
Time.zone = 'Europe/Zagreb'
require './app'
if ENV["MEMCACHED_1_PORT_11211_TCP_ADDR"]
memcache_url = "#{ENV["MEMCACHED_1_PORT_11211_TCP_ADDR"]}:#{ENV["MEMCACHED_1_PORT_11211_TCP_PORT"]}"
client = Dalli::Client.new(memcache_url, password: "password", username: "admin")
use Rack::Cac... | 24.588235 | 102 | 0.741627 |
26cc02600a6cf94d6e6fc539da04b4a3bab5df4d | 9,460 | # frozen_string_literal: true
module Parser
module Source
##
# @api private
#
# Actions are arranged in a tree and get combined so that:
# children are strictly contained by their parent
# sibblings all disjoint from one another and ordered
# only actions with replacement==nil may h... | 38.930041 | 158 | 0.617019 |
2892f416107316a89ec7cca3b35013b89f5e9bf0 | 466 | class Candybar < Cask
version '3.3.4'
sha256 'f305596f195445016b35c9d99a40789c6671195e9cbad0b6e92e808b6c633ad6'
url "https://panic.com/candybar/d/CandyBar%20#{version}.zip"
homepage 'http://www.panic.com/blog/candybar-mountain-lion-and-beyond'
license :unknown
app 'CandyBar.app'
caveats <<-EOS.undent
... | 31.066667 | 75 | 0.748927 |
5ddeb5fbd8eb32d758f7bafcf87b32162d85e477 | 9,648 | require 'tempfile'
class Thor
module Shell
class Basic
attr_accessor :base, :padding
# Initialize base, mute and padding to nil.
#
def initialize #:nodoc:
@base, @mute, @padding = nil, false, 0
end
# Mute everything that's inside given block
#
def mute
... | 29.060241 | 114 | 0.553897 |
6a1537578a34018da7311ddb8c64354904807464 | 811 | # frozen_string_literal: true
require_relative '../types'
module Xumlidot
module Types
class Superklass < ::Xumlidot::Types::Constant
def initialize(name, namespace = nil)
super
@has_root = false
end
def <<(constant)
if constant == '::'
@has_root = true # TOD... | 24.575758 | 80 | 0.621455 |
bf21a1f9616f2028830503504ee0c94fc7c1eef4 | 2,057 | class DialogHandler
def initialize(user)
@user = user
@context = DialogContext.new(@user)
@context.reset!
end
def handle_message(message)
# Restart conversation if timed out
@context.reset! if @context.timed_out?
# Send to Wit.ai
resp = WitResponse.new WitProxy.message(message['text... | 32.140625 | 97 | 0.713175 |
4a984cffb9fd08221ef06c2c5e431abf4cbff3bc | 1,984 | require 'spec_helper'
describe Moon::Product do
it { should validate_presence_of(:name) }
end
describe Moon::Product, '.empty_option_values?' do
let(:option_value) { FactoryGirl.create(:option_value, presentation: 'L') }
let(:option_type) { FactoryGirl.create(:option_type, presentation: 'Size', option_values... | 30.060606 | 111 | 0.714718 |
016e060b0db9e5ae14693bd437e2e9831245287e | 213 | # http://www.codewars.com/kata/5609fd5b44e602b2ff00003a
# --- iteration 1 ---
def process_2arrays(arr1, arr2)
[(arr1 & arr2), ((arr1 - arr2) + (arr2 - arr1)), (arr1 - arr2), (arr2 - arr1)]
.map(&:size)
end
| 26.625 | 80 | 0.619718 |
28f980f17621b0f3d83e422e99fb667f65d541a6 | 830 | # Use this migration to create the tables for the ActiveRecord store
class AddOpenIdStoreToDb < ActiveRecord::Migration
def self.up
create_table "open_id_associations", :force => true do |t|
t.column "server_url", :string, :null => false
t.column "handle", :string, :null => false
t.column "secre... | 33.2 | 68 | 0.651807 |
ac29012426864f12abf47559e7f80a240d92dd5d | 334 | class Admin::JobsController < ApplicationController
def create
name = params[:name]
if name =~ /\ASet\w+Job\z/ || name == 'CreateMissingTranscodesJob' || name == 'BackupDatabaseJob'
name.constantize.perform_later
head :ok
else
head :forbidden
end
rescue NameError
head :forbidd... | 20.875 | 101 | 0.664671 |
1d0519598c371f4e22768d99ab9ae5ba8dcbbdf3 | 2,991 | class Pry
class PluginManager
PRY_PLUGIN_PREFIX = /^pry-/
# Placeholder when no associated gem found, displays warning
class NoPlugin
def initialize(name)
@name = name
end
def method_missing(*args)
warn "Warning: The plugin '#{@name}' was not found! (no gem found)"
... | 28.759615 | 113 | 0.613507 |
ffcd006a640177ff7076fe9d8c12071cc793c4d3 | 208 | require 'digest'
module ToyGit
class Hasher
def self.generate(object:, serializer:)
serialized = serializer.serialize(object: object)
Digest::SHA256.hexdigest(serialized)
end
end
end
| 18.909091 | 55 | 0.711538 |
6203e452b81643d46f1224fa0aa6dcfed22595d7 | 210 | class RfpStatusComponent < ViewComponent::Base
def initialize(rfp:)
@rfp = rfp
end
def display_status
@rfp.status.to_s.humanize
end
def status_class
@rfp.status.to_s.dasherize
end
end
| 15 | 46 | 0.709524 |
1ae32bde05716ae9cb4a99f07bd08741bfa89979 | 3,366 | # This is a 1:1 representation of ISO 639-2.
# It is built on initialization with a rake task, and not further touched.
# Many of the languages have multiple version (e.g. there are 4 variations of German)
#
# @!attribute alpha_3_bibiographic
# @return [String] attribute alpha_3_bibliographic always has a distinct 3 ... | 43.714286 | 207 | 0.710933 |
7a36b2801fc399fea78964db1b4d418b8f8b63d7 | 83 | module Telephony
module Events
class Answer < CallAnswered
end
end
end
| 11.857143 | 31 | 0.710843 |
28ab5129c7d618a24f468f6116a082ace48c393f | 966 | Pod::Spec.new do |s|
s.platform = :ios
s.name = 'TopTabBar-Chtar'
s.version = '0.0.6'
s.summary = 'It is scrolling top tab bar with indicator items for selection'
s.description = <<-DESC
Top tab bar can be used for all iOS platform, I can think about native iOS tab bar, bu... | 38.64 | 173 | 0.596273 |
38638f220a6b6ebb8211f356b9fb8d4cb3247a8e | 1,061 | require 'json'
package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
Pod::Spec.new do |s|
s.name = "RNFBPerf"
s.version = package["version"]
s.description = package["description"]
s.summary = <<-DESC
A well tested fe... | 44.208333 | 122 | 0.557022 |
79c9227e5f5261ab4d80fe101614c3cf93d21556 | 14,067 | # frozen_string_literal: true
# Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render inv... | 48.340206 | 154 | 0.751262 |
011ea9132f3dbdd6e607b32176a215dc3af9b13f | 2,038 | require 'spec_helper'
describe EosdisTagger do
before(:all) do
@tagger = EosdisTagger.new
end
it 'should tag EOSDIS collections with one POST per provider' do
VCR.use_cassette 'services/eosdis_collections', :record => :once, :decode_compressed_response => true do
@tagger.execute_scheduled_task
... | 39.960784 | 117 | 0.661923 |
e8a9f8680ff20d90419fc9c6cc86121ce79c950b | 2,420 | #--
# Copyright (c) 2010-2013 Michael Berkovich, tr8nhub.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, cop... | 41.724138 | 115 | 0.727273 |
39c68a693213e1f25c6f8362bb334d68e6bda690 | 371 | class Api::BaseController < ApplicationController
include ApiHelper
skip_before_action :authenticate_user!
before_action :authenticate_api
protected
def authenticate_api
if AppConfig[:api_key] != params[:api_key] || params[:api_key].blank?
render :text => "Sorry, you don't have access.", :s... | 21.823529 | 75 | 0.690027 |
6188a0479c5333ff7482ca3798402c5e5282ba55 | 3,102 | require 'manageiq-gems-pending'
require 'VMwareWebService/MiqVim'
require 'VMwareWebService/VimTypes'
VMwareWebService.logger = Logger.new(STDOUT)
VMwareWebService.logger.level = Logger::WARN
$miq_wiredump = false
$stderr.sync = true
$stdout.sync = true
SRC_VM = "rpo-clone-src"
TARGET_VM = "rpo-linked-cl... | 23.5 | 90 | 0.645712 |
d5b54d403d9abe0eae2a2e2e5e2ed18ba2de40a5 | 805 | require 'spec_helper'
describe OpenStackRubySDK::Neutron::Port do
let(:network) do
OpenStackRubySDK::Neutron::Network.create({ name: "testing" })
end
let(:port) do
OpenStackRubySDK::Neutron::Port.create({
network_id: network.id,
name: "testing",
admin_state_up: true
})
end
it ... | 20.125 | 75 | 0.658385 |
39ef1c33fc70be241a8ba000e6048328c46332ba | 483 | require "active_support/core_ext/module/delegation"
require "active_support/core_ext/module/attribute_accessors"
require "ffi"
require "ceph-ruby/lib/rados"
require "ceph-ruby/lib/rbd"
require "ceph-ruby/version"
require "ceph-ruby/cluster"
require "ceph-ruby/pool"
require "ceph-ruby/rados_block_device"
require "cep... | 21 | 60 | 0.778468 |
01af3486ffa19f82a6a675ff934c6b084c90f012 | 1,108 | class PostsController < ApplicationController
before_action :set_post, only: [:show, :edit, :update, :destroy]
# GET /posts
def index
@posts = authorize Post.all
end
# GET /posts/1
def show
end
# GET /posts/new
def new
@post = authorize Post.new
end
# GET /posts/1/edit
def edit
end... | 18.466667 | 71 | 0.66426 |
7a6593f41fbae584cb2c528e787173dc92d4a231 | 696 | module ParallelWorkforce
module Job
class Sidekiq
include ::Sidekiq::Worker
include ParallelWorkforce::Job::Util::JobHelper
sidekiq_options retry: false
class << self
def enqueue_actor(actor_class_name:, result_key:, index:, server_revision:, serialized_actor_args:)
enq... | 24.857143 | 107 | 0.627874 |
910665eb52ba65f89dc7a524cf330683dcefdade | 2,004 | #
# This class was auto-generated.
#
require 'onlinepayments/sdk/data_object'
require 'onlinepayments/sdk/domain/personal_name'
module OnlinePayments::SDK
module Domain
# @attr [String] additional_info
# @attr [String] city
# @attr [String] country_code
# @attr [String] house_number
# @attr [Onl... | 33.966102 | 101 | 0.628244 |
2674429102ab8d045276df1fb4a1e225c84d5f32 | 2,436 | class Gmt < Formula
desc "Tools for processing and displaying xy and xyz datasets"
homepage "https://gmt.soest.hawaii.edu/"
url "ftp://ftp.soest.hawaii.edu/gmt/gmt-5.4.5-src.tar.gz"
mirror "https://mirrors.ustc.edu.cn/gmt/gmt-5.4.5-src.tar.xz"
mirror "https://fossies.org/linux/misc/GMT/gmt-5.4.5-src.tar.xz"
... | 35.304348 | 98 | 0.706486 |
e254e324fce6e3410883d4b69994d405da607915 | 282 | # frozen_string_literal: true
class V3::ChaptersController < ApplicationController
# GET /chapters
def index
chapters = Chapter.all
render json: chapters
end
# GET /chapters/1
def show
chapter = Chapter.find(params[:id])
render json: chapter
end
end
| 15.666667 | 52 | 0.698582 |
872394d849eb158839f3820c4fa0228d6eb9f8b5 | 42 | module RefParsers
VERSION = "0.2.1"
end
| 10.5 | 19 | 0.690476 |
6a505dc68bb0bf1e01bcdde1ea11d1eac1dbd112 | 3,646 | RSpec.describe "staff/exports/organisations/show" do
let(:organisation) { build(:delivery_partner_organisation, id: SecureRandom.uuid) }
let(:xml_downloads) do
[
double("Iati::XmlDownload", title: "XML Download 1", path: "http://example.com/1"),
double("Iati::XmlDownload", title: "XML Download 2", p... | 45.012346 | 196 | 0.722161 |
e230369a4097b9fb5d00f0bc67cebfe37387fb73 | 1,821 | # frozen_string_literal: true
require 'kramdown_html'
describe Kramdown::Converter::Html do
context 'valid PlantUML' do
let (:options) { { input: 'GFM' } }
subject do
diagram = File.read(File.join(__dir__, 'examples', 'diagram.plantuml'))
document = "```plantuml\n#{diagram}\n```"
Kramdown... | 22.481481 | 77 | 0.535969 |
39dda220d477a59cbbacfd278776ab82e586ed16 | 1,402 | # -*- encoding: utf-8 -*-
# stub: liquid 4.0.0 ruby lib
Gem::Specification.new do |s|
s.name = "liquid".freeze
s.version = "4.0.0"
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.7".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Tobias L\u00FCt... | 36.894737 | 116 | 0.664051 |
28481e4ce97f27a2c438fdd210cb494b05e5154f | 2,542 | # frozen_string_literal: true
class AutomaticHandoverEmailJob < ApplicationJob
queue_as :default
HEADERS = ['Prisoner', 'CRN', 'Prisoner number', 'Handover start date', 'Responsibility handover', 'Release/Parole Date', 'Prison', 'Current POM', 'POM email', 'COM'].freeze
# Turns out that between? is inclusive at ... | 43.827586 | 175 | 0.660504 |
4aa83cc097813e1cb9ffe29160d109f064cdb484 | 2,483 | Railsblog::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
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.acti... | 36.514706 | 104 | 0.759968 |
21b1b434460a4e042bbff2e3db01b9884e886782 | 3,052 | # Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::DataMigration::Mgmt::V2018_04_19
module Models
#
# Properties for the command that completes sync migration for a database.
#
class MigrateSyn... | 29.631068 | 78 | 0.486239 |
4ac3192e6e47fe28c2b577a88c84c84e3a7a8e51 | 469 | describe 'coercion of nil' do
before do
class Test::Foo
extend Dry::Initializer
param :bar, proc(&:to_i)
end
class Test::Baz
include Dry::Initializer.define -> do
param :qux, proc(&:to_i)
end
end
end
let(:foo) { Test::Foo.new(nil) }
let(:baz) { Test::Baz.new(nil... | 18.038462 | 43 | 0.597015 |
d5a1de77d00e63ddcbeed47f8016726c5cc75bd0 | 547 | module Jekyll
module CardImageFilter
def card_image(doc)
item = doc.instance_variable_get('@obj').try('data')
case item.dig('content_type')
when 'song', 'album', 'message'
item.dig('background_image', 'url') || item.dig('bg_image', 'url') || item.dig('image', 'url')
when 'episode'
... | 30.388889 | 102 | 0.610603 |
1c0fe92bc0ec33914ff03dd9f8c8e9b130e1424f | 5,405 | module ActiveModel
module SecurePassword
extend ActiveSupport::Concern
# BCrypt hash function can handle maximum 72 characters, and if we pass
# password of length more than 72 characters it ignores extra characters.
# Hence need to put a restriction on password length.
MAX_PASSWORD_LENGTH_ALLOWE... | 42.226563 | 130 | 0.624792 |
b935bdcf4f40a365b5a0381710be4e08e115d357 | 1,759 | ActiveAdmin.register Bill do
# STRONG PARAMS
permit_params :meal_id, :resident_id, :community_id, :amount, :subdomain
# SCOPE
scope_to :current_admin_user
# CONFIG
filter :resident, as: :select, collection: proc { Resident.order(:name).all.pluck([:name, :id]) }, include_blank: true
filter :meal_reconcil... | 33.826923 | 246 | 0.688459 |
6a262023e49f624491f35a09c76758037463c36b | 2,362 | # This file is a template for a basic game loop
# It can be used in its current form or it can be modified
module SDC
# Main routine as an entry point for the Shidacea engine
# @param game_class [Class] The class for the game data
# @param title [String] Title of the window
# @param width [Fixnum] Width o... | 24.102041 | 129 | 0.640135 |
e234a18c3d36bd9cc0f5a3359181b3c6b45dd273 | 806 | # frozen_string_literal: true
# Copyright (c) 2020, Robert Haines.
#
# Licensed under the BSD License. See LICENCE for details.
module Mos6502
class Memory
def initialize(image = nil)
load!(image)
end
def set(address, value)
@memory[address] = (value & 0xff)
end
def get(address)
... | 19.190476 | 70 | 0.58933 |
abae0e559597b7e76ba3fc2dd06628a5dbf60f74 | 6,711 | =begin
#NSX-T Data Center Policy API
#VMware NSX-T Data Center Policy REST API
OpenAPI spec version: 3.1.0.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.17
=end
require 'date'
module NSXTPolicy
# Ipaddress information of the fabric node.
class IpAddressInfo
... | 28.802575 | 107 | 0.618984 |
216895edb9ce669efedb72971c71893b7f4043d1 | 85 | set :output, "/home/ubuntu/cron.log"
every 5.minutes do
runner "Ranker.rank!"
end
| 14.166667 | 36 | 0.705882 |
edb0cb525dd178bb5f6d8cfb975b4605f2dc7fa4 | 1,172 | class Trip < ActiveRecord::Base
attr_accessor :longitude, :latitude
attr_accessible :longitude, :latitude, :description, :name, :zoom, :user_id
belongs_to :user
validates :longitude,presence: true, numericality: { greater_than_or_equal_to: -180, less_than_or_equal_to: 180 }
validates :latitude, pr... | 31.675676 | 117 | 0.68686 |
f704bd7d36a13b31a2541c3f148a60f97619c26a | 557 | class UsersMailer < ActionMailer::Base
layout 'email'
def notification_email(notification)
@notification = notification
old_locale = I18n.locale
I18n.locale = @notification.user.locale if I18n.locale.to_s != @notification.user.locale.to_s # we need this if to avoid stack overflow in controller
mail... | 46.416667 | 153 | 0.723519 |
91c17fc1cc83576f6e5eee1721de42dd1b6c7370 | 295 | # create and run npm hosted repository
nexus3_api 'npm-internal' do
content "repository.createNpmHosted('npm-internal');" \
" repository.createNpmProxy('npmjs-org','https://registry.npmjs.org');" \
" repository.createNpmGroup('npm-all',['npmjs-org','npm-internal'])"
action :run
end
| 36.875 | 77 | 0.715254 |
2663ffac900920428daaaeaa3631593eb6b83a86 | 870 | module Fastbill
module Automatic
module Services
module Update
module ClassMethods
def update_attributes(id, attributes)
id_attribute = "#{self.class.name.split("::").last.downcase}_id".to_sym
attributes[id_attribute] = id
response = Fastbill::Automatic... | 31.071429 | 115 | 0.605747 |
e893fddb9bc76e689d8f61b32188b660061cdfae | 6,421 | =begin
#UltraCart Rest API V2
#UltraCart REST API Version 2
OpenAPI spec version: 2.0.0
Contact: support@ultracart.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.4.15-SNAPSHOT
=end
require 'date'
module UltracartClient
class TaxProviderUltraCart
attr_accessor ... | 28.286344 | 107 | 0.611743 |
1d15642138b7a4441a71163a30c320e91c3c9c2e | 1,229 | =begin
#Datadog API V2 Collection
#Collection of all Datadog Public endpoints.
The version of the OpenAPI document: 1.0
Contact: support@datadoghq.com
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 5.0.0-SNAPSHOT
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for Dat... | 29.97561 | 102 | 0.768104 |
03527a26a97693cee3dc22d6e6845b8fd8a3fd0c | 2,954 | require "alertdesigner/formatters"
require "erb"
require "ostruct"
module AlertDesigner
module Formatters
# Class for the generic nagios formatter
class Nagios < Formatter
# Generic Nagios definition class
class NagiosDefinition < OpenStruct
TEMPLATE = <<-EOS.freeze
define <%= type %>{
<... | 27.607477 | 78 | 0.597833 |
87e2b09aff4a7d01086a75609f225ab8999e6c30 | 294 | # _Description_
#
# Return the default gateway of the system
#
Facter.add(:defaultgateway) do
confine :kernel => 'Linux'
setcode do
netstat = %x{/bin/netstat -rn}
gw = "unknown"
if netstat =~ /^0\.0\.0\.0\s+(.*)/ then
gw = $1.split(/\s+/).first
end
gw
end
end
| 16.333333 | 43 | 0.581633 |
1cbcf3f658cef04c7f0e2c8069d8cabbca60a513 | 148 | require_dependency "hanuman/application_controller"
module Hanuman
class AboutController < ApplicationController
def index
end
end
end
| 16.444444 | 51 | 0.797297 |
ed78eb0223d21c7a8ad7dffce157ceb0687940be | 470 | require_relative '../spec_helper'
class Deployment
attr_accessor :name, :code
def initialize(name, code)
@name = name
@code = code
end
DEPLOYMENTS = [
BAMPFA = new('BAMPFA', 'bampfa'),
BOTGARDEN = new('BOTGARDEN', 'botgarden'),
CINEFILES = new('CINEFILES', 'cinefiles'),
CORE ... | 20.434783 | 48 | 0.585106 |
1c65a559f0c6dab8919f86d4bdc7bd99e3ffe2ac | 560 | require "spec_helper"
describe "Standard Library" do
describe "set!" do
before :each do
@interpreter = Flea::Interpreter.new
end
it "should change the value of an existing variable" do
@interpreter.run('
(define test 1)
(set! test 2)'
)
expect(@interpre... | 22.4 | 70 | 0.605357 |
ab059e741fb1b033519f47b790346e3ac7ed48d1 | 490 | =begin
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
The version of the OpenAPI document: 20220523
Generated by: https://github.com/openapitools/openapi-generator.git
=end
class GenerationController < ApplicationController
def generation_list
# Your ... | 22.272727 | 106 | 0.740816 |
1d0975cde7ff4ec82baaacf3e7cce9d0f8aef899 | 1,114 | def uber_jar(args)
if !jar?
puts "Unable to run uber_jar task"
exit -1
end
out = "build/#{args[:out]}"
file out => args[:src] + args[:deps] do
puts "Building: #{args[:out]}"
dir = "build/#{args[:name]}_temp"
mkdir_p dir, :verbose => false
args[:src].each do |src|
sh "cd ... | 23.702128 | 70 | 0.528725 |
6a63eb70b170d0f071080a3c0882eac16cc6fe51 | 15,866 | # frozen_string_literal: true
module ActiveRecord
module Calculations
# Count the records.
#
# Person.count
# # => the total count of all people
#
# Person.count(:age)
# # => returns the total count of all people whose age is present in database
#
# Person.count(:all)
... | 36.642032 | 136 | 0.623724 |
bb5e66b8178d9cadfc5a26505c63ad85cf908b13 | 329 | class Sneaker < ApplicationRecord
belongs_to :user
belongs_to :brand
has_many :comments
validates_presence_of :name
accepts_nested_attributes_for :brand
accepts_nested_attributes_for :comments
scope :most_comments, -> {joins(:comments).group(:sneaker_id).order("COUNT(comments.sneaker_id) DES... | 32.9 | 107 | 0.762918 |
7a127328409218b60322ac1e6325a52012ccf3c0 | 4,380 | # 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_08_01
module Models
#
# Details of on demand test probe request.
#
class ApplicationGatewayOnDemandProb... | 32.444444 | 78 | 0.531279 |
03ec80cc18dc8359980d0cb3c4a0efdcc2fb3173 | 2,862 | class Nzbget < Formula
desc "Binary newsgrabber for nzb files"
homepage "https://nzbget.net/"
url "https://github.com/nzbget/nzbget/releases/download/v21.0/nzbget-21.0-src.tar.gz"
sha256 "65a5d58eb8f301e62cf086b72212cbf91de72316ffc19182ae45119ddd058d53"
license "GPL-2.0"
revision 1
head "https://github.co... | 31.8 | 108 | 0.65304 |
bf73527fb74e5f87b15221c927c03ed8a9478171 | 777 | require "language/node"
class Cdk8s < Formula
desc "Define k8s native apps and abstractions using object-oriented programming"
homepage "https://cdk8s.io/"
url "https://registry.npmjs.org/cdk8s-cli/-/cdk8s-cli-1.0.6.tgz"
sha256 "a3e2c92f99afdbb63dd93e4aced159543d6394f7f0ffdec59ea7ec9ab2162b91"
license "Apach... | 29.884615 | 112 | 0.747748 |
18a59ce0ba62e9fa52764a6a5ef79559d8ed2e18 | 2,453 | #-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2014 the OpenProject Foundation (OPF)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of ... | 37.738462 | 101 | 0.725642 |
9136e4e2503005176f7ad55e2bcc709e6e8000c3 | 1,305 | # frozen_string_literal: true
class GroupWikiRepository < ApplicationRecord
include ::Gitlab::Geo::ReplicableModel
include EachBatch
include Shardable
with_replicator Geo::GroupWikiRepositoryReplicator
belongs_to :group
validates :group, :disk_path, presence: true, uniqueness: true
delegate :reposito... | 27.1875 | 117 | 0.718008 |
6ac792e8de200a7d3daaf4a5a412d3201a133b26 | 2,806 | # frozen_string_literal: true
module Rockette
#
# @api public
# Handle actions and parameters
class CLI < Thor
# Error raised by this runner
Error = Class.new(StandardError)
desc "version", "rockette version"
def version
require_relative "version"
puts "v#{Rockette::VERSION}"
e... | 33.404762 | 108 | 0.59943 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.