Skip to content

Instantly share code, notes, and snippets.

View Nursultan91's full-sized avatar
🎯
Focusing

Nursultan Kuzhagaliyev Nursultan91

🎯
Focusing
  • Almaty, Kazakhstan
View GitHub Profile
@Nursultan91
Nursultan91 / user.rb
Created June 13, 2017 08:18
Описание файла путь к которому app/admin/user.rb (глянь в реппозитории, я тебя в коллабораторы добавлял)
ActiveAdmin.register User do
permit_params :email, :name, :paid, :user_id, :first_ip, :current_sign_in_ip, :password
member_action :reset_ip, method: :put do
resource.first_ip = resource.current_sign_in_ip
resource.save!
redirect_to resource_path, notice: "IP сброшен!"
end
@Nursultan91
Nursultan91 / registration_controller.rb
Created June 15, 2017 07:38
Вот мой контроллер где создаются юзеры
class Users::RegistrationsController < Devise::RegistrationsController
# before_action :configure_sign_up_params, only: [:create]
# before_action :configure_account_update_params, only: [:update]
# GET /resource/sign_up
# def new
# super
# end
# POST /resource
@Nursultan91
Nursultan91 / file.rb
Created June 27, 2017 09:21
Вот как выглядит код видео сейчас
<div id="wistia_<%= @task.video %>">
<% if @task.video.length > 10 %>
<iframe width="640" height="360" src="<%= @task.video %>" frameborder="0" allowfullscreen></iframe>
<% else %>
<iframe src="https://player.vimeo.com/video/<%= @task.video %>" width="640" height="360" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen>
<div class="">
<%= current_user.email %>
</div>
</iframe>
<% end %>
@Nursultan91
Nursultan91 / videosign.js
Created July 19, 2017 10:12
подгрузка изображения на 58 строке
/**
* Add signs to videos
* Фрейм с видео должен содержать класс "video--signed" и находиться в блоке контейнера ```<div class="video-container">```. При добавлении видео необходимо указать атрибут фрейма ```fs="0"```, чтобы не срабатывал полноэкранный режим фрейма.
* Параметры прописываются в виде data-* атрибутов фрейма с видео.
* Параметры:
* - data-sign-opacity - прозрачность от 0 до 1
* - data-sign-color - цвет в любом формате CSS
* - data-sign-font-size - размер шрифта
* - data-sign-text - текст
*/
#
# This file configures the New Relic Agent. New Relic monitors Ruby, Java,
# .NET, PHP, Python and Node applications with deep visibility and low
# overhead. For more information, visit www.newrelic.com.
#
# Generated August 17, 2017, for version 4.3.0.335
#
# For full documentation of agent configuration options, please refer to
# https://docs.newrelic.com/docs/agents/ruby-agent/installation-configuration/ruby-agent-configuration
@Nursultan91
Nursultan91 / paid_project.rb
Created September 26, 2017 08:20
если внести такие изменения то могут ли быть проблемы?
#То как все выглядит сейчас
ActiveAdmin.register PaidProject do
permit_params :user_id, :project_id
show do |t|
attributes_table do
row :user do
paid_project.user.name
end
row :project do
@Nursultan91
Nursultan91 / script.js
Created October 4, 2017 09:25
надо поправить код. Переключатель языков
<script type="text/javascript">
var platformLanguage = navigator && (
navigator.language ||
navigator.browserLanguage ||
navigator.systemLanguage ||
navigator.userLanguage ||
null ),
elemsRU, elemsUK, elemsKZ, elemsEN;
if (platformLanguage.match("ru") && document.getElementsByClassName) {
elemsRU = document.getElementsByClassName("b-text_lang_ru");
@Nursultan91
Nursultan91 / user.rb
Created October 18, 2017 14:14
Жалуется на 32 строку
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:confirmable, :omniauthable
validates :fullname, presence: true, length: {maximum: 50}
def self.from_omniauth(auth)
@Nursultan91
Nursultan91 / omniauth_callbacks_controller.rb
Created October 18, 2017 17:44
Может тут есть ошибка?
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
def facebook
# You need to implement the method below in your model (e.g. app/models/user.rb)
@user = User.from_omniauth(request.env["omniauth.auth"])
if @user.persisted?
sign_in_and_redirect @user, :event => :authentication #this will throw if @user is not activated
set_flash_message(:notice, :success, :kind => "Facebook") if is_navigational_format?
else
session["devise.facebook_data"] = request.env["omniauth.auth"]
@Nursultan91
Nursultan91 / database.yml
Created December 11, 2017 09:21
вот он
# PostgreSQL. Versions 9.1 and up are supported.
#
# Install the pg driver:
# gem install pg
# On OS X with Homebrew:
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config
# On OS X with MacPorts:
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
# On Windows:
# gem install pg