This file contains hidden or 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
$("html, body").animate({ scrollTop: %%% }); |
This file contains hidden or 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
CSS: | |
1) css3 arrow http://cssarrowplease.com/ |
This file contains hidden or 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
$screen-xs-min: 480px; // Tiny screen / phone | |
$screen-sm-min: 768px; // Small screen / tablet | |
$screen-md-min: 992px; // Medium screen / desktop | |
$screen-lg-min: 1200px; // Large screen / wide desktop | |
// So media queries don't overlap when required, provide a maximum | |
$screen-xs-max: ($screen-sm-min - 1); | |
$screen-sm-max: ($screen-md-min - 1); | |
$screen-md-max: ($screen-lg-min - 1); |
This file contains hidden or 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 DesignersController < ApplicationController | |
include PublicHelper | |
include SizeChange | |
load_and_authorize_resource | |
before_action :load_size | |
def index | |
@designers = @designers.main.visible.includes(:favorites).order('LOWER(title) ASC') | |
end |
This file contains hidden or 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 Reception < ActiveRecord::Base | |
STATES = ['processing', 'refused', 'finished'] | |
belongs_to :user | |
has_many :comments, as: :commentable, dependent: :destroy | |
has_many :reception_items, inverse_of: :reception, dependent: :destroy | |
accepts_nested_attributes_for :reception_items | |
# TODO: remove this when reception form will be finished | |
attr_accessor :name |
This file contains hidden or 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
module OrderedSelect | |
extend ActiveSupport::Concern | |
included do | |
def self.ordered_list(ids) | |
ids_list = ids.to_s.split(',').select(&:present?) | |
self.where(id: ids_list).order(ids_list.reverse.map { |id| "#{self.table_name}.id = #{id}" }.join(", ")) | |
end | |
def self.unordered_list(ids) |
This file contains hidden or 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 Gift < ActiveRecord::Base | |
include PgSearch | |
pg_search_scope :search_title, :against => [:title] | |
has_many :gift_markets, dependent: :destroy | |
accepts_nested_attributes_for :gift_markets, reject_if: :all_blank, allow_destroy: true | |
has_one :min_gift_markets, -> { order('gift_markets.price') }, class_name: 'GiftMarket' | |
has_many :gift_params, dependent: :destroy |
This file contains hidden or 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
getExtension = (filename) -> | |
parts = filename.split('.') | |
parts[parts.length - 1] | |
isImage = (filename) -> | |
ext = getExtension(filename) | |
$.inArray(ext.toLowerCase(), ['jpg', 'jpeg', 'gif', 'bmp', 'png']) > -1 | |
validation_errors = -> |
This file contains hidden or 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://inorganik.github.io/countUp.js/ | |
http://aishek.github.io/jquery-animateNumber/ |
This file contains hidden or 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
module SampleForOrder | |
def create_order_status_history | |
order = current_user.has_role?(:guide) ? @order : @application | |
OrderStatusHistory.create!({ | |
user_id: current_user.id, | |
order_id: order.id, | |
status: Order.statuses[order.status] | |
}) | |
end |
OlderNewer