text stringlengths 10 2.61M |
|---|
# Copyright (c) 2009-2011 VMware, Inc.
require File.dirname(__FILE__) + "/spec_helper"
module VCAP
module Services
module Redis
class Node
attr_reader :base_dir, :redis_server_path, :local_ip, :capacity, :max_memory, :max_swap, :node_id, :config_template, :free_ports, :redis_timeout
attr_... |
class User < ActiveRecord::Base
#include RottenTomatoes API wrapper from https://github.com/nmunson/rottentomatoes
require 'httparty'
#Omniauth tutorial code
######
######
TEMP_EMAIL_PREFIX = 'change@me'
TEMP_EMAIL_REGEX = /\Achange@me/
# Include default devise modules. Others available are:
# :c... |
#def new graphql type
Types::LinkType = GraphQL::ObjectType.define do
name 'Link'
#the fields it has
field :id, !types.ID
field :url, !types.String
field :description, !types.String
# -> {} - helps against loading issues between types
# property - remaps fields to an attribute of Link model
field :post... |
class AddImageUrlToOrderitems < ActiveRecord::Migration[5.2]
def change
add_column :orderitems, :image_url, :string
end
end
|
#
# Cookbook Name:: bach_repository
# Recipe:: diamond
#
# This recipe leaves its source tree in place. Since we don't know
# the intended version until we check out the repository, the source
# needs to be available every time the package is updated.
#
require 'tmpdir'
include_recipe 'bach_repository::directory'
bin... |
#!/usr/bin/ruby
def my_count_words(str)
words = str.split()
words.sort.inject(Hash.new(0)) { |total, e| total[e] += 1 ;total}
end
|
module Maini
module Auth
module Handler
extend ActiveSupport::Concern
included do
protected :authenticate_user_from_token!
before_action :authenticate_user_from_token!
before_action :authenticate_user!, :unless => :devise_controller?
skip_before_action :verify_authen... |
class HomeController < ApplicationController
def index
@companies = Company.where(pledged_support: true)
@participating_schools_count = School.participating.size
@events = Event.all
end
end
|
require "hbc/cli/abstract_command"
require "cleanup"
using CleanupRefinement
module Hbc
class CLI
class Cleanup < AbstractCommand
OUTDATED_DAYS = 10
OUTDATED_TIMESTAMP = Time.now - (60 * 60 * 24 * OUTDATED_DAYS)
def self.help
"cleans up cached downloads and tracker symlinks"
end... |
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel... |
# == Schema Information
#
# Table name: locations
#
# id :integer not null, primary key
# name :string(255)
# address1 :string(255)
# address2 :string(255)
# city :string(255)
# state :string(255)
# zip :string(255)
# phone :string(255)
# email :string(255... |
class Ntop < Formula
desc "High-speed web-based traffic analysis"
homepage "http://www.ntop.org"
url "https://downloads.sourceforge.net/projects/ntop/files/ntop/ntop-4.0.1/ntop-4.0.1.tar.gz"
sha256 "5b8d393246e423e434532a4de79fe4f08191b98c451d76a4ede251302fd4f56d"
depends_on "gdbm"
depends_on "geoip"
dep... |
class County < ActiveRecord::Base
has_many :parishes
has_many :listings
end
|
class CourseTimeExpression
attr_reader :weekday, :number, :weekday_str,
:number_str, :start_time_str, :end_time_str,
:weekday_number_str
attr_accessor :course_teacher
def initialize(weekday, number)
@weekday = weekday.to_i
@number = number.to_i
set_weekday_str
set_start_time
... |
MileageTracker::Application.routes.draw do
mount StripeEvent::Engine => '/stripe-events'
devise_for :admins
get 'home', controller: 'home'
devise_for :users, :skip => [:sessions], :controllers => {:registrations => "users"}
as :user do
get 'login' => 'devise/sessions#new', :as => :new_user_session
post '... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
config.vm.define :oracle do |web_config|
web_config.vm.box = "lucid64"
web_config.vm.customize { |vm| vm.memory_size = 768 }
web_config.vm.network :hostonly, "192.168.15.21"
web_config.vm.share_folder "chef", "/etc/chef", "~/.ch... |
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'bundler/setup'
require 'vedeu'
# An example application to demonstrate templates.
class VedeuViewTemplateApp
Vedeu.configure do
debug!
log Dir.tmpdir + '/vedeu.log'
end
Vedeu.bind(:_initialize_) { Vedeu.trigger(:_refresh_) }
Vedeu.interfac... |
class User < ApplicationRecord
acts_as_voter
validates :email, :name, :uniqueness => true
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable
end... |
class Person
attr_accessor :first_name, :last_name, :gender, :age
def initialize (first_name, last_name, gender, age)
@first_name = first_name
@last_name = last_name
@gender = gender
@age = age
end
def introduction
puts "#{@first_name} #{@last_name} is a #{@age} year old #{@gender}"
end
end
p = Pers... |
require_relative '../fix_using_tests/turtles_all_the_way_down'
turtles = [{name: "Donatello", weapon: "bo-staff", traits: ["serious", "leader"]},
{name: "Michaelangelo", weapon: "nunchuks", traits: ["party dude"]},
{name: "Raphael", weapon: "sais", traits: ["cool", "rude"]},
{name: "Leonardo", weapon... |
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe User, type: :model do
subject { build(:user) }
it { is_expected.to respond_to :name }
it { is_expected.to respond_to :email }
it { is_expected.to respond_to :bio }
it { is_expected.to respond_to :url }
it { is_expected.to respond_to :loc... |
module Manufacturer
attr_reader :manufacturer
def name_of_manufacturer(name)
@manufacturer = name
end
end |
require_relative 'condition_occurrence_source_vocabulary_operator'
module ConceptQL
module Operators
class Medcode < ConditionOccurrenceSourceVocabularyOperator
register __FILE__
argument :medcodes, type: :codelist, vocab_id: '203'
predominant_domains :condition_occurrence
def vocabular... |
module RadioTune
class TestDatabaseAdapter < MTest::Unit::TestCase
def test_execute_returns_result_of_sql_query
with_database do
database_adapter = DatabaseAdapter.new(Application.database)
result = database_adapter.execute %{
SELECT * from dummy ORDER BY id DESC;
}
... |
class Reconciler
# points to the corresponding model.
# e.g: MyModelReconciler => MyModel
def model
@model ||= self.class.name.demodulize.gsub('Reconciler', '').constantize
end
# default find method.
# Can be overridden on the subclass to specify behavior
def find(context)
model.where name: conte... |
require 'spec_helper'
include SessionsHelper
RSpec.describe 'layouts/application.html.erb' do
before do
Rails.application.load_seed
end
context 'when the user is logged in' do
before { log_in(User.first) }
it 'displays the name and "Log out" in the navbar' do
render
expect(rendered).t... |
module AccessSchema
class Assert
attr_reader :name
def initialize(name, vars = [], &block)
@name = name
@block = block
vars << :subject unless vars.include?(:subject)
(class << self; self; end).class_eval do
vars.each do |name|
define_method name do
@opti... |
require 'rails_helper'
RSpec.describe CrunchbaseCompanyWorker do
it 'should retrieve the startup data using the crunchbase api' do
VCR.use_cassette('crunchbase/company-expect-labs') do
worker = CrunchbaseCompanyWorker.new
worker.perform('Expect Labs')
end
expect(Company.count).to eq(1)
... |
class AddEstadoToThief < ActiveRecord::Migration[6.0]
def change
add_column :thiefs, :estado, :string
end
end
|
class Activity < ActiveRecord::Base
validates_presence_of :name
validates_uniqueness_of :name
has_many :event_types
has_and_belongs_to_many :users
end
|
require_relative 'ship'
class Board
attr_reader :ships, :game_board, :log
def initialize
@ships = []
@game_board = Array.new(10){Array.new(10)}
@log = Array.new(10){Array.new(10)}
end
def place(ship, x, y)
fail 'Out of bounds!' if y > 10 || (x.ord)-65 > 9 || y < 1 || (x.ord) < 65
... |
class Project < ActiveRecord::Base
has_and_belongs_to_many :users
validates :name, presence: true, length: {maximum: 90, too_long: '90 chars is the maximum allowed'}
validates :description, presence: true, length: {maximum: 200, too_long: '140 chars is the maximum allowed'}
validates :location, presence: true, len... |
if defined? Capistrano
# We're running in Capistrano, only load tasks
require 'panter-rails-deploy/capistrano'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
load File.expand_path('../capistrano/tasks/panter-rails-deploy.rake', __FILE__)
else
# We're running in the application, loa... |
def select_books_titles_and_years_in_first_series_order_by_year
# SELECT books.title, books.year
# HAVING series.id=1
# ORDER BY books.year
"SELECT books.title, books.year
FROM books
WHERE series_id=1
ORDER BY books.year;"
end
def select_name_and_motto_of_char_with_longest_motto
"SELECT character... |
class RentMailer < ApplicationMailer
def rent_created(rent)
@rent = rent
mail(to: @rent.user.email, subject: I18n.t('mailer.rent_mailer.rent_created.subject'))
end
def rent_expire(rent)
@rent = rent
mail(to: @rent.user.email, subject: I18n.t('mailer.rent_mailer.rent_expire.subject'))
end
end
|
#!/usr/bin/env ruby
# Kinema
# reinterpreted from BASIC by stephan.com
EPSILON = 0.15
def close?(guess, answer)
(guess-answer).abs < answer * EPSILON
end
def ask(text, answer)
puts text
guess = gets.strip.to_f
if close?(guess, answer)
puts 'Close enough'
@score += 1
else
puts 'Not even close..... |
class Day < ActiveRecord::Base
# Associations
validates_date :date
# Scopes
default_scope :order => 'date DESC'
# Helpers
def to_s
"%s: brutto %0.2f, netto %0.2f" % [date, gross_turnover, net_turnover]
end
# Callbacks
after_create :create_bookings
private
def create_bookings
BookingTem... |
class Ability
include CanCan::Ability
def initialize(user)
can :read, :all do |model|
!model.is_a?(Proposal)
end
can [:search], Project
if user
can [:create, :update, :destroy], Participation
can [:create, :update, :destroy], Comment do |comment|
comment.user == user
... |
Gem::Specification.new do |s|
s.name = "mysql_s3_backup"
s.version = "0.0.1"
s.authors = ["Marc-Andre Cournoyer"]
s.email = "macournoyer@gmail.com"
s.files = Dir["**/*"]
s.homepage = "http://github.com/macournoyer/mysql_s3_backup"
s.require_paths =... |
class MoviesController < ApplicationController
before_action :set_movie, only: [:show, :edit, :update, :destroy]
# GET /movies
# GET /movies.json
def index
@movies = Movie.all
end
# GET /movies/1
# GET /movies/1.json
def show
end
# GET /movies/new
def new
@movie = Movie.new
end
... |
class Commit
class CreateOrUpdateFromPayload
method_object :commit_payload, :push_payload
def call
commit = find_or_initialize
commit.payload = payload
commit.json_payload = payload.to_json
commit.author = create_or_update_author
commit.save!
commit
end
private
... |
module Accountable
module SearchHelpers
def self.extended(base)
base.send :include, InstanceMethods
end
def class_name
to_s
end
def search_to_active_relation(hits)
if !hits.empty?
sids = hits.map { | hit | hit.primary_key }
self.where('id IN (?)', sids)
... |
module NewIssuable
attr_reader :issuable, :user
def ensure_objects_found(issuable_id, user_id)
@issuable = issuable_class.find_by(id: issuable_id)
unless @issuable
log_error(issuable_class, issuable_id)
return false
end
@user = User.find_by(id: user_id)
unless @user
log_error... |
# == Schema Information
#
# Table name: board_members
#
# id :integer not null, primary key
# board_id :integer not null
# member_id :integer not null
# admin :boolean default(FALSE), not null
# created_at :datetime
# updated_at :datetime
#
# Indexes
#
# index_... |
class Bill < ApplicationRecord
has_many :bill_details
belongs_to :User
validates :status, numericality: true
end
|
require 'minitest/autorun'
class Account
attr_accessor :balance, :account_holder
def initialize
@balance = 0
end
def deposit(money)
@balance += money
end
def withdraw(money)
@balance -= money
end
def transfer(money, b)
@balance -= money
b.balance ... |
class V1::Dashboards::Teacher::ContestsController < V1::BaseController
include V1::MessageHelper
def list
load_contests
@sta = @contests.size > 0 ? :success : :error
contests = ActiveModel::ArraySerializer.new(@contests, each_serializer: ::Teacher::ContestSerializer)
render json: {
msg: cmsg(... |
class Post < ApplicationRecord
has_many :contents, dependent: :destroy
belongs_to :user
validates :subject, presence: true, length: { maximum: 50}
validates :user_id, presence: true
default_scope -> { order(updated_at: :desc) }
end
|
require "factory_bot"
require "factory_bot_extensions"
class Dog
attr_accessor :name, :breed, :is_saved
def save
self.is_saved = "Saved via #save"
end
def save!
self.is_saved = "Saved via #save!"
end
end
FactoryBot.define do
factory :dog do
name "Rover"
breed "Golden Retriever"
end
en... |
students = [
["Dr. Hannibal Lecter", :november],
["Darth Vader", :november],
["Nurse Ratche", :november],
["Michael Corleone", :november],
["Alex DeLarge", :noember],
["The Wiched Witch of the West",:november],
["Terminator", :november],
["Freddy Kruegfer" , :november],
["The Joker",:november],
["Joffrey Baratheon", :n... |
class AddCallbackUrlToVideosAndPreview < ActiveRecord::Migration
def change
add_column :videos, :callback_url, :text
add_column :videos, :stream_callback_url, :text
add_column :video_previews, :callback_url, :text
end
end
|
require 'spec_helper'
describe file('/etc/dd-agent/conf.d/process.yaml') do
it { should be_file }
it { should be_mode 644 }
it { should be_owned_by 'dd-agent' }
it { should be_grouped_into 'root' }
end
|
#Fedena
#Copyright 2011 Foradian Technologies Private Limited
#
#This product includes software developed at
#Project Fedena - http://www.projectfedena.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 ... |
class ChangeDefaultValueArticles < ActiveRecord::Migration
def up
change_column :articles, :is_project, :boolean, :default => false
change_column :articles, :is_paper, :boolean, :default => false
end
def down
end
end
|
# Try to use this
# Auth.set({id: 1, email: "ichunlea@me.com", role: "user", token: "app-token"})
class Auth
class << self
ATTRIBUTES = %w(id username email phone token avatar confirmed_at).freeze
def set(arguments={})
reset
arguments.each do |key, value|
MotionKeychain.set(key.to_s, valu... |
require 'authorization'
require 'authentication_needed_san'
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_filter :find_authenticated, :ensure_valid_writer, :block_access
protected
include Authorization::BlockAccess
extend Authorization::AllowAccess
de... |
# Copyright 2014 Square 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 ... |
class AddBanEndsAtToGroupChatMemberships < ActiveRecord::Migration[6.1]
def change
add_column(:group_chat_memberships, :ban_ends_at, :datetime)
end
end
|
require 'yaml'
class Game
def initialize(game_name, player_name)
@game_name = game_name
@player = Player.new(player_name)
@wrong_guesses = -1
@wrong_guess_display = []
end
def pick_word
@word = ''
dictionary = File.open("5desk.txt").readlines
while @word.length < 5 || @word.length > 12
@word = ... |
class Mms::ToolsDownload < ActiveRecord::Base
set_table_name :mms_tools_downloads
belongs_to :tool, :class_name=>"Mms::Tool"
belongs_to :user
end
|
class InvitationsController < ApiController
load_and_authorize_resource
before_action :authenticate_user!
def create
begin
@invitation = Invitation.new(invitation_params)
@invitation.generate_invitation
render json: @invitation
rescue Exception => e
@invitation = Invitation.ne... |
require 'spec_helper'
require 'kafkat/command/topic_verify'
describe Kafkat::Command::TopicVerify do
let(:verify_replicas) { Kafkat::Command::TopicVerify.new }
context 'two topics with replication factor 3' do
let(:topic_rep_factor_three_with_four_replicas_in_partition1) do
FactoryBot.build(:topic_rep_f... |
class CreateOrders < ActiveRecord::Migration
def change
create_table :orders do |t|
t.date :purchase_date, :null => false
t.date :paid_date
t.integer :customer_id, :null => false
t.integer :purchase_amount, :null => false
t.integer :paid_amount, :default => 0, :null => false
t.... |
module Jindouyun::Dingding
class UrlHelper
class << self
def sns_user_oauth_path(redirect_uri, appid: nil, state: '')
"https://oapi.dingtalk.com/connect/qrconnect?appid=#{appid}&response_type=code&scope=snsapi_login&state=#{state}&redirect_uri=#{redirect_uri}"
end
end
end
end
|
Gem::Specification.new do |s|
s.name = 'bing_images'
s.version = '0.0.2'
s.date = '2012-07-08'
s.summary = "Wrapper for Bing's Image Search"
s.description = "A wrapper around Bing's image search."
s.authors = ['Rajiv Bakulesh Shah']
s.email = 'brainix@gmail.com'
s.files ... |
require 'slack-notifier'
class SlackNotificationWorker
include Sidekiq::Worker
def perform(order_number)
order = Spree::Order.find_by_number(order_number)
notifier = Slack::Notifier.new ENV['SLACK_WEBHOOK_URL'], channel: ENV['SLACK_ORDER_CHANNEL'], username: "rails-notifier"
if order # avoid order.sta... |
# Write a program that asks the user whether they want the program to print "something",
#then print it if the user enters y. Otherwise, print nothing.
puts " Do you want to me to print something? (y/n)"
answer = gets.chomp.downcase
if answer == "y"
puts "something"
end
|
class EmployerSkill < ActiveRecord::Base
attr_accessible :employer_id, :skill_id
belongs_to :employer
belongs_to :skill
end
|
# Strategy pattern is used for implementing each version of algorythm as a separate object
require 'active_support/inflector'
class CV
attr_accessor :subject, :skills, :generator
def initialize(subject, options)
options[:skills] ||= []
options[:generator] ||= :pdf
@subject = subject
@skills = op... |
include_recipe "tomcat"
include_recipe "nginx"
directory node.jenkins.home do
owner node.tomcat.user
end
tomcat_instance "jenkins:tomcat" do
war_url node.jenkins.url
war_location node.jenkins.location
end
tomcat_jenkins_http_port = tomcat_config("jenkins:tomcat")[:connectors][:http][:port]
nginx_add_default_l... |
class ArtistsController < ApplicationController
def index
@artists = Artist.all
end
def new
@artist = Artist.new
end
def create
@artist = Artist.new(artist_params)
if @artist.save
redirect_to artists_path
else
render 'new'
end
end
def edit
@artist = Artist.find(params[:id])
end
def upd... |
# frozen_string_literal: true
require 'test_helper'
module Vedeu
describe 'Bindings' do
it { Vedeu.bound?(:_refresh_).must_equal(true) }
end
module Output
describe Refresh do
let(:described) { Vedeu::Output::Refresh }
let(:instance) { described.new }
let(:_name) { :vedeu_outpu... |
require('rspec')
require('parcel')
describe('Parcel') do
describe('#volume') do
it('returns the volume for given length, width, and height') do
parcel = Parcel.new(10, 5, 5, 10, 10, false)
expect(parcel.volume()).to(eq(250))
end
it('returns shipping cost for given weight') do
parcel = ... |
require "test_utils"
describe "parse syslog", :if => RUBY_ENGINE == "jruby" do
extend LogStash::RSpec
config <<-'CONFIG'
filter {
grok {
type => "syslog"
singles => true
pattern => [ "<%{POSINT:syslog_pri}>%{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:syslog_hostname} %{... |
class PersonGroupAssignment < ApplicationRecord
tracked
resourcify
belongs_to :person
belongs_to :person_group
end
|
class BoxDelivery < ApplicationRecord
acts_as_paranoid
validates_as_paranoid
has_paper_trail
extend Enumerize
WHITE = 1
BLACK = 2
enumerize :color, in: {
white: WHITE,
black: BLACK
}, scope: :by_color
belongs_to :store
validates :amount, :color, presence: true
def generate_input_to_r... |
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
has_one :users_subs_relationship
has_one :subscripti... |
require_relative '../helpers/prime_factors'
class OEIS
# Squarefree part of n: a(n) = smallest positive number m such that n/m is a
# square.
def self.a007913(n)
PrimeFactors.hash(n).select { |_, power| power.odd? }.keys.reduce(:*) || 1
end
end
|
Rails.application.routes.draw do
get 'analytics/show'
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
post '/pages-search', to: 'pages#search', as: "page_search"
post '/users-search', to: 'users#search', as: "user_search"
resources :users, except: [:destroy... |
SUITS = ["\u{2660}", "\u{2665}", "\u{2663}", "\u{2666}"]
VALUES = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A']
TARGET = 21
STAYS_AT = 17
def initialize_deck
SUITS.product(VALUES)
end
def prompt(message)
puts "=> #{message}"
end
def total(cards)
values = cards.map do |card|
card[1].gsu... |
# frozen_string_literal: true
Sequel.migration do
up do
run <<-ENUM
CREATE TYPE project_type AS ENUM (
'nano',
'camp'
);
ENUM
create_table(:projects) do
Integer :id, identity: true, primary_key: true
column :created, 'timestamp with time zone', null: false, default: Seque... |
class CreateOldBirthdayDealStateTransitions < ActiveRecord::Migration
def change
create_table :birthday_deal_state_transitions do |t|
t.integer :birthday_deal_id
t.string :event
t.string :from
t.string :to
t.datetime :created_at
t.timestamps
end
end
end
|
require 'bundler/setup'
root = File.join(File.dirname(__FILE__), '..')
$:.unshift File.join(root, 'lib')
require 'sinatra'
require 'sinatra/config_file'
require 'gridsby/api'
require 'ostruct'
require 'pp'
config_path = File.expand_path(File.join(root, 'config', 'sumo-demo.yaml'))
unless File.exists?(config_path)
... |
require 'spec_helper'
describe IncomingReceipt do
before { @incoming_message = IncomingReceipt.new }
subject { @incoming_message }
it { should respond_to(:message_id) }
it { should respond_to(:workstation_id) }
it { should respond_to(:user_id) }
it { should belong_to(:message) }
it { should belong_to(... |
class AssetsCreator < ActiveRecord::Base
belongs_to :asset, :polymorphic => true
belongs_to :creator, :class_name => 'Person'
include Seek::Rdf::ReactToAssociatedChange
update_rdf_on_change :asset
def self.add_or_update_creator_list(resource, creator_params)
recieved_creators = (creator_params.blan... |
class Photo < ActiveRecord::Base
belongs_to :user
has_many :comments
has_many :favorites
has_many :fans, :through => :favorites, :source => :user
end
|
Pod::Spec.new do |spec|
spec.name = "RAValidatorView"
spec.version = "1.0.3"
spec.summary = "A framework to analyse on basis of number inputs, if you are a human or robot."
spec.description = "An iOS Swift Framework, to Validate, if Human or a Robot operating the screen by entering the disp... |
class UserRequestsController < ApplicationController
before_action :check_signed
def my_requests
@user_requests = current_user.user_requests
end
def create
if current_user.user_requests.create(user_request_params)
render json: {status: :ok}
else
render json: {status: :canceled}
en... |
require 'rspec/core/formatters/helpers'
module Qspec
module Manager
TIME_LOG_NAME = 'elapsed_time'
DEFAULT_ELAPSED_TIME = 3.0
attr_reader :output
attr_reader :id
def start_worker
@id = rand(10000)
output.puts "ID: #{id}"
register_files(id)
if runnning_ports
puts "... |
class Post < ApplicationRecord
belongs_to :user, optional: true
has_many :likes, dependent: :destroy
has_many :liked_users, through: :likes, source: :user
validates :image, :genre_id, :title, presence: true
mount_uploader :image, ImageUploader
end
|
module LinkedIn
class Client
module Group
# Returns the information about the Group
#
# @see https://developer.linkedin.com/documents/groups-api
# @param id [Integer] Retreive a Group using the Group ID
# @param options [Hash] A customizable set of options.
# @option options f... |
require 'set'
class CondorcetPoll
class InvalidCandidateError < StandardError
end
class MultipleVoteError < StandardError
end
class OverdueVoteError < StandardError
end
attr_reader :title, :candidates, :votes, :closing
def initialize(title, candidates, closing)
@title = title
@candidates = ca... |
class CreateActivities < ActiveRecord::Migration
def change
create_table :activities do |t|
t.integer :action, :null => false
t.references :trackable, :polymorphic => true, :null => false
t.references :user, :null => false, :index => true
t.timestamps null: false
end
add_index :ac... |
module Task
class Record < ActiveRecord::Base
self.table_name = 'tasks'
self.inheritance_column = nil
self.record_timestamps = false
belongs_to :user
has_many :attribute_revisions,
:foreign_key => :task_id,
:class_name => ::Task::AttributeRevisionRecord,
:dependent => :destroy
... |
require 'formula'
class Lablgl < Formula
homepage 'https://forge.ocamlcore.org/projects/lablgl/'
url 'https://forge.ocamlcore.org/frs/download.php/816/lablgl-20120306.tar.gz'
sha256 '39017555724ca67807e73543b9fca1fcf9aab285f723635c9eee4034ac88adf0'
depends_on :x11
depends_on 'objective-caml'
def install
... |
# encoding: UTF-8
# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0
module TwitterCldr
module Utils
module CodePoints
class << self
def to_char(code_point)
[code_point].pack('U*')
end
def from_char(char)
char.unpack('U*').first
... |
module CDI
module V1
class SimpleGameGroupSerializer < ActiveModel::Serializer
attributes :id, :game_group_item_id, :title, :items,
:created_at, :updated_at
def items
scope.try(:backoffice_profile?) ? object.items : []
end
end
end
end
|
And /^there is ([0-9]+) "([^\"]*)" cubicle label$/ do |count, category|
count.to_i.times do
@thecubicle = @current_account.cubicle_labels.make(category.to_sym)
end
end
Then /^I should see my label$/ do
Then "I should see \"#{@thecubicle.label}\""
end
# Create
Then /^I should be able to create a new label$/ ... |
require 'spec_helper'
require 'FacilityConstraint'
describe "FacilityPages" do
subject { page }
before { visit new_facility_path }
it { should have_content("Describe Facilities")}
it { should have_title(FacilityConstraint.PAGE_TITLE) }
describe 'with invalid information' do
it "should it should not change... |
class PodcastFinder::Scraper
attr_accessor :index, :categories
def scrape_page(url)
html = open(url)
@index = Nokogiri::HTML(html)
end
def scrape_category_list(url)
self.scrape_page(url)
@categories = []
groups = @index.css('nav.global-navigation div.subnav.subnav-podcast-categories div.group')
categ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.