Skip to content

Instantly share code, notes, and snippets.

View almaron's full-sized avatar

Ilya Levin almaron

View GitHub Profile
# frozen_string_literal: true
namespace :db do
desc 'Also create shared_extensions Schema'
task extensions: :environment do
# Create Schema
ActiveRecord::Base.connection.execute 'CREATE SCHEMA IF NOT EXISTS shared_extensions;'
# Enable Hstore
ActiveRecord::Base.connection.execute 'CREATE EXTENSION IF NOT EXISTS HSTORE SCHEMA shared_extensions;'
# Enable UUID-OSSP
.use-docker: &use-docker
image: docker:latest
variables:
DOCKER_DRIVER: overlay
services:
- docker:dind
before_script:
- docker login -u $CI_BUILD_USER -p $CI_BUILD_TOKEN registry.gitlab.com
- echo $CI_BUILD_REF >> REVISION
def show
topic_ids = if (read = ForumTopicRead.find_by(user_id: current_user.id, forum_topic_id: 0))
ForumTopic.unscoped.joins("LEFT JOIN forum_topic_reads ON forum_topic_reads.forum_topic_id = forum_topics.id AND forum_topic_reads.user_id = #{current_user.id}").where(forum_id: params[:id]).where('forum_topics.last_post_at > ?', read.updated_at).group('forum_topics.id').having('count(forum_topic_reads.id) < 1').pluck(:id)
else
ForumTopic.unscoped.joins("LEFT JOIN forum_topic_reads ON forum_topic_reads.forum_topic_id = forum_topics.id AND forum_topic_reads.user_id = #{current_user.id}").where(forum_id: params[:id]).group('forum_topics.id').having('count(forum_topic_reads.id) < 1').pluck(:id)
end
render json: topic_ids
end
Arahsi Tiba
Cерафима
Silvio Silvestri
Takashi Fudo
Uni
Vane
Zheng Tong
Аанг
Абу - Аслан
Азула
@app.service "ngTableService", ["$filter", "$http", ($filter, $http) ->
filterData = (data, filter) ->
$filter('filter')(data, filter)
orderData = (data, params) ->
(if params.sorting() then $filter("orderBy")(data, params.orderBy()) else filteredData)
sliceData = (data, params) ->
data.slice (params.page() - 1) * params.count(), params.page() * params.count()
Акацуки Мэй
Алексис Виталина Блэквич
Корра
Максим Шпорт
Шоно Дава
Aleksandr
Alennora
Arsenic
Ayrin
Bright Lizavetta
def parse_row(row1='', row2='')
map = []
map += [JSON.parse(row1)].flatten
map += [JSON.parse(row2)].flatten
map
resque JSON::ParserError
[]
end
if @topic.links.detect{|l| l.rel_url == rel_url(params)}.state == 'redirect'
redirect_to @topic.links.detect{|l| l.state == 'main'}.rel_url, status: :moved_permanently
end
<h1><%= @article.head %></hi>
<div class="body">
<%= simple_format @article.body %>
</div>
<h1>Articles</h1>
<ul>
<% articles.each do |article| %>
<li><%= link_to article.head, article %></li>
<% end %>
</ul>