Skip to content

Instantly share code, notes, and snippets.

View moskvin's full-sized avatar

Nikolay Moskvin moskvin

View GitHub Profile
@moskvin
moskvin / setup_docker.sh
Last active October 1, 2018 09:00
Setup Docker for Ubuntu OS
true \
&& sudo apt-get update -qq \
&& sudo apt-get -qq -y install curl apt-transport-https ca-certificates software-properties-common \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - \
&& sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
&& sudo apt-get update -qq \
&& sudo apt-get install docker-ce \
&& sudo apt-get clean
# Install Docker Machine V0.15.0
# -*- coding: utf-8 -*-
require 'uri'
require 'addressable/uri'
module SiteUrlHelper
def self.site_url_valid? url
uri = URI.parse url
uri.kind_of? URI::HTTP
rescue URI::InvalidURIError
@moskvin
moskvin / resque.rake
Created July 3, 2012 16:03
Fix for resque connection issue
require 'resque/tasks'
task "resque:setup" => :environment do
ENV['QUEUE'] = '*'
Resque.before_fork = Proc.new { ActiveRecord::Base.establish_connection }
end
@moskvin
moskvin / gist:2283919
Created April 2, 2012 14:38
Fix for postgres connection via redis
------------------------- app/workers/post_receive.rb -------------------------
index 28216ec..39ead22 100644
@@ -2,6 +2,9 @@ class PostReceive
@queue = :post_receive
def self.perform(reponame, oldrev, newrev, ref, author_key_id)
+
+ defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection
+
project = Project.find_by_path(reponame)
@moskvin
moskvin / gist:2226604
Created March 28, 2012 14:26
Patch for gitlab postgres support
diff --git a/app/models/issue.rb b/app/models/issue.rb
index ce4944a..9e446ad 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -2,6 +2,7 @@ class Issue < ActiveRecord::Base
belongs_to :project
belongs_to :author, :class_name => "User"
belongs_to :assignee, :class_name => "User"
+# has_many :notes, :dependent => :destroy, :conditions => ["noteable_id = '?'", 6]
has_many :notes, :as => :noteable, :dependent => :destroy