repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
tmyracle/mandrill-stats
mandrill_stats.rb
require 'mandrill' API_KEY = 'ADD API KEY HERE' mandrill = Mandrill::API.new API_KEY # Add the template names you want stats on to this array templates_to_query = [ 'template-name', ] templates_to_query.each do |template| begin total_sent = 0 total_unique_open = 0 total_unique_clicks = 0 results...
ecbypi/capistrano-env
lib/capistrano/env.rb
require 'capistrano' require "capistrano/env/version" if Capistrano::Configuration.instance Capistrano::Configuration.instance.load do require 'aws' _cset :aws_credentials, {} _cset(:s3) { AWS::S3.new(aws_credentials) } _cset :env_bucket_name do name = ENV['AWS_BUCKET_NAME'] || ENV['BUCKET_NA...
ecbypi/capistrano-env
capistrano-env.gemspec
<reponame>ecbypi/capistrano-env # coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'capistrano/env/version' Gem::Specification.new do |spec| spec.name = "capistrano-env" spec.version = Capistrano::Env::VERSION spec.authors ...
rewindio/dagwood
lib/dagwood/dependency_graph.rb
# frozen_string_literal: true require 'tsort' module Dagwood class DependencyGraph include TSort attr_reader :dependencies # @param dependencies [Hash] # A hash of the form { item1: ['item2', 'item3'], item2: ['item3'], item3: []} # would mean that "item1" depends on item2 and item3, item2...
rewindio/dagwood
spec/dagwood_spec.rb
<gh_stars>10-100 # frozen_string_literal: true describe Dagwood do it 'should have a version number' do expect(Dagwood::VERSION).not_to be_nil end end
rewindio/dagwood
dagwood.gemspec
<reponame>rewindio/dagwood<filename>dagwood.gemspec # frozen_string_literal: true lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'dagwood/version' Gem::Specification.new do |spec| spec.name = 'dagwood' spec.version = Dagwood::VERSION spec.au...
rewindio/dagwood
lib/dagwood.rb
<filename>lib/dagwood.rb # frozen_string_literal: true require 'dagwood/version' require 'dagwood/dependency_graph' module Dagwood class Error < StandardError; end end
rewindio/dagwood
spec/dependency_graph_spec.rb
# frozen_string_literal: true require 'spec_helper' describe Dagwood::DependencyGraph do describe '#initialize' do it 'converts nil values to []' do graph = Dagwood::DependencyGraph.new(item1: nil, item2: [], item3: [:item1]) expect(graph.dependencies).to eql item1: [], item2: [], item3: [:item1] ...
davosky/OpisNext
config/routes.rb
<gh_stars>0 # frozen_string_literal: true Rails.application.routes.draw do root to: 'dashboard#index' resources :howtos get 'dashboard/index' get 'dashboard/credits' get 'dashboard/authorization' devise_for :users, skip: [:registrations] as :user do get 'users/edit' => 'devise/registrations#edit', ...
davosky/OpisNext
app/controllers/generic_subscriptions_controller.rb
<filename>app/controllers/generic_subscriptions_controller.rb class GenericSubscriptionsController < ApplicationController load_and_authorize_resource before_action :set_generic_subscription, only: %i[show edit update destroy] def index @user = current_user @q = GenericSubscription.ransack(params[:q]) ...
davosky/OpisNext
app/models/payment_typology.rb
<filename>app/models/payment_typology.rb # frozen_string_literal: true class PaymentTypology < ApplicationRecord has_many :inca_receipts has_many :inca_subscriptions has_many :generic_subscriptions validates :name, presence: true validates :position, presence: true end
davosky/OpisNext
app/models/work_worker.rb
class WorkWorker < ApplicationRecord has_many :inca_subscriptions has_many :generic_subscriptions validates :name, presence: true validates :position, presence: true end
davosky/OpisNext
app/views/inca_subscriptions/index.json.jbuilder
json.array! @inca_subscriptions, partial: "inca_subscriptions/inca_subscription", as: :inca_subscription
davosky/OpisNext
app/views/inca_receipts/index.json.jbuilder
<gh_stars>0 json.array! @inca_receipts, partial: "inca_receipts/inca_receipt", as: :inca_receipt
davosky/OpisNext
app/views/inca_subscriptions/show.json.jbuilder
<reponame>davosky/OpisNext<filename>app/views/inca_subscriptions/show.json.jbuilder json.partial! "inca_subscriptions/inca_subscription", inca_subscription: @inca_subscription
davosky/OpisNext
config/initializers/rails_admin.rb
# frozen_string_literal: true RailsAdmin.config do |config| config.authorize_with do redirect_to main_app.root_path unless current_user.admin == true end config.parent_controller = 'ApplicationController' config.main_app_name = ['Opis Next Generation'] config.model 'User' do visible true label...
davosky/OpisNext
app/views/howtos/index.json.jbuilder
<reponame>davosky/OpisNext json.array! @howtos, partial: "howtos/howto", as: :howto
davosky/OpisNext
app/models/inca_practise.rb
<reponame>davosky/OpisNext # frozen_string_literal: true class IncaPractise < ApplicationRecord has_many :inca_subscriptions validates :name, presence: true validates :position, presence: true end
davosky/OpisNext
db/migrate/20211210075551_create_tariffs.rb
class CreateTariffs < ActiveRecord::Migration[6.1] def change create_table :tariffs do |t| t.integer :name t.references :category, null: false, foreign_key: true t.integer :position t.string :typology t.decimal :amount, precision: 8, scale: 2, default: 0.0 t.timestamps end...
davosky/OpisNext
db/migrate/202112166095981_create_generic_subscriptions.rb
class CreateGenericSubscriptions < ActiveRecord::Migration[6.1] def change create_table :generic_subscriptions do |t| t.references :generic_office, null: false, foreign_key: true t.references :subscription_typology, null: false, foreign_key: true t.string :customer_name t.string :customer_...
davosky/OpisNext
db/schema.rb
<reponame>davosky/OpisNext # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # This file is the source Rails uses to define your s...
davosky/OpisNext
app/models/inca_subscription.rb
class IncaSubscription < ApplicationRecord belongs_to :inca_office belongs_to :subscription_typology belongs_to :sex belongs_to :company_typology, optional: true belongs_to :work_qualify, optional: true belongs_to :work_level, optional: true belongs_to :work_worker, optional: true belongs_to :payment_ty...
davosky/OpisNext
app/controllers/howtos_controller.rb
# frozen_string_literal: true class HowtosController < ApplicationController load_and_authorize_resource before_action :set_howto, only: %i[show edit update destroy] def index @howtos = Howto.all.paginate(page: params[:page], per_page: 5) end def show; end def new @howto = Howto.new # autho...
davosky/OpisNext
app/controllers/inca_subscriptions_controller.rb
class IncaSubscriptionsController < ApplicationController load_and_authorize_resource before_action :set_inca_subscription, only: %i[show edit update destroy] def index @user = current_user @q = IncaSubscription.ransack(params[:q]) @inca_subscriptions = @q.result(didtinct: true).order(name: 'DESC') ...
davosky/OpisNext
app/helpers/application_helper.rb
# frozen_string_literal: true module ApplicationHelper def admin? current_user.admin == true end def full_user "#{current_user.name} - #{current_user.institute}" end def inca_receipt_customer_full_name(inca_receipt) "#{inca_receipt.customer_name} #{inca_receipt.customer_forname}" end def i...
davosky/OpisNext
app/controllers/dashboard_controller.rb
class DashboardController < ApplicationController def index; end def credits; end def authorization; end end
davosky/OpisNext
app/views/howtos/show.json.jbuilder
json.partial! "howtos/howto", howto: @howto
davosky/OpisNext
app/models/howto.rb
<reponame>davosky/OpisNext # frozen_string_literal: true class Howto < ApplicationRecord validates :title, presence: true validates :topic, presence: true validates :description, presence: true end
davosky/OpisNext
app/views/howtos/_howto.json.jbuilder
<reponame>davosky/OpisNext json.extract! howto, :id, :title, :topic, :description, :created_at, :updated_at json.url howto_url(howto, format: :json)
davosky/OpisNext
app/models/ability.rb
<filename>app/models/ability.rb # frozen_string_literal: true class Ability include CanCan::Ability def initialize(user) can :manage, :all if user.present? && user.admin == true can :read, Howto if user.present? if user.institute == 'Ufficio Amministrazione' can :billdownload, IncaReceipt ...
davosky/OpisNext
app/views/generic_subscriptions/index.json.jbuilder
<reponame>davosky/OpisNext<gh_stars>0 json.array! @generic_subscriptions, partial: 'generic_subscriptions/generic_subscription', as: :generic_subscription
davosky/OpisNext
app/models/inca_receipt.rb
<gh_stars>0 class IncaReceipt < ApplicationRecord belongs_to :inca_office belongs_to :payment_typology belongs_to :user has_one_attached :pdf before_create :set_name def set_name last_name = IncaReceipt.maximum(:name) self.name = last_name.to_i + 1 end validates :date, presence: true valida...
davosky/OpisNext
app/controllers/inca_receipts_controller.rb
# frozen_string_literal: true class IncaReceiptsController < ApplicationController load_and_authorize_resource before_action :set_inca_receipt, only: %i[show edit update destroy] def index @user = current_user @q = IncaReceipt.ransack(params[:q]) @inca_receipts = @q.result(distinct: true).order(nam...
davosky/OpisNext
db/migrate/20211121081814_add_cancellation_to_inca_receipt.rb
<reponame>davosky/OpisNext<filename>db/migrate/20211121081814_add_cancellation_to_inca_receipt.rb class AddCancellationToIncaReceipt < ActiveRecord::Migration[6.1] def change add_column :inca_receipts, :cancellation, :boolean add_column :inca_receipts, :cancellation_reason, :string end end
davosky/OpisNext
app/views/generic_subscriptions/show.json.jbuilder
<filename>app/views/generic_subscriptions/show.json.jbuilder json.partial! 'generic_subscriptions/generic_subscription', generic_subscription: @generic_subscription
davosky/OpisNext
db/migrate/20211101104357_create_inca_receipts.rb
<filename>db/migrate/20211101104357_create_inca_receipts.rb class CreateIncaReceipts < ActiveRecord::Migration[6.1] def change create_table :inca_receipts do |t| t.references :inca_office, null: false, foreign_key: true t.string :customer_name t.string :customer_forname t.string :customer_...
davosky/OpisNext
app/models/inca_office.rb
<gh_stars>0 # frozen_string_literal: true class IncaOffice < ApplicationRecord has_many :inca_receipts has_many :inca_subscriptions validates :name, presence: true validates :position, presence: true end
davosky/OpisNext
app/views/inca_receipts/show.json.jbuilder
json.partial! "inca_receipts/inca_receipt", inca_receipt: @inca_receipt
davosky/OpisNext
app/models/user.rb
# frozen_string_literal: true class User < ApplicationRecord devise :database_authenticatable, :registerable validate :password_complexity def password_complexity if password.present? && !password.match(/^(?=.*[a-z])(?=.*[A-Z])/) errors.add :password, 'La password non è sufficientemente complessa' ...
davosky/OpisNext
app/models/tariff.rb
class Tariff < ApplicationRecord belongs_to :category before_create :set_name def set_name last_name = Tariff.maximum(:name) self.name = last_name.to_i + 1 end validates :category_id, presence: true validates :typology, presence: true validates :amount, presence: true end
br/cache_fu
test/sti_test.rb
<reponame>br/cache_fu require File.join(File.dirname(__FILE__), 'helper') context "An STI subclass acting as cached" do include StoryCacheSpecSetup setup do @feature = Feature.new(:id => 3, :title => 'Behind the scenes of acts_as_cached') @interview = Interview.new(:id => 4, :title => 'An interview with...
br/cache_fu
lib/acts_as_cached/recipes.rb
<reponame>br/cache_fu Capistrano.configuration(:must_exist).load do %w(start stop restart kill status).each do |cmd| desc "#{cmd} your memcached servers" task "memcached_#{cmd}".to_sym, :roles => :app do run "RAILS_ENV=production #{ruby} #{current_path}/script/memcached_ctl #{cmd}" end end end
br/cache_fu
lib/acts_as_cached/memcached_rails.rb
<gh_stars>1-10 class Memcached # A legacy compatibility wrapper for the Memcached class. It has basic compatibility with the <b>memcache-client</b> API. class Rails < ::Memcached def initialize(config) super(config.delete(:servers), config.slice(DEFAULTS.keys)) end def servers=(servers) ...
br/cache_fu
test/helper.rb
## # This file exists to fake out all the Railsisms we use so we can run the # tests in isolation. $LOAD_PATH.unshift 'lib/' # begin require 'rubygems' gem 'mocha', '>= 0.4.0' require 'mocha' gem 'test-spec', '= 0.3.0' require 'test/spec' require 'multi_rails_init' rescue LoadError puts '=> acts_as_cac...
br/cache_fu
lib/acts_as_cached/local_cache.rb
module ActsAsCached module LocalCache @@local_cache = {} mattr_accessor :local_cache def fetch_cache_with_local_cache(*args) @@local_cache[cache_key(args.first)] ||= fetch_cache_without_local_cache(*args) end def set_cache_with_local_cache(*args) @@local_cache[cache_key(args.first)] ...
br/cache_fu
test/benchmarking_test.rb
require File.join(File.dirname(__FILE__), 'helper') ActsAsCached.config.clear config = YAML.load_file(File.join(File.dirname(__FILE__), '../defaults/memcached.yml.default')) config['test'] = config['development'] ActsAsCached.config = config Story.send :acts_as_cached context "When benchmarking is enabled" do speci...
br/cache_fu
test/local_cache_test.rb
require File.join(File.dirname(__FILE__), 'helper') context "When local_cache_for_request is called" do include StoryCacheSpecSetup setup do ActionController::Base.new.local_cache_for_request $cache = CACHE if $with_memcache end specify "get_cache should pull from the local cache on a second hit" do ...
br/cache_fu
test/extensions_test.rb
<gh_stars>10-100 require File.join(File.dirname(__FILE__), 'helper') module ActsAsCached module Extensions module ClassMethods def user_defined_class_method true end end module InstanceMethods def user_defined_instance_method true end end end end context "W...
br/cache_fu
test/disabled_test.rb
<gh_stars>10-100 require File.join(File.dirname(__FILE__), 'helper') context "When the cache is disabled" do setup do @story = Story.new(:id => 1, :title => "acts_as_cached 2 released!") @story2 = Story.new(:id => 2, :title => "BDD is something you can use") $stories = { 1 => @story, 2 => @story2 } ...
br/cache_fu
lib/acts_as_cached/disabled.rb
<reponame>br/cache_fu module ActsAsCached module Disabled def fetch_cache_with_disabled(*args) nil end def set_cache_with_disabled(*args) args[1] end def expire_cache_with_disabled(*args) true end def self.add_to(klass) return if klass.respond_to? :fetch_cache_wi...
br/cache_fu
lib/acts_as_cached/local_fragment_cache.rb
<filename>lib/acts_as_cached/local_fragment_cache.rb module ActsAsCached module LocalFragmentCache @@local_fragment_cache = {} mattr_accessor :local_fragment_cache def read_with_local_cache(*args) @@local_fragment_cache[args.first] ||= read_without_local_cache(*args) end def self.add_to(k...
br/cache_fu
test/fragment_cache_test.rb
require File.join(File.dirname(__FILE__), 'helper') require 'test/unit' require 'action_controller/test_process' ActionController::Routing::Routes.draw do |map| map.connect ':controller/:action/:id' end class FooController < ActionController::Base def url_for(*args) "http://#{Time.now.to_i}.foo.com" end end...
streamroot/avplayer-dna-plugin
AVPlayerDNAPlugin.podspec
Pod::Spec.new do |s| s.name = 'AVPlayerDNAPlugin' s.version = '1.1.25' s.swift_version = '5.5' s.summary = 'Streamroot Distributed Network Architecture AVPlayer plugins, a new way to deliver large-scale OTT video' s.homepage = 'https://www.streamroot.i...
vicmaster/chartjs-rails
chartjs.gemspec
<reponame>vicmaster/chartjs-rails $:.push File.expand_path("../lib", __FILE__) # Maintain your gem's version: require "chartjs/version" # Describe your gem and declare its dependencies: Gem::Specification.new do |s| s.name = "chartjs" s.version = Chartjs::VERSION s.authors = ["<NAME>"] s.email ...
dacur/que
lib/que/locker.rb
<gh_stars>0 # frozen_string_literal: true # The Locker class encapsulates a thread that is listening/polling for new # jobs in the DB, locking them, passing their primary keys to workers, then # cleaning up by unlocking them once the workers are done. require 'set' module Que Listener::MESSAGE_FORMATS[:job_availab...
radamanthus/MovieEffects
app/helpers/effects/progress_helper.rb
module Effects::ProgressHelper end
radamanthus/MovieEffects
app/controllers/effects/base_controller.rb
<reponame>radamanthus/MovieEffects class Effects::BaseController < ApplicationController include ActionView::Helpers::SanitizeHelper helper_method :bgcolor def create saved_config = SavedConfiguration.new({ session_id: request.session.id, effect: effect_name, configuration: configuration_f...
radamanthus/MovieEffects
app/controllers/effects/processing_controller.rb
class Effects::ProcessingController < Effects::BaseController helper_method :bgcolor private def bgcolor '#1b1c1d' end def configuration_from_params_and_defaults { processing_text: sanitize(params[:processing_text]) || default_config[:processing_text], progress_bar_color: sanitize(params[...
radamanthus/MovieEffects
app/controllers/effects/access_controller.rb
<gh_stars>1-10 class Effects::AccessController < Effects::BaseController helper_method :bgcolor private def bgcolor '#ffffff' end def configuration_from_params_and_defaults { header_text: sanitize(params[:header_text]), mode: sanitize(params[:mode]), username_label: sanitize(para...
radamanthus/MovieEffects
spec/models/saved_configuration_spec.rb
# frozen_string_literal: true require 'rails_helper' describe SavedConfiguration do it "generates a slug on save" do saved_config = SavedConfiguration.new(effect: 'processing') saved_config.save expect(saved_config.slug).not_to be_nil end end
radamanthus/MovieEffects
config/routes.rb
Rails.application.routes.draw do root 'home#index' namespace :effects do resources :processing resources :access end end
radamanthus/MovieEffects
app/services/slug_generator.rb
<filename>app/services/slug_generator.rb # frozen_string_literal: true class SlugGenerator HASHID_ALPHABET = ('a'..'z').to_a.join + ('0'..'9').to_a.join attr_reader :slug def initialize(id) hashid = Hashids.new(Settings.hash_id_salt, 5, HASHID_ALPHABET) @slug = hashid.encode(id) end end
radamanthus/MovieEffects
db/migrate/20190727042057_create_saved_configurations.rb
<filename>db/migrate/20190727042057_create_saved_configurations.rb class CreateSavedConfigurations < ActiveRecord::Migration[5.2] def change create_table :saved_configurations do |t| t.string :effect, null: false t.string :slug t.string :hashed_password t.string :sessio...
radamanthus/MovieEffects
app/models/saved_configuration.rb
# frozen_string_literal: true class SavedConfiguration < ApplicationRecord after_create :generate_slug private def generate_slug self.slug = SlugGenerator.new(id).slug self.save end end
ugogon/Autolab
app/models/risk_condition.rb
class RiskCondition < ApplicationRecord serialize :parameters, Hash enum condition_type: { no_condition_selected: 0, grace_day_usage: 1, grade_drop: 2, no_submissions: 3, low_grades: 4 } has_many :watchlist_instances, dependent: :destroy belongs_to :course # parameter correspondence...
iancanderson/tenderjit
test/instructions/opt_aref_test.rb
<gh_stars>0 # frozen_string_literal: true require "helper" class TenderJIT class OptArefTest < JITTest def aref obj, key obj[key] end def test_has_opt_aref assert_has_insn method(:aref), insn: :opt_aref end def test_opt_aref jit.compile method(:aref) jit.enable! ...
iancanderson/tenderjit
test/instructions/setlocal_WC_1_test.rb
<reponame>iancanderson/tenderjit # frozen_string_literal: true require "helper" class TenderJIT class SetlocalWc1Test < JITTest def test_setlocal_WC_1 skip "setlocal_WC_1 has been implemented. Please add a test." end end end
iancanderson/tenderjit
test/runtime_test.rb
# frozen_string_literal: true require "helper" class TenderJIT class RuntimeTest < Test attr_reader :rt def setup super fisk = Fisk.new buffer = StringIO.new temp_stack = TempStack.new @rt = Runtime::new(fisk, buffer, temp_stack) end # Smoke test. # def test...
iancanderson/tenderjit
test/make_warnings_errors.rb
<reponame>iancanderson/tenderjit # Make errors into warnings (gcc's -W) # This is somewhat odd, but it's been officially accepted for this purpose (see https://bugs.ruby-lang.org/issues/3916). # module Warning def warn msg raise msg end end
iancanderson/tenderjit
test/temp_stack_test.rb
# frozen_string_literal: true require "helper" class TempStackTest < TenderJIT::Test def test_push_then_read_with_square stack = TenderJIT::TempStack.new stack.push("name") assert_equal 0, stack[0].displacement end def test_negative_numbers_raise_index_error_with_square stack = TenderJIT::Temp...
iancanderson/tenderjit
test/instructions/topn_test.rb
<filename>test/instructions/topn_test.rb<gh_stars>0 # frozen_string_literal: true require "helper" class TenderJIT class TopnTest < JITTest # Disassembly (as of 3.0.2): # # local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1]) # [ 1] arr@0 # 0000 dup...
iancanderson/tenderjit
lib/tenderjit/runtime.rb
<gh_stars>0 class TenderJIT class Runtime def initialize fisk, jit_buffer, temp_stack @fisk = fisk @labels = [] @label_count = 0 @jit_buffer = jit_buffer @temp_stack = temp_stack yield self if block_given? end def flush_pc_and_sp pc, sp cfp_ptr = point...
reiz/safe_cookies
lib/safe_cookies.rb
<gh_stars>1-10 # -*- encoding: utf-8 -*- require "safe_cookies/configuration" require "safe_cookies/cookie_path_fix" require "safe_cookies/helpers" require "safe_cookies/util" require "safe_cookies/version" require "rack" require "time" # add Time#rfc2822 # Naming: # - application_cookies: cookies received from the ap...
reiz/safe_cookies
lib/safe_cookies/cookie_path_fix.rb
<reponame>reiz/safe_cookies<filename>lib/safe_cookies/cookie_path_fix.rb module SafeCookies module CookiePathFix # Previously, the SafeCookies gem would not set a path when rewriting # cookies. Browsers then would assume and store the current "directory" # (see below), leading to multiple cookies per d...
reiz/safe_cookies
lib/safe_cookies/configuration.rb
<reponame>reiz/safe_cookies module SafeCookies MissingOptionError = Class.new(StandardError) class << self attr_accessor :configuration def configure self.configuration ||= Configuration.new yield(configuration) end end class Configuration attr_accessor :log_unknown_cookies ...
reiz/safe_cookies
lib/safe_cookies/util.rb
<reponame>reiz/safe_cookies class SafeCookies::Util class << self def slice(hash, *allowed_keys) sliced_hash = hash.select { |key, _value| allowed_keys.include? key } # Normalize the result of Hash#select # (Ruby 1.8 returns an Array, Ruby 1.9 returns a Hash) Hash[slice...
reiz/safe_cookies
spec/util_spec.rb
<filename>spec/util_spec.rb require 'spec_helper' describe SafeCookies::Util do describe '.except!' do before do @hash = { 'a' => 1, 'ab' => 2, 'b' => 3 } end it 'deletes the given keys from the original hash' do SafeCookies::Util.except!(@hash, 'a') @hash.should == { 'ab' => 2...
reiz/safe_cookies
lib/safe_cookies/helpers.rb
module SafeCookies module Helpers KNOWN_COOKIES_DIVIDER = '|' # Since we have to operate on and modify the actual @headers hash that the # application returns, cache the @headers['Set-Cookie'] string so that # later on, we still know what the application did set. def cache_application_cookie...
reiz/safe_cookies
spec/safe_cookies_spec.rb
# -*- encoding: utf-8 -*- require 'spec_helper' describe SafeCookies::Middleware do subject { described_class.new(app) } let(:app) { stub 'application' } let(:env) { { 'HTTPS' => 'on' } } it 'rewrites registered request cookies as secure and http-only, but only once' do SafeCookies.configure do |conf...
reiz/safe_cookies
spec/cookie_path_fix_spec.rb
require 'spec_helper' require 'cgi' describe SafeCookies::Middleware do describe 'cookie path fix,' do subject { described_class.new(app) } let(:app) { stub 'application' } let(:env) { { 'HTTPS' => 'on' } } before do @now = Time.parse('2050-01-01 00:00') Timecop.travel(@now) ...
reiz/safe_cookies
spec/spec_helper.rb
require File.expand_path('../../lib/safe_cookies', __FILE__) require 'timecop' RSpec.configure do |config| config.treat_symbols_as_metadata_keys_with_true_values = true config.run_all_when_everything_filtered = true config.filter_run :focus # Run specs in random order to surface order dependencies. If you fin...
reiz/safe_cookies
spec/configuration_spec.rb
# encoding: utf-8 require 'spec_helper' describe SafeCookies::Middleware do it 'does not allow registered cookies to be altered' do SafeCookies.configure do |config| config.register_cookie('filter', :expire_after => 3600) end filter_options = SafeCookies.configuration.registered_cookies['fi...
antrix1/omniauth-bnet
lib/omniauth-bnet.rb
<filename>lib/omniauth-bnet.rb require "omniauth-bnet/version" require "omniauth/strategies/bnet"
antrix1/omniauth-bnet
lib/omniauth/strategies/bnet.rb
require 'omniauth-oauth2' require 'base64' module OmniAuth module Strategies class Bnet < OmniAuth::Strategies::OAuth2 option :region, 'us' option :client_options, { :scope => 'wow.profile sc2.profile' } def client # Setup urls based on region option if !options.c...
antrix1/omniauth-bnet
examples/sinatra.rb
#!/usr/bin/env ruby # This example provides login links for github and bnet in order to test that # bnet oauth is correctly working. require 'omniauth' require 'omniauth-bnet' require 'omniauth-github' require 'sinatra' # Uncomment to see requests going back and forth <3 # require 'httplog' # HttpLog.options[:log_he...
antrix1/omniauth-bnet
lib/omniauth-bnet/version.rb
<filename>lib/omniauth-bnet/version.rb module OmniAuth module Bnet VERSION = "2.0.0" end end
javier-delgado/URF-picker
app/models/highest_stat.rb
<gh_stars>0 # == Schema Information # # Table name: highest_stats # # id :integer not null, primary key # champion_id :integer # assists :float # champ_level :float # deaths ...
javier-delgado/URF-picker
db/migrate/20150405231715_change_integer_to_decimal.rb
class ChangeIntegerToDecimal < ActiveRecord::Migration def change change_table :highest_stats do |t| t.change :assists, :float t.change :champ_level, :float t.change :deaths, :float t.change :double_kills, :float t.change :kills, :float t.change :minions_killed, :float t....
javier-delgado/URF-picker
app/controllers/home_controller.rb
<filename>app/controllers/home_controller.rb class HomeController < ApplicationController def search; end end
javier-delgado/URF-picker
config/deploy.rb
<reponame>javier-delgado/URF-picker # config valid only for Capistrano 3.1 lock '3.1.0' set :application, 'URF-picker' set :repo_url, '<EMAIL>:javier-delgado/URF-picker.git' set :deploy_to, '/home/deploy/URF-picker' set :linked_files, %w{config/database.yml config/secrets.yml} set :linked_dirs, %w{log tmp/pids tmp/c...
javier-delgado/URF-picker
db/migrate/20150331012700_create_teams.rb
<reponame>javier-delgado/URF-picker class CreateTeams < ActiveRecord::Migration def change create_table :teams do |t| t.integer :team_key t.integer :baron_kills t.integer :dragon_kills t.boolean :firs_baron t.boolean :first_dragon t.boolean :first_blood t.boolean :first_i...
javier-delgado/URF-picker
app/models/team.rb
<reponame>javier-delgado/URF-picker # == Schema Information # # Table name: teams # # id :integer not null, primary key # team_key :integer # baron_kills :integer # dragon_kills :integer # firs_baron :boolean # first_dragon :boolean # first_blood :boolean # first_...
javier-delgado/URF-picker
db/migrate/20150331012746_create_participants.rb
<gh_stars>0 class CreateParticipants < ActiveRecord::Migration def change create_table :participants do |t| t.references :match_detail, index: true t.references :team, index: true t.integer :champion_key t.integer :team_key t.string :highest_achieved_season_tier t.integer :par...
javier-delgado/URF-picker
app/models/region.rb
<reponame>javier-delgado/URF-picker # == Schema Information # # Table name: regions # # id :integer not null, primary key # key :string # name :string # created_at :datetime not null # updated_at :datetime not null # class Region < ActiveRecord::Base validates_uniqu...
javier-delgado/URF-picker
app/models/participant_stat.rb
<reponame>javier-delgado/URF-picker # == Schema Information # # Table name: participant_stats # # id :integer not null, primary key # participant_id :integer # assists :integer # champ_level :integer # de...
javier-delgado/URF-picker
app/services/data_parser.rb
<gh_stars>0 class DataParser def initialize(json_string) @data = JSON.parse(json_string) @teams = [] end def parse! ActiveRecord::Base.transaction do match = parse_match_details parse_teams(match) parse_participants(match) end end private def parse_match_details Match...
javier-delgado/URF-picker
db/migrate/20150331020555_create_champions_participants.rb
class CreateChampionsParticipants < ActiveRecord::Migration def self.up create_table :champions_participants, :id => false do |t| t.references :champion t.references :participant end add_index :champions_participants, [:champion_id, :participant_id] add_index :champions_participants, :...
javier-delgado/URF-picker
db/migrate/20150331015316_create_banned_champions.rb
<gh_stars>0 class CreateBannedChampions < ActiveRecord::Migration def change create_table :banned_champions do |t| t.references :team, index: true t.references :champion, index: true t.integer :champion_key t.timestamps null: false end add_foreign_key :banned_champions, :teams ...
javier-delgado/URF-picker
lib/tasks/calculate_averages.rake
<filename>lib/tasks/calculate_averages.rake<gh_stars>0 namespace :data do task :calculate_averages => :environment do t = Time.now puts "Caclulating averages..." champ_average = ChampAverages.new champ_average.calculate! puts "Done, " + (Time.now - t).to_s + " seconds" end end
javier-delgado/URF-picker
app/helpers/application_helper.rb
module ApplicationHelper def put_background_image(image_path, position = "center") "<style media='screen'> body { background: #222222 url(#{image_path}) no-repeat #{position} center; background-size: cover; background-attachment: fixed; } </style>".html_safe end end