text stringlengths 10 2.61M |
|---|
class AddRaisedByToTask < ActiveRecord::Migration[5.2]
def change
add_reference :tasks, :raisedBy, foreign_key: { to_table: :users }
add_reference :tasks, :resolvedBy, foreign_key: { to_table: :users }
end
end
|
require 'spec_helper'
describe ::RandomStringGenerator do
describe '.generate_of_length' do
it 'should accept (:size) as a parameter' do
expect(RandomStringGenerator).to receive(:generate_of_length).with(:size)
RandomStringGenerator.generate_of_length(:size)
end
it 'should generate string of... |
require 'rails_helper'
RSpec.describe Item, type: :model do
before do
@item = FactoryBot.build(:item)
end
describe "商品出品" do
context '商品の出品ができる場合' do
it '必要な項目が入力されて入れば出品できる' do
expect(@item).to be_valid
end
end
context '商品の出品ができない場合' do
it '画像が空では出品できない' do
@it... |
module ShopsHelper
# def shop_render(template, *args)
# template += '.liquid' if File.extname(template) != '.liquid'
# path = File.join(@shop.name, "views", template).to_s
# render partial: path
# end
def exists?(template)
template = template.to_s
dir, base = File.dirname(template), File.ba... |
require 'rails_helper'
describe "Integration: Users" do
describe "Create User" do
describe "failure" do
it "should not create a new user" do
lambda do
# visit 'root'
visit root_path
click_link "Create New User"
fill_in "Email", :with => ""
fill_... |
require 'airport'
require 'plane'
describe Airport do
let(:airport) { Airport.new }
let(:plane) { Plane.new }
context "taking off and landing" do
it "planes should be able to land" do
plane.land!
airport.dock(plane)
expect(airport.plane_count).to eq(1)
end
it "planes should be a... |
require 'rails_helper'
describe TripsController, type: :controller do
let!(:user) { create(:user) }
let(:trip) { create(:trip) }
let(:task) { create(:task) }
describe 'POST #mark_as_done' do
let(:method){ post :mark_as_done, task_id: task.id, trip_code: trip.trip_code }
context 'when us... |
class MoreSuggestionsToSuppliers < ActiveRecord::Migration
def change
add_column :suppliers, :suggested_address, :text
add_column :suppliers, :suggested_url_main, :string
end
end
|
class Stack
attr_reader :count, :is_empty, :type
def initialize
self.clear()
end
def clear
@items = []
update_properties()
end
def peek
unless @is_empty
@items[-1]
else
raise "Cannot peek an empty stack"
end
end
def push(obj)
if not obj.instance_of? @type and ... |
class Api::V1::ReviewsController < ApplicationController
before_action :authenticate_user!, only: [:create, :destroy, :update, :like, :dislike]
before_action :page_params, only: [:index, :get_by_anime, :recent]
before_action :find_review, only: [:show, :destroy, :update, :like, :dislike]
after_action :update_li... |
class RoundCategorySerializer < ApplicationSerializer
has_many :round_questions
has_one :category, except: [:questions]
end
|
module Callgraphy
# Records the information that describes a call graph.
#
class Registry
def initialize
@registry = { public: [], private: [], callers: [], dependencies: [], calls: [] }
end
def register_method(scope, caller)
@registry.fetch(scope).push(caller.to_s)
end
alias regi... |
class Api::WineriesController < ApplicationController
def names
@wineries = Winery.order(:name_en).where("name_en like ?", "%#{params[:term]}%")
render json: @wineries.map(&:name)
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_filter :configure_permitted_parameters, if: :devise_controller?
protected
def configure_permitted_param... |
class AddFirstLineIndentToTextStyle < ActiveRecord::Migration[5.2]
def change
add_column :text_styles, :first_line_indent, :float
end
end
|
class StaffAdmin < ActiveRecord::Base
belongs_to:user
belongs_to:department
end
|
require 'test_helper'
class TasksControllerTest < ActionController::TestCase
context 'with user logged in' do
setup do
@user = Factory.create(:test_employee01)
@another_user = Factory.create(:employee_user)
@user.privileges << Factory.create(:privilege)
login_as @user
@assignee = Fa... |
class VotesController < ApplicationController
skip_before_filter :verify_authenticity_token
def create
@user = authenticate_token
@vote = Vote.new(vote_params)
@post = Post.find(vote_params[:post_id])
if !@user.nil? and !@post.nil? and @post.user_id!=vote_params[:user_id] and @user.id==vote_params... |
class Rental < ApplicationRecord
belongs_to :video
belongs_to :customer
validates :customer_id, :video_id, :due_date, presence: :true
end
|
maintainer "Heavy Water Software Inc."
maintainer_email "darrin@heavywater.ca"
license "Apache 2.0"
description "Installs/Configures oh-my-zsh"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
version "0.4.2"
depends "git"
depends "zsh"
depends ... |
require 'bundler/setup'
require 'dbus'
class BLE
attr_reader :bus
SERVICE_NAME = 'org.bluez'
SERVICE_PATH = '/org/bluez'
ADAPTER = 'hci0'
DEVICE_IF = 'org.bluez.Device1'
SERVICE_IF = 'org.bluez.GattService1'
CHARACTERISTIC_IF = 'org.bluez.GattCharacteristic1'
DBUS_PROPERTIES_IF... |
module Ag
class Client
def initialize(adapter)
@adapter = adapter
end
def connect(consumer, producer)
@adapter.connect(consumer, producer)
end
def produce(event)
@adapter.produce(event)
end
def connected?(consumer, producer)
@adapter.connected?(consumer, producer... |
# frozen_string_literal: true
RSpec.describe Bitcoin::Fees::Client do
before do
stub_request(:get, 'https://bitcoinfees.earn.com/api/v1/fees/recommended')
.to_return(status: 200, body: '{"fastestFee":14, "halfHourFee":14, "hourFee":12}', headers: {})
stub_request(:get, 'https://bitcoinfees.earn.com/api... |
# frozen_string_literal: true
require "selenium-webdriver"
require 'sauce_whisk'
RSpec.configure do |config|
config.expect_with :rspec do |c|
c.syntax = :expect
end
config.before do |example|
metadata = example.metadata
browser = metadata[:browser] || :chrome
opts = Selenium::WebDriver::Option... |
class Trove < ActiveRecord::Base
belongs_to :user
has_and_belongs_to_many :products
# have many received suggestions
has_many :alternative_troves, class_name: "Trove", foreign_key: "original_trove_id"
belongs_to :original, class_name: "Trove"
def trove_total
self.products.sum(:price)
end
end
|
require_relative 'cal_day'
require_relative 'cal_year'
class Month
attr_reader :month,:year
def initialize(month,year)
@month = month
@year = year
end
Translate_month_table = [nil,"January","February","March","April",
"May","June","July","August","September","October","Novembe... |
module Types
class EventContactType < Types::BaseObject
field :phone_number, String, null: true
field :phone_name, String, null: true
field :email_address, String, null: true
field :email_name, String, null: true
field :meetup, String, null: true
field :facebook, String, null: true
end
end... |
require 'test_helper'
class OidsControllerTest < ActionController::TestCase
setup do
@oid = oids(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:oids)
end
test "should get new" do
get :new
assert_response :success
end
test "shoul... |
class AddDecimalToBills2 < ActiveRecord::Migration
def change
change_column :bills, :amount_due, :decimal
end
end
|
Pod::Spec.new do |s|
s.name = "CustomTableViewPod2"
s.version = "1.0.0"
s.summary = "A TableView DataSource Pod"
s.description = "A tableview data source pod with custom cells which can download image icons and provide a nice UI and UX"
s.homepage = "https://github.com/vallal7"
... |
# encoding: UTF-8
module Sinatra
module Spitter
def json?
params[:format] == 'json'
end
def yaml?
params[:format] == 'yaml'
end
def xml?
params[:format] == 'xml'
end
def spit options
if json? || !options[:html]
return jsonp(options[:json]) || spit_haml(... |
# frozen_string_literal: true
module Refinery
module Caststone
module Admin
class ComponentsPresenter
include ActionView::Helpers::TagHelper
include ActionView::Helpers::FormHelper
attr_accessor :collection, :output_buffer
def initialize(collection)
@collection =... |
class UsersController < ApplicationController
def create
begin
user = User.create!(username: params[:username])
render json: user
rescue ActiveRecord::RecordInvalid => e
if e.message == "Validation failed: Username has already been taken"
render json: {error: e.message}, status: 409
... |
module Nobbie
module Wx
module Command
class GetSelectedValuesCommand < ComponentAwareCommand #:nodoc:
def execute
if component.is_a?(Notebook)
component.page(component.get_selection).name
elsif component.is_a?(ComboBox)
component.value
... |
class Mechanism < ApplicationRecord
has_many :product_mechanisms
has_many :products, through: :product_mechanisms
end
|
require 'spec_helper'
require_relative '../lib/challenge2'
describe Challenge2 do
it '.sum_to_0 verification 1' do
results = Challenge2.sum_to_0([])
results.each do |result|
expect(result).to include([])
end
end
it '.sum_to_0 verification 2' do
results = Challenge2.sum_to_0([1, 2, 3, -4])... |
class RightMenuController < UIViewController
MEMBER_CELL_ID = "MemberCell"
attr_accessor :members
# ---------- viewcontroller life cycle ----------
def viewDidLoad
puts "[R] viewDidLoad"
super
rmq.stylesheet = RightMenuControllerStylesheet
rmq(self.view).apply_style :root_view
@members_ta... |
# 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... |
# abstract
class CondimentDecorator < SimpleDelegator
def initialize(beverage)
@beverage = beverage
super
end
end
|
class User < ActiveRecord::Base
has_secure_password
attr_accessible :email, :password, :password_confirmation
has_many :own_stories, class_name: :Story, foreign_key: :author_id, dependent: :restrict
has_many :assigned_stories, class_name: :Story, foreign_key: :performer_id, dependent: :restrict
has_many :comment... |
class ModeInfo
def initialize
@tabsize = 8
end
def tabsize(*value)
return @tabsize if value.empty?
if value.size > 1
raise ArgumentError, "expected 1 argument"
end
@tabsize = value[0]
end
end
class Modes
def register_mode(name, depends, code=nil)
code ||= lambda{}
depname = depends ? depends.insp... |
class Topic < ActiveRecord::Base
belongs_to :user
has_many :bookmarks
validates :title, presence: true
end
|
module Oauth
class Info
include Mongoid::Document
has_one :oauth, class_name: 'Oauth::Provider', inverse_of: :info
field :data, type: Hash, default: {}
end
end |
When(/^I fill in "(.*?)" with "(.*?)"$/) do |field_label, field_contents|
fill_in(field_label, :with => field_contents)
end
When(/^I press "(.*?)"$/) do |button_text|
click_button(button_text)
end
Then(/^I should see "(.*?)"$/) do |expected_content|
page.should have_content(expected_content)
end |
class Order < ApplicationRecord
has_many :food_order_items
has_many :foods, through: :food_order_items
end
|
class Counter
def initialize
@strategy = FactoryGirl.strategy_by_name(:build).new
end
delegate :association, to: :@strategy
def result(evaluation)
record = @strategy.result(evaluation)
{record.class.table_name => 1}.merge(
Hash[record._reflections.map{ |k, v|
[v.plural_name, Array.wr... |
require "rspec/core/rake_task"
desc "Run those specs"
task :spec do
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = %w{--colour --format progress}
t.pattern = 'spec/**/*_spec.rb'
# t.rspec_path = '/usr/bin/rspec'
end
end
task :default => :spec
desc "Run the server"
task :server do
system "ra... |
require_relative 'timeformatter'
class TimeApp
def call(env)
request = Rack::Request.new(env)
if request.get?
path = request.path_info
params = request.params['format']
router(path, params)
end
end
private
def router(path, params)
case path
when '/time' then time(p... |
# frozen_string_literal: true
FactoryBot.define do
factory :ladder do
name { Faker::Name.unique.name }
desc { Faker::Lorem }
end
end
|
class CreateConsignments < ActiveRecord::Migration
def self.up
create_table :consignments do |t|
t.string :consignor
t.string :consignee
t.integer :origin_id
t.integer :destination_id
t.string :waybill_no
t.string :origin_address
t.string :destination_address
... |
module Wikia
module Response
module RelatedPage
class RelatedPages
class RelatedPage
class ImgOriginalDimension
attr_reader :width, :height
def initialize(img_original_dimensions)
if img_original_dimensions
@width = img_original_dimensi... |
require 'spec_helper'
describe 'create user', :js => true , debug:true do
it 'new user validations' do
visit '/'
click_on 'Add new user'
fill_in 'Name', :with => 'J. Random Hacker'
click_on 'create user'
page.should have_content('There are below errors')
end
it 'add new user' do
visit '/'... |
# 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,
# software distributed
# under the Lice... |
class Attachment < ActiveRecord::Base
has_attached_file :attachment
belongs_to :message
#validates_presence_of :message_id
def attachment_url
self.attachment.url
end
def serializable_hash(options = nil)
{
id: id,
message_id: message_id,
updated_at: updated_at,
... |
# require 'prime'
module BookKeeping
VERSION = 1
end
class Sieve
attr_reader :max, :bools
def initialize(max)
@max = max
@bools = Array.new(max + 1) { true }.tap { |a| a[0] = a[1] = nil }
end
# Note to self: ruby includes this in stdlib
# def primes
# Prime::EratosthenesGenerator.new.take_wh... |
class Room
def initialize(name, description)
@name = name
@objects = []
@exits = []
@baseDescription = description
@dark = true
end
def getName
return @name
end
def isDark?()
return @dark
end
def setDark(newDark)
@dark = newDark
end
def getDescription()
description = String.new(@baseD... |
class VehicleServicesController < ApplicationController
before_action :set_vehicle_service, only: [:show, :edit, :update, :destroy]
# GET /vehicle_services
def index
@vehicle_services = VehicleService.all
end
# GET /vehicle_services/1
def show
end
# GET /vehicle_services/new
def ne... |
require 'rails_helper'
RSpec.describe Api::LikesController, type: :controller do
it { expect(post: 'api/comments/1/likes').to be_routable }
it { expect(delete: 'api/comments/1/likes').to be_routable }
it { expect(post: 'api/posts/1/likes').to be_routable }
it { expect(delete: 'api/posts/1/likes').to be_rout... |
# @note Ça n'est pas une classe, mais simplement les fonctions
# permettant de construire les boutons de partage des pages
# du site.
COMPTE_TWITTER = "phil_icare"
# Pour afficher le nombre de recommandations facebook et le nombre
# d'abonnés tweeter, mettre à true ci-dessous
# @TODO: ces constant... |
require 'pry'
require 'imdb'
class MovieSearch
attr_reader :movie_list
def initialize
@movie_list = []
end
def search(search_term)
@movie_list = [] #clears array from previous search results
@results = Imdb::Search.new(search_term).movies.first(10)
@results.each do |movie|
if @movie_lis... |
module WiKey
module Views
# View object for collection of Wiki subjects
class AllSubjects
def initialize(all_topics)
@all_topics = all_topics
end
def none?
@all_topics.topics.none?
end
def any?
@all_topics.topics.any?
end
def collection
... |
# Note: If SimpleCov starts after your application code is already loaded (via require),
# it won't be able to track your files and their coverage! The SimpleCov.start must be
# issued before any of your application code is required!
require 'simplecov'
SimpleCov.start do
add_filter {|src| src.filename =~ /spec/ }
en... |
# frozen_string_literal: true
RSpec.describe 'Statistics Request', type: :request do
include_context 'with branch location'
include_context 'with user token'
include_context 'with json response'
include_context 'with event'
describe '#statistics' do
subject(:statistics!) { get '/api/statistics', headers... |
# frozen_string_literal: true
require_relative 'frame'
class Game
def initialize(argv)
@frames = separate_frames(argv)
end
def calc_score
@frames.map.with_index { |frame, index| frame.score(index, @frames[index.next], @frames[index.next.next]) }.sum
end
def separate_frames(argv)
shots = argv.s... |
Rails.application.routes.draw do
root 'users#index'
post 'new' => 'users#new'
get 'posts' => 'posts#index'
post 'posts/new' => 'posts#new', as: 'new_post'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
|
class CreateTempBirthdayParties < ActiveRecord::Migration
def change
create_table :temp_birthday_parties do |t|
t.references :cake, index: true
t.integer :quantity
t.jsonb :properties, default: {}
t.integer :hearts_limit
t.date :birth_day
t.datetime :delivery_time
t.refer... |
class AddTruckToDrivers < ActiveRecord::Migration[5.0]
def change
add_column :trucks, :driver_id, :uuid, foreign_key: true, null: false
add_index :trucks, :driver_id
end
end
|
# 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 me to print something? (y/n)"
answer = gets.chomp
puts 'Something' if answer == 'y'
|
class AddTrackToTracks < ActiveRecord::Migration
def change
add_column :tracks, :track, :string
end
end
|
# frozen_string_literal: true
namespace :fetch do
desc "Fetch data from covid19india.org api"
task covid19india: :environment do
::FetchCovid19india.perform_task
end
end
|
module MessageType
SKILL_LEARNT = :'skill-learnt'
CLASS_LEARNT = :'class-learnt'
SEARCH_SUCCESS = :'search-success'
SEARCH_NOTHING = :'search-nothing'
HIDDEN = :'hide-success'
ERROR = :'error-exception'
BACKTRACE = :'exception-trace'
FAILED = :'message-failed'
SPEECH = :'speech'
SPEECH_EMOTE = :'speech-emote'... |
#
# Kibana is a website to visulize information collected by
# logstash.
#
if node['nginx']['kibana_available']
template '/etc/nginx/sites-available/kibana' do
owner 'root'
group 'root'
mode '0644'
source 'kibana_virtual_server.erb'
notifies :reload, 'service[nginx]'
end
nginx_site 'kiban... |
# frozen_string_literal: true
desc 'Send birthday wishes'
task send_wishes: :environment do
Team.all.each do |team|
client = Slack::Web::Client.new(token: team.oauth_token)
client.auth_test
user_list = []
team.users.born_today.each { |user| user_list.push("<@#{user.slack_id}>") }
total_birthday_... |
# frozen_string_literal: true
if defined?(Sidekiq)
require "spec_helper"
require "sidekiq/testing"
require "checkups/sidekiq_worker"
require "checkups/checkup"
class TestWorkerCheckup < Checkups::Checkup
def self.frequency
:daily
end
end
RSpec.describe Checkups::SidekiqWorker do
let(:... |
class VideoUrl < ActiveRecord::Base
belongs_to :user
validates_presence_of :url
validates_presence_of :user_id
end
|
require 'spec_helper'
describe Fn::Salesforce::Operation do
let(:operation) { described_class.new(attributes) }
context 'create' do
let(:attributes) { {
"sObject" => "my__ObjectName__c", "properties" => { "Name" => "Belthazar" }
} }
context '#action' do
subject { operation.action }
... |
module Publisher
extend self
def broadcast_event(event_name, payload = {})
if block_given?
ActiveSupport::Notifications.instrument(event_name, payload)do
yield
end
else
ActiveSupport::Notifications.instrument(event_name, payload)
end
end
end
# 我们可以在 model 或 controller 中发布具体... |
class DelayedGenerateAssessmentReport < Struct.new(:generated_report_id, :batch_id)
@@report_logger = Logger.new('log/gradebook_report_errors.log')
def perform
generated_report = GeneratedReport.find generated_report_id
report_batches = batch_id.present? ? generated_report.generated_report_batches.pendin... |
# frozen_string_literal: true
require 'appium_lib'
# Element definer for screen objects
class BaseScreen
def self.identificator(element_name, &block)
define_method(element_name.to_s, *block)
end
class << self
alias value identificator
alias action identificator
alias trait identificator
end
e... |
class RemoveEmailFromUsers < ActiveRecord::Migration
def change
remove_columns :users, :email
end
end
|
class AddTpToArticleCategory < ActiveRecord::Migration
def self.up
add_column :article_categories, :tp, :integer, :default => 0 # 0 => 资讯, -1 => 公告
end
def self.down
remove_column :article_categories, :tp
end
end
|
# The program conjugates most common english verbs with the following option:
# * :tense => :past or :present or :future
# * :person => :first or :second or :third
# * :plurality => :singular or :plural
# * :aspect => :habitual or :perfect or :perfective or :progressive or :prospective
# * :mood => :indicative or :impe... |
require 'sidekiq'
require 'fileutils'
require 'itpkg/utils/string_helper'
class DockerJob < ActiveJob::Base
queue_as :docker
def perform(nt_id, cache=true)
nt = NodeType.find nt_id
logger.info "Begin build #{nt.name}"
v = "v#{Itpkg::StringHelper.current}"
bp = "#{Rails.root}/tmp/docker/#{v}"
... |
class ApplicationController < ActionController::Base
before_action :configure_permitted_paramaters, if: :devise_controller?
before_action :basic_auth, if: :production?
before_action :clean_items
private
def clean_items ## 商品の定期消去
if Time.now.wday == 6 && Time.now.hour == 18
delete_items = Item.whe... |
class Notifier < ActionMailer::Base
default from: "from@example.com"
def comment_updated(comment, user)
@comment = comment
@user = user
@folder = comment.folder
@activity = @folder.activity
subject = "[Shooring] #{@activity.name} - #{@folder.name}"
mail(to: user.email, subject: subject,
... |
class Purchase < ActiveRecord::Base
belongs_to :product
belongs_to :receipt
def self.receipt_total(current_receipt_id)
Purchase.joins(:product).where(receipt_id: current_receipt_id).sum(:price)
end
end
|
# Helper Method
def position_taken?(board, index)
!(board[index].nil? || board[index] == " ")
end
# Define your WIN_COMBINATIONS constant
WIN_COMBINATIONS = [
#Top rows
[0, 1, 2],
#Middle Row
[3, 4, 5],
#Bottom Row
[6, 7, 8],
#Bottom left diagonal
[6, 4, 2],
#Bottom Right diagonal
[8, 4, 0],
#T... |
class VotesController < ApplicationController
# Rails UI is deprecated. All content UI should be through Backbone.
def create
puts vote_params[:up]
@vote = current_user.owned_votes.build(vote_params)
@votable = @vote.votable
if @vote.save
flash[:notice] = "Thanks for voting!"
redirect_... |
require 'gtk3'
class RubyApp < Gtk::Window
def initialize
super
init_ui
end
def init_ui
fixed = Gtk::Fixed.new
add fixed
#Quit button code start
button = Gtk::Button.new :label => "Quit"
button.set_size_request 80, 35
button... |
class Group < ActiveRecord::Base
attr_accessible :name, :default
has_many :users
before_save :remove_default_flag
def Group.default_group
find_by_default(true)
end
def remove_default_flag
if default
Group.default_group.try(:update_attributes, default:false)
end
end
end
|
# Step 1 open a file and read it
people_file = File.open("database.txt")
#
# # p people_file
#
# # Trial 1 read in file into an array
#
# database = []
#
# until people_file.eof?
# # take each record and store it in an array
# database.push(people_file.gets.chomp)
# end
# p database
# trial 2 breaking the line u... |
require 'elasticsearch'
class Search
@@es = Elasticsearch::Client.new Tripgraph::Application.config.elasticsearch
unless @@es.indices.exists index: 'tripgraph'
@@es.indices.create index: 'tripgraph'
end
@@es.indices.put_mapping(
index: 'tripgraph',
type: 'trip_places',
body: {
trip_plac... |
# frozen_string_literal: true
require "graphql/schema/find_inherited_value"
module GraphQL
class Schema
class Member
# DSL methods shared by lots of things in the GraphQL Schema.
# @api private
# @see Classes that extend this, eg {GraphQL::Schema::Object}
module BaseDSLMethods
in... |
class RootController < ApplicationController
def index
@contact = Contact.new
@posts = CACHE.fetch('posts:feed') do
Post.active.order('created_at desc').limit(5).load
end
end
end
|
class Gilbert < Chingu::GameObject
trait :bounding_box, debug: false, scale: 0.52
traits :velocity, :timer, :collision_detection
attr_accessor :jumping
attr_reader :last_x, :direcction
PLATAFORMAS = [Base,
Plataforma,
Plataforma2,
BaseLv3,
... |
# frozen_string_literal: true
class UserSerializer < BaseSerializer
attributes %i[id email username first_name last_name birth_date role address]
end
|
class Animal
attr_accessor :nom
def initialize(nom)
@nom = nom
end
end
class Chat < Animal
def parler
puts "#{nom} dit: Miaou"
end
end
class Chien < Animal
def parler
puts "#{nom} dit: Ouaf"
end
end
class Oiseau < Animal
def parler
puts "#{nom... |
require 'Bentrackergem'
describe 'BenTrackerGem' do
let (:response_get) { RestClient.get('http://brostofftrack.herokuapp.com/history.json') }
let (:response_post) { BenTrackerGem.post_message("Test Suite") }
context "get-based methods" do
it "successfully gets the data " do
expect(response_get.cod... |
# encoding: UTF-8
dir = File.expand_path('..', __FILE__)
require 'sinatra/base'
require dir + '/environment'
ERROR_RESPONSE = {'error' => 'No soup for you!'}
class ApiApp < Sinatra::Base
helpers Sinatra::JSON
helpers Sinatra::Jsonp
helpers Sinatra::Spitter
helpers Sinatra::ItemUtils
#====================... |
module Idv
class PhoneJob < ProoferJob
def verify_identity_with_vendor
confirmation = agent.submit_phone(vendor_params, vendor_session_id)
result = extract_result(confirmation)
store_result(result)
end
private
def vendor
Figaro.env.phone_proofing_vendor.to_sym
end
end
e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.