repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
AssociationPaupiette/paupiette | app/models/ambassadorship.rb | # == Schema Information
#
# Table name: ambassadorships
#
# id :bigint(8) not null, primary key
# user_id :integer
# city_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
class Ambassadorship < ApplicationRecord
belongs_to :user
belongs_to :cit... |
AssociationPaupiette/paupiette | app/helpers/dashboard/advices_helper.rb | <reponame>AssociationPaupiette/paupiette<filename>app/helpers/dashboard/advices_helper.rb
module Dashboard::AdvicesHelper
end
|
AssociationPaupiette/paupiette | app/models/ability.rb | <gh_stars>0
class Ability
include CanCan::Ability
def initialize(user)
@user = user ||= User.new
guest
host if @user.host?
ambassador if @user.ambassador?
admin if @user.admin?
end
protected
def guest
can :manage, Message, from: @user
end
def host
can :manage, Meal, host: ... |
AssociationPaupiette/paupiette | db/seeds.rb | # This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Ch... |
AssociationPaupiette/paupiette | app/controllers/pages_controller.rb | <filename>app/controllers/pages_controller.rb
class PagesController < ApplicationController
def index
@preregistration = Preregistration.new
@preregistration_cities = City.inactive
@map_center = { latitude: 46.71109, longitude: 1.7191036 }.to_json
@map_cities = City.active.map { |city|
{ latit... |
AssociationPaupiette/paupiette | db/migrate/20181102084505_add_slugs_to_users_and_cities.rb | <gh_stars>0
class AddSlugsToUsersAndCities < ActiveRecord::Migration[5.2]
def change
add_column :cities, :slug, :string, default: '', null: false
add_column :users, :slug, :string, default: '', null: false
end
end
|
AssociationPaupiette/paupiette | db/migrate/20181113094109_rename_preregister_for_preregistration.rb | <filename>db/migrate/20181113094109_rename_preregister_for_preregistration.rb<gh_stars>0
class RenamePreregisterForPreregistration < ActiveRecord::Migration[5.2]
def change
rename_table :preregisters, :preregistrations
end
end
|
AssociationPaupiette/paupiette | db/migrate/20181031092714_change_profile_status_column_in_users.rb | <filename>db/migrate/20181031092714_change_profile_status_column_in_users.rb
class ChangeProfileStatusColumnInUsers < ActiveRecord::Migration[5.2]
def change
rename_column :users, :profile_status, :profile_verification
end
end
|
AssociationPaupiette/paupiette | app/controllers/hosts_controller.rb | <filename>app/controllers/hosts_controller.rb
class HostsController < ApplicationController
respond_to :html, :js, only: [:index]
add_breadcrumb I18n.t('menu.hosts'), :hosts_path
def index
@cities = City.active
@users = User.hosts.approved.page params[:page]
@meals = Meal.opened
@map_center = { ... |
AssociationPaupiette/paupiette | app/controllers/admin/preregistrations_controller.rb | <reponame>AssociationPaupiette/paupiette<gh_stars>0
class Admin::PreregistrationsController < Admin::ApplicationController
add_breadcrumb 'Préinscriptions', :admin_preregistrations_path
def index
@preregistrations = Preregistration.all
end
def import
Preregistration.import params[:csv]
redirect_to... |
AssociationPaupiette/paupiette | test/models/user/review_test.rb | # == Schema Information
#
# Table name: user_reviews
#
# id :bigint(8) not null, primary key
# from_id :bigint(8)
# about_id :bigint(8)
# text :text
# approved :boolean default(FALSE)
# created_at :datetime not null
# updated_at :datetime not null
#
require '... |
AssociationPaupiette/paupiette | test/models/message_test.rb | <reponame>AssociationPaupiette/paupiette
# == Schema Information
#
# Table name: messages
#
# id :bigint(8) not null, primary key
# from_id :bigint(8)
# content :text
# read_at :datetime
# created_at :datetime not null
# updated_at :datetime no... |
AssociationPaupiette/paupiette | test/controllers/ambassadorships_controller_test.rb | <gh_stars>0
require 'test_helper'
class AmbassadorshipsControllerTest < ActionDispatch::IntegrationTest
setup do
@ambassadorship = ambassadorships(:one)
end
test "should get index" do
get ambassadorships_url
assert_response :success
end
test "should get new" do
get new_ambassadorship_url
... |
AssociationPaupiette/paupiette | app/controllers/my/meals_controller.rb | class My::MealsController < My::ApplicationController
load_and_authorize_resource
add_breadcrumb I18n.t('my.meals.name'), :my_meals_path
def index
@meals = current_user.meals.future
end
def new
add_breadcrumb t('my.meals.new')
@meal = Meal.new capacity: 2, confirmed: 1, date: Date.tomorrow
en... |
AssociationPaupiette/paupiette | app/models/conversation.rb | <reponame>AssociationPaupiette/paupiette
# == Schema Information
#
# Table name: conversations
#
# id :bigint(8) not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
#
class Conversation < ApplicationRecord
has_and_belongs_to_many :users
has_many :... |
AssociationPaupiette/paupiette | test/models/user_test.rb | # == Schema Information
#
# Table name: users
#
# id :bigint(8) not null, primary key
# email :string default(""), not null
# encrypted_password :string default(""), not null
# reset_password_token :string
# reset_password_sent_at :datetime
# r... |
AssociationPaupiette/paupiette | app/controllers/admin/users_controller.rb | <gh_stars>0
class Admin::UsersController < Admin::ApplicationController
load_and_authorize_resource
add_breadcrumb 'Utilisateurs', :admin_users_path
def index
@admins = User.admins
@ambassadors = User.ambassadors
@guests = User.guests
@hosts = User.hosts
end
def admins
add_breadcrumb 'A... |
AssociationPaupiette/paupiette | lib/tasks/app.rake | <filename>lib/tasks/app.rake
namespace :app do
namespace :db do
desc 'Get database from Heroku'
task :production do
Bundler.with_clean_env do
sh 'heroku pg:backups capture --app associationpaupiette'
sh 'curl -o db/latest.dump `heroku pg:backups public-url --app associationpaupiette`'
... |
AssociationPaupiette/paupiette | app/mailers/message_mailer.rb | class MessageMailer < ApplicationMailer
def notification_email
@from = params[:from]
@to = params[:to]
@url = my_conversation_url(user_slug: @from.slug)
mail to: @to.email, subject: 'Vous avez un message'
end
end
|
AssociationPaupiette/paupiette | app/controllers/my/reviews_controller.rb | class My::ReviewsController < My::ApplicationController
add_breadcrumb I18n.t('my.reviews.name')
def index
@conversations = current_user.conversations
end
def save
@user = User.find_by(slug: params[:user_slug])
@review = current_user.review_about(@user)
@review.text = params[:user_review][:tex... |
AssociationPaupiette/paupiette | db/migrate/20181102162019_create_conversations.rb | <reponame>AssociationPaupiette/paupiette
class CreateConversations < ActiveRecord::Migration[5.2]
def change
create_table :conversations do |t|
t.timestamps
end
create_join_table :conversations, :users
remove_column :messages, :meal_id
remove_column :messages, :to_id
add_column :messages... |
AssociationPaupiette/paupiette | app/controllers/admin/dashboard_controller.rb | <gh_stars>0
class Admin::DashboardController < Admin::ApplicationController
def index
authorize! :read, :Dashboard
@active_cities = City.active
@inactive_cities = City.inactive
end
end
|
AssociationPaupiette/paupiette | test/models/meal_test.rb | # == Schema Information
#
# Table name: meals
#
# id :bigint(8) not null, primary key
# date :datetime
# host_id :bigint(8)
# capacity :integer
# created_at :datetime not null
# updated_at :datetime not null
# confirmed :integer default(1)
# remaining ... |
AssociationPaupiette/paupiette | db/migrate/20181025121149_add_infos_to_users.rb | class AddInfosToUsers < ActiveRecord::Migration[5.2]
def change
add_column :users, :first_name, :string
add_column :users, :description, :text
add_column :users, :specialties, :text
add_column :users, :reception_days, :string
add_column :users, :profile_status, :integer, default: 0
add_column ... |
AssociationPaupiette/paupiette | test/system/meals_test.rb | <gh_stars>0
require "application_system_test_case"
class MealsTest < ApplicationSystemTestCase
setup do
@meal = meals(:one)
end
test "visiting the index" do
visit meals_url
assert_selector "h1", text: "Meals"
end
test "creating a Meal" do
visit meals_url
click_on "New Meal"
fill_in... |
AssociationPaupiette/paupiette | app/controllers/my_cities/application_controller.rb | <filename>app/controllers/my_cities/application_controller.rb
class MyCities::ApplicationController < ApplicationController
before_action :redirect_if_unauthorized
before_action :load_city
def index
@cities = current_user.managed_cities
render 'my_cities/index'
end
protected
def load_city
@ci... |
AssociationPaupiette/paupiette | app/controllers/concerns/devise_permitted_params.rb | <reponame>AssociationPaupiette/paupiette<filename>app/controllers/concerns/devise_permitted_params.rb
module DevisePermittedParams
extend ActiveSupport::Concern
included do
before_action :configure_devise_permitted_parameters, if: :devise_controller?
end
def configure_devise_permitted_parameters
edit_... |
AssociationPaupiette/paupiette | app/models/user/review.rb | # == Schema Information
#
# Table name: user_reviews
#
# id :bigint(8) not null, primary key
# from_id :bigint(8)
# about_id :bigint(8)
# text :text
# approved :boolean default(FALSE)
# created_at :datetime not null
# updated_at :datetime not null
#
class Use... |
AssociationPaupiette/paupiette | db/migrate/20181120163937_create_user_reviews.rb | <reponame>AssociationPaupiette/paupiette
class CreateUserReviews < ActiveRecord::Migration[5.2]
def change
create_table :user_reviews do |t|
t.references :from, foreign_key: {to_table: :users}
t.references :about, foreign_key: {to_table: :users}
t.text :text
t.boolean :approved, default: f... |
AssociationPaupiette/paupiette | app/controllers/preregistrations_controller.rb | class PreregistrationsController < ApplicationController
def create
@preregistration = Preregistration.new preregistration_params
if @preregistration.save
flash[:notice] = 'Votre préinscription est enregistrée'
else
flash[:warning] = 'Problème: votre préinscription n\'a pas pu être enregistrée... |
AssociationPaupiette/paupiette | app/controllers/my_cities/reviews_controller.rb | <gh_stars>0
class MyCities::ReviewsController < MyCities::ApplicationController
def index
@reviews = @city.reviews.page params[:page]
add_breadcrumb t('my_cities.reviews.name')
end
def approval
@reviews = @city.reviews.unapproved.page params[:page]
add_breadcrumb t('my_cities.reviews.to_approve')... |
AssociationPaupiette/paupiette | app/controllers/my/messages_controller.rb | class My::MessagesController < My::ApplicationController
add_breadcrumb I18n.t('my.messages.name'), :my_messages_path
def index
@conversations = current_user.conversations
end
def user
@user = User.find_by(slug: params[:user_slug])
@conversation = Conversation.between(current_user, @user)
@con... |
AssociationPaupiette/paupiette | app/helpers/dashboard/messages_helper.rb | <gh_stars>0
module Dashboard::MessagesHelper
end
|
AssociationPaupiette/paupiette | db/migrate/20181123104922_refactor_meals.rb | <filename>db/migrate/20181123104922_refactor_meals.rb
class RefactorMeals < ActiveRecord::Migration[5.2]
def change
add_column :meals, :confirmed, :integer, default: 1
add_column :meals, :remaining, :integer
end
end
|
AssociationPaupiette/paupiette | lib/tasks/legacy.rake | require 'csv'
class Cities
LIST = ['Paris','Bordeaux','Quimper','Marseille','Lyon','Toulouse','Nice','Nantes','Strasbourg','Montpellier','Lille','Rennes','Reims', 'Le Havre''Saint Étienne','Toulon','Grenoble','Dijon','Angers','Brest','Le Mans','Nîmes','Aix en Provence','<NAME>','Limoges','Tours','Amiens','Villeurban... |
AssociationPaupiette/paupiette | app/controllers/application_controller.rb | class ApplicationController < ActionController::Base
include DevisePermittedParams
add_breadcrumb 'Paupiette', :root_path
end
|
AssociationPaupiette/paupiette | app/models/preregistration.rb | <filename>app/models/preregistration.rb<gh_stars>0
# == Schema Information
#
# Table name: preregistrations
#
# id :bigint(8) not null, primary key
# first_name :string
# email :string
# city_id :bigint(8)
# created_at :datetime not null
# updated_at :datetime not null
#
cl... |
AssociationPaupiette/paupiette | test/mailers/previews/message_received_mailer_preview.rb | # Preview all emails at http://localhost:3000/rails/mailers/message_received_mailer
class MessageReceivedMailerPreview < ActionMailer::Preview
end
|
AssociationPaupiette/paupiette | app/models/user.rb | <reponame>AssociationPaupiette/paupiette
# == Schema Information
#
# Table name: users
#
# id :bigint(8) not null, primary key
# email :string default(""), not null
# encrypted_password :string default(""), not null
# reset_password_token :string... |
AssociationPaupiette/paupiette | app/controllers/ambassadors_controller.rb | class AmbassadorsController < ApplicationController
add_breadcrumb 'Ambassadeurs'
def index
@users = User.ambassadors.page params[:page]
end
end
|
AssociationPaupiette/paupiette | config/routes.rb | <reponame>AssociationPaupiette/paupiette<filename>config/routes.rb
Rails.application.routes.draw do
devise_for :users
namespace 'admin' do
resources 'ambassadorships'
resources 'cities' do
member do
get 'ambassadors'
get 'guests'
get 'hosts'
get 'preregistrations'
... |
AssociationPaupiette/paupiette | app/models/city.rb | # == Schema Information
#
# Table name: cities
#
# id :bigint(8) not null, primary key
# name :string
# created_at :datetime not null
# updated_at :datetime not null
# active :boolean default(FALSE)
# slug :string default(""), not null
# latitude ... |
AssociationPaupiette/paupiette | app/helpers/dashboard/application_helper.rb | <gh_stars>0
module Dashboard::ApplicationHelper
end
|
AssociationPaupiette/paupiette | app/controllers/my/dashboard_controller.rb | class My::DashboardController < My::ApplicationController
def index
end
end |
AssociationPaupiette/paupiette | app/controllers/admin/application_controller.rb | class Admin::ApplicationController < ApplicationController
before_action :authenticate_user!
layout 'admin/layouts/application'
add_breadcrumb 'Admin', :admin_root_path
rescue_from CanCan::AccessDenied do |exception|
render file: "#{Rails.root}/public/403", formats: [:html], status: 403, layout: false
... |
AssociationPaupiette/paupiette | db/migrate/20181113084330_add_lat_long_to_city.rb | class AddLatLongToCity < ActiveRecord::Migration[5.2]
def change
add_column :cities, :latitude, :float
add_column :cities, :longitude, :float
end
end
|
AssociationPaupiette/paupiette | app/controllers/admin/cities_controller.rb | <gh_stars>0
class Admin::CitiesController < Admin::ApplicationController
load_and_authorize_resource
add_breadcrumb 'Villes', :admin_cities_path
def index
@cities = City.all
end
def new
@city = City.new
add_breadcrumb 'Nouvelle ville'
end
def show
add_breadcrumb @city
end
def prer... |
AssociationPaupiette/paupiette | db/migrate/20181026095233_add_city_ref_to_users.rb | <reponame>AssociationPaupiette/paupiette
class AddCityRefToUsers < ActiveRecord::Migration[5.2]
def change
add_reference :users, :city, foreign_key: true
end
end
|
AssociationPaupiette/paupiette | app/controllers/my_cities/users_controller.rb | class MyCities::UsersController < MyCities::ApplicationController
def index
@users = @city.users.guests.page params[:page]
add_breadcrumb t('my_cities.users.guests')
end
def hosts
@users = @city.users.hosts.page params[:page]
add_breadcrumb t('my_cities.users.hosts')
end
def approval
@u... |
AssociationPaupiette/paupiette | app/helpers/dashboard/profile_helper.rb | module Dashboard::ProfileHelper
end
|
AssociationPaupiette/paupiette | app/models/message.rb | # == Schema Information
#
# Table name: messages
#
# id :bigint(8) not null, primary key
# from_id :bigint(8)
# content :text
# read_at :datetime
# created_at :datetime not null
# updated_at :datetime not null
# conversation_id :integer
#
cla... |
AssociationPaupiette/paupiette | app/controllers/my/application_controller.rb | class My::ApplicationController < ApplicationController
add_breadcrumb I18n.t('my.name'), :my_root_path
before_action :authenticate_user!
end
|
SLP-KBIT/LinkUS | app/models/group.rb | # == Schema Information
#
# Table name: groups
#
# id :integer not null, primary key
# name :string
# created_at :datetime not null
# updated_at :datetime not null
#
class Group < ActiveRecord::Base
has_many :group_users
has_many :users, through: :group_users
validates... |
SLP-KBIT/LinkUS | db/schema.rb | <gh_stars>1-10
# encoding: UTF-8
# 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.
#
# Note that this schema.rb definition is the au... |
SLP-KBIT/LinkUS | config/deploy/production.rb | set :stage, :production
set :branch, 'master'
set :rails_env, 'production'
set :migration_role, 'db'
set :deploy_to, '/home/app/UnivWare/linkus'
server 'c4', user: ENV['PRODUCTION_USER'], roles: %w(web app db)
set :ssh_options, {
keys: [File.expand_path('~/.ssh/id_rsa')],
forward_agent: true,
auth_methods: %w(p... |
SLP-KBIT/LinkUS | app/api/linkus/api.rb | <filename>app/api/linkus/api.rb
module Linkus
require 'v1/base'
class API < Grape::API
logger = Logger.new GrapeLogging::MultiIO.new(STDOUT, File.open('log/grape.log', 'a')), 'daily'
logger.formatter = GrapeLogging::Formatters::Default.new
use GrapeLogging::Middleware::RequestLogger, logger: logger
... |
SLP-KBIT/LinkUS | app/decorators/group_user_decorator.rb | <filename>app/decorators/group_user_decorator.rb<gh_stars>1-10
class GroupUserDecorator < Draper::Decorator
delegate_all
def name_and_position
"#{object.group.name}(#{GroupUser::POSITION[object.position]})"
end
end
|
SLP-KBIT/LinkUS | config.ru | require 'unicorn/worker_killer'
use Unicorn::WorkerKiller::MaxRequests, 3072, 4096
use Unicorn::WorkerKiller::Oom, (192 * (1024**2)), (256 * (1024**2))
require ::File.expand_path('../config/environment', __FILE__)
if ENV['RAILS_RELATIVE_URL_ROOT']
map ENV['RAILS_RELATIVE_URL_ROOT'] do
run Rails.application
end... |
SLP-KBIT/LinkUS | config/routes.rb | <filename>config/routes.rb
Rails.application.routes.draw do
use_doorkeeper
mount Linkus::API => '/api'
devise_for :users, controllers: {
omniauth_callbacks: 'users/omniauth_callbacks'
}
root 'users#index'
resources :users
namespace :admin do
resources :users, except: [:new, :create] do
post... |
SLP-KBIT/LinkUS | app/models/user.rb | <gh_stars>1-10
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# email :string default(""), not null
# encrypted_password :string default(""), not null
# remember_created_at :datetime
# sign_in_count :integer ... |
SLP-KBIT/LinkUS | app/api/linkus/v1/users.rb | module Linkus::V1
class Users < Grape::API
resource :users do
desc 'get user information'
get 'me' do
current_resource_owner.schema
end
end
end
end
|
SLP-KBIT/LinkUS | config/deploy.rb | # config valid only for current version of Capistrano
lock '3.4.0'
set :application, 'linkus'
set :repo_url, 'https://github.com/SLP-KBIT/linkus.git'
set :scm, :git
set :format, :pretty
set :log_level, :debug
set :pty, true
set :linked_files, fetch(:linked_files, []).push('.env')
set :linked_dirs, fetch(:linked_dirs,... |
SLP-KBIT/LinkUS | app/controllers/users_controller.rb | <reponame>SLP-KBIT/LinkUS<gh_stars>1-10
class UsersController < ApplicationController
before_action :authenticate_user!
before_action :verified_user!
def index
@search = User.ransack(params[:q])
@users = @search.result.page(params[:page]).per(20)
end
def edit
end
end
|
SLP-KBIT/LinkUS | config/deploy/staging.rb | set :stage, :production
set :branch, 'master'
set :rails_env, 'production'
set :migration_role, 'db'
set :deploy_to, '/home/rails/deploy/linkus'
server 'linkus_staging', user: 'rails', roles: %w(web app db)
set :ssh_options, {
keys: [File.expand_path('~/.ssh/id_rsa')],
forward_agent: true,
auth_methods: %w(publ... |
SLP-KBIT/LinkUS | spec/spec_helper.rb | <gh_stars>1-10
require 'codeclimate-test-reporter'
CodeClimate::TestReporter.start
require 'active_record'
require 'factory_girl_rails'
require 'database_cleaner'
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end... |
SLP-KBIT/LinkUS | app/models/white_list.rb | <reponame>SLP-KBIT/LinkUS
# == Schema Information
#
# Table name: white_lists
#
# id :integer not null, primary key
# email :string not null
# active :boolean default(TRUE), not null
# created_at :datetime not null
# updated_at :datetime not null
#
clas... |
SLP-KBIT/LinkUS | app/controllers/users/omniauth_callbacks_controller.rb | <reponame>SLP-KBIT/LinkUS
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
def google_oauth2
@user = User.find_for_google_oauth2(request.env['omniauth.auth'])
if @user.persisted?
flash[:notice] = I18n.t 'devise.omniauth_callbacks.success', kind: 'Google'
if session[:... |
SLP-KBIT/LinkUS | app/models/group_user.rb | <filename>app/models/group_user.rb
# == Schema Information
#
# Table name: group_users
#
# id :integer not null, primary key
# user_id :integer
# group_id :integer
# position :integer
# created_at :datetime not null
# updated_at :datetime not null
#
class GroupUser < Activ... |
SLP-KBIT/LinkUS | db/seeds.rb | <filename>db/seeds.rb
%w(CEM ETR GMV WSP).each do |group|
Group.create(name: group)
end
|
SLP-KBIT/LinkUS | app/decorators/user_decorator.rb | class UserDecorator < Draper::Decorator
delegate_all
def last_sign_in_at
return '未ログイン' unless object.last_sign_in_at
object.last_sign_in_at.strftime('%Y/%m/%d %H:%M')
end
def laboratory
User::LABORATORY[object.laboratory]
end
def position
User::POSITION[object.position]
end
end
|
SLP-KBIT/LinkUS | db/migrate/20150718005838_create_group_users.rb | <filename>db/migrate/20150718005838_create_group_users.rb
class CreateGroupUsers < ActiveRecord::Migration
def change
create_table :group_users do |t|
t.integer :user_id
t.integer :group_id
t.integer :position
t.timestamps null: false
end
add_index :group_users, :user_id
add_i... |
SLP-KBIT/LinkUS | app/api/linkus/v1/base.rb | require 'doorkeeper/grape/helpers'
module Linkus::V1
class Base < Grape::API
version 'v1', using: :path
format :json
helpers Doorkeeper::Grape::Helpers
before do
doorkeeper_authorize!
end
helpers do
def current_resource_owner
User.find_by(id: doorkeeper_token.resource_o... |
SLP-KBIT/LinkUS | config/application.rb | <gh_stars>1-10
require File.expand_path('../boot', __FILE__)
require 'rails'
require 'active_model/railtie'
require 'active_job/railtie'
require 'active_record/railtie'
require 'action_controller/railtie'
require 'action_mailer/railtie'
require 'action_view/railtie'
require 'sprockets/railtie'
Bundler.require(*Rails.... |
SLP-KBIT/LinkUS | config/unicorn/production.rb | app_path = '/home/app/UnivWare/linkus'
app_shared_path = "#{app_path}/shared"
worker_processes 3
working_directory "#{app_path}/current"
listen "#{app_shared_path}/tmp/sockets/unicorn.sock"
stdout_path "#{app_shared_path}/log/unicorn.stdout.log"
stderr_path "#{app_shared_path}/log/unicorn.stderr.log"
pid "#{app_sh... |
SLP-KBIT/LinkUS | app/controllers/admin/users_controller.rb | class Admin::UsersController < ApplicationController
before_action :authenticate_user!
before_action :admin_user!
before_action :load_user, except: [:index, :new, :create]
def index
@search = User.search(params[:q])
@users = @search.result.page(params[:page]).per(20)
end
def edit
render :show_... |
composetools/Compose | Compose.podspec | <reponame>composetools/Compose
Pod::Spec.new do |s|
s.name = 'Compose'
s.version = '1.0'
s.summary = 'Compose is a library that helps you compose complex and dynamic views.'
s.description = <<-DESC
Compose is a data-driven library that will help encaps... |
BorisDuan/BLBaseUtils | BLBaseUtils.podspec | #
# Be sure to run `pod lib lint BLBaseUtils.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'BLBaseU... |
zpx2012/zeek_3.0.8 | aux/zeek-aux/devel-tools/gen-mozilla-ca-list.rb | <reponame>zpx2012/zeek_3.0.8
#!/usr/bin/env ruby
tmpcert = "/tmp/tmpcert.der"
incert=false
intrust=false
if ARGV.length != 1
abort "\nPass path to the certdata.txt you want to add as first input argument to this script\n\n"+
"certdata.txt can be retrieved from the newest NSS release."
end
url = 'http://mxr.mo... |
fercreek/humanize | lib/humanize/locales/jp.rb | <reponame>fercreek/humanize
require_relative 'constants/jp'
module Humanize
class Jp
def humanize(number)
iteration = 0
parts = []
until number.zero?
number, remainder = number.divmod(10000)
unless remainder.zero?
add_grouping(parts, iteration)
parts << SUB_O... |
iuriivolochai/ios-app | Scripts/gen_loc_keys.rb | source_file_path = './TokenDWalletTemplate/Resources/Base.lproj/Localizable.strings'
target_file_path = './TokenDWalletTemplate/Sources/LocKey.swift'
source_content = File.read(source_file_path)
source_content.encode!('UTF-16', undef: :replace, invalid: :replace, replace: '')
source_content.encode!('UTF-8')
source_c... |
raepad/Restaurant_CLI | lib/Restaurant_CLI.rb | <filename>lib/Restaurant_CLI.rb
require "Restaurant_CLI/version"
module RestaurantCLI
class Error < StandardError; end
# Your code goes here...
end
|
alphagov-mirror/omniauth-gds | lib/omniauth-gds.rb | <reponame>alphagov-mirror/omniauth-gds
require "omniauth-gds/version"
require "omniauth/strategies/gds"
|
alphagov-mirror/omniauth-gds | lib/omniauth/strategies/gds.rb | <reponame>alphagov-mirror/omniauth-gds<gh_stars>1-10
require 'omniauth-oauth2'
require 'multi_json'
class OmniAuth::Strategies::Gds < OmniAuth::Strategies::OAuth2
uid { user['uid'] }
info do
{
name: user['name'],
email: user['email']
}
end
extra do
{
user: user,
permission... |
alphagov-mirror/omniauth-gds | lib/omniauth-gds/version.rb | <reponame>alphagov-mirror/omniauth-gds
module Omniauth
module Gds
VERSION = "3.2.1"
end
end
|
mjobin-mdsol/faraday-http-cache | spec/request_spec.rb | <reponame>mjobin-mdsol/faraday-http-cache
# frozen_string_literal: true
require 'spec_helper'
describe Faraday::HttpCache::Request do
subject { Faraday::HttpCache::Request.new method: method, url: url, headers: headers }
let(:method) { :get }
let(:url) { URI.parse('http://example.com/path/to/somewhere') }
let(... |
mjobin-mdsol/faraday-http-cache | lib/faraday/http_cache/cache_control.rb | # frozen_string_literal: true
module Faraday
class HttpCache < Faraday::Middleware
# Internal: A class to represent the 'Cache-Control' header options.
# This implementation is based on 'rack-cache' internals by <NAME>.
# It breaks the several directives into keys/values and stores them into
# a Hash.... |
mjobin-mdsol/faraday-http-cache | spec/binary_spec.rb | <reponame>mjobin-mdsol/faraday-http-cache<filename>spec/binary_spec.rb
# frozen_string_literal: true
require 'spec_helper'
describe Faraday::HttpCache do
let(:client) do
Faraday.new(url: ENV['FARADAY_SERVER']) do |stack|
stack.use :http_cache, serializer: Marshal
adapter = ENV['FARADAY_ADAPTER']
... |
mjobin-mdsol/faraday-http-cache | lib/faraday-http-cache.rb | <filename>lib/faraday-http-cache.rb
require 'faraday/http_cache'
|
mjobin-mdsol/faraday-http-cache | spec/instrumentation_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'active_support'
require 'active_support/notifications'
describe 'Instrumentation' do
let(:backend) { Faraday::Adapter::Test::Stubs.new }
let(:client) do
Faraday.new do |stack|
stack.use Faraday::HttpCache, instrumenter: ActiveSupport::Notifica... |
mjobin-mdsol/faraday-http-cache | spec/spec_helper.rb | # frozen_string_literal: true
require 'uri'
require 'socket'
require 'faraday-http-cache'
require 'faraday_middleware'
# https://github.com/rails/rails/pull/14667
require 'active_support/per_thread_registry'
require 'active_support/cache'
require 'support/test_app'
require 'support/test_server'
server = TestServer.... |
mjobin-mdsol/faraday-http-cache | spec/validation_spec.rb | <gh_stars>10-100
# frozen_string_literal: true
require 'spec_helper'
describe Faraday::HttpCache do
let(:backend) { Faraday::Adapter::Test::Stubs.new }
let(:client) do
Faraday.new(url: ENV['FARADAY_SERVER']) do |stack|
stack.use Faraday::HttpCache
stack.adapter :test, backend
end
end
it '... |
mjobin-mdsol/faraday-http-cache | spec/cache_control_spec.rb | <gh_stars>10-100
# frozen_string_literal: true
require 'spec_helper'
describe Faraday::HttpCache::CacheControl do
it 'takes a String with multiple name=value pairs' do
cache_control = Faraday::HttpCache::CacheControl.new('max-age=600, max-stale=300, min-fresh=570')
expect(cache_control.max_age).to eq(600)
... |
mjobin-mdsol/faraday-http-cache | examples/parallel.rb | require 'rubygems'
require 'bundler/setup'
require 'faraday/http_cache'
require 'active_support/logger'
require 'em-http-request'
client = Faraday.new('https://api.github.com') do |stack|
stack.use :http_cache, logger: ActiveSupport::Logger.new(STDOUT)
stack.adapter :em_http
end
2.times do
started = Time.now
... |
k-o-d-e-n/ScreenUI | ScreenUI.podspec | <gh_stars>1-10
#
# Be sure to run `pod lib lint ScreenUI.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name ... |
jonny-rawlin/movie-maker | app/controllers/directors_controller.rb | class DirectorsController < ApplicationController
# GET: /directors
get "/directors" do
@directors = Director.all
erb :"/directors/index.html"
end
# GET: /directors/new
get "/directors/new" do
erb :"/directors/new.html"
end
# POST: /directors
post "/directors" do
director = Director.n... |
jonny-rawlin/movie-maker | app/controllers/movies_controller.rb | <reponame>jonny-rawlin/movie-maker<gh_stars>0
class MoviesController < ApplicationController
# GET: /movies
get "/movies" do
@movies = Movie.all
erb :"/movies/index.html"
end
# GET: /movies/new
get "/movies/new" do
erb :"/movies/new.html"
end
# POST: /movies
post "/movies" do
@movie =... |
jonny-rawlin/movie-maker | app/models/movie.rb | class Movie < ActiveRecord::Base
has_many :actors
belongs_to :director
end
|
jonny-rawlin/movie-maker | app/controllers/actors_controller.rb | class ActorsController < ApplicationController
# GET: /actors
get "/actors" do
@actors = Actor.all
erb :"/actors/index.html"
end
# GET: /actors/new
get "/actors/new" do
erb :"/actors/new.html"
end
# POST: /actors
post "/actors" do
actor = Actor.new(name: params[:actor][:name], age: pa... |
aks/validate_suffixed_number | lib/validate_suffixed_number.rb | # frozen_string_literal: true
# Class to parse and validate suffixed numbers.
class ValidateSuffixedNumber
# methods for validating strings as optionally suffixed numbers (floats or integers)
SI_MULTIPLIERS = {
'hundred': 10**2,
'thousand': 10**3, 'K': 10**3, # kilo
'million': ... |
aks/validate_suffixed_number | spec/spec_helper.rb | <filename>spec/spec_helper.rb
# spec_helper.rb
$LOAD_PATH << File.join(__dir__, '..', 'lib')
require 'validate_suffixed_number'
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.