Skip to content

Instantly share code, notes, and snippets.

View gorborukov's full-sized avatar

Evgeny gorborukov

  • Krasnodar
View GitHub Profile
@gorborukov
gorborukov / gist:9079301
Created February 18, 2014 20:26
shotspace scroll events
$(function() {
$('#scroll').scroll(function(e)
{
var windowSize = $(window).width()
if($('.kinetic-active').scrollLeft()>windowSize)
{
console.log("scrolled to window width")
}
else
{
- if @photos.present?
%ul.cbp-rfgrid
= render :partial => 'photos'
.load_more
= link_to 'Показать больше фотографий', user_path(:page => @photos.next_page), :class => 'load-more-photos', :remote => true if @photos.next_page
- else
.scroll_dummy
%p Пока не загружено ни одной фотографии
- if @user == current_user
= link_to "Загрузить", user_upload_path, :class => 'btn btn-default btn-upload-empty'
@gorborukov
gorborukov / gist:9385691
Created March 6, 2014 08:57
CSV import to db
require ‘csv’
CSV.open(‘./public/cities.csv’, ‘r’).each do |row|
City.create(:field1 => row[0], :field2 => row[1])
end
@gorborukov
gorborukov / gist:9757594
Last active August 29, 2015 13:57
Nginx.conf for Unicorn
worker_processes 1;
user nobody nogroup;
pid /var/log/nginx/nginx.pid;
error_log /var/log/nginx/nginx.error.log;
events {
worker_connections 1024; # increase if you have lots of clients
accept_mutex off; # "on" if nginx worker_processes > 1
@gorborukov
gorborukov / gist:9757604
Created March 25, 2014 08:53
Unicorn Azure
# Sample verbose configuration file for Unicorn (not Rack)
#
# This configuration file documents many features of Unicorn
# that may not be needed for some applications. See
# http://unicorn.bogomips.org/examples/unicorn.conf.minimal.rb
# for a much simpler configuration file.
#
# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete
# documentation.
!!!
%html
%head
= metamagic :title, :description, :keywords
= stylesheet_link_tag "application", :media => "all"
= javascript_include_tag "application"
= csrf_meta_tags
%body
.update-message
.container
- meta :title => @tour.seo_title,
- :description => @tour.seo_description,
- :keywords => @tour.seo_keywords
.content
.tour_column
.tour_block
.blue
%h3
Тур «#{@tour.name}»
.resort
@gorborukov
gorborukov / print.css
Created May 28, 2014 14:57
/app/assets/stylesheets/morskoy/print.css
@media print {
* {
background: transparent !important;
color: #333 !important; /* Black prints faster: h5bp.com/s */
box-shadow: none !important;
text-shadow: none !important;
}
a,
a:visited {
@gorborukov
gorborukov / apartments_controller.rb
Last active August 29, 2015 14:01
/app/controllers/apartments_controller.rb & /app/views/layouts/print.html.erb & /app/config/routes.rb & /app/views/apartments/printable.html.erb
class ApartmentsController < ApplicationController
layout :choose_layout
def show
@building = Building.find params[:building_id]
@apartment = @building.apartments.find params[:id]
end
def printable
@building = Building.find params[:building_id]
@apartment = params[:apartment_id]
# заменяем в /app/views/common/_header.html.erb
<h1>
<%= link_to image_tag('/img/logo.png', :alt => 'Морской квартал'), root_path, :title => 'Морской квартал', :remote => true %>
</h1>
на
<h1 class="logo">
<%= link_to image_tag('/img/logo.png', :alt => 'Морской квартал'), root_path, :title => 'Морской квартал', :remote => true, :class => 'logo-main' %>
<%= link_to image_tag('/img/printlogo.png', :alt => 'Морской квартал'), root_path, :title => 'Морской квартал', :remote => true, :class => 'logo-printable' %>