text
stringlengths
10
2.61M
# -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure(2) do |config| config.vm.box = "ubuntu/xenial64" config.vm.define "roletestingvm" do |roletestingvm| end config.vm.provider "virtualbox" do |v| v.memory = 1024 v.cpus = 2 end # Ensure python is installed on Ubuntu 16.04, so we can use A...
require 'flow_test_helper' class ShareEmailTest < FlowTestCase test 'share an image via email on index' do image_to_share = 'https://www.concrete5.org/files/2514/1650/8557/share_me_screenshot_0_1416508557.jpg' Image.create!(image_link: image_to_share, tag_list: 'share me') images_index_page = PageObjects...
class CreatePlayerCards < ActiveRecord::Migration[5.1] def change create_table :player_cards, id: :uuid do |t| t.string :first_name t.string :last_name t.string :position, index: true t.uuid :team_chemistry_id, index: true t.uuid :program_id, index: true t.integer :salary_cap_v...
class BookHistory < ApplicationRecord belongs_to :book belongs_to :student def self.checkIfAlreadyIssued?(bookid,studentid) isIssued = BookHistory.where(:returnDate=>nil,:book_id=>bookid,:student_id=>studentid) if isIssued.count > 0 return true else return false e...
class Memoo < ApplicationRecord validates :text, presence: true end
atom_feed do |feed| feed.details "Who ordered?" feed.title "#{@room.title}" feed.roomtype "#{@room.roomtype}" feed.updated @latest_order.try(:updated_at) @room.orders.each do |order| feed.entry(order) do |entry| entry.title "Order #{order.id}" entry.summary type: 'xhtml' do |xhtml| x...
require 'formula' class Tophat < Formula homepage 'http://tophat.cbcb.umd.edu/' url 'http://tophat.cbcb.umd.edu/downloads/tophat-2.0.6.tar.gz' sha1 'd1c19cdccb5ddf74b8cb604a0ed1e5d33a25aae9' depends_on 'samtools' depends_on 'boost' # Variable length arrays using non-POD element types. Initialize with len...
# frozen_string_literal: true FactoryBot.define do factory :education_benefits_claim do after(:build) do |education_benefits_claim| education_benefits_claim.saved_claim ||= build(:va1990) end end %w[1990e 1990n].each do |form_type| factory :"education_benefits_claim_#{form_type}", class: 'Educ...
require 'spec_helper' describe 'Parsing' do before(:each) do @psd = PSD.new('spec/files/example.psd') end it "should parse without error" do @psd.parse! @psd.parsed?.should be_true end describe 'Header' do before(:each) do @psd.parse! end it "should contain data" do @ps...
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Api::Users::Quizzes', type: :request do include_context 'login as current_user' let(:current_user) { create(:user) } describe 'GET /api/users/quizzes' do let!(:quizzes) { create_list(:quiz, 2, :with_questions, user: current_user) } it ...
require 'informal' class Filter include Informal::ModelNoInit def initialize(params) @params = params || {} end def self.model_name @model_name ||=ActiveModel::Name.new(Filter) end end
FactoryGirl.define do factory :order do total_price nil state "in_progress" customer delivery_service end end
require 'spec_helper' describe DashboardController do describe "GET 'index'" do it "should redirect to the login page when the user is not signed-in" do get 'index' response.should redirect_to('/users/sign_in') end it "should render the intdex page when the user is signed-in" do sign_...
Rails.application.routes.draw do get 'sessions/new' get 'users/edit' get 'users/index' get 'users/show' get 'recipes/edit' get 'recipes/new' get 'recipes/show' get '/signup', to: 'users#new' post '/signup', to: 'users#create' get '/login', to: 'sessions#new' post '/login', to: 'session...
# encoding: UTF-8 # Copyright 2013 Max Trense # # 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 t...
class Admin::CoursesController < ApplicationController layout "admin_application" before_action :authenticate_user! before_action :verify_admin load_and_authorize_resource before_action :load_subjects, only: [:new, :edit] def index end def show @creater = User.find_by id: @course.user_id @user...
class Listing < ApplicationRecord belongs_to :user has_many :bookings validates :category, presence: true validates :price, presence: true mount_uploader :photo, PhotoUploader end
class ProductsController < ApplicationController def create @product = Product.new(params[:product]) @product.seller_id = current_user.id if @product.save redirect_to user_url(current_user) else @categories = Category.all @selected = params[:product][:category_ids].map{ |i| i.to_i } flash[:errors...
# encoding: utf-8 require 'spec_helper' describe Word do # Create model instances before do @pl = Language.new(name: "Polski") @eng = Language.new(name: "Angielski") @esp = Language.new(name: "Hiszpański") words_pl = %w(pies dom) words_en = %w(dog hound house) words_es = %w(perro...
require 'gooddata' describe "Full project implementation", :constraint => 'slow' do before(:all) do @spec = JSON.parse(File.read('./spec/data/test_project_model_spec.json'), :symbolize_names => true) @invalid_spec = JSON.parse(File.read('./spec/data/blueprint_invalid.json'), :symbolize_names => true) Con...
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 def confirm_logged_in unless session[:user_id] redirect_to login_path, flash: {alert: "You Must Be Logged...
# require modules here require 'yaml' require 'pry' def load_library(file_path) # code goes here emoticon_library_yaml = YAML.load_file(file_path) organized_emoticon_library = { "get_emoticon" => {}, "get_meaning" => {} } emoticon_library_yaml.each do |emotion, emoticons| organized_emoticon_li...
class AddEngineeringcostandcustodychargetoproject < ActiveRecord::Migration[5.1] def change add_column :projects, :engineering_costs, :integer, default: 0 add_column :projects, :custody_charge, :integer, default: 0 end end
# frozen_string_literal: true module Sidekiq module Instrumental module Middleware # Server side sidekiq middleware class Server < Base protected def track(stats, worker_instance, msg, queue, elapsed) submit_general_stats(stats) return unless config.allowed_to_su...
class CreateCardUserRelationships < ActiveRecord::Migration[5.2] def change create_table :card_user_relationships do |t| t.references :card, foreign_key: true t.references :user, foreign_key: true t.references :deck, foreign_key: true t.float :easiness t.text :front t.text :bac...
class List < ActiveRecord::Base belongs_to :user belongs_to :category, counter_cache: true has_many :comments, as: 'commentable' validates :title, :body, presence: true after_creaet :update_hot, :owner_subscribe after_touch :update_hot def calculate_hot order = Math.log10([comments_count, 1].max) order +...
require 'spec_helper' describe UsersController, type: :controller do let(:valid_attributes) { { name: Faker::Name.name, email: Faker::Internet.email, password: "twitter" ,password_confirmation: "twitter" } } let(:invalid_attributes) { { name: "" } } describe "POST create" do describe "with valid params" ...
class Like < ApplicationRecord belongs_to :user belongs_to :likeable, polymorphic: true def total_likes self.likes.size end end
module CreditSharedContexts shared_context "with unaccounted credit" do let!(:credit) { FactoryGirl.create(:credit, :amount => BigDecimal.new("100")) } def add_entry(debit = nil, amount = BigDecimal.new("0")) if debit.nil? entry = FactoryGirl.create(:entry, :credit => credit, :amount => amount)...
require 'spec_helper' describe BetfairApiNgRails::Api::Connection do subject(:connection) { described_class.new } describe "#request" do let(:provider) { double(:provider) } let(:parser) { double(:parser, process: true) } let(:response) { double(:response, result: "") } let(:logger) { ...
## Writing complete files in one files, Files separated by the respective file names ## Please keep an eye on the comments with mulitple pound(comments) symbols ################# ################# Chess.rb ################# ################# require "chess/board" require "chess/piece" require "chess/pawn" require "ch...
module Tight module Engine module Locale private def detect_selected_locale selected_locale = params[:locale].to_s[0..1] if swift.locales.include?(selected_locale) selected_locale.to_sym else detect_session_locale end end def detect_ses...
# frozen_string_literal: true arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] new_array = arr.select do |n| n + 1 end p new_array # lin6: will output an array [1..10] and return an array [1..10] # line1: we initialize the local variable arr and assign to it an Array object with integers 1 through 10 as elements. # line3: w...
module Refinery class ProjectCategory < ActiveRecord::Base has_many :projects, :class_name => '::Refinery::Project', :order => 'position ASC', :inverse_of => :project_category #attr_accessible :title, :position, :projects end end
# ------------------------------------------------------------------------------ # Display an album's photos # ------------------------------------------------------------------------------ get "/album/:id" do @album = Album.find(params["id"]) erb :"albums/album_photos" end # --------------------------------------...
class NpcShiftsController < ApplicationController before_action :authenticate_user! after_action :verify_authorized, :except => :index after_action :verify_policy_scoped, :only => :index def index @npc_shifts = policy_scope(NpcShift) @recently_closed_npc_shifts = @npc_shifts.recently_closed ...
class AddRolesToUsers < ActiveRecord::Migration[5.1] def change add_column :users, :creator_role, :boolean, default: false add_column :users, :solver_role, :boolean, default: true end end
Rails.application.routes.draw do scope path: '/organization_commission_others', controller: :organization_commission_others, as: 'organization_commission_others' do get 'need_approve' => :need_approve #审批 get 'need_finance_check' => :need_finance_check #财务复核 match "set_user/:id" => :set_user, via: [:get,:...
require "propay/command/base" module ProPay module Command class GetAllPayerPaymentMethods < Base def initialize(params = {}) super @request = Nokogiri::XML::Builder.new do |xml| xml["soapenv"].Envelope("xmlns:soapenv" => "http://schemas.xmlsoap.org/soap/envelope/", "xmlns:con" =...
class Superhero @@superheroes = [] attr_accessor :name, :power, :biography def initialize(args) args.each do |key, value| self.send("#{key}=", value) end @@superheroes << self end def self.all @@superheroes end end
RSpec.describe Web::Controllers::Goals::Index, type: :action do let(:action) { described_class.new } let(:params) { Hash[] } let(:repository) { GoalRepository.new } before do repository.clear @goal = repository.create(title: 'Learn Hanami') end it 'is successful' do response = action....
class DocumentUploader < CarrierWave::Uploader::Base if ENV['AWS'] storage :aws def cache_dir "#{Rails.root}/tmp/uploads" end else storage :file end def store_dir "#{model.class.name.pluralize.downcase}/#{model.id}/#{mounted_as}" end def extension_white_list %w(pdf) end en...
#!/usr/bin/env ruby # -*- coding: utf-8 -*- # Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyrigh...
#!/usr/bin/env ruby # encoding: utf-8 describe "Filter Macros" do before do delete_project create_project Glyph.run! 'load:macros' end after do delete_project end it "should filter textile input" do text = "textile[This is a _TEST_(TM).]" interpret text expect(@p.document.output).to eq("<p>This i...
json.array!(@problem_in_contests) do |problem_in_contest| json.extract! problem_in_contest, :id, :problem_id, :contest_id json.url problem_in_contest_url(problem_in_contest, format: :json) end
class SessionsController < ApplicationController # before_action :redirect_if_logged_in def login @user = User.new end def create @user = User.find_by(email: params[:email]) if @user.nil? redirect_to '/signup' else session[:user_id] = @user.i...
require 'time' require 'json' module Mailgun # A Mailgun::MessageBuilder object is used to create a valid payload # for the Mailgun API messages endpoint. If you prefer step by step message # generation through your code, this class is for you. # # See the Github documentation for full examples. class Mes...
# -*- coding: utf-8 -*- require 'spec_helper' require 'board.rb' require 'pp' describe Board do context 'PLAYER' do it 'should PLAYER +1, -1' do expect(Board::PLAYERS[-1]).to eq('X') expect(Board::PLAYERS[1]).to eq('O') expect(Board::PLAYERS[0]).to eq(' ') end end context '#new' do ...
# # Simple drawing program to show Madeleine's logging feature. # # When you restart the program, your old artwork is still there. # # (Note: The GUI components used here aren't marshal-able, # so in a real app you would have to do custom marshaling for # the Painter class to get working snapshots. Then again, in a rea...
require 'cxbrank/const' require 'cxbrank/site_settings' require 'cxbrank/playdata/music_skill' module CxbRank module PlayData class Chart < Hash attr_accessor :last_modified def self.load(user) skill_chart = self.new skills = MusicSkill.find_by_user(user, :fill_empty => true).to_a ...
require 'rails_helper' feature 'creating and editing departments' do let(:department_name) { 'Main' } let(:department_phone_number) { '+14155551212' } let(:user_full_name) { 'Jenny Smith' } let(:user_email) { 'jenny@example.com' } let(:user_password) { 'password' } let(:admin_user) { create :user, admin: t...
require 'rails_helper' # this used to be OrderItem RSpec.describe JobApplication, type: :model do before do @user = User.create!(username: "mitch", password: "password", role: 0) company = Company.create!(name: "acme", information: "asdf") @job = company.jobs.create!(title: "junior_developer", descript...
class Chef class Knife module Core # Instances of BootstrapContext are the context objects (i.e., +self+) for # bootstrap templates. For backwards compatability, they +must+ set the # following instance variables: # * @config - a hash of knife's config values # * @run_list -...
require 'game' describe Game do let(:game) { Game.new } let(:player1) { double :player1, :grid => grid1, :deploy_ships => nil, :display_grid => nil } let(:player2) { double :player2 } let(:grid1) { double :grid1, :count_sunken_ships => 5 ...
require "spec_helper" require 'yaml' feature "Register user and configure cluster" do before(:each) do unless self.inspect.include? "User registers" login end end # Using append after in place of after, as recommended by # https://github.com/mattheworiordan/capybara-screenshot#common-problems ...
class AddIndexOnKits < ActiveRecord::Migration[6.0] def change add_index :kits, [:name, :organization_id], unique: true change_column_null :kits, :organization_id, false change_column_null :kits, :name, false end end
module Auth class Configuration # When included by a configuration object, the Keys module will override #attr_reader, #attr_writer and # #attr_accessor to add configuration keys for each. A #to_hash instance method is generated which will # this object into a Hash containing only the registered keys. ...
require 'test_helper' class UserTest < ActiveSupport::TestCase def setup @user = User.new(email: "mysize@example.com", mysize_id: "mysize2", password: "foobar", password_confirmation: "foobar") end test "should be valid" do assert @user.valid? e...
class PointsController < ApplicationController before_filter :find_list def total_weight @point = @list.points.all sum(@point.weight) end def create @point = @list.points.new(params[:point]) respond_to do |format| if @point.save format.html { redirect_to list_url(@list) } ...
require 'formula' class Cvc3 < Formula homepage 'http://www.cs.nyu.edu/acsys/cvc3/' url 'http://www.cs.nyu.edu/acsys/cvc3/releases/2.4.1/cvc3-2.4.1.tar.gz' sha256 'd55b1d6006cfbac3f6d4c086964558902c3ed0efa66ac499cfb2193f3ee4acf7' option 'with-zchaff', 'Build with zChaff' option 'with-gmp', 'Build with GMP' ...
module RedmineRca module ApplicationHelperPatch def self.included(base) # :nodoc: base.send(:include, InstanceMethods) base.class_eval do unloadable # Send unloadable so it will not be unloaded in development alias_method_chain :thumbnail_tag, :rca_patch end end module...
def heapsort(arr) # Heapify the input array heapify = lambda do |arr| first = (arr.length - 2) / 2 while first >= 0 do arr = sift_down(arr, first, arr.length - 1) first -= 1 end arr end arr = heapify.call arr last = arr.length - 1 # Sifts down the array elements, 'fixing it'...
# frozen_string_literal: true RSpec.describe 'User Referral Request', type: :request do include_context 'with branch location' include_context 'with user token' include_context 'with json response' include_context 'with event' include_context 'with more events' subject(:remove_referral!) { post "/api/user...
#!/usr/bin/env ruby # encoding: UTF-8 =begin Περιγραφή: Εκπομπή της Κ. Ακριβοπούλου «Μία και να καίει», καθημερινές στις 13:00 στο ΣΚΑΪ. Λειτουργία: Το script κατεβάζει την σημερινή ή χθεσινή εκπομπή «Μία και να καίει» από την ιστοσελίδα του ΣΚΑΪ σε μορφή mp3. email: atma[at]convalesco.org =end require "net/http" req...
Shindo.tests('TerremarkEcloud::Compute | vm requests', ['terremark_ecloud']) do @instantiate_vm_template_format = { 'name' => String, 'uri' => String, 'status' => String } @get_vm_deploying_format = { 'name' => String, 'uri' => String, 'status' => String, 'storage_size' => Integer, ...
require 'spec_helper' describe "hellows/index" do before(:each) do assign(:hellows, [ stub_model(Hellow, :name => "Name", :memo => "MyText", :category => "" ), stub_model(Hellow, :name => "Name", :memo => "MyText", :category => "" ) ]) ...
#!/usr/bin/env ruby require 'lazy_stream' require 'promise' def enumerate_interval(low, high) low > high ? lazy_stream : lazy_stream(low) { enumerate_interval(low + 1, high) } end def integers_starting_from(n) lazy_stream(n) { integers_starting_from(n + 1) } end def no_sevens integers_starting_...
class Booking < ApplicationRecord belongs_to :user belongs_to :barge validates :start_date, presence: { message: "is needed, when do you want to start your party?" } validates :end_date, presence: { message: "is needed, how long is your party going to last?" } end
module Enumerable def my_each return self.to_enum unless block_given? array = self.to_a for i in 0...array.length yield(array[i]) end array end def my_each_with_index return self.to_enum unless block_given? array = self.to_a for i in 0...array.length yield(array[i],...
class Patient < ActiveRecord::Base belongs_to :admission has_many :admissions # I think a patient can have multiple admissions has_many :patients_allergies, :foreign_key => 'patient_id', :dependent => :delete_all # allergies are common between patients so I'm using a join table has_many :allergies, through: :pa...
describe NpcsController do let(:user) { FactoryGirl.create :user} let(:system) { FactoryGirl.create :system, user_id: user.id} let!(:npc) { FactoryGirl.create :npc, system_id: system.id } let(:new_npc) { FactoryGirl.build :npc } let(:strength) { CharacterSkill.create(name: "Strength", level: 3)} let(:will) ...
# # Author:: Celso Fernandes (<fernandes@zertico.com>) # © Copyright IBM Corporation 2014. # # LICENSE: MIT (http://opensource.org/licenses/MIT) # Shindo.tests("Fog::DNS[:softlayer] | Domain model", ["softlayer"]) do tests("success") do @service = Fog::DNS[:softlayer] # Setup name = "fog-domain-"+...
module TicTacToeGame class Move attr_reader :board, :turn,:movelist def initialize(board, turn = nil, movelist=[]) @board = board @movelist = movelist end def current_movelist @movelist end def move(idx, toggle) @board...
module PermissionSystem #raise exception if not allowed otherwise nil def allow_category(categ_name) @current_category = Category.find_or_create_by_name(categ_name) raise "Permission denied (access to category " + categ_name + " not allowed)." unless @current_user and @current_user.can_access_category?(@current...
require "application_system_test_case" class GamesTest < ApplicationSystemTestCase test "Going to /new gives us a new random grid to play with" do visit new_url assert test: "New game" assert_selector "li", count: 10 end test "Filling in invalid word should print error message" do visit new_url ...
module Yakitori # Esa に問い合わせた全記事に重み付け計算結果を付与する class Client LOAD_PER_PAGE = ENV['LOAD_PER_PAGE'] || 100 ESA_ACCESS_TOKEN = ENV['ESA_ACCESS_TOKEN'] ESA_TEAM_NAME = ENV['ESA_TEAM_NAME'] def initialize @esa_client = ::Esa::Client.new( access_token: ESA_ACCESS_TOKEN, c...
require 'd3c3-rails' module D3C3Rails # Loads graphing helper methods into class module Grapher def self.included(base) D3C3Rails::Generators.instance_methods(false).each do |method| base.class_eval do def _grapher_holder @_grapher_holder ||= D3C3Rails::Holder.new ...
# frozen_string_literal: true require 'rails_helper' RSpec.describe FloatPlan do context 'with default factory' do let(:float_plan) { create(:float_plan, :one_onboard) } it 'successfully generates a PDF' do expect { float_plan.generate_pdf }.not_to raise_error end it 'successfully generates ...
class AddPlayerIdToAssists < ActiveRecord::Migration[5.1] def change add_column :assists, :player_id, :integer add_column :assists, :goal_id, :integer add_column :assists, :opponent_team_id, :integer add_column :assists, :minute_scored_in, :datetime add_column :assists, :area_passed_from, :string ...
module Nectarine SIDEKIQ_REDIS_CONFIG = { development: { url: 'redis://localhost:6379', namespace: "#{Rails.application.class.to_s.split('::').first.underscore}_#{Rails.env}_sidekiq", driver: :hiredis }, test: { url: 'redis://localhost:6379', namespace: "#{Rails.application....
require 'spec_helper' describe Team do before(:each) do @count = Team.all.count end it { should have_many(:users) } it { should validate_presence_of(:name) } it { should validate_uniqueness_of(:name) } context "with invalid input" do it "should not save team to database without a name" do ...
class OrdersController < ApplicationController include BreadExpressHelpers::Cart include BreadExpressHelpers::Shipping before_action :check_login, only: [:create, :new, :show, :index] before_action :set_order, only: [:show, :update, :destroy] def index if logged_in? && !current_user.role?(:customer) ...
require "formula" class Multinest < Formula desc "A Bayesian inference tool that calculates the evidence and explores the parameter space which may contain multiple posterior modes and pronounced (curving) degeneracies in moderately high dimensions." homepage "https://github.com/JohannesBuchner/MultiNest" url "h...
class Api::ChannelSubscribersController < ApplicationController def index @channel_subscribers = channel_subscribers.all render :index end def show @channel_subscriber = channel_subscriber.find(params[:id]) if @channel_subscriber render :show else ...
class RecipesController < ApplicationController def new @recipe = Recipe.new end def create @recipe = Recipe.new(get_params) if @recipe.save redirect_to recipe_path(@recipe) else render :new end end def show @recipe = Recipe.find(params[:id]) end def edit @recipe...
#1 puts "Enter the 1st number:" number_1 = gets.chomp.to_i puts "Enter the 2nd number:" number_2 = gets.chomp.to_i puts "Enter the 3rd number:" number_3 = gets.chomp.to_i puts "Enter the 4th number:" number_4 = gets.chomp.to_i puts "Enter the 5th number:" number_5 = gets.chomp.to_i puts "Enter the last number:" ...
require 'pg' class DatabaseConnection def self.setup(database) @connection = PG.connect(dbname: database) end def self.query(query_string) @connection.exec(query_string) end end
class AddImageUrlToUserGroup < ActiveRecord::Migration[5.0] def change add_column :user_groups, :image_url, :string end end
class TaskPoint < ActiveRecord::Base belongs_to :story belongs_to :project_task validates :project_task_id, presence: true validates :point_50, numericality: { only_integer: true, allow_nil: true } validates :point_90, numericality: { only_integer: true, allow_nil: true } def square_of_diff point_50 &&...
require 'bundler/gem_tasks' require 'rake/testtask' require 'rubocop/rake_task' require 'treetop' require 'polyglot' Rake::TestTask.new do |t| t.test_files = FileList['test/**/*_test.rb'] end desc 'Run tests' RuboCop::RakeTask.new(:rubocop) do |task| task.options << '--fail-fast' end desc 'Run RuboCop' task :com...
class PurchaseTransaction < ActiveRecord::Base attr_accessible :purchase_id, :response_data, :link_id serialize :response_data, JSON #associations belongs_to :purchase belongs_to :link after_create do return nil if response_data.nil? if (update_user_balance) deliver_link end end ...
require 'test_helper' class AlphanumericTest < SexyPgConstraintsTest def test_alphanumeric ActiveRecord::Migration.constrain :books, :title, :alphanumeric => true assert_prohibits Book, :title, :alphanumeric do |book| book.title = 'asdf@asdf' end assert_allows Book do |book| book.title ...
require 'rails_helper' RSpec.feature "AdminDashboard", type: :feature do it "does not allow users to access without being signed in" do visit admin_root_path expect(current_path).to eq(new_user_session_path) end it "cannot be reached by a non admin user" do user = build(:user) login_as(user) ...
class TasksController < ApplicationController include TasksHelper def index storage.fetch_all @events = graph.all_events render :json => {:events => @events} end # TODO: Remove effective_date - 1.second hack def create task = graph.new_task task_attrs.merge(on: effective_date) task.up...
#!/usr/bin/ruby require 'tmpdir' require 'yash_config' #require_relative '../lib/yash_config' tmpdir = Dir.mktmpdir puts "Using #{tmpdir} for file creation" config_file = "#{tmpdir}/yash_config.yaml" new_config_file = "#{tmpdir}/new-config.yaml" puts "Initialize" config = YashConfig.new({ :config_file => config_f...
class AddColumnToConfigUserPermission < ActiveRecord::Migration[4.2] def change add_column :config_user_permissions, :panel_partial, :string, null: false end end
class Album < ActiveRecord::Base include LastFM validates_presence_of :title, :artist has_attached_file :cover_art, :styles => {:blurred => "100%", :thumb => "40x40#"}, :convert_options => { :blurred => "-blur 0x8" } belongs_to :artist has_many :album_tracks, :dependent => :destroy has_many :tracks, :thr...
# Mad libs are a simple game where you create a story template with blanks for # words. You, or another player, then construct a list of words and place them # into the story, creating an often silly or funny story as a result. # Create a simple mad-lib program that prompts for a noun, a verb, an adverb, # and an adje...
class AddShopifyIDtoOrderAndLineItem < ActiveRecord::Migration[5.0] def change add_column :orders, :shopifyID, :integer, limit: 8 add_column :line_items, :shopifyID, :integer, limit: 8 end end
class ForumGroupsController < ApplicationController def index @forum_groups = ForumGroup.all end def new @forum_group = ForumGroup.new end def create @forum_group = ForumGroup.new(params[:forum_group]) if @forum_group.save flash[:notice] = "Forum Group was successfully created...