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 |
|---|---|---|---|---|---|
5d9ea85dd8b68aa0d224a2f0d7d50d01c4270c9c | 6,794 | require 'spec_helper'
describe 'cis_hardening::auth::ssh' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }
# Check for default class
it {
is_expected.to contain_class('cis_hardening::auth::ssh')
}
# Ensure that Ensure permissions on ... | 34.48731 | 141 | 0.558287 |
d59123419750c98fc62a14507a0170dc3f104b46 | 149 | class GuidePlaceAssociation < ActiveRecord::Base
attr_accessible :guide_id, :place_id, :order_num, :note
belongs_to :guide
belongs_to :place
end
| 21.285714 | 56 | 0.798658 |
e93d711590f2f43f6d20053ec09784e1afc64128 | 92 | # frozen_string_literal: true
json.user do
json.id @user.id
json.email @user.email
end
| 13.142857 | 29 | 0.73913 |
5d29f577894db5c0ab099334f1934dc1bcc9f265 | 686 | if Rails.env.production?
Rails.application.config.after_initialize do
ActiveRecord::Base.connection_pool.disconnect!
ActiveSupport.on_load(:active_record) do
begin
uri = URI.parse(ENV["DATABASE_URL"])
rescue URI::InvalidURIError
raise "Invalid DATABASE_URL"
end
databas... | 26.384615 | 53 | 0.616618 |
01321bedd5747ec19ea8bebf3c037db0a0129cff | 242 | FactoryGirl.define do
factory :jive_tiles_tile, :class => 'JiveTiles::Tile' do
guid "MyString"
remote_id "MyString"
config "MyText"
name "MyString"
jive_url "MyString"
tenant_id "MyString"
push_url "MyString"
code "MyString"
end
end
| 17.285714 | 58 | 0.747934 |
624280a4930f516f8336e4f17f54f24bf747c389 | 2,503 | class LogStash::Filters::Statement
@logger = Cabin::Channel.get(LogStash)
attr_accessor :query
attr_accessor :query_filepath
attr_accessor :parameters
attr_accessor :schedule
attr_accessor :join_keys
attr_accessor :node_name
attr_accessor :persistence_data
attr_accessor :persistence_store_type
att... | 31.2875 | 118 | 0.619257 |
331f3176553959e4d882049663e84914fe5cc91d | 2,024 | #-- encoding: UTF-8
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2018 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,... | 39.686275 | 91 | 0.759881 |
01348ef32146417e86ede29af4c20d80871275ea | 3,320 | # typed: false
# frozen_string_literal: true
module Homebrew
module Livecheck
module Strategy
# The {Gnome} strategy identifies versions of software at gnome.org by
# checking the available downloads found in a project's `cache.json`
# file.
#
# GNOME URLs generally follow a standar... | 37.727273 | 99 | 0.602108 |
618d773eb4bba694935976f7b38a8c2d556dc804 | 3,137 | Pod::Spec.new do |s|
s.name = 'FirebaseRemoteConfig'
s.version = '4.4.9'
s.summary = 'Firebase Remote Config'
s.description = <<-DESC
Firebase Remote Config is a cloud service that lets you change the
appearance and behavior of your app without requiring users to download an
... | 41.826667 | 76 | 0.687281 |
b9ba6adc4069ed26d4b050b9c010779335a29fa6 | 298 | # This migration comes from spree_promo (originally 20100419190933)
class RenameCouponsToPromotions < ActiveRecord::Migration
def up
drop_table :promotions if table_exists?(:promotions)
rename_table :coupons, :promotions
end
def down
rename_table :promotions, :coupons
end
end
| 24.833333 | 67 | 0.775168 |
e988759ba4c53422e4099c44625486e9f9ae3c93 | 2,770 | 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.2-src.tar.xz"
mirror "http://gd.tuwien.ac.at/pub/gmt/gmt-5.4.2-src.tar.xz"
mirror "http://ftp.iris.washington.edu/pub/gmt/gmt-5.4.2-src.tar.xz... | 38.472222 | 98 | 0.709025 |
213d3889dec57be4d232472a4419da12d10bac9b | 36,708 | require 'spec_helper_min'
require 'support/helpers'
require 'helpers/database_connection_helper'
describe Carto::ApiKey do
include CartoDB::Factories
include DatabaseConnectionHelper
def api_key_table_permissions(api_key, schema, table_name)
api_key.table_permissions_from_db.find do |tp|
tp.schema == ... | 35.604268 | 289 | 0.657241 |
5d0a0ebec102261d4b74a529a817d5bf882f0277 | 303 | cask "font-nixie-one" do
version :latest
sha256 :no_check
url "https://github.com/google/fonts/raw/master/ofl/nixieone/NixieOne-Regular.ttf",
verified: "github.com/google/fonts/"
name "Nixie One"
homepage "https://fonts.google.com/specimen/Nixie+One"
font "NixieOne-Regular.ttf"
end
| 25.25 | 85 | 0.722772 |
0145585c05b608a4e8267f2bea14b217b2a67c09 | 4,726 | # encoding: utf-8
require 'tempfile'
class Nanoc::Filters::XSLTest < Nanoc::TestCase
SAMPLE_XSL = <<-EOS
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/>
<xsl:template ma... | 25.005291 | 79 | 0.562844 |
7acc26367952c0c51049530c236e0a556639fce3 | 10,567 | require 'gosu'
require 'wads'
#require 'rdia-games'
require_relative '../lib/rdia-games'
include Wads
include RdiaGames
GAME_WIDTH = 1280
GAME_HEIGHT = 720
class TileEditor < RdiaGame
def initialize(board_file = "./data/editor_board.txt")
super(GAME_WIDTH, GAME_HEIGHT, "TileEditor", TileEditorDisplay.ne... | 31.828313 | 134 | 0.522949 |
913e21b2fc84035d7b7f6825a9066385f3ee8afc | 71 | require 'openssl'
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE | 35.5 | 53 | 0.788732 |
bbf358cb0545ec509e7389208a82f3907d74cbb0 | 284 | # frozen_string_literal: true
require_relative '../protos/artist_pb.rb'
require_relative '../protos/contributor_pb.rb'
require_relative '../protos/recording_pb.rb'
require_relative '../protos/release_pb.rb'
module Mscmetadata
# RecordingBuilder
class RecordingBuilder
end
end
| 21.846154 | 46 | 0.795775 |
d59f331bbb1bc8b5ef8d4b29196e51f3edf19a4f | 1,771 | # -*- ruby -*-
# encoding: utf-8
require File.expand_path("lib/google/area120/tables/v1alpha1/version", __dir__)
Gem::Specification.new do |gem|
gem.name = "google-area120-tables-v1alpha1"
gem.version = Google::Area120::Tables::V1alpha1::VERSION
gem.authors = ["Google LLC"]
gem.email ... | 46.605263 | 348 | 0.676454 |
d5fb84214f959b407950be42074b19466ced1327 | 1,360 | # Settings specified here will take precedence over those in config/environment.rb
Publify::Application.configure do
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test su... | 42.5 | 85 | 0.771324 |
03c35925d8f3d49c2c11f07677982e8bab2dea91 | 10,162 | #
# Copyright:: 2015-2016, Benoit Creau <benoit.creau@chmod666.org>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | 35.16263 | 127 | 0.682838 |
38b94b2de57cf379a8b1b91411ea3881e001d40a | 1,071 | class SequencesController < ApplicationController
before_action :assign_sequence, only: [:show, :edit, :update, :destroy]
def index
@sequences = Sequence.all
end
def new
@sequence = Sequence.new
end
def create
@sequence = Sequence.new(
params.require(:sequence).permit(:name)
)
... | 17.557377 | 91 | 0.671335 |
bfcba165f50f5f8cedf62afdf7eef79a8eb6cad7 | 4,156 | Rails.application.configure do
# Verifies that versions and hashed value of the package contents in the project's package.json
config.webpacker.check_yarn_integrity = false
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cach... | 39.580952 | 102 | 0.757459 |
e2902bf4b9e7723dfa8b9deeef426f42f7d31b17 | 3,779 | class ScaffoldGenerator < Rails::Generator::NamedBase
default_options :skip_timestamps => false, :skip_migration => false
attr_reader :controller_name,
:controller_class_path,
:controller_file_path,
:controller_class_nesting,
:controller_class_nesti... | 40.202128 | 156 | 0.695687 |
edd75c02f1e6e27a1f9a0c73ab1dda8e194d498a | 225 | # Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :series_statement_relationship_type do
display_name "MyString"
typeid 1
position 1
note "MyText"
end
end
| 20.454545 | 68 | 0.755556 |
1a7f6dee3b2fe339cb002604f9d26ffe5dedf5ba | 1,226 | # frozen_string_literal: true
class TestCommand < Licensed::Commands::Command
def initialize(config:, reporter: TestReporter.new)
super(config: config)
@test_reporter = reporter
end
def reporter
@test_reporter
end
def create_reporter(options)
@test_reporter
end
def run(**options)
su... | 22.290909 | 91 | 0.674551 |
01e7efcd7a242b8f080e1f5ee71a344d705981f1 | 3,148 | module Locomotive
class Configuration
@@default_locales = %w{en de fr bg ca cs da el es et fa-IR fi-FI it ja-JP lt nb nl pl-PL pt pt-BR ru sk sr sv sv-FI uk zh-CN}
@@defaults = {
name: 'Locomotive',
host: nil,
# forbidden_paths: %w... | 32.791667 | 170 | 0.586086 |
b968a0de52cc12f9a8fba4d78434d59bb8868e9d | 277 | class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :firstname
t.string :lastname
t.string :email, :allow_null => false
t.string :timezone
t.integer :login_count
t.boolean :system_admin
t.timestamps
end
end
end
| 19.785714 | 43 | 0.714801 |
1ae8e7035e624ae6006ab706b14610cf45a7c215 | 879 | Given /^I login as a new learner$/ do
step %{I login as a new "learner"}
end
Given /^I login as a new "([^"]*)"$/ do |user_role|
password = 'password'
role_to_factory = { 'scitent admin' => :user_scitent_admin,
'tech support' => :user_tech_support,
'product admin' => :user_product_admin,
'course admi... | 25.114286 | 67 | 0.657565 |
ab80c39f6fed68a3fc3caf9137ab0aa33ccc04e1 | 1,502 | # -*- encoding: utf-8 -*-
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
require 'acts_as_sanitiled/version'
Gem::Specification.new do |s|
s.name = "acts_as_sanitiled"
s.version = ActsAsSanitiled::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Gabe da Silveira"]
s.email... | 39.526316 | 391 | 0.647803 |
61b41688c1e13b840408ff2bf3bfd8bbde784271 | 42 | Alki do
service(:val) { "<<one>>" }
end
| 10.5 | 29 | 0.52381 |
61b73a474384ff88be71b62fd920aa8bdcf22d59 | 860 | class SecurityMailer < ApplicationMailer
layout nil
def notify(user, type, activity)
address = []
Geocoder.configure(language: I18n.locale)
ip_result = Geocoder.search(activity.ip).first
unless ip_result.blank? || ip_result.data["loc"].blank?
loc_result = Geocoder.search(ip_result.data["loc"]... | 33.076923 | 86 | 0.689535 |
1ac305d328a55990e0cc53e5319ad1d0976eb205 | 327 | if Object.const_defined? :PolarSSL
module PolarSSL
VERSION = '0.0.1'
class MallocFailed < StandardError; end
class NetWantRead < StandardError; end
class NetWantWrite < StandardError; end
class SSL
class Error < StandardError; end
class ReadTimeoutError < StandardError; end
end
... | 25.153846 | 49 | 0.706422 |
bb807a1d526d1d2c33d45fc89c23c6a83ef53d7c | 1,373 | # -*- encoding: utf-8 -*-
# stub: globalid 0.4.2 ruby lib
Gem::Specification.new do |s|
s.name = "globalid".freeze
s.version = "0.4.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["David Heinemeie... | 37.108108 | 112 | 0.669337 |
ac636aa90661e11b4142ba74bf5c2628236e25fc | 325 | class User < ActiveRecord::Base
devise :database_authenticatable,
:recoverable, :rememberable, :trackable, :validatable
has_many :memberships
has_many :accounts, through: :memberships
def owned_accounts
Account.where(owner: self)
end
def all_accounts
owned_accounts + accounts
end... | 20.3125 | 62 | 0.723077 |
214b8acfd471bb43c863087027dfe82c07ad4b7d | 3,877 | # 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::V2019_06_01
module Models
#
# BGP peer status details.
#
class BgpPeerStatus
include MsRestAzure
# @return [Strin... | 29.371212 | 78 | 0.480526 |
28d26e1c993c2ef4379aa97a64addb9824cd992f | 230 | class CreateSites < ActiveRecord::Migration[6.0]
def change
create_table :sites do |t|
t.string :name, null: false, unique: true
t.string :fits_id, null: false, unique: true
t.timestamps
end
end
end
| 20.909091 | 50 | 0.656522 |
f85143f10f77bb9748821bf6a9fd8f3d6c4975fb | 2,246 | # frozen_string_literal: true
require 'collectionspace/mapper/tools/symbolizable'
module CollectionSpace
module Mapper
# Represents a JSON RecordMapper containing the config, field mappings, and template
# for transforming a hash of data into CollectionSpace XML
# The RecordMapper bundles up all the in... | 36.819672 | 112 | 0.669635 |
288018a89bd9ab0acb6421cb23bbe04342a372dd | 490 | # frozen_string_literal: true
module GraphQL
module Introspection
class DynamicFields < Introspection::BaseObject
field :__typename, String, "The name of this type", null: false, extras: [:irep_node]
# `irep_node:` will be nil for the interpreter, since there is no such thing
def __typename(ire... | 27.222222 | 91 | 0.669388 |
619b1b477527a4bb92aeb4998d2a52040ca951cd | 312 | describe 'comable/admin/shipment_methods/new' do
let(:shipment_method) { build(:shipment_method) }
before { assign(:shipment_method, shipment_method) }
it 'renders new shipment_method form' do
render
assert_select 'form[action=?][method=?]', comable.admin_shipment_methods_path, 'post'
end
end
| 28.363636 | 89 | 0.746795 |
3387495d5ece1497bb925792712a929abbb86a31 | 1,780 | # Accumulates samples in a sorted array, with methods to extract
# the sample at any given broportion of the dataset.
#
# Insertion: log n
# Fetch: 1
#
# Use:
# p = SortedSamples.new
# p << 1
# p << 3
# p << 2
#
# p % 50 get the 50th percentile (median) value.
# => 2
# p % 0 mini... | 16.635514 | 75 | 0.546067 |
ed1ec84bfd9dfd02e2e26a88472742506fc57fff | 444 | cask "hopper-disassembler" do
version "5.2.0"
sha256 "1dd4fc0aeb6c5ab64ddd5c956e1d8a7abd25557ac4b2cf3c90baad7ec041f372"
url "https://d2ap6ypl1xbe4k.cloudfront.net/Hopper-#{version}-demo.dmg"
name "Hopper Disassembler"
desc "Hopper Disassembler"
homepage "https://www.hopperapp.com/"
livecheck do
url ... | 26.117647 | 75 | 0.759009 |
612c643ed1159b30c47f55dd97786476af374551 | 966 | class Ioping < Formula
desc "Tool to monitor I/O latency in real time"
homepage "https://github.com/koct9i/ioping"
url "https://github.com/koct9i/ioping/archive/v1.0.tar.gz"
sha256 "db999abb0f9de00bce800267965cdd9b826ebce6052e905b12d9f40076157088"
head "https://github.com/koct9i/ioping.git"
bottle do
c... | 37.153846 | 93 | 0.777433 |
21a1e7d2162a3f4fe20369fc3f52eb9c2b6e0252 | 837 | class Repositext
# Represents text
class Text
attr_reader :contents, :language
def initialize(contents, language)
raise ArgumentError.new("Invalid contents: #{ contents.inspect }") unless contents.is_a?(String)
raise ArgumentError.new("Invalid language: #{ language.inspect }") unless langua... | 22.621622 | 138 | 0.661888 |
e28131abe237914b626f5d1e37d5afbfe41b203d | 6,199 | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe Course::Level, type: :model do
it { is_expected.to belong_to(:course).inverse_of(:levels) }
it 'ensures that experience points threshold is greater or equal to 0' do
expect(subject).
to validate_numericality_of(:experience_points_thresho... | 35.83237 | 99 | 0.64946 |
bb366175bc69da0ee54d72fffe96677d5bce23af | 5,689 | require "spec_helper"
describe "Bundler.require" do
before :each do
build_lib "one", "1.0.0" do |s|
s.write "lib/baz.rb", "puts 'baz'"
s.write "lib/qux.rb", "puts 'qux'"
end
build_lib "two", "1.0.0" do |s|
s.write "lib/two.rb", "puts 'two'"
s.add_dependency "three", "= 1.0.0"
... | 24.521552 | 83 | 0.560731 |
395b6ee472d510c7e22d36181bb11ebbd275bf63 | 459 | class BabyItems::Item
attr_accessor :name, :price, :description, :stores, :url
@@all = []
# def initialize(name, price, url, stores, description)
# @name = name
# @price = price
# @description = description
# @stores = stores
# @url = url
# save
# end
def save
@@all << self
en... | 15.827586 | 58 | 0.590414 |
0120fd6d8becfeec56d4366088e699156dba6248 | 1,289 | require 'rails'
module SeoMeta
class << self
def attributes
@@attributes ||= {
:browser_title => :string,
:meta_description => :text
}
end
end
class Engine < ::Rails::Engine
engine_name 'seo_meta'
end
autoload :InstanceMethods, File.expand_path('../seo_meta/instance... | 27.425532 | 87 | 0.660978 |
e8cdc43cd822f79fe2d07c55e0c4e3f58ecc128c | 1,030 | class CreateTenants < ActiveRecord::Migration[5.1]
def change
create_table :cortex_tenants, id: :uuid do |t|
t.string :name, limit: 50, null: false, index: { unique: true }
t.string :name_id, null: false, index: { unique: true }
t.text :description
t.uuid :parent_id, index: true
t.in... | 38.148148 | 119 | 0.687379 |
21d3446accfe07bc5ed43728b3cb8d2b59ea06c7 | 345 | # frozen_string_literal: true
json.id patient.id
json.pid patient.pid
json.first_name patient.first_name
json.last_name patient.last_name
json.middle_name patient.middle_name
json.full_name patient.full_name
json.phone patient.phone
json.email patient.email
json.samples_count patient.samples_count
json.contact_address... | 26.538462 | 44 | 0.866667 |
79b35b3bd96b31a2bf57194f4f9dec3c9eafbedb | 877 | # This file was automatically generated by Trapeze, the safety-net generator for
# Ruby. Visit http://trapeze.rubyforge.org/ for more information.
require 'test/unit'
class Test_ < Test::Unit::TestCase
def test_top_level_method_bar_should_return_bar
assert_equal "BAR!", eval('bar', TOPLEVEL_BINDING, __FILE__... | 36.541667 | 202 | 0.791334 |
33925eda58d8ea6c89659ddd27983bc433bc1fab | 508 | module Loaderio
module Configuration
extend self
attr_accessor :api_key, :api_version, :protocol, :server
#default values
self.api_version = "v2"
self.protocol = "https"
self.server = "api.loader.io"
self.api_key = ENV["LOADERIO_API_KEY"]
def base_url
"#{protocol}:/... | 24.190476 | 116 | 0.641732 |
ab2f667a3ad6bccd385e8d72fa1533411d79d7ca | 2,184 | feature 'Uploaded Items Block', feature: true, js: true, versioning: true do
let(:exhibit) { FactoryBot.create(:exhibit) }
let(:exhibit_curator) { FactoryBot.create(:exhibit_curator, exhibit: exhibit) }
let(:fixture_file1) { File.join(FIXTURES_PATH, '800x600.png') }
let(:fixture_file2) { File.join(FIXTURES_PATH... | 33.090909 | 81 | 0.686813 |
e2a602327771d9a6b8326e22b6caaba011c4c872 | 688 | cask "powershell" do
version "7.1.2"
sha256 "A3B664487FB2906ABF52442B5E620DF3CF1FCE8AFF82C81679923C66097272C2"
url "https://github.com/PowerShell/PowerShell/releases/download/v#{version}/powershell-#{version}-osx-x64.pkg"
name "PowerShell"
desc "Command-line shell and scripting language"
homepage "https://... | 24.571429 | 112 | 0.694767 |
62c14a4be4f12d5f33dabb38a411b518e7b161fc | 1,517 | # frozen_string_literal: true
require 'spec_helper'
shared_examples 'package_helper' do |data, conf|
describe ::MSDotNet::PackageHelper do
let(:package_helper) do
# Set Core SKU
data['kernel']['os_info']['operating_system_sku'] = conf[:core?] ? 0x0D : 0x00
# Set arch
data['kernel']['mach... | 28.622642 | 96 | 0.667765 |
4aaf55780dcc5a96c376f112336c89b74553185c | 1,437 | # frozen_string_literal: true
require 'g5_authenticatable_api/services/token_validator'
require 'g5_authenticatable_api/services/user_fetcher'
module G5AuthenticatableApi
module Helpers
# Helpers for rails API controllers
module Rails
def authenticate_api_user!
raise_auth_error unless token_va... | 22.107692 | 58 | 0.619346 |
b9a395059da05c29edcf42b25b4a97de1cf33300 | 3,005 | # encoding: utf-8
require File.dirname(__FILE__) + '/../spec_helper'
require 'cucumber/rb_support/rb_step_definition'
require 'cucumber/rb_support/rb_language'
module Cucumber
describe StepMatch do
before do
@rb_language = RbSupport::RbLanguage.new(nil)
end
def stepdef(regexp)
RbSupport::RbS... | 45.530303 | 150 | 0.627953 |
87dcda6a64e241194818c0b1e2077452b1c1d5bb | 542 | module FistOfFury
module Actor
class Clock < FistOfFury::Clock
include FistOfFury::Actor
def initialize(*args, &block)
after(0) do
debug 'FistOfFury::Clock starting loop...'
loop!
end
end
private
def loop!
after([time { tick }, 0].max) d... | 20.074074 | 65 | 0.555351 |
396e4598b23ac9a3a5d5172e537c723ea46f3351 | 677 | testcase Malt::Machine do
method :engine do
test "corrent engine is used when specified" do
machine = Malt::Machine.new
engine = machine.pry.engine(:erb,:erubis)
engine.assert == Malt::Engine::Erubis
#machine.render(:text=>"<%= title %>", :type=>:erb, :engine=>:erubis, :data=>{:title=>'T... | 24.178571 | 103 | 0.610044 |
ac7f1771979afcd2a8f34d23b86a13521f15b69a | 1,740 | # -*- mode: ruby -*-
# vi: set ft=ruby :
namespace :project do
namespace :json do
desc "Import from file a json dump of a project, primary-content, workflows & primary-content, avatar and background"
task import: :environment do
json_dump_file_path = "#{ENV['JSON_PROJECT_DUMP_PATH']}"
new_owner =... | 40.465116 | 121 | 0.662644 |
91eaa6e9cc22889e4b10e532c89fea1b286c0cea | 3,766 | class Ling < ApplicationRecord
resourcify
include Groupable
include CSVAttributes
CSV_ATTRIBUTES = %w[ id name depth parent_id group_id creator_id ]
def self.csv_attributes
CSV_ATTRIBUTES
end
validates :name, :presence => true, :uniqueness => { :scope => :group_id }
validates :depth, :presence ... | 30.617886 | 149 | 0.69145 |
1832f67e4c95c34570510e3648bfad91d160a35a | 180 | Rails.application.routes.draw do
root 'people#new'
get 'adm0n' => 'people#clear', constraints: {ip: /127.0.0.1/}
resources :people, :except => [:edit, :update, :destroy]
end
| 30 | 63 | 0.666667 |
b92adcf29874803db66533632dcc1db34dd03dd2 | 135 | class CreateImportFieldMappings < ActiveRecord::Migration
def change
create_table :import_field_mappings, &:timestamps
end
end
| 22.5 | 57 | 0.807407 |
b93047a6647fa4f7f24aa836d2abf6743e9a7e7a | 988 | #
# Chef Documentation
# https://docs.chef.io/libraries.html
#
#
# This module name was auto-generated from the cookbook name. This name is a
# single word that starts with a capital letter and then continues to use
# camel-casing throughout the remainder of the name.
#
module Workstation
module Helpers
def pip_... | 26 | 82 | 0.717611 |
bf65be8509763abca626afad22568777d110890b | 5,795 | #===============================================================================
# ** Scene Battle
#------------------------------------------------------------------------------
# Add the feature to call the Scan screen in battle
#===============================================================================
class ... | 36.677215 | 86 | 0.456946 |
797f22a758488d1a4e8d1693fd6a2b04f19910b6 | 6,195 | =begin rdoc
= Property Registry
This module allows model classes to register properties that have setter and getter methods,
and are earmarked to be included in calls between instances of those classes and the API.
Properties are registered using a DataMapper-style syntax (ActiveRecord-style autodiscover... | 30.975 | 158 | 0.580468 |
91d3648d1d0333c298550d0bcc7b285c0009b17b | 746 | cask 'extraterm' do
version '0.49.0'
sha256 '66ec873fcf3530935bbbff76dbd655d85fc765e448e41fe20d6a4f708ca4d5bc'
# github.com/sedwards2009/extraterm/ was verified as official when first introduced to the cask
url "https://github.com/sedwards2009/extraterm/releases/download/v#{version}/extraterm-#{version}-darwin... | 39.263158 | 115 | 0.715818 |
d556813254433b128adc118f5656d372d263d0ab | 177 | json.array!(@orders) do |order|
json.extract! order, :id, :name, :address, :phone, :ship_cost, :total_cost, :discount, :food_id
json.url order_url(order, format: :json)
end
| 35.4 | 97 | 0.700565 |
f849617299a641b8e8b2c8d0081b19fd4e97b354 | 2,831 | class SearchNotesQueries
SCOPE_ALL_STUDENTS = 'SCOPE_ALL_STUDENTS'
SCOPE_FEED_STUDENTS = 'SCOPE_FEED_STUDENTS'
SCOPE_MY_NOTES_ONLY = 'SCOPE_MY_NOTES_ONLY'
MAX_YEARS_BACK = 4
MAX_LIMIT = 100
def self.clamped_with_defaults(query = {})
query.merge({
scope_key: query[:scope_key] || SearchNotesQuerie... | 34.108434 | 104 | 0.703992 |
62c43d3a95f65e68703cddd414e1956ebaac3a7d | 4,306 | # This file contains support for the now-deprecated +config+ method that the engines
# plugin provided before version 1.2. Instead of using this, plugin authors are
# now encouraged to create their own Module configuration mechanisms; the
# +mattr_accessor+ mechanism provided by ActiveSupport is ideal for this:
#
# m... | 31.896296 | 85 | 0.653275 |
080c10568dd7dec6e145506ef20f7c74522d5f1b | 2,929 | RSpec::Support.require_rspec_core "formatters/base_formatter"
require 'json'
module RSpec
module Core
module Formatters
# @private
class JsonFormatter < BaseFormatter
Formatters.register self, :message, :dump_summary, :dump_profile, :stop, :close
attr_reader :output_hash
def... | 30.831579 | 87 | 0.571526 |
62bdbcad97cd68c7acb53d8a3eb4aceb781d5f19 | 8,298 | # Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either lic... | 37.890411 | 245 | 0.680405 |
87a9d7364ccadb514bd2bec73462c81b20381015 | 1,632 | require 'spec_helper_acceptance'
describe 'basic ec2api' do
context 'default parameters' do
it 'should work with no errors' do
pp= <<-EOS
include ::openstack_integration
include ::openstack_integration::repos
include ::openstack_integration::rabbitmq
include ::openstack_integratio... | 26.322581 | 95 | 0.555147 |
5d6209c93df7d6bee04373010198b12d1d2ba968 | 2,547 | require 'leveldb/leveldb' # the c extension
module LevelDB
class DB
include Enumerable
class << self
## Loads or creates a LevelDB database as necessary, stored on disk at
## +pathname+.
##
## See #make for possible options.
def new pathname, options={}
make path_string(pathname),
... | 24.728155 | 108 | 0.64625 |
7a9098603d06c640cc909a3c28f5283ba79f029a | 1,471 | module Ru
class Array
def initialize(array)
@data = array.to_a
end
def each_line
Ru::Iterator.new(self)
end
def files
@data.map! do |line|
Ru::File.new(line)
end
self
end
def format(format='l')
@data.map! do |item|
item.format(format)
... | 16.908046 | 60 | 0.542488 |
083c6d5992232a4d0a6bd6b0f644af32f9ce110e | 742 | module Events
module CardEvents
class AnEvilEmpire < Instruction
def action
instructions = []
instructions << Instructions::AwardVictoryPoints.new(
player: US,
amount: 1
)
instructions << Instructions::CancelEffect.new(
card_ref: "FlowerPower... | 19.526316 | 61 | 0.571429 |
1a3044c2e6c190ea2983c81bce705c7e3cba85c4 | 1,625 | #: * `unpack` [`--git`|`--patch`] [`--destdir=`<path>] <formulae>:
#: Unpack the source files for <formulae> into subdirectories of the current
#: working directory. If `--destdir=`<path> is given, the subdirectories will
#: be created in the directory named by `<path>` instead.
#:
#: If `--patch` is passe... | 29.545455 | 80 | 0.632 |
acde932a19000099bb82330d3326ac7ebdaddbe1 | 5,083 | require 'uri'
require 'hashr'
require 'travis/config'
require 'core_ext/string/to_bool'
module Travis
module Build
class Config < Travis::Config
extend Hashr::Env
self.env_namespace = 'travis_build'
def ghc_version_aliases_hash
@ghc_version_aliases_hash ||= version_aliases_hash('ghc'... | 32.375796 | 83 | 0.560299 |
b9e718cda0305e50ad5fbd864118ce9f0e4ca5c9 | 245 | class UserMailer < ApplicationMailer
def account_activation(user)
@user = user
mail to: user.email, subject: "Account activation"
end
def password_reset(user)
@user = user
mail to: user.email, subject: "Password reset"
end
end
| 18.846154 | 54 | 0.722449 |
6a7ebc83e7919d8dfa38eb45f158b474aa6a1a89 | 302 | class SwitchHostPathIndexToCanonicalPath < ActiveRecord::Migration
def up
add_index :host_paths, :canonical_path
remove_index :host_paths, column: [:c14n_path_hash]
end
def down
add_index :host_paths, :c14n_path_hash
remove_index :host_paths, column: [:canonical_path]
end
end
| 25.166667 | 66 | 0.764901 |
873b44d991027b9674f56bc832201fc7eb5c6234 | 2,163 | # frozen_string_literal: true
# `ApplicationControler` is set to always return JSON. In this controller we want to return
# html and pdf, so we subclass ActionController directly
class Public::PostingsController < ActionController::Base
include Response
include TransactionHandler
# /public/postings/<id>
... | 30.464789 | 91 | 0.657883 |
7976e1d6a0230953f4cea81c35ce9e4363dcabc9 | 1,178 | module Statsd
class Runner
def self.default_config
{
:host => "0.0.0.0",
:port => 8125,
:daemonize => false,
:debug => false,
:flush_interval => 10,
:threshold_pct => 90,
:graphite_host => '127.0.0.1',
:gra... | 27.395349 | 124 | 0.537351 |
21529d8f38db7ae8b6913ebecdadaff5d66c4cf1 | 147 | class AddLastHarvestSecondsToResources < ActiveRecord::Migration
def change
add_column :resources, :last_harvest_seconds, :integer
end
end
| 24.5 | 64 | 0.809524 |
08d02e17a0c5a727ee83e5f0531b272820786ebf | 1,196 | #---
# Excerpted from "Ruby on Rails, 2nd Ed."
# We make no guarantees that this code is fit for any purpose.
# Visit http://www.editions-eyrolles.com/Livre/9782212120790/ for more book information.
#---
class AdminController < ApplicationController
before_filter :authorize
# ....
def index
list
r... | 19.933333 | 88 | 0.64214 |
f7dfd7c1bc5c376313307133645caf1b70329910 | 6,975 | require File.expand_path('../../spec_helper', __FILE__)
require 'tempfile'
describe Checksum::Tools::Remote do
describe "file operations" do
before :all do
@mock_sftp = Class.new do
def dir
Class.new do
def self.[](*args)
Dir[File.join(*args)].collect { |s|
... | 47.128378 | 190 | 0.62552 |
ed645f3e3674b0d29bdb34f56938d40c70527f06 | 460 | cask 'flipper' do
version '0.45.0'
sha256 '533b35691d99ecb441f8da9a2609911c2e7b57ab6d13b1ac1d4e999e07e89461'
# github.com/facebook/flipper/ was verified as official when first introduced to the cask
url "https://github.com/facebook/flipper/releases/download/v#{version}/Flipper-mac.zip"
appcast 'https://githu... | 32.857143 | 91 | 0.767391 |
5dae631eb51044a2f4799431e04a7f54160e454d | 1,584 | require_relative "DefaultUIobject.rb"
require_relative "../../Maths/General_Maths.rb"
#Also serves a roll of buttons...
class InteractableUIobject < DefaultUIobject
include General_Maths
def initialize drawable, label, rect, listener
@box, @text = drawable
@box_default_width, @box_default_height = @box.... | 33 | 158 | 0.683081 |
e80345faa7594f3b080ce2149dc06db8e92fbed6 | 191 | # Note that this policy is only for *management* of ItemTypes. All users can
# of course view items within any item type, since they are all public.
class ItemTypePolicy < FieldSetPolicy
end
| 38.2 | 76 | 0.78534 |
abebb74f731202a0a6f707e4796065ac059b7de1 | 2,142 | class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
def change
# Use Active Record's configured type for primary and foreign keys
primary_key_type, foreign_key_type = primary_and_foreign_key_types
create_table :active_storage_blobs, id: primary_key_type do |t|
t.string :key, n... | 37.578947 | 126 | 0.69281 |
bf00c04af5447a11b5d181175c9ffc0ee2c2bba2 | 818 | require 'faraday'
require 'faraday_middleware'
module ZenhubRuby
module Connection
END_POINT = 'https://api.zenhub.io'.freeze
def get(path)
api_connection.get(path)
end
private
def api_connection
@api_connection ||= Faraday::Connection.new(END_POINT, connect_options)
end
... | 21.526316 | 78 | 0.634474 |
bb9947633db1691dc2ecd9e19910c1b23d908eda | 645 | DUMMY_PRIV_KEY = 'f278550976dbe8cee36bd9bed2faa4170d8cee467e41b97e7ee557bd407bef7c'
DUMMY_ADDRESS = 'MzgmkqvuhZtVxY7Ni5ytgxRMGF4wtdaD1G'
DUMMY_IDENTIFIER = 'MzgmkqvuhZtVxY7Ni5ytgxRMGF4wtdaD1G_2c7f0b55c7c63a66c8b5ef84702cd2b5d61e7b9f'
DUMMY_HASHED_REVIEW = '2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5... | 71.666667 | 125 | 0.877519 |
796de2b5f30768bb882c9c54e5142cdb4a3d13c6 | 1,956 | require 'securerandom'
RSpec.shared_examples 'publisher' do
# WARNING: This example group requires the following helpers to be defined by caller:
# - `read_messages(topic_name, num_messages)`
# - `publisher_url`
subject do
BPS::Publisher.resolve(publisher_url)
end
after do
subject.close
end... | 26.794521 | 87 | 0.712679 |
619adc539f959fb4803c2f368c875d5c2f3b6ff7 | 616 | # encoding: utf-8
require 'erb'
class EndERB
class << self
# for single template script using __END__ and DATA
#
# === Params
#
# * <tt>:hash</tt> - erb template variable hash
#
# === Example
#
# def hoge
# hash = {
# hoge: '@hoge@',
# hige: '@hige@',... | 16.210526 | 55 | 0.444805 |
e84bc7dca1283495886a1ddace2d3787ed464f69 | 1,456 | # -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'credit_card_validations/version'
Gem::Specification.new do |gem|
gem.name = "credit_card_validations"
gem.version = CreditCardValidations::VERSION
gem.authors ... | 39.351351 | 114 | 0.669643 |
bb05ff294ec80d0d187a12143c1a30e65f643024 | 69 | # frozen_string_literal: true
module Liquid
VERSION = "4.0.3"
end
| 11.5 | 29 | 0.724638 |
62480a929dcdc2538fb17ace40a8da0329153c01 | 9,537 | class ReconNg < Formula
include Language::Python::Virtualenv
desc "Web Reconnaissance Framework"
homepage "https://github.com/lanmaster53/recon-ng"
url "https://github.com/lanmaster53/recon-ng/archive/v5.1.2.tar.gz"
sha256 "18d05030b994c9b37f624628251d3376d590f3d1eec155f67aca88fa5f3490cc"
license "GPL-3.0"... | 46.75 | 143 | 0.809898 |
180acd47f535c45113d742367d5c6025b531bd72 | 3,129 | require File.expand_path('../../test_helper', __FILE__)
module Checkr
class CountyCriminalSearchTest < Test::Unit::TestCase
setup do
@county_criminal_search_url = "#{Checkr.api_base}/v1/county_criminal_searches"
end
context 'CountyCriminalSearch class' do
should 'be retrieveable' do
... | 37.698795 | 179 | 0.738575 |
bb3b67c8807f4184775f0378981e18db62b0d5ec | 629 | require_relative 'point'
class Line
attr_reader :a, :b
def self.from_points(point_a, point_b)
a = (point_b.y - point_a.y).to_f / (point_b.x - point_a.x)
b = point_b.y - a * point_b.x
new(a, b)
end
def initialize(a, b)
@a = a
@b = b
end
def cover?(point)
point.y == value(point.x)
... | 16.552632 | 62 | 0.561208 |
ab5f235d6bc8b17d851e6ffaf9425b36959a2cd5 | 3,273 | class Job
module CdeExtension
def process_new_cde
Rails.logger.info("I'm about to process cde job #{self.id}")
# the coordinates may be stored as a proper coordinate string or by
# four simple values supplied by simple users. Here one converts
# the latter into the former
user = Us... | 34.819149 | 84 | 0.597922 |
e973935d002edb721b6c3460c7380d1c8cb62800 | 2,204 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# dat... | 35.548387 | 86 | 0.718693 |
38f31c0078e206515f814ed612b2afc59cf3bdd9 | 1,385 | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# dat... | 39.571429 | 86 | 0.750903 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.