text stringlengths 10 2.61M |
|---|
module Predictor
def self.average_on_day(day_of_month, expenses)
sum = 0
considering = expenses_to_consider(day_of_month, expenses)
considering.each do |expense|
sum += expense.amount_in_cents
end
sum / considering.count
end
def self.spend_less_than(day_of_month, expenses)
conside... |
#!/usr/bin/env ruby -2
require "ppm"
require "enumerator"
require "optparse"
options = {:rule => 30, :steps => 20, :cells => "1", :output => :ascii}
ARGV.options do |opts|
opts.banner = "Usage: #{File.basename($PROGRAM_NAME)} [OPTIONS]"
opts.separator ""
opts.separator "Specific Options"
opts.on( "-r", "... |
class FontRajdhani < Formula
version "2.000"
sha256 "2dd0b14ed9989319fde8518e4b596467ae635571ffe7733d7968201d8cdeb9cf"
url "https://github.com/itfoundry/rajdhani/releases/download/v#{version}/rajdhani-#{version.to_s.gsub(".", "_")}.zip"
desc "Rajdhani"
homepage "https://github.com/itfoundry/rajdhani"
def in... |
module WindTalker
def solve_for(code, clues)
solution = WheelPositionSolution.new
solution.wheel_position_combinations = permute.select do |wheel_positions|
mark_machine = with_wheel_positions(*wheel_positions)
decoded = mark_machine.decode(code)
clues_fit = clues.all? { |clue| decoded.incl... |
require "active_support/all"
module Rezource
extend ActiveSupport::Concern
def self.included(clazz)
clazz.helper_method :resource, :resources, :parent
clazz.helper_method :resources_path, :resource_path, :new_resource_path, :edit_resource_path
end
module ClassMethods
def resource(opts={})
@... |
require "rubygems"
require "aws-sdk"
module Datapimp
module Amazon
class STS
def linx_session
return @linx_session if @linx_session
@linx_policy ||= AWS::STS::Policy.new
@linx_policy.allow(actions:["s3:ListBucket","s3:PutObject"], resources: "*")
temporary_user = options.f... |
output_folder_path = File.absolute_path './output'
error_msgs = []
Dir.mkdir(output_folder_path) unless Dir.exist? output_folder_path
Dir.glob('./videos/*').each do |file_name|
input_path = File.absolute_path file_name
basename = File.basename file_name
[320, 480, 640].each do |size|
output_path = File.join ... |
# frozen_string_literal: true
require 'rails_helper'
RSpec.feature 'Toppages', type: :feature, js: true do
scenario 'User find a signin button' do
visit '/'
screenshot_and_save_page
expect(page).to have_text('SIGN IN WITH GOOGLE')
end
end
|
json.array!(@scribbles) do |scribble|
json.extract! scribble, :id, :title, :image
json.url scribble_url(scribble, format: :json)
end
|
class Api::TaskCommentsController < Api::ApiController
include Concerns::Projected, Concerns::Paginated
# GET /api/:token/tasks/:task_id/comments
def index
comments = TaskComment.includes(:creator)
.where(task_id: params[:task_id])
.order(id: :desc)
... |
# This patch is necessary so that the RailsConnector can return the date
# in the time zone defined in Rails.application.config.time_zone
module RailsConnector
module DateAttribute #:nodoc: all
def self.parse(iso_date_time)
# Original
# Time.from_iso(iso_date_time).localtime
# Patched
Tim... |
class ModifyStudentIdToString < ActiveRecord::Migration
def change
change_column :submissions, :student_id, :string
end
end
|
require 'rails_helper'
RSpec.describe Appointment, type: :model do
it { is_expected.to have_one(:protocol) }
it { is_expected.to belong_to(:arm) }
it { is_expected.to belong_to(:participant) }
it { is_expected.to belong_to(:visit_group) }
it { is_expected.to have_many(:procedures) }
it { is_expected.to ... |
FactoryBot.define do
factory :user do
nick_name { 'ササキさん' }
last_name { '佐々木' }
first_name { '雅也' }
email { Faker::Internet.free_email }
password = 'Masaya85'
password { password }
password_confirmation { password }
last_name_kana { 'ササキ' }
first_name_kana { 'マサヤ' }
birth_date ... |
require 'hadupils/commands/options'
module Hadupils::Commands
def self.run(command, params=[])
handler = handler_for command
handler.run params
end
def self.normalize_command(command)
command.to_s.downcase
end
def self.handler_for(command)
@handlers and @handlers[normalize_command(command)]... |
#!/usr/bin/env ruby
class HashTree
attr_accessor :name, :children
def initialize hash
@name = hash.keys[0]
@children = []
ch = hash[@name]
ch.each_key do |key|
@children << HashTree.new({key => ch[key]})
end
end
def visit_all &block
visit {... |
class QuizAnswer < ApplicationRecord
belongs_to :quiz_question
end
|
# frozen_string_literal: true
require 'json'
module Xendit
module ErrorHandler
def handle_error_response(response) # rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity
parsed_response = JSON.parse(response.body)
case parsed_response['error_code']
when 'API_VALIDATION_ERROR'
... |
FactoryGirl.define do
# This will use the User class (Admin would have been guessed)
factory :address do
adress Faker::Address.street_name
zipcode Faker::Address.zip_code
city Faker::Address.city
phone Faker::PhoneNumber.cell_phone
end
end |
ActiveAdmin.register Delayed::Job, as: "DelayedJob" do
menu priority: 4, label: "DelayedJob"
# collection_action :run_all, method: :post do
# successes, failures = Delayed::Worker.new.work_off
# if failures > 0
# flash[:alert] = "#{failures} failed delayed jobs when running them."
# end... |
# frozen_string_literal: true
#
# The FatCore extensions to Hash provide a handful of generally useful methods
# on Ruby Hash objects.
#
# You can get these with:
#
# ```
# require 'fat_core/hash'
# ```
#
# It provides a couple of methods for manipulating the keys of a Hash:
# `#remap_keys` for translating the current... |
class EventsController < ApplicationController
def index
events = Event.all
json_response(events)
end
def show
event = Event.find(params[:id])
json_response(event)
end
def create
event = Event.create!(event_params)
json_response(event, :created)
end
def event_params
par... |
module Hermes
module Plugin
##
# Plugin that allows users to retrieve definitions from Urban Dictionary.
#
class UrbanDictionary
include Cinch::Plugin
set :help => 'u/ud/urban [TERM] - Retrieves the definition of a term ' \
'using Urban Dictionary',
:plugin_name => 'urban'... |
class LyricsController < ApplicationController
before_filter :find_artist
def index
@lyrics = @artist.lyrics.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @lyrics }
end
end
def show
@lyric = @artist.lyrics.find(params[:id])
respond_to do |... |
module Charts
class QueryCultivationInfo
prepend SimpleCommand
def initialize(current_user, args = {})
@user = current_user
raise ArgumentError, 'period is required' if args[:period].blank?
raise ArgumentError, 'facility_ids is required' if args[:facility_ids].blank?
raise ArgumentEr... |
gem 'minitest'
require './lib/scrabble'
require 'minitest/autorun'
require 'minitest/emoji'
require 'pry'
class ScrabbleTest < Minitest::Test
def test_it_can_score_a_single_letter
game = Scrabble.new
assert_equal 1, Scrabble.new.score("a")
assert_equal 4, Scrabble.new.score("f")
end
def test_it_ca... |
require "betfair_api_ng_rails/errors"
module BetfairApiNgRails
module Api
class Connection
def request(method, params = {})
provider.fetch method: method, params: hashing(params)
end
include Api::ConnectionExt::Caching
include Api::ConnectionExt::Logging
include Api::Conne... |
class WallbaseProfileColorPalette < ActiveRecord::Base
belongs_to :wallbase_profile
belongs_to :color_palette
end |
class User
attr_accessor :first_name
attr_accessor :last_name
def initialize(f, l)
@first_name = f
@last_name = l
end
def get_full_name
"#{@first_name} #{@last_name}"
end
end |
class User < ApplicationRecord
attr_reader :gravatar_url
has_many :posts, dependent: :nullify
has_many :comments
has_many :votes
acts_as_voter
validates_uniqueness_of :username
before_validation :set_default_username, :sanitize_username
after_validation :set_default_role
after_save :set_gravatar_ur... |
class Virulign < Formula
# cite Libin_2018: "https://doi.org/10.1093/bioinformatics/bty851"
desc "Fast codon-correct alignment and annotation of viral genomes"
homepage "https://github.com/rega-cev/virulign"
url "https://github.com/rega-cev/virulign/archive/v1.0.1.tar.gz"
sha256 "f7191c31e73bced5b37a4ef2a1e6d... |
# frozen_string_literal: true
module Tikkie
module Api
module V1
module Responses
# Response when requesting payment requests (list).
class PaymentRequests < Base
include Enumerable
include Tikkie::Api::V1::Responses::Pagination
def initialize(response, option... |
class XlineitemsController < ApplicationController
def destroy
@xlineitem = Xlineitem.find(destroy_lineitem_params)
@id = @xlineitem.xferslip_id
@xlineitem.destroy
respond_to do |format|
format.html { redirect_to Xferslip.find(@id) }
format.js { }
end
end
def create
@xferslip = Xfersl... |
class NoticesController < ApplicationController
before_filter :require_admin, :only => [ :index, :create, :update, :destroy ]
before_filter :load_notices, :only => [ :index ]
def index
end
#dodawanie nowego ogłoszenia
def create
@notice = Notice.new(:body => params[:notice][:body], :data => param... |
# frozen_string_literal: true
module Decidim
module Opinions
module Admin
# A command with all the business logic when an admin splits opinions from
# one component to another.
class SplitOpinions < Rectify::Command
# Public: Initializes the command.
#
# form - A form ob... |
require 'spec_helper'
describe Shoulda::Matchers::Independent::DelegateMethodMatcher::StubbedTarget do
subject(:target) { described_class.new(:stubbed_method) }
describe '#has_received_method?' do
it 'returns true when the method has been called on the target' do
target.stubbed_method
expect(targ... |
###########################################################
#
# Name: Joseph Markley
# Assignment: Header
# Date: 01/24/2019
# Class: CIS 282
# Description: Creating a payroll application
#
###########################################################... |
class Parser::BostonRetirementSystem < Parser::Csv
def category
"boston_retirement_system"
end
end
|
class QuestionsController < ApplicationController
def dashboard
@questions=Question.all.order("created_at DESC")
end
def show
@question = Question.find(params[:id])
@answers = @question.answers
end
def new
@question=Question.new
end
def create
@question=Question.new(question_param... |
require_relative '../action'
class Screenplay
module Actions
class Link < Screenplay::Action
def initialize(
source: source,
target: target,
state: :exists,
symbolic: true,
on_fail: nil
)
@on_fail = on_fail
command = case state
when :a... |
class MembershipRequest < ActiveRecord::Base
validates :user_id, presence: true
belongs_to :user
has_many :membership_request_responses
end
|
require "rails_helper"
RSpec.describe "Pool Standings", js: true do
let!(:pool) { create(:pool) }
let!(:entry) { create(:entry, pool: pool) }
describe "summary" do
let!(:conte) { create(:contestant, pool: pool) }
before { visit "/pools/#{pool.id}" }
it "displays the pool title" do
expect(pag... |
require 'openssl'
require_relative 'wallet'
require 'pry'
require 'json'
class Transaction
attr_reader :inputs, :outputs, :signature
def initialize(inputs, outputs)
@inputs = inputs
@outputs = outputs
end
def input_array_with_signature(wallet)
txn_signature = signature(wallet)
inputs.map do |... |
Game.create(title: "古今東西ゲーム", rule: "制限時間は1人10秒です。\n出されたお題に関連した単語を1人ずつ言っていきます。
\n前に出た単語と同じ単語を言ったり、同じ意味やカテゴリーのことを言ってはいけません。
\n例:「飲み物」というお題で,前に「お酒」というワードが出ていた場合
\n「アルコール」(同じ意味)、「ビール」(同じカテゴリー)といった単語は言えません。
\n制限時間以内に答えられなかった人が罰ゲームとなります。",
explanation: "任意で順番を決めましょ... |
require 'spec_helper'
describe Chanko do
before(:all) do
Prefix = Module.new.tap {|expander| expander.send(:include, Chanko::Expand) }
end
shared_examples_for 'expand' do
describe 'basic' do
let(:expander) do
Module.new.tap do |expander|
expander.send(:include, Chanko::Expand)
... |
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe OkComputer::ClamavServiceCheck do
subject(:check) { described_class.new }
describe '#check' do
context 'in a failing state' do
it 'marks failure occurred' do
expect { check.check }
.to change { check.failure_occurred }... |
# Copyright 2014 Google Inc. All rights reserved.
#
# Use of this source code is governed by the MIT
# license that can be found in the LICENSE file.
# This plugin allows for clean URLs of the form /:title (with no trailing slash
# or ".html" extension). This is done by creating destination files of the
# form '/:tit... |
# frozen_string_literal: true
require 'json'
require 'net/http'
require 'dotenv'
require_relative 'helper'
# Load .env & require necessary keys
Dotenv.load
Dotenv.require_keys('RIOT_KEY', 'RIOT_BASE_URI')
# Base API client - https://developer.riotgames.com/apis
class LeagueOfLegends
BASE_URI = ENV['RIOT_BASE_URI'... |
class FontMarvel < Formula
head "https://github.com/google/fonts.git", verified: "github.com/google/fonts", branch: "main", only_path: "ofl/marvel"
desc "Marvel"
homepage "https://fonts.google.com/specimen/Marvel"
def install
(share/"fonts").install "Marvel-Bold.ttf"
(share/"fonts").install "Marvel-Bold... |
module BookingDataSystem
#
# Booking fuel information
#
module BookingFuel
FUEL = ['1/8','2/8','3/8','4/8','5/8','6/8','7/8','8/8']
def self.included(model)
if model.respond_to?(:property)
model.property :pickup_fuel, String, :length => 3
model.property :return_fuel, String, :lengt... |
# 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 rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Ch... |
class Openemu < Cask
url 'https://github.com/OpenEmu/OpenEmu/releases/download/v1.0/OpenEmu_1.0.zip'
homepage 'http://openemu.org/'
version '1.0'
sha1 'face67b75e6703f702068fdbb98fb8f7bc59f813'
link 'OpenEmu.app'
end
|
require_relative '../repository/repository'
require_relative '../model/user'
require_relative 'validations'
require 'bcrypt'
require 'singleton'
class Users
def self.create(email, password, password_confirmation)
encrypted_user = encrypt_record(email, password)
v = validate_on_create(email, password, passwo... |
class Invoice < ActiveRecord::Base
# Relations
belongs_to :account
belongs_to :client
has_many :items
has_many :payments
accepts_nested_attributes_for :items
accepts_nested_attributes_for :payments
# Validations
validates :due_at, presence: true
# Scope
default_scope -> { order(created_at: :de... |
# Teskal
# Copyright (C) 2007 Teskal
class DocumentsController < ApplicationController
layout 'base'
before_filter :find_project, :authorize
def show
@attachments = @document.attachments.find(:all, :order => "created_on DESC")
end
def edit
@categories = Enumeration::get_values('DCAT... |
FactoryBot.define do
factory :work_experience do
organization { Faker::Name.name[0...255] + ' Inc.' }
position { Faker::Lorem.words(4)[0...255] }
start_date { Faker::Time.between(15.years.ago, 2.years.ago, :midnight) }
end_date { Faker::Time.between(2.years.ago, Time.now, :midnight) }
association(... |
class BuildImageSoftwrap
def initialize(data, filename)
@data = data
@filename = filename
end
def BuildImageSoftwrap.build(data, filename)
BuildImageSoftwrap.new(data, filename).generate
end
def generate
require 'RMagick'
vx, vy, vw, vh = @data[1]
# measure the size of the image required
nx = @data... |
class DosesController < ActionController::Base
before_action :set_dose, only: [:show]
def index
@dose = Dose.all
end
def show
@dose = Dose.find(params[:id])
end
def new
@cocktail = Cocktail.find(params[:cocktail_id])
@dose = Dose.new
@ingredients = Ingredient.all
end
def create
... |
class AddingTitleAndAudience < ActiveRecord::Migration
def self.up
create_table :audiences do |t|
t.string :audience
t.string :description
end
create_table :titles do |t|
t.string :title
end
end
def self.down
drop_table :audiences
drop_table :titles
end
end
|
class Cart
def initialize
@items = Array.new []
@total_price = 0
end
def items
@items
end
## @return{float} The total price of all the goods in the cart.
def total_price
@total_price = 0
items.each {|item|
@total_price += item.price
}
return @total_price
end
## @para... |
module VocabulariSe
class RequestHandler
# six hours
DURATION_SHORT = :short
# two days
DURATION_NORMAL = :normal
# seven week
DURATION_LONG = :long
#inspired by YARD::Handlers::Base
# cf https://github.com/lsegal/yard/blob/master/lib/yard/handlers/base.rb
class << self
def clear_subclasses
... |
class Member
include Virtus.model
attribute :id, String
attribute :name, String
end
|
require 'rails_helper'
describe SpecializationCategory do
it { should have_many(:specializations) }
it { should allow_value('foobar').for(:name) }
it { should_not allow_value('foo').for(:name) }
it { should_not allow_value('').for(:name) }
end
|
# test.rb
require File.expand_path '../test_helper.rb', __FILE__
class MyTest < MiniTest::Test
include Rack::Test::Methods
def app
app = Sinatra::Application
app.set :accounts, YAML.load_file('example.accounts.yaml').deep_symbolize_keys!
app
end
def setup
ActionMailer::Base.delivery_method =... |
class AdminUser < ApplicationRecord
include Godmin::Authentication::User
validates :password, presence: true, length: { minimum: 6 }
validates :email, presence: true
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :email, presence: true, length: { maximum: 105},
... |
module DynamodbOrm
class TableIndex
attr_reader :name, :hash, :range
def initialize(hash_field, settings)
@hash = hash_field.to_sym
@range = cleanup_range(settings[:range])
@name = settings[:name] || autogenerate_table_name
end
def all_fields
[hash] + range
end
def h... |
class PagesController < ApplicationController
def home
redirect_to action: 'dashboard' if user_signed_in?
end
def dashboard
@contacts = current_user.contacts.all
end
end
|
#--------------------------------------------------------------------------
# Copyright (c) Microsoft Open Technologies, Inc.
# All Rights Reserved. Licensed under the Apache License, Version 2.0.
# See License.txt in the project root for license information.
#----------------------------------------------------------... |
FactoryBot.define do
factory :item_purchase do
token { 'tok_abcdefghijk00000000000000000' }
postal_code { "#{Faker::Number.number(digits: 3)}-#{Faker::Number.number(digits: 4)}" }
prefecture_id { Faker::Number.between(from: 2, to: 48) }
municipalities { Gimei.city.kanji }
address_line1 { "#{Gimei.... |
class ChangeSoftwareToRequerimientosInReserva < ActiveRecord::Migration
def change
rename_column :reservas, :software, :requerimientos
end
end
|
# Calling a method before it's created will produce an error.
# introduce_myself
def introduce_myself
puts "I love Ruby"
puts "I hope it loves me back"
puts "It's a very good language"
end
introduce_myself
introduce_myself
puts
|
class ChangeUsgsIdToString < ActiveRecord::Migration
def change
change_table :rivers do |t|
t.change :usgs_id, :string
end
end
end
|
# Guest user using the Null Object pattern.
class Guest
def email
"guest@test.test"
end
def first_name
"Guest"
end
def last_name
"User"
end
def type
"Guest"
end
def admin?
false
end
def guest?
true
end
def author?(_post)
false
end
end
|
# Look in the tasks/setup.rb file for the various options that can be
# configured in this Rakefile. The .rake files in the tasks directory
# are where the options are used.
begin
require 'bones'
Bones.setup
rescue LoadError
begin
load 'tasks/setup.rb'
rescue LoadError
raise RuntimeError, '### please i... |
class Exercise
attr_reader :method, :problems
def initialize(method)
@method = method
@problems = []
end
def <<(problem)
@problems << problem
end
def test_suites
[
TestSuite.new(method, :each, problems),
TestSuite.new(method, :enum, problems)
]
end
end
|
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
# Pick a unique cookie name to distinguish our session data from others'
require "jcode"
$KCODE="UFT8"
# in... |
class AddExpenses < ActiveRecord::Migration
def change
create_table :expenses do |t|
t.integer :user_id
t.string :name
t.string :category
t.integer :value
t.string :interval
end
end
end
|
Rails.application.routes.draw do
root 'conversations#index'
resources :conversations, only: [:index, :create] do
resources :messages, only: [:index, :create]
end
get '/register', to: 'users#new'
post '/register', to: 'users#create'
get '/login', to: 'sessions#new'
post '/login', to: 'sessions#creat... |
require 'rails_helper'
describe Answer, type: :model do
let!(:apartment) { FactoryGirl.create(:apartment) }
let!(:user) { FactoryGirl.create(:user) }
let!(:review) { FactoryGirl.create(:review, apartment: apartment, user: user) }
let!(:review_question) { FactoryGirl.create(:review_question) }
describe "answer" d... |
# frozen_string_literal: true
# Given a relation containing all of the element objects, sort them by name while accounting for
# ordinal numbers
class SortCollectionOrdinally
include Service
def call(collection:, column_name: 'name')
first_sort = collection.sort_by do |e|
ActiveSupport::Inflector.transl... |
json.array!(@time_spans) do |time_span|
json.extract! time_span, :id, :start, :end, :task_id
json.url time_span_url(time_span, format: :json)
end
|
class Item
def initialize
@name = name
end
def done
@done
end
item = Item.new("")
puts item.done # should return nil
item.done = true
puts item.done # should return 'true'
class List
attr_accessessor :items, :name
def initialize(name, item = [])
@name = name
@items... |
class Api::GroupChatMembershipsController < ApplicationController
before_action :check_headers_and_find_current_user, only: [ :update, :destroy ]
def update
begin
membership = GroupChatMembership.find(params[:id])
ActiveRecord::Base.transaction do
membership.update_by_params!({by: @current_... |
# frozen_string_literal: true
describe Kafka::BrokerPool do
let(:connection_builder) { double('connection_builder') }
let(:connection) { double('connection') }
let(:logger) { LOGGER }
let(:broker_pool) do
described_class.new(
connection_builder: connection_builder,
logger: logger,
)
end
... |
class CreateSettingsStore < ActiveRecord::Migration
def self.up
create_table :settings, :id => false do |t|
t.string :key, :null => false, :uniq => true
t.text :value
end
add_index :settings, :key
end
def self.down
drop_table :settings
remove_index :settings, :key
end
end |
class Api::V1::SessionSerializer < Api::V1::BaseSerializer
attributes :id, :email, :name, :token
def token
object.authentication_token
end
end |
require 'mail'
require 'sequel'
require 'uri'
require 'feed2email'
require 'feed2email/configurable'
require 'feed2email/core_ext'
require 'feed2email/loggable'
require 'feed2email/version'
module Feed2Email
setup_database
class Entry < Sequel::Model(:entries)
plugin :timestamps
many_to_one :feed
cl... |
ActiveAdmin.register Product do
permit_params :name, :weight, :price, :description, :picture, :caption, :product_category_id
end
|
class Robot
def initialize
@available_directions = ['NORTH', 'EAST', 'SOUTH', 'WEST']
end
attr_accessor :x_position, :y_position, :current_direction
attr_reader :available_directions
def place(x, y, f, table)
if table.valid?(x,y) && @available_directions.include?(f)
@x_position = x
@y_pos... |
json.array!(@question_plays) do |question_play|
json.extract! question_play, :id, :user_id, :question_id, :answer_id, :level_play_id, :score
json.url question_play_url(question_play, format: :json)
end
|
class MakeSenderIdNullTrue < ActiveRecord::Migration[5.2]
def change
change_column_null(:game_transactions, :sender_id, true)
end
end
|
class Flavor < ActiveRecord::Base
has_many :batches
has_many :fermenters
ROSE_BUD={:primary=>"#C46273", :secondary=>"#751425"}
LEMON_GINGER={:primary=>"#D67940", :secondary=>"#913D09"}
MINT_GREEN={:primary=>"#92956D", :secondary=>"#535629"}
BERRY_BLACK={:primary=>"#9F7E9A", :secondary=>"#713E69"}
end
|
require_relative '../exceptions.rb'
require_relative '../release.rb'
require_relative '../formulary.rb'
require_relative 'build_options.rb'
module Crew
def self.build(args)
raise NoBuildOnWindows if Global::OS == 'windows'
options, args = BuildOptions.parse_args(args)
raise FormulaUnspecifiedError if ... |
class CreateSlides < ActiveRecord::Migration
def change
create_table :slides do |t|
t.text :image_url
t.text :link_url
t.integer :play_order, default: -1
t.timestamps
end
end
end
|
class ChangeInterpretationAliasesToPolymorphic < ActiveRecord::Migration[5.1]
def change
remove_foreign_key :interpretation_aliases, :intents
remove_index :interpretation_aliases, :intent_id
add_column :interpretation_aliases, :interpretation_aliasable_type, :string
rename_column :interpretation_alia... |
require "openssl"
require "base64"
require "json"
class Encryption
@cipher = OpenSSL::Cipher.new('AES-128-CBC')
@cipher.encrypt
@key = @cipher.random_key
@iv = @cipher.random_iv
@decipher = OpenSSL::Cipher::AES.new(128, :CBC)
@decipher.decrypt
@decipher.key = @key
@decipher.iv = @iv
class << self
... |
FactoryGirl.define do
factory :location do
position [0.0111111 , 1.1111111]
# after_build do |location|
# pos.posts << FactoryGirl.build(:post, :location => location)
# end
end
factory :post do
sequence(:content) { |n| "MyText#{n}" }
photo "MyString"
position "MyString"
# ... |
require "spec_helper"
describe Podnapisi::Response::RaiseError do
it "raises SearchNotSupported when looking for titles" do
stub_get("subtitles/release.aspx?q=asdf").
to_return(:status => 302, :body => "", :headers => {})
expect {
puts Podnapisi.search("asdf")
}.to raise_error(Podnapisi::Sea... |
require 'spec_helper'
describe 'Task' do
let(:klass ) { TM::Task }
let(:description ) { "write code" }
let(:is_complete ) { false }
let(:priority ) { 0 }
let(:task ) { klass.new(project_id, description, priority) }
let(:id ) { 1 }
let(:project_id ) { 1 }
# before each do
# ... |
# == Schema Information
#
# Table name: announcements
#
# id :bigint(8) not null, primary key
# name :string
# kind :string
# title :string
# subtitle :string
# page_column :integer
# column :integer
# lines :integer
# page :in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.