text stringlengths 10 2.61M |
|---|
require 'models/exact_target_message'
require 'mock_http_response'
# This is used to redefine the ExactTargetMessage.do_http method to NOT query ET; instead
# we load a response xml document that has already been set on the object
class ExactTargetMessage
def do_http(http, req)
MockHttpResponse.new self... |
# == Schema Information
#
# Table name: blessings
#
# id :integer not null, primary key
# location :string(255)
# date :date
# contactinfo :text
# comments :text
# created_at :datetime not null
# updated_at :datetime not null
#
class Blessing < ActiveRecord::Base... |
Puppet::Type.newtype(:fluffy_test) do
@doc = 'Manage Fluffy test process for the current session'
newparam(:name, :namevar => true) do
desc 'Session name'
newvalues(:puppet)
end
def refresh
provider.test
end
end
|
module VotesHelper
def link_to_vote(label, option)
link_to(label, match_vote_path(option.match, :vote => {:option_id => option.id}), :method => :post, :class => 'btn-movie-vote')
end
def vote_percentage(match, option)
percentage_value = (match.total_votes > 0) ? ((option.votes_count / match.total_votes.... |
require 'erb'
people = %w(yoko tomowo tim) # !> assigned but unused variable - people
erb = ERB.new(<<-EOS,nil,'-') # !> Passing trim_mode with the 3rd argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, trim_mode: ...) instead.
<%- people.each do |person| %>
* <%= person %>
<%- end %>
EOS
er... |
require 'rails_helper'
RSpec.describe CompulsoryRequirement, type: :model do
before do
q1 = FactoryGirl.create :qualification
q2 = FactoryGirl.create :qualification
s1 = FactoryGirl.create :skill
s2 = FactoryGirl.create :skill
j1 = FactoryGirl.create :job_type
@requirement = FactoryGirl.create :... |
class ConfigVersion < ActiveRecord::Base
has_many :jnlp
validates_presence_of :key
validates_uniqueness_of :key
before_save :verify_valid_template
def verify_valid_template
begin
# TODO how do we verify we have a valid template?
# most templates will rely on externally set variables... |
require 'json'
require_relative 'rest_client'
class GitHubClient
COMMITS_URI = "https://api.github.com/repos/$1/$2/commits"
COMMITTER_URI = "https://api.github.com/users/"
def initialize(organization:, project:)
@commit_uri = build_commit_uri(organization: organization,
... |
class Error
class ValidationFailed < Error
def initialize(data)
super(:validation_failed, 400, data)
end
end
end
|
require 'spec_helper'
describe ReceptionsController do
before(:each) do
turn_of_devise_and_cancan_because_this_is_specced_in_the_ability_spec
end
specify { should have_devise_before_filter }
def mock_reception(stubs={})
@mock_reception ||= mock_model(Reception, stubs)
end
describe "GET in... |
class AddFieldsToOrders < ActiveRecord::Migration
def change
add_column :orders, :first_name, :string
add_column :orders, :last_name, :string
add_column :orders, :address, :string
add_column :orders, :city, :string
add_column :orders, :state, :string
add_column :orders, :zipcode, :integer
... |
class SpecimensController < ApplicationController
before_action :set_work_order
before_action :set_specimen, only: [:show, :edit, :update, :destroy]
before_action :authorize_specimens, only: [:new, :create, :index]
# GET /specimens
def index
if request.format.xls?
@sheets = Specimen.where(sample_id... |
module DasParse
def initialize( machine )
@machine = machine
end
def machine=(m)
@machine=m
end
def machine
@machine
end
def parse( text )
text = text.join if text.is_a?(Array)
#puts "t0",text.inspect
#text_no_comments = text.gsub( /\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/,"" ... |
class Project < ApplicationRecord
enum status: [:created, :started, :stopped, :completed]
belongs_to :user
has_many :comments, :dependent => :destroy
validates :name, :description, :estimated_effort, :actual_effort, :status, presence: true
validates_inclusion_of :is_public, :in => [true, false]
validate... |
class FillInStudentPhoneNumberFromOrder < ActiveRecord::Migration
def change
Student.joins(:order).each do |student|
next unless student.order.present?
student.update(phone_number: student.order.billing_phone)
end
end
end
|
class CreateResourceAssets < ActiveRecord::Migration
def change
create_table :resource_assets do |t|
t.references :resource
t.references :asset
t.integer :order
t.timestamps
end
add_index :resource_assets, :resource_id
add_index :resource_assets, :asset_id
end
end
|
require File.join( File.dirname( __FILE__ ), "..", "spec_helper" )
class Configurator
describe Server do
before :each do
Configuration.stub!( :temporary_directory ).and_return( "/tmp/lucie" )
end
context "initializing a client" do
before :each do
dpkg = mock( "dpkg" )
dpkg.... |
class ApplicationController < ActionController::Base
include Pundit
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
rescue_from ActiveRecord::RecordNotFound, with: :record_not_found
rescue_from Pundit::NotAuthoriz... |
class AddReferencesToBandMembers < ActiveRecord::Migration[5.2]
def change
add_reference :band_members, :band, foreign_key: true
add_reference :band_members, :musician, foreign_key: true
end
end
|
class InitialSchema < ActiveRecord::Migration[5.2]
create_table "boxscores", force: :cascade do |t|
t.string "name", limit: 255
t.date "date"
t.integer "season", limit: 4
t.string "ballpark", limit: 255
t.integer "home_team_id", limit: 4
t.integer "away_team... |
require 'open-uri'
require 'yaml'
module OmniFocus::Github
VERSION = '1.0.0'
GH_URL = "http://github.com"
def fetch url, key
base_url = "#{GH_URL}/api/v2/yaml"
YAML.load(URI.parse("#{base_url}/#{url}").read)[key]
end
def populate_github_tasks
user = `git config --global github.user`.chomp
... |
Given(/^I am on the Google homepage$/) do
visit 'https://google.co.uk'
end
When(/^I search for Ada Lovelace$/) do
fill_in 'q', :with => 'Ada Lovelace'
sleep 5
click_on(class: 'lsb', text: 'Google Search')
end
Then(/^I should see a Wikipedia link$/) do
expect(page).to have_content('Wikipedia')
end
Given("I... |
class CreateStructure < ActiveRecord::Migration
def self.up
create_table :projects do |t|
t.string :name
t.text :desc
t.integer :owner_id
t.timestamps
end
create_table :repositories do |t|
t.string :name
t.string :path
t.integer :owner_id
t.integer :reposito... |
require 'spec_helper'
describe "counteroffers/show" do
before(:each) do
@counteroffer = assign(:counteroffer, stub_model(Counteroffer,
:offer => nil,
:buyer => "Buyer",
:seller => "Seller",
:buyer_price => "Buyer Price",
:seller_price => "Seller Price"
))
end
it "renders at... |
# encoding: utf-8
##
# Facebook Open Graphic Protocol Service
#
class FacebookOgpService
def post_topic(user_id, topic_id, topic_url)
@user_id = user_id
# TODO: check permission here
ogp { |p| p.put_connections("me", "mongolian_rubyist:create", topic: topic_url) }
end
handle_asynchronously :post_to... |
class Customer::CartItemsController < ApplicationController
before_action :authenticate_customer!
def index
@cart_item = CartItem.where(customer_id: current_customer.id).order("created_at DESC")
end
def update
@cart_item = CartItem.find(params[:id])
@cart_items = CartItem.where(customer_id: curren... |
module Enumerable
def group_by
inject({}) do |h, e|
h.fetch(yield(e)) { |k| h[k] = [] } << e; h
end
end unless method_defined?(:group_by)
end
|
module SemanticNavigation
module Core
module MixIn
module DslMethods
def item(id, url=nil, options={}, &block)
options[:id] = id.to_sym
options[:render_if] = [*@render_if, options[:render_if], *@scope_render_if].compact
if url.is_a?(Array)
options[:url] = ... |
# Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do
factory :point do
title { Faker::Lorem.words.join(' ') }
score 1
description { Faker::Lorem.paragraph }
pointable nil
article
end
end
|
module Admin
module CmsHelper
def link_to_section_edit(contents_key, link_text=nil)
found_content = CachedContents.all(
:conditions => { :contents_key => [ contents_key, "#{contents_key}_preview" ] },
:order => "contents_key DESC"
)
cached_content = if found_content.empt... |
class AddDiscourseTopicIdToLessons < ActiveRecord::Migration
def change
add_column :lessons, :discourse_topic_id, :integer
end
end
|
module Strumbar
module Instrumentation
module ActionController
def self.load(options={})
options[:rate] ||= Strumbar.default_rate
using_mongoid = options.fetch(:mongoid, false)
Strumbar.subscribe /process_action.action_controller/ do |client, event|
key = "#{event.payload[... |
require 'spec_helper'
describe Directory do
context 'add_organization' do
before do
@organization = FactoryGirl.create(:organization, status: 'new')
FactoryGirl.create(:organization_admin, organization: @organization, role: 'Primary')
DirectoryApi.stub!(:create_organization)
DirectoryAp... |
class CreateTimesheets < ActiveRecord::Migration
def change
create_table :timesheets do |t|
t.integer :sp_id, :null => false
t.integer :user_id, :null => false
t.datetime :start_timestamp, :null => false
t.datetime :end_timestamp, :null => false
t.integer :in_day, :null => false
... |
class RemoveUsersIdentifier < ActiveRecord::Migration[6.1]
def change
remove_column :users, :identifier, :string, index: true
end
end
|
class CatAddQuickLink < ActiveRecord::Migration
def self.up
add_column :categories, :quick_link, :boolean, :default => false
end
def self.down
remove_column :categories, :quick_link
end
end
|
class DreamSerializer
include FastJsonapi::ObjectSerializer
attributes :title, :description, :date, :category_id, :favorite
belongs_to :category
end
|
class Flow < ApplicationRecord
belongs_to :recipe, optional: true
mount_uploader :image, ImageUploader
end
|
class ConditionColorIndicator < ConditionSimple
def initialize(indicator)
@indicator = indicator.downcase.gsub(/ml/, "").chars.to_set
@indicator_name = Color.color_indicator_name(@indicator)
end
# Only exact match
# For "has no color indicator" use -ind:*
def match?(card)
card.color_indicator and... |
require 'rails_helper'
require 'database_cleaner'
RSpec.describe Api::V1::Merchants::SearchController, type: :controller do
describe "GET /merchants/find" do
it "returns a specific merchant" do
m1 = Merchant.create(name: "amazon")
m2 = Merchant.create(name: "etsy")
get :show, name: "amazon", ... |
class Admin::GroupsController < Admin::ApplicationController
layout 'admin'
active_scaffold do |config|
config.columns.exclude :created_at
config.columns[:title].set_link :edit
config.columns[:rights].label = 'Rights for forum'
config.list.columns = \
config.create.columns = \
config.upd... |
class CreateProducts < ActiveRecord::Migration
def change
create_table :products do |t|
t.string "title"
t.boolean "new"
t.integer "status"
t.string "type"
t.integer "brand_id"
t.integer "model_id"
t.integer "year"
t.string "city"
t.string "brake"
t.inte... |
require 'spreadsheet'
namespace :import do
desc 'Import provinces to database'
task :provinces => :environment do
p 'Import provinces...'
book = open_file
if book
province_worksheet = 0
book.worksheet(province_worksheet).each_with_index do |row, index|
next if index == 0
Pr... |
class CommentToCommentary < ApplicationRecord
belongs_to :user
belongs_to :commentary
end
|
module ClientPkgServe
def broker_urls
::RSence.config[:broker_urls]
end
def match( uri, request_type )
uri.match( /^#{broker_urls[:h]}/ )
end
# Helper method to return the time formatted according to the HTTP RFC
def httime(time)
return time.gmtime.strftime('%a, %d %b %Y %H:%M:%S %Z')
end
... |
class BooksController < ApplicationController
get "/books/new" do
erb :'/index'
end
post "/api/books" do
authenticate
book = Book.find_by(isbn_13: json_request_body[:isbn_13])
if book
json(book.as_json)
else
new_book = Book.new(
authors: json_request_body[:authors],
... |
class Yard2steep::AST::ConstantNode
@name: any
@klass: any
@v_type: any
def name: -> any
def klass: -> any
def v_type: -> any
def initialize: (name: String, klass: String, v_type: String) -> any
def long_name: -> String
end
|
require 'spec_helper'
describe AdditionalCostsDeploymentsController do
render_views
let(:user) { User.make! }
before(:each) do
sign_in user
@deployment = given_resources_for([:deployment], :user => user)[:deployment]
@additional_cost = AdditionalCost.make!(:user => user)
end
it "should render ... |
# Copyright (C) 2011-2014 Tanaka Akira <akr@fsij.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and t... |
require 'bcrypt'
class Maker
include DataMapper::Resource
attr_reader :password
attr_accessor :password_confirmation
validates_confirmation_of :password
property :id, Serial
property :full_name, String, required: true
property :user_name, String, required: true
property :email, Str... |
# encoding: utf-8
control "V-92653" do
title "The Apache web server must have resource mappings set to disable the serving of certain file types."
desc "Resource mapping is the process of tying a particular file type to a process in the web server that can serve that type of file to a requesting client and to identi... |
# frozen_string_literal: true
FactoryBot.define do
factory :screening do
movie
cinema_hall
screening_time { DateTime.current }
end
end
|
class OrdersController < ApplicationController
skip_before_action :require_login
before_action :find_cart, only: [ :clear_cart, :submit_order, :checkout ]
before_action :find_order, only: [ :show_complete, :cancel]
def cart
if session[:cart_id]
@order = Order.find_by(id: session[:cart_id])
else
... |
class HomeController < ApplicationController
def get_infomercial_ipsum
if params[:number_of_paragraphs].present?
number_of_paragraphs = params[:number_of_paragraphs].to_i
informercial_ipsum_request = InfomercialIpsumRequest.new(number_of_paragraphs)
@informercial_ipsum = informercial_ipsum_requ... |
RSpec.describe "Users can create a external income" do
context "when signed in as a partner organisation user" do
let(:financial_quarter) { FinancialQuarter.new(Time.current.year, 1) }
let(:user) { create(:partner_organisation_user) }
let(:programme) { create(:programme_activity, extending_organisation: u... |
#!/usr/bin/env ruby
#
# Reads in multiple JSON documents and generates a
# master JSON schema to define them all.
#
# Input is a directory continaing one or more JSON
# JSON docs (*.json). Each *.json file must
# contain one valid JSON document.
#
dir = File.dirname(__FILE__)
$: << File.expand_path("#{dir}/... |
require "octokit"
require "fileutils"
require "base64"
require "bundler"
require "json"
abort("Please set ENV[\"GITHUB_USERNAME\"] and/or ENV[\"GITHUB_PASSWORD\"] and try again") unless ENV["GITHUB_USERNAME"] && ENV["GITHUB_USERNAME"]
abort("Oops, looks like you forgot to specify a Github organization name. Please try... |
require File.dirname(__FILE__) + '/spec_helper'
module MethodMatching
describe ExtendableBlock do
it "should give a friendly message when block is called but none is set" do
ExtendableBlock.new { block.call }.
should raise_error(/No block given/)
end
end
end
|
class ResultsController < ApplicationController
def show
@result = Result.find(params[:id])
end
def new
@result = Result.new
@quizzes = Quiz.all
end
def create
@result = Result.new(result_params)
if @result.save
flash[:success] = "Your result has been created!"
redirect_to @... |
# Copyright © 2011-2019 MUSC Foundation for Research Development~
# All rights reserved.~
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:~
# 1. Redistributions of source code must retain the above copyright notice, this l... |
module SCSSLint
# Checks for nesting depths
class Linter::NestingDepth < Linter
include LinterRegistry
def visit_root(_node)
@max_depth = config['max_depth']
@depth = 0
yield # Continue linting children
end
def visit_rule(node)
if !node.node_parent.respond_to?(:parsed_rules... |
class EventTimeValidator < ActiveModel::Validator
def validate(record)
if record.start_time < Time.now
record.errors[:start_time] << "cannot be in the past"
end
if record.end_time < record.start_time
record.errors[:end_time] << "must be after start time"
end
end
end
|
#
# Cookbook Name:: weechat-cookbook
# Recipe:: default
#
require_recipe "weechat::scripts"
package 'weechat' do
package_name = value_for_platform(
['debian', 'ubuntu'] => {'default' => 'weechat-curses'},
['mac_os_x'] => {'default' => 'weechat'}
)
action :install
end
node[:weechat][:users].each do |user... |
# frozen_string_literal: true
module SharedFunctions
def uploaded_file(file = Rails.root.join('spec', 'support', 'images', 'test.png'))
Rack::Test::UploadedFile.new(file)
end
end
RSpec.configure do |config|
config.include SharedFunctions
end
|
class Admin::DepartmentsController < AdminController
def index
@departments = Department.order(:title)
end
def show
@department = Department.find_by_id(params[:id])
end
def new
@department = Department.new
end
def create
@department = Department.new(params[:department])
if ... |
class WorkspacesController < ApplicationController
wrap_parameters :exclude => []
def index
if params[:user_id]
user = User.find(params[:user_id])
workspaces = user.workspaces.workspaces_for(current_user)
else
workspaces = Workspace.workspaces_for(current_user)
end
workspaces = wor... |
module Report
require 'WIN32OLE'
require "Date"
class ReportorError < StandardError;end
class NotValidParameterError < ReportorError;end
Summary_file_name = "summary\.xlsx"
Directory_name = "directory"
Cover_name = "cover"
class Directory
Result_attr = "a"
Testcase_attr = "b"
Detail_attr = "c"
Firs... |
class Sous < Formula
desc "Sous tool for building and deploying at OpenTable"
homepage "https://github.com/opentable/sous"
# When the version of Sous changes, these two fields need to be updated
version "0.1.7"
sha256 "539ca446ecd9f931cb6eba24312f7dd1c724c4222140a701ababa3aef9265a1e"
url "https://github.c... |
# -*- encoding: utf-8 -*-
# stub: handsoap 0.2.5 ruby lib
Gem::Specification.new do |s|
s.name = "handsoap".freeze
s.version = "0.2.5"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Troels Knak-Nie... |
module API
module V1
# API methods for monsters
class Monsters < Grape::API
resource :monsters do
get '/' do
@monsters = Monster.all
end
params do
requires :monster_id, type: Integer, desc: 'Monster id'
end
get ':monster_id' do
@mons... |
# frozen_string_literal: true
class TechniqueLink < ApplicationRecord
acts_as_list scope: %i[linkable_type linkable_id], sequential_updates: true
belongs_to :linkable, polymorphic: true
validates :linkable_id, :linkable_type, :url, presence: true
# validates :position, presence: true
validates :title, leng... |
require 'str_to_seconds'
class Category < ApplicationRecord
has_many :titles
validates :name, presence: true
validates :description, presence: true
validates :loan_length_seconds, presence: true
# before_save :update_titles_enabled
def loan_length
unless self.loan_length_seconds.nil?
self.loan_... |
module Api
class SegmentsController < ApiController
def index
@segments = Segment.all
render :index
end
def create
@segment = Segment.new(segment_params)
if @segment.save
render json: @segment
else
render json: @segment.errors.full_messages
... |
require 'spec_helper'
describe ArticlesController do
context "unauthenticated" do
it "should redirect to root path" do
get :feed
response.should redirect_to('/')
flash[:notice].should == I18n.t("users.access.denied")
end
it "should be able to access index page" do
get :index
... |
class Holiday < ApplicationRecord
validates :name, presence: true
validates :startDate, presence: true
validates :endDate, presence: true
end
|
require 'spec_helper'
require_relative '../lib/grid_partition/algorithm/recursive_partition'
require_relative '../lib/grid_partition/graph'
describe GridPartition::Algorithm::RecursivePartition do
include GridPartition::Algorithm::RecursivePartition
before do
continuable_nodes =[]
(1..3).each do |i|
... |
class Api::PostLikesController < ApplicationController
before_action :require_logged_in
before_action :require_friendship, only: [:create]
def create
@post_like = PostLike.new(
user_id: current_user.id,
post_id: post_like_params[:post_id]
)
if @post_like.save
render :show
else
... |
# == Schema Information
#
# Table name: routes
#
# id :integer not null, primary key
# name :string(255)
# latitude :float
# longitude :float
# created_at :datetime not null
# updated_at :datetime not null
# user_id :integer
# difficulty ... |
Facter.add(:wrecked) do
setcode do
Dir.glob('/var/spool/wrecked/*.wreck').collect {|e| File.basename(e, '.wreck')}
end
end
|
module Imdb
# Represents a Movie on IMDB.com
class Movie
attr_accessor :id, :url, :title
# Initialize a new IMDB movie object with it's IMDB id (as a String)
#
# movie = Imdb::Movie.new("0095016")
#
# Imdb::Movie objects are lazy loading, meaning that no HTTP request
# will be perfor... |
require 'yaml'
require 'pry'
MESSAGES = YAML.load_file('loan_calculator_messages.yml')
def prompt(message)
puts ">> #{message}"
end
def valid_whole?(loan)
/^\d+$/.match?(loan) && loan.to_i >= 1
end
def valid_decimal?(amount)
amount.to_f.to_s == amount && amount.to_f > 0
end
def monthly_apr(rate)
rate.to_f/... |
# Implementar en este fichero la clase para crear objetos racionales
require "./gcd.rb"
class Fraccion
attr_reader :numerador, :denominador
#metodo inicializa fraccion
def initialize(numerador, denominador)
@numerador= numerador
@denominador = denominador
forma_reducida
end ... |
require 'spec_helper'
describe Restaurant do
it 'is not valid without a name' do
restaurant = Restaurant.new(name:nil)
expect(restaurant).to have(2).errors_on(:name)
expect(restaurant.valid?).to eq false
end
it 'is not valid without an address' do
restaurant = Restaurant.new(address:nil)
expect(... |
require 'binary_struct'
require 'miq_unicode'
require 'fs/ntfs/index_node_header'
require 'fs/ntfs/directory_index_node'
require 'fs/ntfs/index_record_header'
module NTFS
using ManageIQ::UnicodeString
#
# INDEX_ROOT - Attribute: Index root (0x90).
#
# NOTE: Always resident.
#
# This is followed by a seq... |
class StripeCharge
def initialize(stripe_id)
@stripe_id = stripe_id
end
def on_succeeded
self.invoice.on_successful_payment
end
def invoice_id
self.charge.invoice
end
def invoice
return @invoice if @invoice
@invoice = StripeInvoice.new self.invoice_id,
... |
module Ricer::Plug::Params
class ServerUrlParam < UrlParam
def schemes
['irc', 'ircs']
end
end
end |
require_relative 'tax'
require_relative 'order'
require 'yaml'
class OrderProcessor
attr_accessor :order_lines, :total_tax, :total_items_cost, :args, :tax
def initialize (args, config_file)
@tax = Tax.new(YAML.load_file(config_file))
@args = args
end
def get_order
@order_lines = Order::OrderReader... |
# frozen_string_literal: true
module Dotloop
module Models
class Contact
include Virtus.model
attribute :address
attribute :city
attribute :country
attribute :email
attribute :fax
attribute :first_name
attribute :home
attribute :id, Integer
attribute :l... |
class PigLatinizer
def piglatinize(input)
#take in a string
#split it by spaces
#iterate over the array
#for each word, take first letter and append it to the end and add 'ay'
#if it begins with a vowel, don't shift first letter and append 'way'
#then join with spaces
words = input.split(... |
require Rails.root.join('lib', 'rails_admin', 'book_report')
RailsAdmin::Config::Actions.register(RailsAdmin::Config::Actions::BookReport)
RailsAdmin.config do |config|
config.main_app_name = ["Lib Fácil", ""]
### Popular gems integration
## == Devise ==
config.authenticate_with do
warden.authenticate! ... |
class RemoveColumnFacebookIdFromCampaign < ActiveRecord::Migration[5.0]
def change
remove_column :campaigns, :facebook_campaign_id
end
end
|
# frozen_string_literal: true
require 'time'
require_relative 'analyzable'
class SalesAnalyst
include Analyzable
attr_reader :items
def initialize(items, merchants, customers, invoices, invoice_items, transactions)
@items = items
@merchants = merchants
@customers = cu... |
require "bundler/gem_tasks"
require 'appraisal'
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
desc 'Default: run unit tests.'
task default: [:all]
desc 'Test the paperclip plugin under all supported Rails versions.'
task :all do |t|
ENV['RAILS_ENV'] ||= 'test'
puts 'Create database'
Dir.chdi... |
class AddDoneColumnToGoals < ActiveRecord::Migration[5.0]
def change
add_column :goals, :done, :boolean, default: :false
add_column :goals, :expected_completion_day, :date # Expected Completion Day
end
end
|
class Api::V1::FavoriteController < ApplicationController
def index
if listing_params[:api_key].present? && user(listing_params).present?
favorite_locations = user(listing_params).favorites.each do |favorite|
favorite.location
end
listing_location = FavoriteLocation.new(favorite_location... |
require 'capistrano/cli'
require 'fileutils'
class Capfile
def initialize(path, stage = nil)
@path = path
@cap = load(stage)
end
def tasks
cap_tasks
end
def stages
cap_stages
end
def variables
@cap.variables
end
private
def load(stage... |
def select_letter(sentence, letter)
selected = ''
counter = 0
loop do
break if counter == sentence.size
current_letter = sentence[counter]
selected << current_letter if current_letter == letter
counter += 1
end
selected
end
question = 'How many times does a particular character appear in ... |
class PublicController < ApplicationController
layout 'public'
before_filter :load_nav
before_filter :get_master_user
def index
#renders index template
end
def show
@page = Page.where(:title => params[:id], :visible => true).first #TODO: does the visibile part make this error-prone?
@items... |
class GigSong < ApplicationRecord
belongs_to :gig
belongs_to :song
scope :by_date, -> { order(date: :asc) }
scope :unique, -> { group(:song_id) }
scope :not_over, -> { where("date > ?", DateTime.now)}
def self.search(search)
if search
Song.find_by(name: search)
e... |
class Api::V1::InviteNotificationsController < Api::V1::BaseController
before_action :set_invite_notification, only: [:show, :update, :destroy]
# GET /invite_notifications
def index
@invite_notifications = InviteNotification.all
render json: @invite_notifications
end
# GET /invite_notifications/1
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.