View apartment.rake
# 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
View gist:cbb0f987988c082e2f34565f98b01b71
.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
View controller.rb
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
View gist:785d0e7618b8e7ef2225
Arahsi Tiba
Cерафима
Silvio Silvestri
Takashi Fudo
Uni
Vane
Zheng Tong
Аанг
Абу - Аслан
Азула
View ngTableService.coffee
@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()
View gist:d4545c7415dd88d806b0
Акацуки Мэй
Алексис Виталина Блэквич
Корра
Максим Шпорт
Шоно Дава
Aleksandr
Alennora
Arsenic
Ayrin
Bright Lizavetta
View gist:8d499e13abf83834c4d2
def parse_row(row1='', row2='')
map = []
map += [JSON.parse(row1)].flatten
map += [JSON.parse(row2)].flatten
map
resque JSON::ParserError
[]
end
View gist:afc6b6033d4da80bc48d
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
View gist:23b96bae8e898fc68d37
<h1><%= @article.head %></hi>
<div class="body">
<%= simple_format @article.body %>
</div>
View gist:30191c6add59347bcf79
<h1>Articles</h1>
<ul>
<% articles.each do |article| %>
<li><%= link_to article.head, article %></li>
<% end %>
</ul>