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 / 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
#
# 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 / 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 - текст
*/
@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 / 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 / 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 / index.rb
Created June 8, 2017 09:22
Страница reviews/_index.html.erb
<% if @reviews.blank? %>
<span class="center"><h4>У этого курса пока нет отзывов</h4></span>
<% end %>
<% @reviews.order("id desc").each do |r| %>
<hr>
<div class="row">
<div class="col m1">
<%= image_tag avatar_url(r.user), class: "circle responsive-img avatar-small" %>
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
<div class="card-action grey-text text-darken-4">
<form action="#">
<div class="file-field input-field">
<div class="btn">
<span>Сдать отчет</span>
<input type="file" multiple>
</div>
<div class="file-path-wrapper">
<%= form_tag.file_field :reports, :class=>"file-path validate", :placeholder => "Загрузите один или более файлов", multiple: true %>
</div>
@Nursultan91
Nursultan91 / maigraciya.rb
Created May 18, 2017 07:14
Не хочет принимать миграцию.
class CreateTaskstatuses < ActiveRecord::Migration
def change
create_table :taskstatuses do |t|
t.reference :user
t.reference :task
t.string :task_status
t.timestamps null: false
end