text stringlengths 10 2.61M |
|---|
# frozen_string_literal: true
require 'test_helper'
module Vedeu
module Repositories
class ModelTestClass
include Vedeu::Repositories::Model
def initialize(attributes)
@attributes = attributes
end
def store
self
end
end # ModelTestClass
describe Model... |
#encoding: utf-8
#GIVEN
Given("the user is not authorized") do
@auth = "Basic #{Faker::Crypto.md5}"
end
Given("the authorization token is expired") do
@request['authorization_token'] = "SOEQWrcuUGOQSQshCCs3j0mkSEwwy6"
end
Given("the authorization token is invalid") do
@request['authorization_token'] =... |
class Api::V1::CommentsController < Api::V1::ApiController
skip_before_action :authenticate_user_from_token!, only: :index
before_action :authenticate_user_from_token, only: :index
before_action :set_question, except: :update
before_action :set_comments, except: :update
before_action :set_comment, only: [:upd... |
require "application_responder"
class ApplicationController < RocketPants::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
#protect_from_forgery with: :exception
include Devise::Controllers::Helpers
include Doorkeeper::Rails::Helpers
include Acti... |
require 'pg'
require 'time'
class Space
attr_reader :id, :name, :owner, :availability, :description, :date, :price
attr_writer :availability
def initialize(id:,name:, owner:, availability:, description:, date:, price:)
@id = id
@name = name
@owner = owner
@availability = availability
@descr... |
FactoryBot.define do
factory :quiz do
association :event
division { "senior" }
room { 1 }
round { 1 }
end
end
|
class Article < ApplicationRecord
validates_uniqueness_of :title, :description, :content
validates_presence_of :title, :description, :content
end
|
=begin
You have a bank of switches before you numbered from 1 to 1000.
Each switch is connected to exactly one light that is initially off.
You walk down the row of switches, and turn every one of them on.
Then, you go back to the beginning and toggle switches 2, 4, 6, and so on.
Repeat this for switches 3, 6, 9, a... |
# frozen_string_literal: true
require 'common/client/base'
module Okta
class DirectoryService < Common::Client::Base
DEFAULT_OKTA_SCOPES = %w[openid profile email address phone offline_access].freeze
def scopes(category)
okta_service = Okta::Service.new
servers = okta_service.get_auth_servers
... |
# run maze expects a maze as a string like so:
# ****************
# * * E*
# * * * ***
# * * * *
# * * * *
# * * * *
# *S * *
# ****************
class Maze
def initialize(maze)
@maze = parse_maze(maze)
@start = get_start()
@paths = make_paths()
@... |
namespace :andy do
namespace :mysql do
task :dump_tables => :environment do
file_path = File.join(working_dir, filename)
# select models to dump that aren't copied from bell or worklists1
models_to_dump = Hobo::Model.all_models.select {|m| m.superclass == ActiveRecord::Base}
tables = mode... |
#! /usr/bin/env ruby
require 'tablesmith'
headers = [['Country', 'Books']]
data = [
['Australia', 28_234],
['Brazil', 57_473],
['China', 440_000],
['France', 77_986],
['Germany', 93_600],
['India', 90_000],
['Indonesia', 89_000],
['Italy', 61_... |
class Quiz < ActiveRecord::Base
has_many :questions
accepts_nested_attributes_for :questions
validates :title, presence: true
end
|
module Lita
module Handlers
class Openexchangerates < Handler
config :app_id, type: String, required: true
route(/^currencies$/, :list_currencies, command: true, help: {
"currencies" => "Show valid currencies",
})
route(/^exchange\s(.*)$/, :exchange, command: true, help: {
... |
# frozen_string_literal: true
require 'rdf'
module Vocab
class Donut < RDF::Vocabulary('http://www.library.northwestern.edu/terms#')
term :project_name
term :project_description
term :proposer
term :project_manager
term :task_number
term :preservation_level
term :project_cycle
term :... |
# frozen_string_literal: true
require_relative 'superdeduper/version'
require_relative 'superdeduper/duper_cli_parser'
require_relative 'superdeduper/photo'
require_relative 'superdeduper/photos_collector'
module Superdeduper
# The main Super De Duper driver.
# A command-line program in your chosen language whic... |
class RenameWrongColumnOnPlan < ActiveRecord::Migration
def change
rename_column :plans, :paid_preriod_length, :paid_period_length
end
end
|
class AddGoingAndWentToAttendance < ActiveRecord::Migration[5.1]
def change
add_column :attendances, :going, :boolean
add_column :attendances, :went, :boolean
end
end
|
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_action :assign_ref
private
def check_current_user
fails unless current_user
rescue
red... |
require 'cocoapods'
require 'cocoapods-core/podfile'
require 'cocoapods-lazy/version'
require 'cocoapods-lazy/logger'
require 'cocoapods-lazy/repository'
require 'cocoapods-lazy/remote_storage'
require 'cocoapods-lazy/dsl'
module Pod
module Lazy
def initialize(argv)
super
@should_store = argv.flag?('... |
class HandlingEventRegistration
include Wisper::Publisher
def handle(register_handling_event)
location_repository = LocationRepository.new
# TODO Make this a conversion to an enum when it is implemented
event_type = register_handling_event[:event_type]
completed = register_handling_event[:completi... |
# Parser for contribution reports downloaded from OCPF:
# https://www.ocpf.us/Reports/SearchItems
# joins the data with the "Candidates and Candidate's Committees" file from here:
# https://www.ocpf.us/Data
class Parser::Ocpf < Parser::Csv
def initialize(filename, committee_file)
super(filename)
load_committe... |
class DocumentTemplate < ApplicationRecord
belongs_to :company
has_many :documents
scope :global, -> { where(company_id: nil) }
scope :requires_employee_signature, -> { where(requires_employee_signature: true) }
scope :requires_employer_signature, -> { where(requires_employer_signature: true) }
validates_pr... |
# frozen_string_literal: true
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
include Paginatable
def error_messages_for(attribute)
ApplicationController.helpers.safe_join(errors.full_messages_for(attribute), ApplicationController.helpers.tag(:br))
end
end
|
module ClinkCloud
class FirewallPolicyMapping
include Kartograph::DSL
kartograph do
mapping FirewallPolicy
property :id, scopes: [:read]
property :status, scopes: [:read]
property :enabled, scopes: [:read]
property :source, scopes: [:read]
property :destination, scopes: [... |
namespace :reprocess_data do
##############################
desc "look for registration numbers that were missed before"
task :registration_numbers => [:environment] do
Agenda.reprocess_registration_number
end
##############################
desc "look for items that were not marked as laws before but c... |
class HonksController < ApplicationController
before_action :set_honk, only: [:show, :edit, :update, :destroy]
# GET /honks
# GET /honks.json
def index
@honks = Honk.all
end
# GET /honks/1
# GET /honks/1.json
def show
end
# GET /honks/new
def new
@honk = Honk.new
end
# GET /honks/1... |
class Unit < ActiveRecord::Base
include Localizable
has_many :questions
localize :name
end |
class DirectMessage < ApplicationRecord
belongs_to :sent_message, foreign_key: :sender_id, class_name: "User"
belongs_to :rec_message, foreign_key: :recipient_id, class_name: "User"
end
|
# encoding: UTF-8
module CDI
module V1
module LearningDeliveries
class CreateService < BaseCreateService
include V1::ServiceConcerns::LearningDeliveriesParams
record_type ::LearningDelivery
private
def can_create_record?
return false unless valid_user?
... |
class WessStandings::Race
attr_accessor :name, :date, :location, :url, :results
end |
require File.dirname(__FILE__) + '/../lib/matrix_manager.rb'
require File.dirname(__FILE__) + '/../lib/tile.rb'
class MatrixManager
attr_reader :matrix
end
module MatrixManagerSpecHelper
def with_defaults(config)
{'left_col' => 288, 'top_row' => 155, 'offset_x' => 0, 'offset_y' => 0,
'zoom' => 9, 'sho... |
#!/usr/bin/env ruby
#coding: utf-8
#system 'clear'
require 'uri'
class String
def urlencoded?
return true if self.match(/(%[0-9ABCDEF]{2})+/i)
return false
end
end
module URI
def self.smart_encode(str)
str = URI.smart_decode(str)
return str.gsub(/[^-a-z\/:?&_.~#]+/i) { |m|
URI.encode(m)
}
end
d... |
# Cookbook Name:: rs_utils
# Recipe:: default
#
# Copyright (c) 2011 RightScale Inc
#
# 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 r... |
require 'spec_helper'
require 'hannya'
include Hannya
RSpec.describe "an address converter" do
context "when it is set for uppercase" do
it "converts a symbol to uppercase" do
ac = DataAddressConverter.create(:upper)
expect(ac.convert(:thud)).to eq 'THUD'
end
end
context "when it is set ... |
module Jekyll
class TagsPage < Page
def initialize(site, base, dir, tag, tags)
@site = site
@base = base
@dir = dir
@name = 'index.html'
self.process(@name)
self.read_yaml(File.join(base, '_layouts'), 'tags.html')
self.data['title'] = 'Tags'
self.data['tag'] = ta... |
class SubRepsController < GroupBase
before_action :set_sub_rep, only: [:show, :edit, :update, :destroy]
load_and_authorize_resource # for cancancan
# GET /sub_reps
# GET /sub_reps.json
def index
@sub_reps = SubRep.where(group_id: @groups)
end
# GET /sub_reps/1
# GET /sub_reps/1.json
def show
e... |
cask :v1 => 'padre' do
version '0.92.0'
sha256 '481088a40bc71bd62d13ac23ed8fbfa3b8fc651587b9e47461795a9a78032d87'
url "http://wildperl.com/wp-content/uploads/Padre/padre-osx-uni-#{version.gsub('.','-')}.dmg"
homepage 'http://padre.perlide.org'
license :unknown # todo: change license and remove this commen... |
class Painting < ActiveRecord::Base
belongs_to :artist
validates :title, :image, presence: true
validates :slug, uniqueness: true
def artist_name=(artist_name)
self.artist = Artist.find_or_create_by(name: artist_name)
end
end |
require 'test_helper'
class TestAppConfig < Minitest::Test
def setup
AppConfig.load_config
AppConfig.set "test","subtest", 1
AppConfig.set "shallow", 1
# update default with testing value
defaults = YAML.load_file(AppConfig::DEFAULTS_FILE)
defaults["test"]={}
defaults["test"]["subtes... |
class PicturesController < ApplicationController
def show
@picture = Picture.find(params[:id])
end
def edit
@picture = Picture.find(params[:id])
end
def create
@album = Album.find(params[:album_id])
@picture = @album.pictures.build(picture_params)
@picture.save
... |
require_relative 'test_helper'
describe "user class" do
before do
@user = Slack::User.new(234, "name", "real name")
end
describe "initialize" do
it "can be created" do
expect(@user.class).must_equal Slack::User
end
it "will hold all relevant variables" do
expect(@user.name).must_equ... |
json.array!(@admin_aboutus) do |admin_aboutu|
json.extract! admin_aboutu, :id, :content
json.url admin_aboutu_url(admin_aboutu, format: :json)
end
|
class CreateNotifications < ActiveRecord::Migration
def change
create_table :notifications do |t|
t.integer :user_id
t.text :description
t.text :target #To specify the URL where the notification would take you upon clicking.
t.boolean :seen
t.timestamps
end
end
end
|
class KnownBugsList
# Получение багов по всем известным проектам.
# Проекты указываются в настройках.
# Несуществующие проекты пропускаем.
# Возвращает массив хэшей
def get_issues_by_all_projects
all_issues = []
projects = Setting.plugin_known_bugs_list[:projects].split(',')
projects.each do |p... |
require 'net/http'
require 'uri'
require 'json'
module Services
class Payment < Base
def charge(cbu, amount)
req = {
destinoCBU: api_key,
origenCBU: cbu.truncate(16),
amount: amount
}
response = post('trasferir', req.to_json)
result = JSON.parse(response.body)
... |
require 'pry'
class Api::ItemImagesController < ApplicationController
before_action :find_section
def index
render json: @section.item_image
end
def show
end
def create
# binding.pry
@item_image = @section.item_image.new(itemImage_params)
# binding.pry
if @item_image.save
re... |
require 'bundler'
require 'pry'
Bundler.require
module Concerns
end
require_all 'lib'
class Song
attr_accessor :name
attr_reader :artist, :genre
@@all = []
def initialize(name, artist = nil, genre = nil)
@name = name
self.artist=(artist) unless artist == nil
self.genre=(genre) unless genre ==... |
require 'rails_helper'
describe Contact do
it 'has a valid factory' do
expect(create(:contact)).to be_valid
end
# Checking the validations
it 'is invalid without a firstname' do
expect(build(:contact, firstname: nil)).not_to be_valid
end
it 'is invalid without a lastname' do
expect(build(:con... |
# encoding: utf-8
class TabelaAcompanhamento < Prawn::Document
def initialize(voluntario)
super(:top_margin => 60, :page_size => "A4", :page_layout => :landscape)
@voluntario = voluntario
repeat(:all, :dynamic => true) do
canvas do
span(100, :position => :right) do
move_down 10
... |
class IpAddressesController < ApplicationController
before_action :set_ip_address, only: [:show, :update, :destroy]
# GET /ip_addresses
def index
@ip_addresses = IpAddress.all
render json: @ip_addresses
end
# GET /ip_addresses/1
def show
render json: @ip_address
end
# POST /ip_addresses
... |
require 'spec_helper'
module Headjack
describe Cypher do
let(:dummy) { Object.new }
describe "::all_filter" do
it{ expect(Cypher.all_filter(Object)).to be Object }
end
describe "::auto_filter" do
it{ expect(Cypher.auto_filter("columns"=>["1"], "data"=>[])).to eq [] }
it{ expect(Cy... |
module INTERFACES
Interfaces_path='/app/etc/interfaces.test'
def get_file_content
@file_content ||= lambda do
content = File.readlines(Interfaces_path)
content << "\n" unless content.last =~ /^\s*\n$/
content.map { |el| el.gsub!(/\s{2,}/, ' ') }
content
end.call
end
def stanza_... |
require './lib/data_temperature'
require './lib/degrees_conversion'
RSpec.describe DataTemperature do
describe '#Converts' do
it 'Convert from C to F' do
a = DataTemperature.new
a.value = (15)
a.unit = ('C')
a.unit_convert = ('F')
conversion = DegreesConversion.new
a = convers... |
class HomeworksController < ApplicationController
before_action :logged_in?
def index
@homework = Homework.all
end
def show
@homework = Homework.find(params[:id])
end
def new
@homework = Homework.new
end
def edit
@homework = Homework.find(params[:id])
end
def create
@homewor... |
class CreateWeatherReports < ActiveRecord::Migration[5.0]
def change
create_table :weather_reports, id: :uuid do |t|
t.string :icon
t.float :cloud_cover
t.float :temperature
t.float :precip_probability
t.string :precip_type
t.float :moon_phase
t.timestamps
end
end
... |
class Api::PlaylistsSongsController < ApplicationController
before_action :require_login
def create
@playlist_song = PlaylistSong.new(playlist_id: params[:playlist_id], song_id: params[:song_id])
if @playlist_song.save
render 'api/playlist_songs/show'
else
render json: @playlist_song.e... |
module Envconfig
class Memcached
include Service
def self.providers
[
Memcachier,
]
end
class Memcachier
include Provider
def name; "MemCachier" end
def mapping
{
servers: "MEMCACHIER_SERVERS",
username: "MEMCACHIER_USERNAME",
... |
class RemoveTranscriptWorkstationIdFromTranscripts < ActiveRecord::Migration
def change
remove_column :transcripts, :transcript_workstation_id
end
end
|
class Address < ApplicationRecord
# Relationships
# -----------------------------
belongs_to :constituent, :foreign_key => :lookup_id
# Scopes
# -----------------------------
scope :order_address_id, -> {order(:address_id)}
scope :alphabetical_city, -> {order(:city)}
scope :alphabetical_state, -> ... |
module Kickstarter
module Campaigns
module Reporters
module Slack
class SendNewCampaignsScrapingReportService
def initialize(report_data)
@report_data = report_data
end
def call
slack_payload = build_slack_payload
send_report(slack_p... |
RSpec.describe Truffle do
it 'has a version number' do
expect(Truffle::VERSION).not_to be nil
end
end
|
module ManagementConsultancy
class Journey::ChooseLot
include Steppable
attribute :lot
attribute :framework
validates :lot, inclusion: {
in: [
'MCF1.2',
'MCF1.3',
'MCF2.3',
'MCF1.4',
'MCF1.5',
'MCF1.6',
'MCF1.7',
'MCF1.8',
... |
# encoding: utf-8
Gem::Specification.new do |s|
s.name = 'plain_site'
s.version = '0.0.2'
s.license = 'MIT'
s.date = '2013-08-25'
s.author = 'Jex'
s.email = 'i@jex.im'
s.homepage = 'https://github.com/jex-im/plain_site'
s.summary = 'A sim... |
class Blog
attr_accessor :title, :all_blog_posts, :total_blog_posts
def initialize
@created_at = Time.now
puts "Give your blog a name:"
@title = gets.chomp
@all_blog_posts = []
@total_blog_posts = 0
puts "end initialize method in blog class"
puts "the name of the blog is #{@title}"
end
def create... |
module MongoMapper
module Types
class Binary
def self.to_mongo(value)
if value.is_a?(ByteBuffer)
value
else
value.nil? ? nil : ByteBuffer.new(value)
end
end
def self.from_mongo(value)
value
end
end
class Boolean
def se... |
describe 'Add text and replace it by an empty string' do
before(:all) {
@text = "Replace%20it%20by%20asterics"
}
let(:replace_text){ get "?text=#{@text}&add=asterics&fill_text=" }
it 'Returned string should contains as many * as the longer the replaced word is' do
replace_text
expect_json(result: ... |
require_relative '../../db/config'
class Student < ActiveRecord::Base
has_many :roster, :foreign_key => :student_id
has_many :teachers, :through => :rosters
validates :age, numericality: { only_integer: true,
greater_than_or_equal_to: 5}
validates :email, format: { with: /.+@\w{1,}.\w{2,}/,
message: "... |
require_relative 'hash'
class Docdo
VERSION = "0.1"
class UndoStackEmpty < RuntimeError; end
class RedoStackEmpty < RuntimeError; end
def initialize( initial_values={}, &init_block )
@state = StaticHash.new initial_values, &init_block
@stack = [@state]
@names = []
@index = 0
end
def as( name, options={}... |
# == Schema Information
#
# Table name: quizzes
#
# id :integer not null, primary key
# user_id :integer not null
# title :string not null
# description :text not null
# created_at :datetime not null
# updated_at :datetime not null
#
# I... |
class SchoolsController < ApplicationController
require 'spreadsheet_io'
def show
return render json: { error: 'invalid_urn'}.to_json unless valid_urn?
school = SpreadsheetIo.new.find(urn_params)
render json: { school: school }.to_json
expires_in 1.days, public: true
end
def index
@keywor... |
# # Normalized Phone Number
# * If the phone number is less than 10 digits assume that it is bad number
# * If the phone number is 10 digits assume that it is good
# * If the phone number is 11 digits and the first number is 1, trim the 1 and use the first 10 digits
# * If the phone number is 11 digits and the first nu... |
module CDI
module V1
module DiscussionAnswers
class CreateService < BaseCreateService
record_type ::DiscussionAnswer
alias :answer :discussion_answer
def initialize(discussion, user, options)
super user, options
@discussion = discussion
end
def ... |
module Neovim
class Plugin
# @api private
class Handler
attr_reader :block
def self.unqualified(name, block)
new(nil, nil, name, true, {qualified: false}, block)
end
def initialize(source, type, name, sync, options, block)
@source = source
@type = type.to_sym ... |
require 'rails_helper'
RSpec.describe Item, type: :model do
before do
@item = FactoryBot.build(:item)
end
describe '出品が成功した場合の処理' do
context '出品が成功したとき' do
it "name、text、price、category_id 、status_id、shipping_fee_id、prefecture_id 、scheduled_delivery_id、imageが存在すれば登録できる" do
expect(@item).to b... |
class Monan < ApplicationRecord
belongs_to :thanhvien
validate :ten, presence: true
validate :gia, presence: true
validate :anh, presence: true
validate :mieuta, presence: true, , length: { minimum: 50 }
end
|
module HasPageCollection
extend ActiveSupport::Concern
def page_collection
PageCollection.find(page_collection_id)
end
def page_collection?
page_collection_id && page_collection
end
end |
servers=[
{
:hostname => "local-markitplace",
:ip => "192.168.13.10",
},
]
Vagrant.configure(2) do |config|
servers.each do |machine|
config.vm.define machine[:hostname] do |node|
node.vm.box = "centos/6"
node.vm.hostname = machine[:hostname]
node.vm.network ... |
Rails.application.routes.draw do
resources :friendships, only: [:create, :update, :destroy]
resources :static, only: :index
devise_for :users
root 'static#index'
end
|
class Task < ActiveRecord::Base
belongs_to :post
belongs_to :epic
belongs_to :user
include RankedModel
ranks :rank, scope: :active
def self.active
show_conditions = "tasks.updated_at > ?
OR complete <> true
OR complete IS NULL"
where(show_conditions,... |
require 'yaml'
module Scaffold
# Provides a central configuration class for use between projects. Allows for
# configuration of the given project using YAML configuration files.
class Config
private
attr_accessor :directive
public
# Constructor for configuration object.
# Params:
# +fi... |
ROM::SQL.migration do
change do
alter_table :cars do
add_column :vin, String, null: false, unique: true, index: true
end
end
end
|
class AddStatusTToTransactionBar < ActiveRecord::Migration
def change
add_column :transaction_bars, :status_t, :boolean, default: true
end
end
|
class UsersController < ApplicationController
before_action :user_attr, only:[:show]
def views
ids = helpers.following_picture_ids
if params[:id]
@pictures = Picture.picture_collector(ids).most_recent
end
respond_to do |f|
f.html { render :views }
f.json { render json: @pictures }... |
module Babar
require 'set'
class User
attr_accessor :authenticator
attr_accessor :contexts, :goals, :folders, :locations, :new_tasks, :edited_tasks
def initialize(toodle_uid, toodle_password, session_token = nil, toodle_token_death = nil)
if session_token and toodle_token_death
@authe... |
# Class used by +CanCan+ to define permissions
class Ability
include CanCan::Ability
# initializes a new +Ability+
def initialize(user)
if user.present?
can :manage, :all
end
end
end
|
require 'spec_helper'
describe User do
it "should have a unique goodreads_id" do
user = create(:user)
expect(build(:user, goodreads_id: user.goodreads_id)).to_not be_valid
end
it "has many library systems via the library_system_ids array" do
user = create(:user, library_system_ids: ['minuteman', 'bo... |
class Aeplugin < ApplicationRecord
has_many :vidplugs
has_many :videofxes, through: :vidplugs
end
|
class QueryItems
prepend SimpleCommand
attr_reader :args
def initialize(args = {})
@args = args
end
def call
query_records
end
private
def query_records
# Inventory::Item.where(@args).to_a
[]
end
end
|
require 'rails_helper'
describe ApplicationHelper do
describe '#markdown' do
let(:md) do
<<-TEXT
#Title
Paragraph
TEXT
end
subject { markdown(md) }
it 'successfully converts markdown' do
expect(subject).to eq("<h1 id=\"title\">Title</h1>\n<p>Paragraph</p>\n")
end
end
desc... |
class ListResultBuilder < ResultBuilderBase
def autocomplete_hint
"#{record.name}"
end
end
|
require_relative '../../lib/models/checkout.rb'
RSpec.describe Checkout, type: :model do
let(:item_a) { Item.find_or_create_by(attributes_for(:item, :a)) }
let(:item_b) { Item.find_or_create_by(attributes_for(:item, :b)) }
let(:item_c) do
Item.find_or_create_by(
attributes_for(:item, :c, currency_id: ... |
#!/usr/bin/ruby
# coding: utf-8
# ext_ip_logger.rb
#alternative http://whatismyip.org/
require 'open-uri'
def logit(ip)
open("/home/ogion/tom/external_ip_logfile", 'a') do |f|
if ip == "error"
f.write("#{Time.now} Ein Fehler ist aufgetreten bei der Ermittlung der externen IP\n")
else
f.write("#... |
# frozen_string_literal: true
class DestroyMemberService
attr_reader :target
def initialize(current_user, guild, tid)
@current_user = current_user
@guild = guild
@tid = tid
@target = target_presence(tid, guild)
end
def destroy_errors
return if @current_user.admin == true
current_user... |
class Amazon::Iap2::Client
require 'net/http'
require 'uri'
PRODUCTION_HOST = 'https://appstore-sdk.amazon.com'
def initialize(developer_secret, host=nil)
@developer_secret = developer_secret
@host = host || PRODUCTION_HOST
end
def verify(user_id, receipt_id)
path = "/version/1.0/verifyReceip... |
#!/usr/bin/env ruby
# this is a test of ruby-processing (https://github.com/jashkenas/ruby-processing) with the video library
# use "rp5 unpack library" at a command line to install the video library, among others
# tested with Ruby 1.9.2
# video file: http://bit.ly/H5yBjK
class VideoTest < Processing::App
lo... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "scrumscope" do |box|
box.vm.box = "puppetlabs/centos-6.5-64-puppet"
box.vm.provider :virtualbox do |vb|
vb.memory = 512
vb.name = "scrumscope"
end... |
class Cheater
include Mongoid::Document
field :mobile, type: String
field :desc, type: String, default: ""
field :vote_up, type: Integer, default: 0
field :vote_down, type: Integer, default: 0
has_and_belongs_to_many :providers
validates :mobile, presence: true
validates :mobile, uniqueness: true
v... |
require 'rails_helper'
RSpec.describe 'admin_mailer/user_details', type: :view do
subject :render_view do
render
PDF::Inspector::Text.analyze(rendered).strings.join(' ')
end
before { assign :user, user }
let(:user) { build_stubbed :user }
let(:rendered_images) { PDF::Inspector::XObject.analyze(rend... |
class Comment < ActiveRecord::Base
attr_accessible :headline, :body
belongs_to :location
validates :headline, :body, presence: true
def self.most_recent_first
order(:created_at).reverse_order
end
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.