Skip to content

Instantly share code, notes, and snippets.

- content_for :title do
- if params[:user_id]
Hungry Shark - ресурс для молодых и предприимчивых | Материалы от автора #{params[:user_id]}
- else
Hungry Shark - ресурс для молодых и предприимчивых
- content_for :events_block do
- unless Article.actual_events.size == 0
.events_block.regular_block
.rubric
!!!
%html
%head
%meta{ :charset => "utf-8" }/
%title= yield(:title)
- if controller_name == 'articles' && action_name == 'show'
= yield(:meta_tags)
= stylesheet_link_tag "application", :media => "all"
= javascript_include_tag 'http://vkontakte.ru/js/api/share.js?10'
= javascript_include_tag 'http://userapi.com/js/api/openapi.js?45'
#coding: utf-8
require 'xmlsimple'
require 'restclient'
class Wiki
attr_reader :url
def initialize(search)
@url = url_for(search)
module Translator
extend self
URL = "top secret"
PARTS_OF_SPEECH = %w(noun verb adjective article pronoun conjunction preposition)
def fetch(word)
formatted (JSON (with_encoding_for (translated (URI.escape word))))
end
module LikesCounter
delegate :escape, to: URI
delegate :get, to: RestClient
def url
Rails.application.routes.url_helpers.article_url(self, host: 'hungryshark.ru')
end
def total_likes
class AddCommentsCountToArticles < ActiveRecord::Migration
def up
add_column :articles, :comments_count, :integer, null: false, default: 0
Article.reset_column_information
ids = Set.new
Article.all.each {|art| ids << art.id}
ids.each do |article_id|
Article.reset_counters(article_id, :comments)
end
end
rename table wp_posts to articles;
alter database wwwinfringerru_hungryshark character set utf8;
alter database wwwinfringerru_hungryshark character set utf8 collate utf8_general_ci;
alter table articles change ID id bigint(20);
alter table articles change post_content content text;
alter table articles change post_title title text;
alter table articles change title title varchar(255);
rename table wp_posts to articles;
alter database wwwinfringerru_hungryshark character set utf8;
alter database wwwinfringerru_hungryshark character set utf8 collate utf8_general_ci;
alter table articles change ID id bigint(20);
alter table articles change post_content content text;
alter table articles change post_title title text;
alter table articles change title title varchar(255);
class Show < ActiveRecord::Base
has_many :videos, inverse_of: :show
has_many :subscriptions
has_many :missing_episodes, dependent: :destroy
validates :name, uniqueness: true, presence: true
include Show::Details
include Show::ExternalData
#coding: utf-8
class Video < ActiveRecord::Base
mount_uploader :file, FileUploader
mount_uploader :subtitle, SubtitleUploader
belongs_to :show, inverse_of: :videos
has_many :user_subtitles
has_many :watched_episodes
has_many :users_who_watched, through: :watched_episodes, source: :user