Skip to content

Instantly share code, notes, and snippets.

View davinmsu's full-sized avatar
🐖
Thinking about old friends

Ivan Dashkevich davinmsu

🐖
Thinking about old friends
View GitHub Profile
class Setting < ActiveRecord::Base
enum type: {integer: 0, string: 1, storage: 2}
enum_features :type
store :value, coder: JSON
after_find :match_types
before_save :save_types
validates :value, numericality: { only_integer: true }, if: 'integer?'
validates :title, uniqueness: true
class Order < ActiveRecord::Base
belongs_to :user
has_many :processed_orders
has_many :operations
has_many :documents, as: :reference
include HTTParty
base_uri ENV['VK_API_HOST']
enum type: {
h1 Мой блог
.posts
.post
time.teaser
/todo пофиксить на publish_date
p.date = @post.created_at.strftime('%d')
p.month = @post.created_at.strftime('%b')
= image_tag(@post.photos.first.content.url(:blog_index), class: 'teaser') unless @post.photos.empty?
h1 style="#{(@post.photos.empty?)? 'margin-left: 0px;' : ''}"
= link_to @post.title, user_post_path(user_id: @post.user_id, id: @post.id)
@davinmsu
davinmsu / main.css.scss
Created June 13, 2014 20:03
Гист для Жени
#sb {
display: block;
width: 200px;
height: 50px;
border-radius: 4px;
background: $blue;
text-decoration: none;
text-transform: uppercase;
font-family: 'Microsoft Sans Serif', Tahoma, Arial, Verdana, Sans-Serif;
border: 1px solid $blue;
module Spree
module Core
# THIS FILE SHOULD BE OVER-RIDDEN IN YOUR SITE EXTENSION!
# the exact code probably won't be useful, though you're welcome to modify and reuse
# the current contents are mainly for testing and documentation
# To override this file...
# 1) Make a copy of it in your sites local /lib/spree folder
# 2) Add it to the config load path, or require it in an initializer, e.g...
#
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
- offers.each do |offer|
.offer data-id="#{offer.id}" data-hidden="#{offer.hidden?}"
.hidden-title = offer.hiddenTitle
.offer-type class="#{offer.type.class}" = t(offer.type.title)
// реализация интернационализации t()
.imgWrapper data-gallery="#{offer.gallery}" data-rotate="#{offer.rotate?}" data-video="#{offer.video.count if offer.video.exists?}"
.slider
- if offer.images.empty?
.no-image
- else
- offers.each do |offer|
.offer data-id="#{offer.id}" data-hidden="#{offer.hidden?}" data-url="#{offer.url if offer.mainBlockClickable?}"
.hidden-title = offer.hiddenTitle
.offer-type class="#{offer.type.class}" = t(offer.type.title)
// реализация интернационализации t()
.imgWrapper data-gallery="#{offer.gallery}" data-rotate="#{offer.rotate?}" data-video="#{offer.video.count if offer.video.exists?}"
.slider
- if offer.images.empty?
.no-image
- else
@import 'normalize';
@import 'fonts';
@mixin clearfix {
&:after {
content: "";
display: table;
clear: both;
}
################################
### Классический REST запрос
################################
# запрос на получение объекта типа 'post' с уникальным идентификатором 123
'http://backend.url/posts/123'
# ответ, содержащий структурированную информацию по запросу:
# title - заголовок новости