text stringlengths 10 2.61M |
|---|
class DateRange
attr_reader :start_date, :end_date
# def res_start(start_time = '11:00'.strftime('%k%M'))
# @res_start = res_start
# end
# def res_end(end_time = '15:00'.strftime('%k%M'))
# @res_end = res_end
# end
# def start_date
# @start_date = DateTime.new
# end
#
# def end_date
# @end_date ... |
#
# Cookbook Name:: virtualenv
# Recipe:: default
#
# Copyright 2014, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
package "python-virtualenvwrapper" do
action :install
end
template "/etc/profile.d/virtualenvwrapper.sh" do
source "virtualenv_bashprofile.erb"
not_if do
File.exists?("/etc... |
class Array
def accumulate
accumulated = []
each { |item| accumulated << (yield item) }
accumulated
end
end |
class Accounts::ReaderBookRequestsController < ApplicationController
include AccountKeeper
include BookParams
# GET /books
# GET /books.json
def index
@reader_requests = BookRequest.get_reader_requests_by_account(@account).paginate(page: params[:page])
end
# GET /books/1
# GET /books/1.json
def ... |
#!/usr/bin/env ruby
lang = nil
if ARGV.first.to_s =~ /^lang=(.+)$/
lang = $1
ARGV.shift
end
if ARGV.empty?
puts "usage: eturem (lang=**) script.rb"
exit
end
$PROGRAM_NAME = ARGV.shift
require lang ? "eturem/#{lang}" : "eturem"
|
require 'vanagon/engine/always_be_scheduling'
require 'vanagon/driver'
require 'vanagon/platform'
require 'logger'
class Vanagon
class Driver
@@logger = Logger.new('/dev/null')
end
end
describe 'Vanagon::Engine::AlwaysBeScheduling' do
let (:platform) {
plat = Vanagon::Platform::DSL.new('aix-6.1-ppc')
... |
require "test_helper"
class NewsTest < ActiveSupport::TestCase
include ActiveJob::TestHelper
test "must be valid" do
news = News.new(body: "test")
assert(news.valid?)
end
test "must be invalid" do
news = News.new
assert(news.invalid?)
end
test "must notify" do
assert_difference("Publ... |
module UsersHelper
def past_events_header
content_tag(:h1) { 'past events' } unless @past_events.nil?
end
def past_events
content_tag_for(:h2, @past_events) do |event|
"#{@past_events.index(event) + 1})#{event.name}to take place on #{event.date}" unless @past_events.nil?
end
end
def future... |
SimpleCov.start do
if ENV['CIRCLE_ARTIFACTS']
dir = File.join(ENV['CIRCLE_ARTIFACTS'], "coverage")
coverage_dir(dir)
end
add_filter "/spec/"
end
|
class TemplateModule < ApplicationRecord
has_many :templates
belongs_to :language
end
|
class Comment < ActiveRecord::Base
belongs_to :user
belongs_to :lecture
validates :user_id, :presence =>true
validates :comment, :presence =>true
validates :lecture_id, :presence =>true
end
|
require File.join(File.dirname(__FILE__), "..", "lib", "dessert")
require File.join(File.dirname(__FILE__), "..", "lib", "jellybean")
describe JellyBean do
subject { JellyBean.new("Cake", 100, "black licorice") }
it "should have a delicious" do
subject.should nil
end
it "should return true, healthy < 20... |
Vagrant.configure("2") do |config|
config.vm.define "salt" do |salt|
salt.vm.box = "ubuntu/cosmic64"
salt.vm.hostname = "salt"
salt.vm.network "private_network", ip: "192.168.6.10"
salt.vm.synced_folder "saltstack/", "/srv"
salt.vm.provision :shell, path: "provision-scripts/bootstrap-salt.sh... |
require File.expand_path(File.dirname(__FILE__) + "/../../../../spec_helper")
describe ModelGenerator do
it "model template path" do
ModelGenerator.new("category", build_attributes).template_path.should == "src/templates/models"
end
context "jpa" do
before(:each) do
mock_config_file
@genera... |
class ArticleErrorsSection < Howitzer::Web::Section
me 'div#error_explanation'
element :title, 'h2'
element :details, 'ul'
def error_message
[title_element.text, details_element.text].compact.join(' ')
end
end
|
class Recipe < ApplicationRecord
has_many :ingredientrecipes
has_many :ingedients, through: :ingredientrecipes
end
|
#
# Класс Route (Маршрут).
#
class Route
attr_reader :stations
def initialize(start_station,end_station)
@stations = [start_station,end_station]
validate!
end
def add_station(station)
@stations.insert(-2,station)
end
def remove_station(station)
return unless @stations.include?(station)
... |
require 'rails_helper'
RSpec.describe "screenings/show", type: :view do
before(:each) do
@screening = assign(:screening, Screening.create!(
:movie => nil,
:user => nil,
:theatre => nil,
:offer => nil,
:approval_filmmaker => false,
:approval_theatre => false,
:threshold =... |
module CamaleonCms
class CamaleonController < ApplicationController
add_flash_types :warning
add_flash_types :error
add_flash_types :notice
add_flash_types :info
include CamaleonCms::CamaleonHelper
include CamaleonCms::SessionHelper
include CamaleonCms::SiteHelper
include CamaleonCms:... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "wmit/trusty64"
config.vm.hostname = "trusty"
config.vm.network :forwarded_port, guest: 9200, host: 9200, auto_correct: true # Elasticsearc
config.vm.network :forwarded... |
require File.join(File.dirname(__FILE__), 'spec_helper')
describe Braintree::PaymentType, "initialize" do
before(:each) do
@pt = Braintree::PaymentType.new(:firstname => 'koopa', :lastname => 'troopa')
end
it "should set accessors from attribute hash" do
@pt.firstname.should == 'koopa'
@pt.lastname.... |
# Hackety Hack compatible turtle class
class Turtle
attr_reader :commands
def initialize
@commands = []
@interface_helper = InterfaceHelper.new
@interface = @interface_helper.get_interface("/turtle")
init_turtle
end
def get_reply(message)
@interface_helper.get_reply(message)
end
cla... |
if platform_family?('mac_os_x')
package 'openssl'
package 'ruby-install'
else
install_path = "#{Chef::Config[:file_cache_path]}/ruby-install.tar.gz"
version = '0.6.1'
remote_file install_path do
source "https://github.com/postmodern/ruby-install/archive/v#{version}.tar.gz"
action :create_if_missing
... |
# frozen_string_literal: true
class Profile::DashboardController < ApplicationController
before_action :authenticate_user!
before_action :set_profile
def index
# byebug
@profile_deals = @profile.deals
end
def new
@profile = current_user.build_profile
end
def show; end
def status
pac... |
require 'spec_helper'
describe TradeLead::FbopenImporter::FullData do
let(:resource) { "#{Rails.root}/spec/fixtures/trade_leads/fbopen/full_source_input.xml" }
let(:importer) { described_class.new(resource) }
let(:expected) { YAML.load_file("#{File.dirname(__FILE__)}/fbopen/full_source_results.yaml")... |
class HelpTopic
def initialize(topic)
@topic = topic
end
def self.from_param!(param)
result = new(param.blank? ? "index" : [param].flatten.join('/'))
result.load
result
end
def title
@title ||= (load.first || "")
end
def text
@text ||= (load[1..-1] || []).join("\n")
end
... |
class NchanNginxModule < Formula
desc "Fast, flexible pub/sub server"
homepage "https://nchan.io"
url "https://github.com/slact/nchan/archive/v1.2.7.tar.gz"
sha256 "8bb5d1749af759bb5e9cc5476a9c4b44d51bee6096bb89ab5ff53e85367b490b"
head "https://github.com/slact/nchan.git"
bottle :unneeded
def install
... |
require File.expand_path '../spec_helper.rb', __FILE__
describe WhedonApi do
let(:whedon_commands_from_editor) { json_fixture('whedon-commands-editor-on-pre-review-issue-936.json') }
let(:whedon_commands_from_non_editor) { json_fixture('whedon-commands-non-editor-on-pre-review-issue-936.json') }
let(:whedon_assi... |
class GroupMailer < ActionMailer::Base
default from: Rails.configuration.email
def send_invite(group)
if group.email.blank? then raise Exception end
@group = group
Rails.logger.debug "Mail #{@group.email}"
mail(
to: @group.email,
subject: "Invitation to John and Hin... |
=begin
#Scubawhere API Documentation
#This is the documentation for scubawhere's RMS API. This API is only to be used by authorized parties with valid auth tokens. [Learn about scubawhere](http://www.scubawhere.com) to become an authorized consumer of our API
OpenAPI spec version: 1.0.0
Contact: bryan@scubawhere.co... |
class AddDeliveryTimeToBirthdayParty < ActiveRecord::Migration
def change
add_column :birthday_parties, :delivery_time, :datetime
end
end
|
class Premailer
# Premailer version.
VERSION = '1.8.3'.freeze
end
|
class CommentsController < ApplicationController #all ok
before_action :set_board
load_and_authorize_resource
def create
@comment = Comment.new(comment_params)
if @comment.save
@comments = @board.comments.all
respond_to do |format|
format.js
end
else
redirect_to :back
... |
require 'spec_helper'
describe Contestant do
before :each do
@contestant = build(:contestant)
@photo = build(:photo)
end
context "when validating" do
it "must have an email address" do
@contestant.unset :email
expect(@contestant).to_not be_valid
expect(@contestant).to have_er... |
class ChangeMessageColumnTypeToMediumTextOnReportLogs < ActiveRecord::Migration
def self.up
change_column :report_logs, :message, :text, :limit => 65536
end
def self.down
change_column :report_logs, :message, :text
end
end
|
require 'rubygems'
require 'bundler/setup'
require 'parslet'
require 'octokit'
tables = %w{issues pull_requests prs users}
issue_fields = [:id, :number, :title, :user, :labels,
:state, :assignee, :milestone, :comments,
:created_at, :updated_at, :closed_at, :pull_request, :body ]
class... |
class RemoveFkUserFromPost < ActiveRecord::Migration[5.2]
def change
remove_column :posts, :fk_user, :integer
end
end
|
# frozen_string_literal: true
# GraphQL Client and DSL library
module GQLi
# Gem version
VERSION = '1.2.0'
end
|
class FontIbmPlexSansKr < Formula
head "https://github.com/google/fonts.git", verified: "github.com/google/fonts", branch: "main", only_path: "ofl/ibmplexsanskr"
desc "IBM Plex Sans KR"
homepage "https://fonts.google.com/specimen/IBM+Plex+Sans+KR"
def install
(share/"fonts").install "IBMPlexSansKR-Bold.ttf"... |
class NotesController < ApplicationController
respond_to :json, :html
before_action :find_notable, only: [:index]
def index
@notes = @notable.notes
@notable_id = params[:note][:notable_id]
@notable_type = params[:note][:notable_type]
@notable_sym = @notable_type.downcase.to_sym
end
def new... |
module Ojo
class Sorter
attr_accessor :results
attr_reader :magnitude_max
def initialize(results, magnitude_max)
@results = results
@magnitude_max = magnitude_max
end
def sort
sub_set = @results[:results]
sub_set.sort! do |a, b|
a_val = a[:not_same_pixel_count] ? ... |
require 'ostruct'
# super nasty text manipulation junk
module Zebra
class GitParser
def checkword_report
build_checkword_report
end
def self.get_diff
# cached refers to only staged diffs
`git diff -U0 --cached`
end
private
class LineRecord < Struct.new(:filename, :line, ... |
class AddDetailsToTaskCompleted < ActiveRecord::Migration[5.1]
def change
add_column :task_completeds, :listing_id, :bigint
add_column :task_completeds, :upvote, :bigint
add_column :task_completeds, :downvote, :bigint
end
end
|
class FoodItem < ActiveRecord::Base
acts_as_content_block({:versioned => false})
attr_accessor :skip_callbacks
belongs_to :cheff
has_many :ordered_menus
attr_accessible :meal_info_attributes, :recipe_attributes, :review_attributes, :cooking_todays
has_one :meal_info, :dependent => :destroy
has_one :rec... |
require 'nokogiri'
class TextFromHTML
attr_accessor :html
def initialize(nokogiri_html_document)
@html = nokogiri_html_document
end
def create
html = remove_script_tags(@html)
html = remove_style_tags(html)
text = html.text
text = change_non_words_to_spaces(text)
text = remove_ext... |
class Coordinates
attr_reader :x, :y
def initialize(x, y)
@x = x
@y = y
end
def ==(other)
return false unless other.respond_to?(:x, :y)
other.x == x && other.y == y
end
end
|
class PostsController < ApplicationController
before_action :draw_post, except: [ :index, :new, :create ]
def index
@posts = !!params[:search] ? Post.search_includes(params[:search]) : Post.all_includes
@posts = Post.filter_with(@posts, params[:filter]) if !!params[:filter]
@posts = Post.sort_num_des... |
module WebiniusCms
class Image < ApplicationRecord
belongs_to :imageable, class_name: 'WebiniusCms::Page', foreign_key: :webinius_cms_page_id, polymorphic: true
mount_uploader :image, ImageUploader
end
end
|
class TimelineChangeNameReceiver < ActiveRecord::Migration
def up
rename_column :user_timelines, :receiver, :receiverable_type
rename_column :user_timelines, :receiver_id, :receiverable_id
end
def down
rename_column :user_timelines, :receiverable_type, :receiver
rename_column :user_timelines, :re... |
Dado("que clico buscar elemento") do
#Esse comando esta instanciando a class
@inputsPage = InputsPage.new
@inputsPage.load
#Esse comando ele esta clicando no elemento
@inputsPage.elementos.click
end
Quando("eu clicar em inputs e TextField") do
#Esse comando esta clicando na opção inputs ... |
class User < ApplicationRecord
validates :name, presence: true
validates :email, uniqueness: { case_sensitive: false }, presence: true
has_secure_password
has_many :ideas
enum role: ["default", "admin"]
end
|
# frozen_string_literal: true
module Roster
class ArchiveFilesController < ::RosterController
def create
status = Roster::ArchiveFile.archive!
if status == :current
flash[:notice] = 'Latest archive is current.'
elsif status
flash[:success] = 'Successfully archived current roster... |
require 'active_support/core_ext/object/try'
require 'active_support/inflector'
require_relative './db_connection.rb'
class AssocParams
def other_class
other_class_name.constantize
end
def other_table_name
other_class.table_name
end
end
class BelongsToAssocParams < AssocParams
attr_reader :para... |
require 'spec_helper'
describe "parts/edit" do
before(:each) do
@part = assign(:part, stub_model(Part,
:project_id => 1,
:name => "MyString",
:purchase_url => "MyString",
:average_cost => "9.99"
))
end
it "renders the edit part form" do
render
# Run the generator again w... |
class AlbumPlayerSection < SitePrism::Section
element :player, 'iframe'
def has_album?(album_id)
has_embed_link?("https://embed.spotify.com/?uri=spotify:album:#{album_id}&theme=white")
end
def has_embed_link?(url)
player[:src].start_with?(url)
end
end
|
# frozen_string_literal: true
class MemberApplicationsController < ApplicationController
include BraintreeHelper
secure!(:excom, only: %i[review approve])
title!('Become a Member!')
before_action :load_payment, only: :applied
before_action :process_application, only: :apply
def new
@member_applicat... |
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "gitbc/version"
Gem::Specification.new do |spec|
spec.name = 'gitbc'
spec.version = Gitbc::VERSION
spec.authors = ['Orest Kulik']
spec.email = 'orest@nisdom.co... |
module Monexa
module Util
def self.hash_to_xml(h, l=0)
return h.to_s unless h.is_a? Hash
xml = ''
h.each do |k,v|
xml << if v.kind_of? Enumerable
k = k.to_s.split('_').collect {|w| w.capitalize}.join('_')
(v.is_a?(Array) ? v : Array[v]).collect { |group| "#{"\t"*l}<#... |
class Api::V1::InstructorsController < ApplicationController
def index
@instructors = Instructor.all
render json: @instructors
end
def show
@instructor = Instructor.find(params[:id])
render json: @instructor
end
def create
byebug
@instructor = Instructor.new(instructor_params)
i... |
#!/usr/bin/env ruby
#Laura Barber
#Ruby Program Assignment 1
#CSCI 320 McCauley
#11/4/13
#Test functions:
double = lambda{|x| x*2}
add1 = lambda{|x| x + 1}
add2 = lambda{|x| x + 2}
mult3 = lambda {|x| 3 * x}
square = lambda{|x| x + 2}
half = lambda{|x| x / 2}
#Composition: returns a proc that, when ... |
require 'open-uri'
require 'JSON'
require 'byebug'
class Buda
attr_accessor :base
def initialize
@base = 'https://www.buda.com/api/v2/markets'
end
def markets_max_amount
data = {}
begin
markets.map { |i| data[i[:id]] = max_amount(i[:id]) }
puts '-' * 45 + "\n| Mercado Monto ... |
class StatisticsSerializer
include FastJsonapi::ObjectSerializer
attributes :statistics, :thermostat
attribute :thermostat do |object|
{
id: object.thermostat.id,
household_token: object.thermostat.household_token,
address: object.thermostat.address
}
end
end
|
# -*- encoding : utf-8 -*-
module ::IdentifiesAs::ObjectInstance
include ::IdentifiesAs::ActuallyIsA
####################
# identifies_as! #
####################
# Cause receiver to identify as specified objects.
# @param [Array<Object>] objects Other objects self should identify as.
# @return [Ob... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commen... |
require 'spec_helper'
describe 'after_commit_helper' do
before(:each) do
$called = nil
end
after(:each) do
$called = nil
end
it 'should leave called false' do
test = Test.new value: 1
expect($called).to eq nil
test.save!
expect($called).to eq nil
end
it 'should set called to... |
class Restaurant < ApplicationRecord
has_many :dishes, dependent: :destroy
validates_presence_of :name
end
|
class PropertiesController < ApplicationController
def new
@property = Property.new
end
def create
@property = current_user.properties.build(property_params)
if @property.save
redirect_to @property, notice: 'Property was successfully created.'
else
redirect_to "/"
end
end
de... |
require "application_system_test_case"
class AccessoriesTest < ApplicationSystemTestCase
setup do
@accessory = accessories(:one)
end
test "visiting the index" do
visit accessories_url
assert_selector "h1", text: "Accessories"
end
test "creating a Accessory" do
visit accessories_url
clic... |
# == Schema Information
#
# Table name: posts
#
# id :integer not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
# user_id :integer
# conversation_id :integer
# text :string
#
class Post < ActiveRecord::Base
be... |
require "spec_helper"
describe Gitlab::Git::Diff do
let(:repository) { Gitlab::Git::Repository.new(TEST_REPO_PATH) }
before do
@raw_diff_hash = {
diff: 'Hello world',
new_path: 'temp.rb',
old_path: 'test.rb',
a_mode: '100644',
b_mode: '100644',
new_file: false,
rename... |
class CreateShips < ActiveRecord::Migration[5.2]
def change
create_table :ships do |t|
t.string :starship_name, null:false
t.string :starship_class, null:false
t.string :starship_location, null:false
end
end
end
|
class ShortenedUrl < ApplicationRecord
validates :short_url, :long_url, :user_id, presence: true
validates :short_url, uniqueness: true
validate :nonpremium_max, :no_spamming
has_many :taggings,
primary_key: :id,
foreign_key: :short_url_id,
class_name: :Tagging,
dependen... |
class Task < ActiveRecord::Base
belongs_to :task_lists
def completed?
!completed_at.blank?
end
end
|
#FizzBuzz
=begin
Write a program that prints integers 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz"
Here's an example of what your output should look like:
<img src="http://www... |
class SocialNetwork < ActiveRecord::Base
has_many :sn_memberships
has_many :faculties, :through => :sn_memberships
end
|
class User < ApplicationRecord
before_save :downcase_email, unless: :uid?
validates :name, presence: true, length: { maximum: 50 }, unless: :uid?
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z\d\-]+)*\.[a-z]+\z/i
validates :email, presence: true, length: { maximum: 255 },
format: { with: VALID_E... |
class RecipesController < ApplicationController
def create
@recipe = Recipe.create
redirect_to recipe_path(@recipe)
end
def new
@recipe = Recipe.new
end
def destroy
@recipe = @recipe.find(params[:id])
end
def index
@recipes = Recipe.order("name")
end
def edit
@recipe = @recipe.find(params[:id])... |
class Location < ActiveRecord::Base
attr_accessible :address, :latitude, :longitude, :image_url
has_many :trail_locations
has_many :trails, :through => :trail_locations
geocoded_by :address
after_validation :geocode, :if => :address_changed?
def self.to_dropdown
Location.all.map {|l| [l.address, l... |
class User < ApplicationRecord
has_many :reviews, dependent: :destroy
# used week6 user.rb code for password validation
validates :username, presence: true
validates :email, presence: true
# 1. Expects a column named password_digest
# 2. Provides an attr_accessor :password
# 3. Provides a ... |
class DtMailer < ActionMailer::Base
default from: "D&T Music <awesome.academy.test@gmail.com>"
def new_user user
@user = user
mail to: @user.email, subject: t(".welcome_to")
end
end
|
class OrdersController < ApplicationController
def new
if current_user
@orders = Order.new
else
flash[:notice] = "Please Login or Create an Account to Checkout"
redirect_to login_path
end
end
def create
user_order = UserOrder.new(session, params)
@order = user_order.create_o... |
class ApplicationController < ActionController::Base
protect_from_forgery with: :null_session
include ActionController::HttpAuthentication::Token::ControllerMethods
before_action :authenticate, if: -> { request.format.json? }
before_action :set_locale
def set_locale
I18n.locale = params[:locale] || I18n... |
class ItemsController < ApplicationController
before_action :find_item, only:[:show, :edit, :update, :destroy,]
before_action :authorized?, only:[:new, :edit, :destroy, :update]
def index
@items = Item.all
end
def new
@item = Item.new
end
def create
@item=Item.new(item_params)
@item.u... |
# frozen_string_literal: true
require 'application_system_test_case'
module Teachers
class IndexText < ApplicationSystemTestCase
test 'guest user can see teachers' do
visit teachers_path
assert_content 'Teachers'
assert_content 'Severus Snape'
assert_content 'Rolanda Hooch'
assert... |
class Sudoku
@mreza = []
#inicalizuj mrezu
def initialize(mreza_string = "", nivo)
if mreza_string != ""
@mreza = mreza_string.split("").map { |str| str.to_i }
raise Exception if !validno?
else
until validno?
generisi
end
until (ocigledni.length ... |
module SessionsHelper
def sign_in(user)
cookies.permanent[:remember_token] = user.remember_token
cookies.permanent[:allow_staging_access] = 'true'
self.current_user = user
end
def current_user=(user)
@current_user = user
end
def current_user
@current_user ||= User.find_by_remember_token... |
class Daylite::Role < Daylite::Base
belongs_to :organization, :foreign_key => 'organizationid'
belongs_to :contact, :foreign_key => 'contactid'
belongs_to :project, :foreign_key => 'projectid'
belongs_to :roletype, :foreign_key => 'roletypeid'
def type
roletype.name
end
end
|
class PasswordResetsController < ApplicationController
before_action :get_producer, only: [:edit, :update]
before_action :valid_producer, only: [:edit, :update]
before_action :check_expiration, only: [:edit, :update]
def new
end
def create
@producer = Producer.find_by(email: params[:password_reset][:e... |
class Organization < ActiveRecord::Base
CATEGORIES = [:elementary_school, :high_school]
has_many :users
has_many :workgroups
# TODO add format validation regexs
validates :name, allow_blank: false, presence: true, uniqueness: { case_sensitive: false }
validates :address, presence: true, allow_blank: true
... |
# require 'rails_helper'
# Devise::Test::ControllerHelpers
# RSpec.describe Admin::AdminUsersController, type: :controller do
# render_views
# let(:admin_user_2) { FactoryBot.create :admin_user_2}
# before(:each) do
# DatabaseCleaner.clean
# sign_in admin_user_2
# end
# describe 'edit' do
# ... |
class UserPalettesController < ApplicationController
before_action :set_event, only: [:show, :update, :destroy]
def index
render({json: UserPalette.all})
end
def show
render json: @userPalette
end
def create
@userPalette = UserPalette.new(userPalette_params)
... |
#==============================================================================#
# ** IEX(Icy Engine Xelion) - DnD Damage Formulae
#------------------------------------------------------------------------------#
# ** Created by : IceDragon
# ** Script-Status : Addon (Item and Skill, Enemy)
# ** Script Type : Dama... |
#--
# Copyright (c) 2009-2010, John Mettraux, jmettraux@gmail.com
#
# 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 rights
# to use, copy... |
class AddcustomUrlToGroups < ActiveRecord::Migration
def change
add_column :groups, :url, :string, null: false
add_index(:groups, :url, unique: true)
end
end
|
require 'spec_helper'
describe GameWatch do
before do
mock_geocoding!
@game_watch = FactoryGirl.build(:game_watch)
end
subject { @game_watch }
it { should respond_to(:name) }
it { should respond_to(:creator) }
it { should respond_to(:venue) }
it { should respond_to(:event) }
end
|
require 'rubygems'
require 'neography'
@social_graph = Neography::Rest.new
def create_user(properties)
Neography::Node.create(properties, @social_graph)
end
def suggestions_for(node)
node.both(:contacts).
order("breadth first").
uniqueness("node global").
filter("position.length() == 2;").
... |
#!/usr/bin/env ruby
start_code=ARGV[0]
input=ARGV[1]
end_code=ARGV[2]
output=ARGV[3]
def code_to_mins(code)
code_parts = code.split(":")
return (code_parts[0].to_i * 60) + code_parts[1].to_i + (code_parts[2].to_f / 60)
end
def mins_to_code(mins)
return "#{(mins/60).floor.to_s.rjust(2,"0")}:#{(mins%60).floor.to_s.... |
module ExpenseRepresenter
include Roar::JSON
include Roar::Hypermedia
property :description
property :amount
link :self do
api_expense_url self
end
end
|
class TaxSlabsController < ApplicationController
filter_access_to :all
require 'lib/override_errors'
helper OverrideErrors
before_filter :load_tax_setting
check_request_fingerprint :create, :update
def index
@tax_slabs = TaxSlab.all(:include => [:tax_assignments, :collectible_tax_slabs])
... |
require 'rails_helper'
describe Review do
it { should belong_to :user }
it { should belong_to :cape }
it { should have_valid(:rating).when(8) }
it { should_not have_valid(:rating).when(nil, 0, 12) }
it { should have_valid(:body).when("a body longer than ten characters") }
it { should_not have_valid(:body... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.