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 |
|---|---|---|---|---|---|
79ea9898c5e825abfe5bbeec7365ee58b51da4d6 | 256 | class Phrase
REGULAR_EXPRESSION = {
WORDS: /\b[\w']+\b/
}
RE = REGULAR_EXPRESSION
private_constant :REGULAR_EXPRESSION, :RE
attr_reader :word_count
def initialize(phrase)
@word_count = phrase.downcase.scan(RE[:WORDS]).tally
end
end
| 18.285714 | 56 | 0.699219 |
ff7a32ed67497bf1d2601260840936115cce0222 | 71 | def my_add(param_1, param_2)
n = param_1 + param_2
return n
end | 17.75 | 28 | 0.676056 |
1a5cc1ea71f357e9caccdb61b139078f8725c14d | 1,089 | require File.join(File.dirname(__FILE__), "/../spec_helper" )
describe Device do
context "find or create" do
it "should match and return an existing device" do
device = create :device
data = { :model => device.model, :vendor => device.vendor}
dev = Device.find_or_create_device(data)
dev... | 31.114286 | 97 | 0.632691 |
7a298f1ace905b9337a1fb8f20cd3de207780fed | 1,589 | require 'bitbucket_rest_api'
class IssueTrackers::BitbucketIssuesTracker < IssueTracker
Label = "bitbucket"
Note = 'Please configure your Bitbucket repository in the <strong>BITBUCKET REPO</strong> field above.'
Fields = [
[:api_token, {
:placeholder => "Your username on Bitbucket account",
:label... | 31.156863 | 152 | 0.675897 |
030d79efce630242edba1eabc53885b21aab6592 | 179 | class AddAttemptLimitToProgrammingQuestions < ActiveRecord::Migration[4.2]
def change
add_column :course_assessment_question_programming, :attempt_limit, :integer
end
end
| 29.833333 | 80 | 0.826816 |
910fcc19ed18c2794e7c9f4b4c88252fb9fb7947 | 660 | class PartnerRequest < ApplicationRecord
belongs_to :partner, dependent: :destroy
has_many :items, dependent: :destroy
accepts_nested_attributes_for :items, allow_destroy: true, reject_if: proc { |attributes| attributes["quantity"].blank? }
validates :partner, presence: true
def export_json
{
req... | 27.5 | 123 | 0.701515 |
62e32de98d6e32fb764b5744f1d8c9306eb384c6 | 976 | require "spec_helper"
describe "Vocab::Converter::Rails" do
before( :each ) do
@test_dir = "#{vocab_root}/spec/data/rails/xml"
end
describe 'convert_xml_to_yml' do
it 'converts and xml file to a yml file' do
xml_file = "#{@test_dir}/in_file.xml"
yml_file = "#{@test_dir}/in_file.yml"
... | 30.5 | 66 | 0.654713 |
795f01c82ade6b57ada5a27b3b6675c2bd1183f9 | 964 |
require 'bundler/setup'
require 'miw'
require 'miw/table_view'
require 'miw/model/data_set'
if __FILE__ == $0
w = MiW::Window.new("table", 10, 10, 400, 400, layout: MiW::Layout::VBox)
def w.quit_requested
p :quit_requested
EM.stop_event_loop
end
dataset = MiW::Model::DataSet.new
100.times do |i|
... | 26.777778 | 107 | 0.682573 |
bffb6ee5b9c0cf2119f9347e690492118f2c7ac6 | 779 | require "spec_helper"
require "hamster/sorted_set"
describe Hamster::SortedSet do
let(:sorted_set) { Hamster.sorted_set(*values) }
describe "#last" do
let(:last) { sorted_set.last }
shared_examples "checking values" do
it "returns the last item" do
expect(last).to eq(last_item)
end
... | 20.5 | 50 | 0.609756 |
acf48f1f38c4437d1bab7c5413e7c2a5d1babffd | 55 | class Color < ApplicationRecord
has_many :product
end
| 13.75 | 31 | 0.818182 |
4a0722f8faf41bf5ff6903a75bc4bf147287e12e | 117 | # coding: utf-8
require File.dirname(__FILE__) + '/../test_helper'
class AcBoletosTest < Test::Unit::TestCase
end
| 14.625 | 50 | 0.717949 |
39dde37f1e8e4c4d1027bfc5b522ccefa032ffa2 | 224 | module StandardTasks
class PaperEditorTaskSerializer < TaskSerializer
embed :ids
has_one :editor, serializer: UserSerializer, include: true, root: :users
def editor
object.paper.editor
end
end
end
| 20.363636 | 76 | 0.727679 |
b984f04ad06f4d092223bc5f8ec7a808641cc300 | 190 | class AxureRpPro < Cask
version 'latest'
sha256 :no_check
url 'https://axure.cachefly.net/AxureRP-Pro-Setup.dmg'
homepage 'http://www.axure.com/'
link 'Axure RP Pro 7.0.app'
end
| 19 | 56 | 0.7 |
ff962e0e04fea496514330841732d64cafd4a4dd | 623 | module Sentry
class RequestInterface
def from_rack(env_hash)
req = ::Rack::Request.new(env_hash)
if Sentry.configuration.send_default_pii
self.data = read_data_from(req)
self.cookies = req.cookies
else
# need to completely wipe out ip addresses
IP_HEADERS.each { ... | 27.086957 | 56 | 0.659711 |
ed4c2c31a9acaa3761c4bd82a9b28b401d3531bb | 11,223 | # frozen_string_literal: true
require "helper"
class TestPage < JekyllUnitTest
def setup_page(*args)
dir, file = args
if file.nil?
file = dir
dir = ""
end
@page = Page.new(@site, source_dir, dir, file)
end
def do_render(page)
layouts = {
"default" => Layout.new(@site, sour... | 30.497283 | 77 | 0.586474 |
ac192a66c20ea1dfc9b123305e1816db839fb20b | 19,878 | # encoding: utf-8
require "spec_helper"
require "logstash/filters/grok"
describe LogStash::Filters::Grok do
describe "simple syslog line" do
# The logstash config goes here.
# At this time, only filters are supported.
config <<-CONFIG
filter {
grok {
match => { "message" => "%{SY... | 30.628659 | 213 | 0.555438 |
5d2411b31a5bb44b32ad10eaf0077bce1a53f325 | 2,090 | class ResidentsController < ApplicationController
before_action :authenticate_user!
before_action :set_resident, only: [:show, :edit, :update, :destroy]
# GET /residents
# GET /residents.json
def index
@residents = Resident.order(:house_number, :email_address)
@groups = @residents.group_by { |r| r.ro... | 27.142857 | 96 | 0.675598 |
1c895a5ee6f9e19b2317829448b14514852e3649 | 1,151 | # frozen_string_literal: true
# before hook for Cucumber
Before do
# Brick.enable_routes = true
# Brick.enable_models = true
# Brick.enable_controllers = true
# Brick.enable_views = true
Brick.request.whodunnit = nil
Brick.request.controller_info = {} if defined?(::Rails)
end
module Brick
module Cucumbe... | 28.775 | 63 | 0.668115 |
08d299d9a1e967a65c01e31c63cc06907b1e6b9a | 2,024 | module PlateApi
class Connector
def initialize(public_key, secret_key, custom_server=nil)
@custom_server = custom_server
@public_key = public_key
@secret_key = secret_key
@handling_classes = {}
end
def get(url="", parameters={}, response_type=:json)
GetRequest.new(@public_k... | 33.180328 | 113 | 0.689723 |
d53d385c177dfe9f10c7d0feb25e71f7bf5bef3a | 16,281 | module Sogou
module Search
module Api
module Core
module Regions
REGIONS_CODE = {
1 => 'All regions',
1000 => 'Beijing',
2000 => 'Shanghai',
3000 => 'Tianjin',
4000 => 'Guangdong',
5000 => 'Fujian',
8000 =>... | 37.6875 | 88 | 0.450832 |
61eebfc7e44f2b371626f51593242bbfa4f4e79c | 3,397 | #!/usr/bin/env ruby
# Encoding: utf-8
#
# Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
#
# License:: 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
#
# ... | 32.352381 | 79 | 0.649102 |
1d6501ed91131b3e9375ed684a94feccbf00093c | 1,514 | # frozen_string_literal: true
require "software_spec"
describe SoftwareSpec do
subject(:spec) { described_class.new }
describe "#uses_from_macos" do
before do
sierra_os_version = OS::Mac::Version.from_symbol(:sierra)
allow(OS).to receive(:mac?).and_return(true)
allow(OS::Mac).to receive(:v... | 28.566038 | 93 | 0.678336 |
7a71b2cca67e1b26d80939801b54c605bd7aab96 | 702 | require 'spec_helper'
describe Osare do
it 'has a version number' do
expect(Osare::VERSION).not_to be nil
end
context 'osare prepended class' do
let(:prepended) { Base.new }
it 'enable decorete' do
expect(prepended.fuga).to eq 'fuga decorated2'
end
it 'enable nested decorete' do
... | 25.071429 | 63 | 0.685185 |
08add6ddc66e60c575daf862e9addbc88e74f2a7 | 39,955 | # Copyright 2015 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 44.542921 | 87 | 0.627781 |
018492bdb06bf40cd184287fa165735c0bac2c13 | 157 | Rails.application.routes.draw do
devise_for :users, controllers: {sessions: 'sessions'}
mount EhjobAuthentication::Engine => "/ehjob_authentication"
end
| 31.4 | 62 | 0.783439 |
ac0a59b27bd587131413b96c6dd41a05f1ace08e | 467 | module RSpec
module Sidekiq
module Spec
module Support
module Factories
def create_worker options = {}
clazz_name = "Worker#{ rand(36 ** 10).to_s 36 }"
clazz = Class.new do
include ::Sidekiq::Worker
sidekiq_options options
... | 21.227273 | 60 | 0.505353 |
1dafa49d35efdc741242e43cd8cb50275b455ba0 | 401 | module Fog
module Parsers
module AWS
module Compute
class ReplaceNetworkAclAssociation < Fog::Parsers::Base
def reset
@response = {}
end
def end_element(name)
case name
when 'requestId', 'newAssociationId'
@response[nam... | 19.095238 | 63 | 0.506234 |
9150385e9d7ec7c7f51d9a8a6e400fc0fd21aa57 | 811 | # frozen_string_literal: true
module IndexesCreator
include ActiveSupport::Concern
def generate_solr_document
super.tap do |solr_doc|
index_creator(solr_doc)
end
end
private
def index_creator(solr_doc)
creator_names = object.creators.map(&:display_name)
facet_names = object.cre... | 28.964286 | 95 | 0.717633 |
e8f22515516972497a39a64858ed9b9791fc502f | 115 | module GamesAdmin
class ApplicationController < ActionController::Base
layout "web_ui/application"
end
end
| 19.166667 | 54 | 0.791304 |
1dba498c405990c973f6926d41ef947b6d9eb45a | 419 | class Micropost < ApplicationRecord
belongs_to :user
default_scope -> { order(created_at: :desc) }
mount_uploader :picture, PictureUploader
validates :user_id, presence: true
validates :content, presence: true, length: { maximum: 140 }
validate :picture_size
private
def picture_size
if picture... | 24.647059 | 62 | 0.701671 |
26881cd934c34c2d8a78f5329e20fa9a273d1610 | 1,309 | module HealthSeven::V2_7_1
class Om2 < ::HealthSeven::Segment
# Sequence Number - Test/Observation Master File
attribute :sequence_number_test_observation_master_file, Nm, position: "OM2.1"
# Units of Measure
attribute :units_of_measure, Cwe, position: "OM2.2"
# Range of Decimal Precision
attribute :range_o... | 54.541667 | 122 | 0.792972 |
21cf4f930cf6b9f55fb6b317e222fc25bdd2c40b | 726 | # frozen_string_literal: true
require 'rails_helper'
RSpec.feature 'User Logs in and logs out' do
scenario 'Test the log in and the log out' do
user = FactoryBot.create(:user)
visit new_user_session_path
within('form') do
fill_in 'Email', with: user.email
fill_in 'Password', with: user.passwo... | 30.25 | 57 | 0.698347 |
9156c5bb6fc5dabb1a06ecb07e8b54ed7f931325 | 47 | module VCloudSdk
VERSION = '1.5.0.pre.3'
end
| 11.75 | 25 | 0.680851 |
38c50b1ac42b80e0c0c6a74b242122d9d2cba7a5 | 1,762 | require_dependency "questionable/application_controller"
module Questionable
class AnswersController < ApplicationController
def create
answers = params[:answers]
if answers.is_a?(Hash)
# Answers should always be a hash, and the values should be arrays,
# even if the question input... | 35.959184 | 132 | 0.583428 |
bba3648c0ecc209a1e8e0e3490e4ee49eebf70f3 | 3,432 | =begin
#Power Cloud API
#IBM Power Cloud API for Power Hardware / Infrastructure
The version of the OpenAPI document: 1.0.0
Contact: kylej@us.ibm.com
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 5.0.0-beta2
=end
require 'spec_helper'
require 'json'
require 'date'
# Unit tests for IbmClou... | 28.6 | 102 | 0.712413 |
79e9410bc678948f55503cf356ff537f67b87822 | 162 | require 'factory_bot'
require_relative './testing/constants.rb'
require_relative './testing/factories.rb'
module AndroidInAppBilling
module Testing
end
end
| 16.2 | 41 | 0.802469 |
e8a9eb4e9ba27403bdd5ac5662ab6eef9b412f9f | 237 | # http://www.codewars.com/kata/55c28f7304e3eaebef0000da
# --- iteration 1 ---
def create_array(n)
res=[]
i=1
while i <= n
res+=[i]
i += 1
end
return res
end
# --- iteration 2 ---
def create_array(n)
(1..n).to_a
end
| 13.166667 | 55 | 0.590717 |
268a147f940890a3d6f9a1df46a0332998b000e6 | 1,436 | # encoding: UTF-8
# frozen_string_literal: true
module APIv2
class OrderBook < Struct.new(:asks, :bids); end
class OrderBooks < Grape::API
helpers ::APIv2::NamedParams
desc 'Get the order book of specified market.',
is_array: true,
success: APIv2::Entities::OrderBook
params do
use :... | 37.789474 | 135 | 0.678969 |
6130c124dd12ff31f5244c73d4c4087b1c33ece6 | 1,037 | module Gitlab
module ImportExport
class Saver
include Gitlab::ImportExport::CommandLineUtil
def self.save(*args)
new(*args).save
end
def initialize(project:, shared:)
@project = project
@shared = shared
end
def save
if compress_and_save
... | 23.044444 | 119 | 0.605593 |
1a3406d17389c274ff055368fb28c33da5b778fb | 1,268 | #
# Cookbook Name:: mesos
# Spec:: master
#
require 'spec_helper'
describe 'mesos::master' do
context 'When all attributes are default, on CentOS 7' do
let(:chef_run) do
runner = ChefSpec::ServerRunner.new(platform: 'centos', version: '7.1.1503')
runner.converge(described_recipe)
end
it 'Inc... | 32.512821 | 84 | 0.672713 |
e928b067f1085180cd8e03ca6a27ac90b4c280a2 | 2,891 | # Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this f... | 45.171875 | 210 | 0.692494 |
bb4a5071d12af5dc0b452814f4559deb718c1211 | 2,194 | module ThinkingSphinx; end
require 'active_support/core_ext/string/inflections'
require 'active_support/core_ext/module/delegation'
require 'thinking_sphinx/index_set'
describe ThinkingSphinx::IndexSet do
let(:set) { ThinkingSphinx::IndexSet.new classes, indices,
configuration }
let(:classes) ... | 29.648649 | 87 | 0.662716 |
1832fc38dff86ca90d85714186810354541500eb | 7,545 | module Haml
# This class is used only internally. It holds the buffer of XHTML that
# is eventually output by Haml::Engine's to_html method. It's called
# from within the precompiled code, and helps reduce the amount of
# processing done within instance_eval'd code.
class Buffer
include Haml::Helpers
... | 31.307054 | 113 | 0.602783 |
2102af8dedc8e829500295f9632b9ea0b2e37ad1 | 9,976 | ##
# $Id$
##
##
# This file is part of the Metasploit Framework and may be subject to
# redistribution and commercial restrictions. Please see the Metasploit
# web site for more information on licensing and terms of use.
# http://metasploit.com/
##
=begin
Windows XP systems that are not part of a domain default to... | 26.962162 | 152 | 0.632518 |
1d0976950f8f2fbfcfd7e751d6a3152951d7c42e | 381 | #!/bin/env ruby
require 'open-uri'
require 'JSON'
team = ARGV[0]
dest_dir = team
Dir.mkdir dest_dir unless Dir.exist? dest_dir
json = File.open("#{team}.json").read
json = JSON.parse json
json['emoji'].each do |key, url|
unless url.start_with? 'alias'
puts key
ext = File.extname url
File.binwrite dest... | 19.05 | 72 | 0.677165 |
e96660b118f1682b17c0cb0225f3e731c93c7d72 | 3,053 | # Copyright © 2011-2019 MUSC Foundation for Research Development
# All rights reserved.
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this list... | 52.637931 | 199 | 0.766132 |
f8a7d632f3f6af7cfbbd30e5b998a79bca65a554 | 1,392 | # frozen_string_literal: true
# == Schema Information
#
# Table name: room_users
#
# id :integer not null, primary key
# user_id :integer not null
# room_id :integer not null
# last_read_message_id :integer
# unread_message_count :integer ... | 35.692308 | 106 | 0.704023 |
61cc94ba48c498f742d5124c172e819a792d5dc3 | 1,291 | require 'spec_helper'
require 'gimme/shared_examples/shared_verifies_examples'
module Gimme
describe VerifiesClassMethods do
class Natto
def self.ferment(beans=nil,time=nil)
end
end
Given(:test_double) { Natto }
Given(:double_name) { "#<Class:Gimme::Natto>" }
Given(:verifier_class) ... | 24.358491 | 64 | 0.638265 |
1c43f756f310decca1b353633cd686bcb4af415c | 123 | require 'test_helper'
class MyRequestTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| 15.375 | 45 | 0.707317 |
390d0b2379eced16420d3ef55df5574bbe044276 | 574 | class ControlObjectivesController < ApplicationController
respond_to :html
before_action :auth, :check_privileges
before_action :set_control_objective, only: [:show ]
before_action :set_title
# * GET /control_objectives
def index
@control_objectives = ControlObjective.list.search(
**search_param... | 21.259259 | 65 | 0.743902 |
87b318f7a898af402085e18be9cf2e8a3fe598d6 | 12,104 | require_relative 'test_api'
module PaypalService
module TestMerchant
def self.build(api_builder)
PaypalService::Merchant.new(nil, TestLogger.new, TestMerchantActions.new.default_test_actions, api_builder)
end
end
class FakePalMerchant
def initialize
@tokens = {}
@payments_by_order... | 34.781609 | 124 | 0.603272 |
1c7407da1e56fc3393077bdfd1b66d14750695f3 | 6,556 | RSpec.describe 'Predicates: None' do
include_context 'validator result'
describe 'with required' do
before do
@validator = Class.new do
include Hanami::Validations
validations do
required(:foo) { none? }
end
end
end
describe 'with missing input' do
... | 22.29932 | 92 | 0.511745 |
1ad2099221d9d3cba6fcaf05248015b4314916ec | 364 | if defined?(Rails)
# Rails3 generator invoked with 'rails generate ransack_memory'
class RansackMemoryGenerator < Rails::Generators::Base
source_root(File.expand_path(File.dirname(__FILE__) + "/../templates/ransack_memory"))
def copy_initializer
copy_file 'ransack_memory_template.rb', 'config/initia... | 30.333333 | 90 | 0.760989 |
6265b128878f6eeaea7ee41c92825e52acea3456 | 6,909 | module Vinerb
module Decorators
def decorate(*method_names, &with_block)
method_names.each do |method_name|
unbound_method = instance_method(method_name)
define_method(method_name) do |*args, &block|
bound_method = unbound_method.bind(self)
with_block.call(bound_method, ... | 19.627841 | 122 | 0.565928 |
6a4347c79039cfa8f1b5b0e134fcc5a756600880 | 981 | require 'test_helper'
class MicropostsControllerTest < ActionDispatch::IntegrationTest
def setup
@micropost = microposts(:orange)
end
test "should redirect create when not logged in" do
# ブロックで渡されたものを呼び出す前後でMicropost.countに違いがない
assert_no_difference 'Micropost.count' do
# microposts_pathに... | 27.25 | 77 | 0.740061 |
bf6cea073a2a0f4bd7d868778c16f30ce849d845 | 842 | require 'bipbip'
describe Bipbip::Plugin do
it 'should store configuration' do
plugin = Bipbip::Plugin.new('my-plugin', { foo: 'my foo' }, 2, %w(tag1 tag2), 'my metric')
plugin.name.should eq('my-plugin')
plugin.config.should eq(foo: 'my foo')
plugin.frequency.should eq(2)
plugin.tags.should eq(... | 32.384615 | 94 | 0.67696 |
1a4145e642f455655c0fb36f79249541d3393b00 | 1,121 | require 'speko/slack/base'
require 'speko/slack/client'
require 'speko/slack/config'
require 'speko/slack/version'
# All methods are module methods and should be called on the Speko::Slack module.
#
# Examples
#
# Speko::Slack.configure
# # => {}
module Speko
module Slack
class << self
require 'slack-r... | 21.980392 | 81 | 0.664585 |
ff7cb80a7c7f6c909e2cb2689162b906b5527276 | 72,667 | module FindConditionsSqlSyntax
include Treetop::Runtime
def root
@root || :sqlFindConditions
end
module SqlFindConditions0
def sqlBoolOrExpression
elements[1]
end
end
module SqlFindConditions1
def code; sqlBoolOrExpression.code; end
end
def _nt_sqlFindConditions
start_inde... | 22.673011 | 115 | 0.461282 |
b9a3ca14a1c5ba07cb7a6e0378a5293a438a044b | 7,797 | # 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::DataFactory::Mgmt::V2018_06_01
module Models
#
# Pipeline resource type.
#
class PipelineResource < SubResource
inclu... | 32.08642 | 79 | 0.433244 |
e2bbc522c2b3b3ae9fe8bd20bc9f0866b5448606 | 2,392 | # Copyright (c) 2020-2021 Andy Maleh
#
# 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, publish,
# d... | 30.278481 | 82 | 0.675167 |
0396838052ee1b27dd3733819fbcf9f7501f7af9 | 721 | require 'json'
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
Pod::Spec.new do |s|
s.name = package['name']
s.version = package['version']
s.summary = package['description']
s.description = package['description']
s.license = package['license']
s.autho... | 30.041667 | 96 | 0.600555 |
5d09289ae3e7715ddc758458e15168fc53f10f09 | 802 | # frozen_string_literal: true
Rails.application.routes.draw do
root to: 'articles#index'
get '/admin', to: 'admin#index'
get '/feed', to: 'feeds#index'
get '/login', to: 'sessions#new'
get '/logout', to: 'sessions#destroy'
get '/profile', to: 'users#edit'
post '/login', to: 'sessions#create'
res... | 25.0625 | 81 | 0.653367 |
6a54b645d004f77c3a29fe15bbf49c26648b99bc | 654 | # == Schema Information
#
# Table name: posts
#
# id :bigint not null, primary key
# content :text
# created_at :datetime not null
# updated_at :datetime not null
# user_id :integer
#
# Indexes
#
# index_posts_on_user_id (user_id)
#
class Post < ApplicationRecord
belongs... | 28.434783 | 110 | 0.623853 |
ff33aef4f959c829af46b9cf9847c636f8d3ae85 | 1,221 | # frozen_string_literal: true
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | 28.395349 | 74 | 0.662572 |
bb1ff4d18bdea12c1354f2859d15f260b37b465a | 5,864 | require File.dirname(__FILE__) + '/helper'
class TestTask < Minitest::Test
def setup
God.internal_init
@task = Task.new
@task.name = 'foo'
@task.valid_states = [:foo, :bar]
@task.initial_state = :foo
@task.interval = 5
@task.prepare
end
# valid?
def test_valid_should_return_false_... | 22.640927 | 85 | 0.685539 |
873f884e563c46da555395b6ea0201dfec8e2c19 | 70 | # frozen_string_literal: true
module Snake2d
VERSION = "0.1.0"
end
| 11.666667 | 29 | 0.728571 |
f8095ac00210c29e6c87f7f63819045869385140 | 47 | module CassandraAudits
VERSION = "0.0.1"
end
| 11.75 | 22 | 0.723404 |
6af32eba39dd9a7aa9a472f8937ef8ef670d5812 | 2,403 | require 'cfdoc_spec_helper'
describe CFDoc::Model::StackTemplate do
before :each do
@stack_template = CFDoc::Model::StackTemplate.new
@stack_template.version = "1"
@stack_template.description = "Example template"
end
describe "#initialize" do
end
describe "#<<" do
it "should accept Element ... | 31.207792 | 85 | 0.668747 |
2184b35152eadfb20740aba0b8a3908a9d09c37a | 564 | require 'spec_helper'
describe Projects::CommitsController do
let(:project) { create(:project) }
let(:user) { create(:user) }
before do
sign_in(user)
project.team << [user, :master]
end
describe "GET show" do
context "as atom feed" do
it "should render as atom" do
get(:show, names... | 24.521739 | 71 | 0.648936 |
f796ee69fadd1b93f147310df4445cf140de2e66 | 513 | class ApplicationController < ActionController::Base
before_action :configure_permitted_parameters, if: :devise_controller?
before_action :set_options
protected
def set_options
@options = { current_user: current_user.present? ? current_user.attributes : nil }
end
def configure_permitted_parameters
... | 32.0625 | 95 | 0.781676 |
1d6c271c44c1e68d52f18ee117b0d453f789f4e7 | 1,273 | # -*- encoding: utf-8 -*-
# stub: jquery-rails 3.1.2 ruby lib
Gem::Specification.new do |s|
s.name = "jquery-rails"
s.version = "3.1.2"
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.6") if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib"]
s.authors = ["Andr\u{e9} Arko"]
s.da... | 34.405405 | 109 | 0.62608 |
33db4ed3f3e277f71f469da3d2619c708e980159 | 1,598 | cask "goland" do
arch = Hardware::CPU.intel? ? "" : "-aarch64"
version "2021.3.3,213.6777.51"
if Hardware::CPU.intel?
sha256 "4b245b6fe0cf588adbf36e68f12397d5fd311b0b6d49f17ba374ebaa10d207c9"
else
sha256 "54397d48e20fb534206e13f84b35868b1eaea13175176487b1239b23db4e13db"
end
url "https://download.... | 31.96 | 115 | 0.695244 |
33269dff3e125427dadaaa9cbea1fd0908a2960d | 3,557 | require "spec_helper"
module Terraforming::Resource
describe DBSecurityGroup do
let(:client) do
Aws::RDS::Client.new(stub_responses: true)
end
let(:db_security_groups) do
[
{
ip_ranges: [],
owner_id: "123456789012",
db_security_group_description: "defaul... | 26.744361 | 97 | 0.459376 |
f854ceac249cc8dc793eb668b39656f06b42bba7 | 1,633 | cask 'bettertouchtool' do
if MacOS.version <= :snow_leopard
version '0.939'
sha256 'fad5e9d36259c379bdb33188cf15d179fd9ff73023035c98f5734e7e3e13bb75'
# bettertouchtool.net/releases was verified as official when first introduced to the cask
url "https://bettertouchtool.net/releases/btt#{version}.zip"
... | 37.113636 | 93 | 0.758114 |
79f6e8e751140c8cd4a542978d0bd4d0db8700c8 | 180 | require 'active_record'
require 'database_cleaner'
$: << './lib'
require 'acts_as_shopping_cart'
require 'simplecov'
SimpleCov.coverage_dir 'coverage.features'
SimpleCov.start
| 15 | 42 | 0.783333 |
9104018bac7c473b7422169f326724931f1ee122 | 4,352 | module SS::Model::Task
extend ActiveSupport::Concern
extend SS::Translation
include SS::Document
# include SS::Reference::Site
include SS::Reference::User
attr_accessor :log_buffer
included do
store_in collection: "ss_tasks"
store_in_repl_master
attr_accessor :cur_site
seqid :id
be... | 21.544554 | 98 | 0.616039 |
1a94771aa2aa0758bb22e88565012b0ba63cf3f1 | 941 | class Devdash < Formula
desc "Highly Configurable Terminal Dashboard for Developers"
homepage "https://thedevdash.com"
url "https://github.com/Phantas0s/devdash/archive/v0.4.1.tar.gz"
sha256 "801a4c9b316834589b472e87d2ed16a093b2e6031cb2724668c5ea61b28813c8"
license "Apache-2.0"
bottle do
sha256 cellar:... | 37.64 | 122 | 0.785335 |
1ce149edc34f01200d2c328da20bafb14f96a15f | 11,804 | # win32-sshclient.rb
#
# $Id$
# $Revision$
#
# Meterpreter script to deploy & run the "plink" commandline ssh-client
# supports only MS-Windows-2k/XP/Vista Hosts
#
# Version 1.0
# written by illegalguy
#
require 'net/http'
require 'uri'
meter_type = client.platform
#
# Options
#
@@exec_opts = Rex::Parser::Arguments.n... | 26.057395 | 441 | 0.66308 |
4adab19282563a98427ad6fa8127e0db82e6bec0 | 9,054 | require 'semantic'
require 'paint'
require 'yaml'
require 'json'
require_relative '../spec_file'
require_relative '../../utils/ruby_2_0_monkeypatches'
# TODO: Refactor this once we have integration tests
# rubocop:disable all
module StructCore
class Specwriter20X
# @param version [Semantic::Version]
def can_write... | 30.18 | 111 | 0.689529 |
f789c7d5f8ece17e00f7e399a4f363c08bc26a49 | 186 | class CreateJoinTableCompanyPerson < ActiveRecord::Migration[5.1]
def change
create_join_table :companies, :people do |t|
t.index [:company_id, :person_id]
end
end
end
| 23.25 | 65 | 0.72043 |
873f6b88701b6462929aab9e11c8e38e0323f2bd | 1,673 | class Libcouchbase < Formula
desc "C library for Couchbase"
homepage "http://docs.couchbase.com/developer/c-2.4/c-intro.html"
url "https://s3.amazonaws.com/packages.couchbase.com/clients/c/libcouchbase-2.5.6.tar.gz"
sha256 "5e82f744ffa9d8ac02dc6fde3a2b2e91995c4f71351c7bf12bbc3571357660b6"
head "https://github... | 32.173077 | 92 | 0.702331 |
87734f09cbbfa17eae112ff788ecae63e7c761bd | 1,019 | require "spec_helper"
RSpec.describe Upsalla::Connectors::RatingServiceSelection do
let(:test_credentials) do
{
api_user: "TestUser",
api_key: "123FromNewYorkToAPIKey",
api_password: "TestPassword"
}
end
before do
test_credentials.each do |credential_key, credential|
Upsalla.... | 23.159091 | 76 | 0.667321 |
1d045d8953ed169e9797dc1b1d3efc1e688b4edf | 39 | class Toupiao < ActiveRecord::Base
end
| 13 | 34 | 0.794872 |
38c7e67b586f933cc2141515c65535514b3caed1 | 497 | # 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::Logic::Mgmt::V2018_07_01_preview
module Models
#
# Defines values for WorkflowState
#
module WorkflowState
NotSpecifie... | 23.666667 | 70 | 0.678068 |
e9a8c544a931d35159dcb22bc8e387bab63aa4f5 | 4,736 | require 'rails_helper'
describe 'friends index' do
it 'shows top three friends', :vcr do
stub_omniauth
json_response = JSON.parse(File.read('spec/fixtures/friends/index/friendslist.json'), symbolize_names:true)
friendslist_path = ENV['POF_BE'] + '/api/v1/users/1/friends'
stub_request(:get, friendslis... | 35.878788 | 142 | 0.714316 |
f70cdcb25b70346ad28d588874b6e5db2944a4bd | 79 | json.extract! group, :id, :slug, :name, :disabled
json.users group.users.count
| 26.333333 | 49 | 0.734177 |
ed59c44d1b60a4df6826071338a4759f2d50fc6d | 73 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'slp'
| 24.333333 | 58 | 0.712329 |
87ffa02fcdd5caa3ed836f9be65da70fc6d1fd2d | 2,351 | #
# Copyright The Apache Software Foundation
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache Licens... | 38.540984 | 82 | 0.749894 |
6a5e410458f33c57a7090c234e748d219fec10bd | 947 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'emojivert/version'
Gem::Specification.new do |spec|
spec.name = "emojivert"
spec.version = Emojivert::VERSION
spec.authors = ["Phil Oye"]
spec.email = ["philo... | 37.88 | 74 | 0.656811 |
18e31fdf207b53394812558508a9937318076c6c | 5,571 | # frozen_string_literal: true
require 'spec_helper'
require 'support/sharedcontext'
require 'vagrant/action/runner'
require 'vagrant-libvirt/action'
describe VagrantPlugins::ProviderLibvirt::Action do
subject { described_class }
include_context 'libvirt'
include_context 'unit'
let(:libvirt_domain) { doub... | 31.834286 | 124 | 0.678873 |
1d542e434c086204cfa6439f0b01ca0a99dfbd94 | 833 | # frozen_string_literal: true
#
# Author:: John Bellone (<jbellone@bloomberg.net>)
# License:: Apache License, Version 2.0
#
# 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.apach... | 32.038462 | 74 | 0.751501 |
e922fb9d7153b246897a569c39fa1e25ed73f801 | 236 | class AddCountryIsoToPrices < ActiveRecord::Migration[4.2]
def change
add_column :spree_prices, :country_iso, :string, null: true, limit: 2
add_index :spree_prices, :country_iso
add_index :spree_countries, :iso
end
end
| 26.222222 | 73 | 0.745763 |
916c095da4c57ef37f898633f2c50566f692f853 | 4,882 | module PorterStemmer::Porter2
EXCEPTIONAL_STEMS = {
'kinkajou' => 'kinkajou',
'skis' => 'ski',
'skies' => 'sky',
'dying' => 'die',
'lying' => 'lie',
'tying' => 'tie',
'idly' => 'idl',
'gently' => 'gentl',
'ugly' => 'ugli',
'early' => 'earli',
'only' => 'onli... | 23.028302 | 156 | 0.482589 |
e81c75bfff47f6a41f57a8e388709d04818b76a7 | 60 | class Hoe
module Markdown
VERSION = "1.4.0"
end
end
| 10 | 21 | 0.633333 |
8705d1a48550001fdfbfdd1351b5035b5a56dd37 | 1,097 | class Ott < Formula
desc "Tool for writing definitions of programming languages and calculi"
homepage "https://www.cl.cam.ac.uk/~pes20/ott/"
url "https://github.com/ott-lang/ott/archive/0.30.tar.gz"
sha256 "ffd757e17d618a3162f0822e09b86d3879071e35378f47c9f6cdc16b757274ca"
head "https://github.com/ott-lang/ott... | 36.566667 | 94 | 0.752963 |
38fdffa7c266bef10fae355d002ba5803a0e6181 | 280 | class CreateTags < ActiveRecord::Migration[5.2]
def change
create_table :tags do |t|
t.string :name
t.timestamps
end
create_table :tags_tasks, id: false do |t|
t.references :task, index: true
t.references :tag, index: true
end
end
end
| 20 | 47 | 0.639286 |
e8634cc00894633e49b3e123d5b3e7078fcf80b6 | 2,957 | # typed: false
# TEAM: backend_infra
# A (possibly multidimensional) array which delegates to its elements by mapping
# recursively. Returned by multi: true components of SpecView when they are
# snapshotted.
require_relative "./spec_view_helpers"
# A lazy array of spec views
module SpecView
class SpecViewArray
... | 27.37963 | 85 | 0.63375 |
e9c07b0f1b210653d36e8ca471b00ce64cf98e32 | 268 | module Appboy
module Endpoints
module ListCanvas
def list_canvas(**payload)
list_canvas_service.new(app_group_id, payload).perform
end
private
def list_canvas_service
Appboy::REST::ListCanvas
end
end
end
end
| 16.75 | 62 | 0.656716 |
26531a8ba62af94b20580c1d8d1fc4af9107cf49 | 1,915 | require 'capybara/spec/test_app'
class TestApp
configure do
set :protection, :except => :frame_options
end
POLTERGEIST_VIEWS = File.dirname(__FILE__) + "/views"
POLTERGEIST_PUBLIC = File.dirname(__FILE__) + "/public"
helpers do
def requires_credentials(login, password)
return if authorized?(l... | 23.353659 | 103 | 0.686162 |
bfff03f6f978fc6323617ec511ae1b7f5c63a028 | 834 | # frozen_string_literal: true
require 'vk/api/methods'
module Vk
module API
class Ads < Vk::Schema::Namespace
module Methods
# Returns information about current state of a counter — number of remaining runs of methods and time to the next counter nulling in seconds.
class GetFloodStats < Sc... | 28.758621 | 149 | 0.625899 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.