text
stringlengths
10
2.61M
#!/usr/bin/env ruby # encoding: utf-8 ($LOAD_PATH << File.expand_path("..", __FILE__)).uniq! require 'rubygems' unless defined? Gem require "bundle/bundler/setup" require "alfred" require 'json' require "net/http" require "uri" Alfred.with_friendly_error do |alfred| fb = alfred.feedback uri = URI.parse("http://ip...
class DevelopersController < ApplicationController def index @level = params[:lv] @view = params[:action] if params[:search] @developers = Developer.where("LOWER(name) LIKE ?", "%#{params[:search].downcase}%").limit(10) elsif params[:search_list] @year = '2010' @div = 'dev_filters' ...
require File.dirname(__FILE__) + '/../test_helper' class ForumsControllerTest < ActionController::TestCase def setup @request.remote_addr = '1.2.3.4' @forum = forums(:secret) @user = users(:root) @page = '2' end test 'on GET to :home' do get :home assert_not_nil @response.headers['X-XR...
class SignupsController < ApplicationController before_action :authenticate_player! def create if !params[:player_id].blank? && !params[:practice_id].blank? # check if player is already signed up if selected_player.signed_up?(current_practice) flash[:alert] = "This player is already signed ...
class ApiController < ApplicationController before_filter :init_sdb, :except => :test around_filter :catch_exception def test render :json => 'OK' end # # params: none # returns array def list_domains render :json => @sdb.list_domains()[:domains] end # # params: # domain - (string) simp...
require 'rails_helper' RSpec.describe Country, type: :model do let (:country) { FactoryGirl.create(:country) } describe 'attributes' do it { should respond_to :name } it { should respond_to :population } it { should respond_to :language } end describe 'class methods' do before(:each) do ...
require 'spec_helper' describe ConsultantsController do describe 'routing' do it 'routes to #index' do get('/consultants').should route_to('consultants#index') end it 'routes to #approve' do put('/consultants/1/approve').should route_to('consultants#approve', id: '1') end it 'route...
class Song < ApplicationRecord has_many :user_favorites, foreign_key: "favorite_id" has_many :song_genres has_many :genres, through: :song_genres has_many :lyrics has_many :comments belongs_to :artist belongs_to :user belongs_to :play_list, optional: true belongs_to :album delegate :name, to: :artist, p...
# frozen_string_literal: true module RecipeHelper def recipe { title: 'foo bar', calories: '23', description: 'foo bar', chef: chef, photo: photo, tags: [ tag ] } end def chef OpenStruct.new( id: SecureRandom.uuid, fields: { name: 'Foo Ch...
class EmailValidationValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) if value.blank? record.errors.add(attribute, 'メールアドレスを入力してください。') elsif value !~ /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/ record.errors.add(attribute, 'メールアドレスは不正な値です。') end end end...
module ScannerExtensions module Extensions class SsiDetect < BaseExtension def initialize @type = :detect @general_object_type = :param @extension_type = :vuln @detect_type = [:ptrav, :redir] @defaults = { timeout: 15 } ...
# frozen_string_literal: true module Mongo module Benchmarking # A utility class for returning the list item at a given percentile # value. class Percentiles # @return [ Array<Number> ] the sorted list of numbers to consider attr_reader :list # Create a new Percentiles object that enca...
module Admissions::GalleriesHelper def slide_data(gallery) data = gallery.assets.map{ |asset| { id: asset.id, file: asset.attachment.thumb('500x34').url, url: edit_admin_asset_path(asset), }} return data.to_json end end
FactoryBot.define do factory :nameserver do sequence(:hostname) { |n| "ns.test#{n}.ee" } ipv4 '192.168.1.1' domain end end
require 'test_helper' class IncidentcategoriesControllerTest < ActionDispatch::IntegrationTest setup do @incidentcategory = incidentcategories(:one) end test "should get index" do get incidentcategories_url assert_response :success end test "should get new" do get new_incidentcategory_url ...
module Ricer::Plugins::Debug class Userdebug < Ricer::Plugin trigger_is :udbg permission_is :operator has_usage and has_usage '<user>' def execute(user=nil) user ||= sender args = { id: user.id, user: user.displayname, usermode: user.usermode.display, ...
module Ardes#:nodoc: module ResourcesController # This class holds all the info that is required to find a resource, or determine a name prefix, based on a route segment # or segment pair (e.g. /blog or /users/3). # # You don't need to instantiate this class directly - it is created by ResourcesContro...
# frozen_string_literal: true module MachineLearningWorkbench::Optimizer::NaturalEvolutionStrategies # Block-Diagonal Natural Evolution Strategies class BDNES < Base MAX_RSEED = 10**Random.new_seed.size # block random seeds to be on the same range as `Random.new_seed` attr_reader :ndims_lst, :blocks, :po...
module Nymphia class DSL class Context class Host include HostContextMethods attr_reader :result def initialize(context, name, description, default_params, gateway_usage, &block) @host_name = name @context = context.merge(host_name: name) @result = { ...
require_relative '../src/linked_list' RSpec.describe LinkedList do let(:list) { LinkedList.new } describe 'creating the list' do it 'begins with an empty list' do expect(list.head).to be_nil end end describe '#add_node' do let(:word) { 'cat' } let(:definition) { 'A being who meows.' } ...
require 'spec_helper' describe ICIMS::Job do let(:get_response) {"{\"folder\":{\"id\":\"D31001\",\"value\":\"Approved\",\"formattedvalue\":\"Approved\"},\"jobtitle\":\"Senior Software Engineer - Infrastructure Software Services\",\"joblocation\":{\"id\":5,\"companyid\":6,\"address\":\"https://api.icims.com/custome...
Write::Application.routes.draw do resources :quotes resources :rites root 'welcome#index' devise_for :users resources :users, only: [:show, :index] get :profile, to: 'users#profile', as: :profile resources :welcome, only: [:index] end
class ProductsController < ApplicationController def index if params[:cat] == "all" || !params.has_key?(:cat) #shows all products if params id is "cat" or blank @products = Product.all else #shows products that only have selected category id @products = Product.where(category_id: params[:cat]) ...
class AddPrecisionToCurrency < ActiveRecord::Migration[5.1] def change add_column :currencies, :precision, :integer, default: 2, null: false end end
class EventsController < ApplicationController def index @events = Event.all @events_by_date = @events.group_by(&:event_date) @event = Event.new @date = params[:date] ? Date.parse(params[:date]) : Date.today end def new @event = Event.new end def create @event = Event.new(params[:event]) if @eve...
#encoding: utf-8 # Copyright (c) 2013-2014, Sylvain LAPERCHE # All rights reserved. # License: BSD 3-Clause (http://opensource.org/licenses/BSD-3-Clause) # A Ruby interface to the NetCDF library. # It is built on the NMatrix library and uses Ruby FFI. module NetCDF # An array containing the version number. # The ...
require 'spec_helper' describe 'Payroll Process Calculations' do before(:each) do period = FactoryGirl.build(:periodJan2013) payroll_tags = PayTagGateway.new payroll_concepts = PayConceptGateway.new @payroll_process = PayrollProcess.new(payroll_tags, payroll_concepts, period) end describe 'Payr...
# encoding: utf-8 module CountrySelect COUNTRIES = { 1 => "BRASILEIRA", 2 => "AFEGANESA", 3 => "ALBANESA", 4 => "ALEMA", 5 => "AMERICANA", 6 => "ANDORRENSE", 7 => "ANGOLESA", 8 => "ANTIGUANA", 9 => "ARABE-SAUDITANA", 10 => "ARGELINA", 11 => "ARGENTINA", 12 => "AUSTRALI...
# # Copyright 2009 Huygens Instituut for the History of the Netherlands, Den Haag, The Netherlands. # # This file is part of New Women Writers. # # New Women Writers is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundat...
require 'yaml' Vagrant.configure("2") do |config| config.vm.box = 'debian/jessie64' # Make this VM reachable on the host network as well, so that other # VM's running other browsers can access our dev server. config.vm.network :private_network, ip: "192.168.10.200" # Make it so that network access from...
#!/usr/bin/ruby # -*- coding: utf-8 -*- # Copyright (C) 2016 Yusuke Suzuki <yusuke.suzuki@sslab.ics.keio.ac.jp> # # 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 ...
# frozen_string_literal: true require_relative "choice" module TTY class Fzy class Choices include Interfaceable extend Forwardable attr_accessor :choices, :selected def initialize(choices, search, max_choices) @choices = choices.map { |choice| Choice.new(search, choice) } ...
Rails.application.routes.draw do # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html namespace :api do namespace :v1 do resources :commit_adjustments, only: [:index, :show, :create, :destroy] resources :events, only: [:index, :create, :update, :destro...
class VotesController < ApplicationController CHOICES = Integer(ENV['OPTIONS'] || 9) def index @words = Vote.select(:word, :color, :total) .order(:word, :color) .group(:word, :color, :total) .group_by(&:word) end def new @word = Vote.random_word @votes = CHOICES.times.collect { V...
class AddDefaultValueToArtInProgress < ActiveRecord::Migration def up change_column :users, :art_in_progress, :boolean, default: false end def down change_column :users, :art_in_progress, :boolean end end
module Harvest module HTTP module Server module Resources # Should probably be "FishingGroundBusinessStatisticsServerResource" as # we're returning a whole set here class FishingBusinessStatisticsServerResource < Resource def trace? false end ...
require 'rails_helper' RSpec.describe Relationship, type: :model do before do @user_1 = FactoryBot.create(:user) @user_2 = FactoryBot.create(:user) @relationship = Relationship.new(follower_id: @user_1.id, followed_id: @user_2.id) end describe 'フォロー登録' do context 'フォローできる' do it 'follower_...
class AddUniquenessToFavs < ActiveRecord::Migration[5.0] def change add_index :favorites, [:user_id, :car_id], unique: true end end
class CreateCompanies < ActiveRecord::Migration def change create_table :companies do |t| t.string :name t.string :email t.string :phone t.string :website t.integer :current_plan_id t.integer :owner_id t.integer :first_day_of_week, default: 1 t.datetime :...
require "json" require "selenium-webdriver" require "rspec" include RSpec::Expectations describe "SolrBrowseSortFormatMediumComplex" do before(:each) do @driver = Selenium::WebDriver.for :firefox @base_url = "https://digital.stage.lafayette.edu/" @accept_next_alert = true @driver.manage.timeouts.imp...
# Copyright 2012 6fusion, Inc. # # 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...
# watches Block.io addresses for balance changes using SoChain's API require 'httpclient' require 'json' require 'pusher-client' #require 'logger' # create 2 wallet addresses addresses = [] # an array of addresses we'll create api_key = "edb4-2754-2b6d-5446" # dogecoin api key 2.times do # create an address res...
class SlbigformsController < ApplicationController before_action :set_slbigform, only: [:show, :edit, :update, :destroy] # GET /slbigforms # GET /slbigforms.json def index @slbigforms = Slbigform.all end # GET /slbigforms/1 # GET /slbigforms/1.json def show end # GET /slbigforms/new def n...
# frozen_string_literal: true require 'rails_helper' RSpec.describe Vldl, type: :model do describe 'Associations' do it { should belong_to :profile } end describe 'Validations' do before do @existing_profile = FactoryBot.create :profile, email: 'joao@example.org' end it 'Is valid with ...
Given("I click on the menu tab") do sign_in_page.click_menu_tab end When("I click on the Sign out link") do sign_in_page.click_sign_out_link end Then("I should successfully be signed out.") do expect(current_url).to eq("http://www.codebar.io/") end
# app/workers/freebase/importer/rdf_importer.rb module Freebase module Importer class Rdf include Sidekiq::Worker include DataValidation PARSE_RULES = { "description" => "capture", "genre" => "crawl" } sidekiq_options :queue => :freebase_importer_rdf def perf...
class AddTypesToArticleBanners < ActiveRecord::Migration def self.up add_column :article_banners, :priority_home, :integer, :null => false, :default => 1 add_column :article_banners, :priority_section, :integer, :null => false, :default => 1 add_index :article_banners, [:priority_home], :name => 'articl...
class UserBilling < ActiveRecord::Base default_scope order('created_at ASC') attr_accessible :id, :user_id, :billing_email, :billing_password belongs_to :user validates :billing_email, presence: { message: 'can\'t be blank' } validates :billing_password, presence: { message: 'can\'t be blank' } end
ActiveAdmin.register Page do permit_params :system_name, :app_id, :title, :meta_keywords, :meta_description, :content controller do def find_resource scoped_collection.friendly.find(params[:id]) end end index do selectable_column id_column column :title column :app column :s...
ATTRIBUTE = { "TextAnswer" => "free_text", "HiddenAnswer" => "free_text", "TextBlockAnswer" => "text_block" , "NumberAnswer" => "number", "YearAnswer" => "year", "DateAnswer" => "date", "SingleAnswer" => "option_id", "MultipleAnswer" => "option_ids", "BooleanAnswer" => "option_id" } QUESTION_TYPES = ['TextQuestion', '...
require 'pry' class Backer attr_reader :name def initialize(name) @name = name end def back_project(project) ProjectBacker.new(project, self) end def backed_projects #binding.pry #(ProjectBacker.all.select{|projects|projects.backer == self}).collect{|p| p.pr...
class CreateExpenses < ActiveRecord::Migration def change create_table :expenses, id: :uuid do |t| t.string :description, null: false t.decimal :amount, null: false t.string :frequency, null: false t.datetime :ends t.datetime :onetime_on ...
#!/usr/bin/env ruby # encoding: UTF-8 require 'rubygems' require 'bundler' Bundler.require task :default => "build:all" build_dir = "build" src_dir = "src" environment = Sprockets::Environment.new environment.append_path src_dir # From a given filename src/test.{coffee,js} returns the canonical filename test def fi...
class User < ApplicationRecord validates :username, presence: true, uniqueness: true has_many :artworks, foreign_key: :artist_id, class_name: :Artwork, dependent: :destroy has_many :artwork_shares, foreign_key: :viewer_id, class_name: :ArtworkShare, dependent: :destroy # wi...
X = "X" O = "O" EMPTY = " " TIE = "TIE" NUM_SQUARES = 0..8 WAYS_TO_WIN = [[0,2,3],[3,4,5],[6,7,8],[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,6]] @board = [] def display_instruct print "\n\nWelcome to TIC-TAC-TOE\n\n" print "\n0 | 1 | 2\n---------\n3 | 4 | 5\n----------\n6 | 7 | 8\n\n" end def ask_yes_no question co...
class ListsController < ApplicationController def show @list = List.find(params[:id]) @task = @list.tasks.new end def new @project = Project.find(params[:project_id]) @list = @project.lists.new end def create @list = List.new(params[:list]) @list.project_id = params[:project_id] ...
class AddDescriptionToPhone < ActiveRecord::Migration def change add_column :phones, :description, :string end end
class AddAnonimoToComments < ActiveRecord::Migration[5.0] def change add_column :comments, :anonimo, :string add_column :comments, :ip, :string end end
class RoutinesController < ApplicationController include RoutinesHelper before_action :authenticate_user! before_action :set_routine, only: [:show, :edit, :update, :destroy] before_action :set_routine_list, only: [:index] def index end def show @routine_task = RoutineTask.new(routine_id: @routine.i...
# # Module: # Element Traverse. # module Traverse MODULE_NAME = "Element Traverse" TUPLES = [ {"page"=>"index.html","desc"=>""}, {"page"=>"http://www.baidu.com/","desc"=>""}, ] def self.run(global) global.debug("START #{MODULE_NAME}...") #global.debug("#{TUPLES}...") global.debug(...
class UserStock < ActiveRecord::Base attr_protected belongs_to :user belongs_to :stock belongs_to :issue validates_presence_of :stock_amounts , :user_id, :stock_id, :issue_id scope :count_by_stock, lambda {|id| where(["stock_id = ?",id]).sum(:stock_amounts)} scope :count_by_issue, lambda {|id| where(["iss...
require 'rails_helper' RSpec.describe VisitorInfo, type: :model do it "VisitorInfo is valid when guid is present, path is present, accessed_at is present" do visitor_info = VisitorInfo.new(guid: "824d438a-ea7d-03dc-60dc-829d4eee2527", path:"/rspec", accessed_at: Time.now) expect(visitor_info).to be_valid ...
class RemoveUnusedCredentialsTables < ActiveRecord::Migration[5.1] def change drop_table :env_host_credentials drop_table :env_application_credentials end end
module Ungarbled class Encoder class Base require 'erb' def initialize(browser, options = {}) @browser = browser @options = options end def encode(filename) @browser.ie? ? ::ERB::Util.url_encode(filename) : filename end def encode_for_zip_item(filenam...
class Admin::AdoptionContactsController < Admin::ApplicationController load_and_authorize_resource respond_to :html, :xml, :json, :xls # GET /adoption_contacts # GET /adoption_contacts.xml def index @search = AdoptionContact.organization(current_user).search(params[:q]) @adoption_contacts = @sea...
# Jenkins Pullover Utilities # Author:: Sam de Freyssinet (sam@def.reyssi.net) # Copyright:: Copyright (c) 2012 Sittercity, Inc. All Rights Reserved. # License:: MIT License # # Copyright (c) 2012 Sittercity, Inc # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this softwar...
require 'spec_helper' describe Hitimes do it "can time a block of code" do d = Hitimes.measure do sleep 0.2 end d.must_be_close_to(0.2, 0.002) end it "raises an error if measure is called with no block" do lambda{ Hitimes.measure }.must_raise( Hitimes::Error ) end end
class MeasurementSerializer < BaseSerializer cached self.version = 9 attributes :id, :value, :unit, :details def attributes data = super data['date'] = object.date.to_date.iso8601 if object.date.present? data end def unit data = {} data['name'] = object.unit.name if object.unit.pr...
require './lib/opinions/rating' class API < Sinatra::Base get '/' do "Hello, World!" end not_found do {:error => "not found"}.to_json end get '/products/:product_id/ratings/:user_id' do |product_id, user_id| Opinions::Rating.find_unique(product_id, user_id).to_json end get '/products/:pro...
require 'rm_vx_data' # sperimentale class Window_Writable < Window_base attr_accessor :scope #tipologia :text, :password, :code, :numbers attr_reader :max_char #numero di caratteri massimi attr_reader :max_lines #numero di righe massime #--------------------------------------------------------------...
require "rake" module TaskExampleGroup extend ActiveSupport::Concern included do def silent_warnings old_stderr = $stderr $stderr = StringIO.new yield ensure $stderr = old_stderr end let(:task_name) { self.class.top_level_description.sub(/\Arake /, "") } let(:tasks) { ...
class Api::V1::AdminsController < Api::V1::BaseController include ActiveHashRelation def index admins = Admin.all admins = apply_filters(admins, params) render( json: ActiveModel::ArraySerializer.new( admins, each_serializer: Api::V1::AdminSerializer, root: 'admins', ) ) end def sho...
class RemoveColumnsFromOffers < ActiveRecord::Migration def up remove_column :offers, :redemption_neighborhood remove_column :offers, :redemption_country remove_column :offers, :redemption_street_address1 remove_column :offers, :redemption_street_address2 remove_column :offers, :redemption_city ...
require 'rails_helper' RSpec.describe "Carts", type: :request do describe 'GET/carts/show' do context 'when user not logged in' do it 'redirect to login page' do get carts_show_path expect(response).to redirect_to login_path end end end end
module Fangraphs module Players extend self extend Download def player_data(team) url = "http://www.fangraphs.com/depthcharts.aspx?position=ALL&teamid=#{team.fangraph_id}" doc = download_file(url) batter_css = ".depth_chart:nth-child(58) td" pitcher_css = ".depth_chart:nth-child(76...
class MoveSpicinessFromStoresSalsasToSalsas < ActiveRecord::Migration def change remove_column :stores_salsas, :spiciness add_column :salsas, :spiciness, :integer end end
require "test_helper" describe TransitionLandingPageController do include TaxonHelpers describe "GET show" do before do brexit_taxon = taxon brexit_taxon["base_path"] = "/brexit" stub_content_store_has_item(brexit_taxon["base_path"], brexit_taxon) end it "renders the page" do ...
# Representation of a type that is not contained within the schemas available to this app module StixSchemaSpy class ExternalType attr_reader :name def initialize(prefix, name) @prefix = prefix @name = name end def prefix @prefix || "" end # For compatibility w/ normal ty...
class DashboardController < ApplicationController def index @current_user = current_user @friends = @current_user.grab_friends @parties_hosting = @current_user.parties_hosting @parties_participating = @current_user.parties_participating end end
class UserMailer < ApplicationMailer default from: "leeann.mokoena@gmail.com" #user model sent in as an object to directly extract email(as shown below) def rental_confirmation(user) @user = user mail to: @user.email_address, subject: "Rental confirmation" end end
Rails.application.routes.draw do authenticated :user do devise_scope :user do root "organizations#show" end end root "home#index" devise_scope :user do get '/users' => 'users/sessions#index', as: 'users' get '/user/:id' => 'users/sessions#show', as: 'user' get '/admin' => 'users/sessi...
require File.dirname(__FILE__) + '/../../spec_helper' describe Mysears::SocComParser, "import of single-with-entity-in-title.txt" do fixtures :all it "should replace mapped entities in product name" do @parser = Mysears::SocComParser.new('spec/lib/mysears/soc_com_data/single-with-entity-in-product-name....
#!/usr/bin/env ruby require 'rubygems' if RUBY_VERSION < '1.9.0' require 'json' require 'amqp' require 'net/http' require 'logger' #Todo - correct stop and rabbitmq.close #Still queue.subscribe fetch all the messages in queue #expect one by one fetch class Notificator GRAPHITE_HOST = "127.0.0.1" GRAPHITE...
# frozen_string_literal: true # rubocop:disable Metrics/ModuleLength,Metrics/CyclomaticComplexity module ModsSolrDocument extend ActiveSupport::Concern # rubocop:disable Metrics/BlockLength,Metrics/MethodLength,Metrics/PerceivedComplexity,Metrics/AbcSize/Metrics/ def to_oai_mods builder = Nokogiri::XML::Bui...
class Organization < ActiveRecord::Base validates :name, :presence => true, :uniqueness => true, :allow_blank => false validates :address1, :zip, :city, :email, :tax_id, :site_url, :presence => true, :allow_blank => false validates :zip, zip_code: true validates :email, email: true validates :si...
class Library < ActiveRecord::Base has_many :adventures end
module Trice module ReferenceTime def reference_time Trice.reference_time end end end
require "spec_helper" describe AnsiChameleon::ArrayUtils do describe ".item_spread_map" do subject { AnsiChameleon::ArrayUtils.item_spread_map(array, other_array) } context "([], [])" do let(:array) { [] } let(:other_array) { [] } it { should == "" } end context "([], [:a])...
class UserMarketCoinsController < BaseController attr_reader :user_market_coins before_action :authenticated? before_action :set_user_market_coin def update unless user_market_coin.update user_market_coin_params throw_error "#{user_market_coin.errors.full_messages.join(', ')}" return end ...
module Opener class PolarityTagger ## # Ruby wrapper around the Python based polarity tagger. # # @!attribute [r] options # @return [Hash] # # @!attribute [r] args # @return [Array] # class External attr_reader :options, :args ## # @param [Hash] options ...
# Public Domain - do what you want require "curses" include Curses class Freqchange def initialize @currentfreq = 7.0 @hop = 0.042 @multiplier = 4 @command = "usbsoftrock" @freqchange = "set freq" @setfreqcommand = "#{@command} -m #{@multiplier} #{@freqchange} " init_sc...
require 'rubygems' require 'pry' require 'parser/current' require 'rake' Parser::Builders::Default.emit_lambda = true Parser::Builders::Default.emit_procarg0 = true Parser::Builders::Default.emit_encoding = true Parser::Builders::Default.emit_index = true usage = {} file_list = FileList.new('./*/app...
lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "git_scratch/version" Gem::Specification.new do |spec| spec.name = "git_scratch" spec.version = GitScratch::VERSION spec.authors = ["Kshitij Yadav"] spec.email = ["kshitij.hz...
# $LICENSE # Copyright 2013-2014 Spotify AB. All rights reserved. # # The contents of this file are 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-...
class PdfsController < ApplicationController before_action :authenticate_user! def buildings_list buildings = Building.order(:name) respond_to do |format| format.pdf do ## Creo un Hash ricorsivo hash = Hash.new do |h, k| h[k] = Hash.new(&h.default_proc) end ...
class Song < ActiveRecord::Base belongs_to :collaboration has_many :tracks attr_accessor :key, :tempo, :time_signature, :title def authors collaboration.users end end
ActiveAdmin.register Contact do permit_params :name, :phone, :email, :contact_type, :message, :option end
class Media include Lotus::Entity attributes :id, :media_id, :user_id, :comment_count, :like_count, :hashtag_ids, :format, :caption, :created_at, :updated_at def Media.sample_from_hashtag(hashtag_id) client = Instagram.client(access_token: ENV['INSTAGRAM_ACCESS_TOKEN']) recent_medias = client.tag_recen...
require 'attr_typecastable/types/exception' require 'attr_typecastable/types/base' require 'date' require 'active_support/core_ext/string' module AttrTypecastable module Types class Date < Base def do_typecast(value) return value if value.is_a?(::Date) if value.respond_to?(:to_date) ...
# frozen_string_literal: true # ApplicationJob is an extra layer of indirection to ActiveJob::Base which # allows us to customize its behavior per application without monkey patching class ApplicationJob < ActiveJob::Base end