This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git config --global user.name "Your Name" | |
git config --global user.email [email protected] | |
git remote add origin https://github.com/<username>/first_app.git # Добавление удалённого репозитория | |
git init | |
git add . | |
git commit -m "Initialize repository" | |
git push -u origin master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rails g model category name:string parent:references | |
class Category < ActiveRecord::Base | |
has_many :subcategories, :class_name => "Category", :foreign_key => "parent_id", :dependent => :destroy | |
belongs_to :parent_category, :class_name => "Category" | |
end | |
def index | |
@category = nil | |
@categories = Category.find(:all, :conditions => {:parent_id => nil } ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Контроллер | |
def update_service_types | |
@service_types = ServiceType.where("sto_category_id = ?", params[:sto_category_id]) | |
respond_to do |format| | |
format.js | |
end | |
end | |
#assets/js/autoservice.js.coffee | |
$ -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'devise' | |
rails generate devise:install | |
#config/environments/development.rb: | |
config.action_mailer.default_url_options = { :host => 'localhost:3000' } | |
rails generate devise:views | |
rails generate devise User | |
rake db:migrate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'will_paginate' | |
gem 'bootstrap-sass' | |
gem 'bootstrap-will_paginate' | |
.paginate(page: params[:page], per_page: 15).order('created_at ASC') | |
<div id="my-autoservices"> | |
<%= render @autoservices %> | |
</div> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'activeadmin', github: 'activeadmin' | |
gem 'devise' | |
gem 'cancan' # or cancancan | |
gem 'draper' | |
gem 'pundit' | |
rails g scaffold Product name price:decimal category:references | |
rails g scaffold Category name | |
rake db:migrate | |
Category.create name: "Книги" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://www.sitepoint.com/asynchronous-file-uploads-rails/ - dragonfly + ajax | |
https://github.com/markevans/dragonfly | |
http://markevans.github.io/dragonfly/rails/ | |
http://www.munocreative.com/nerd-notes/justpayme - paperclip | |
https://github.com/thoughtbot/paperclip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. парадокс перфекциониста | |
2. Сила воли Как развить и укрепить | |
3. Выйди из зоны комфорта. Измени свою жизнь | |
4. Психология убеждения |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysqldump db_name > backup-file.sql | |
mysql -u username -p database_name --force < file.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ParserController < ApplicationController | |
require 'open-uri' | |
require 'nokogiri' | |
require 'mechanize' | |
require 'thread' | |
require 'watir-webdriver' | |
def parse_sto | |
url = "file:///home/dima/Sites/sto_parser/%D0%A8%D0%B8%D0%BD%D1%8B,%20%D0%B4%D0%B8%D1%81%D0%BA%D0%B8%20%D0%BD%D0%B0%20%D0%B0%D0%B2%D1%82%D0%BE%20%D0%B2%20%D0%9C%D0%B8%D0%BD%D1%81%D0%BA%D0%B5.%20%D0%9C%D0%B0%D0%B3%D0%B0%D0%B7%D0%B8%D0%BD%D1%8B%20%D0%BF%D0%BE%20%D0%BF%D1%80%D0%BE%D0%B4%D0%B0%D0%B6%D0%B5%20%D1%88%D0%B8%D0%BD,%20%D0%BB%D0%B8%D1%82%D1%8B%D1%85%20%D0%B4%D0%B8%D1%81%D0%BA%D0%BE%D0%B2%20%D0%B2%20%D0%91%D0%B5%D0%BB%D0%B0%D1%80%D1%83%D1%81%D0%B8%20-%20%D0%9A%D0%B0%D1%82%D0%B0%D0%BB%D0%BE%D0%B3%20TUT.BY.html" |
OlderNewer