This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: some_host | |
user: some_user | |
sudo: yes | |
tasks: | |
- name: ensure backup gem is installed | |
gem: name=backup state=present | |
- name: ensure Backup dir is present | |
file: state=directory path=/home/git/Backup/models owner=git group=git recurse=yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe MatchesController do | |
let(:group) {FactoryGirl.create(:group)} | |
context "requires login and checks authorization" do | |
it "for GET 'new'" do | |
controller.should_receive(:authenticate_user!).and_return(false) | |
expect{get :new, group_id: group.id}.to raise_error(CanCan::AccessDenied) | |
end | |
it "for POST 'create'" do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<video autobuffer="autobuffer" class="video_thumbnail" controls="controls" poster="/assets/rails.png" src="movie.mp4"> | |
</video> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c = "abc"; {a: "b", c: case c | |
when "abc" | |
"cba" | |
when "cba" | |
"abc" | |
end | |
} | |
=> {:a=>"b", :c=>"cba"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## either this | |
response.each do |chunk| | |
[[/[\r\n]+/, ''], [/>\s+</, '><']].each do |reg, rep| | |
chunk.gsub! reg, rep | |
end | |
end | |
# or that | |
response = response.map do |chunk| | |
chunk.gsub(/[\r\n]+/, '').gsub(/>\s+/, '>').gsub(/>\s+</, '><').gsub(/; \s+/, '; ').gsub(/{ \s+/, '{ ').gsub(/<!--(.|\s)*?-->/, '') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Member < ActiveRecord::Base | |
belongs_to :project | |
belongs_to :users | |
attr_accessible :project_id, :user_id | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Member < ActiveRecord::Base | |
belongs_to :project | |
belongs_to :users | |
attr_accessible :project_id, :user_id | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream some.where { | |
server unix:/home/somewhere/deploy/somewhere/tmp/puma.sock; | |
} | |
server { | |
listen 80; | |
server_name some.where www.some.where; | |
location / { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bluepill.application("gitlabhq", :foreground => false, :log_file => "/home/deploy/deploy/gitlabhq/shared/log/bluepill.log", :base_dir => "/home/deploy/.bluepill") do |app| | |
app.uid = "deploy" | |
app.gid = "deploy" | |
app.working_dir = "/home/deploy/deploy/gitlabhq/current" | |
app.process("web-1") do |process| | |
process.start_command = "puma -b unix:///home/deploy/deploy/gitlabhq/shared/puma.sock" | |
process.daemonize = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Manufacturer < ActiveRecord::Base | |
def self.selectable | |
result = [] | |
result << self.joins(:cars).joins(cars: :basic_articles).where(published: true, cars:{published: true}, basic_articles: {published: true, requires_extra: false}).map{ |r| r.id } | |
result << self.joins(:cars).joins(cars: :basic_articles).joins(cars: [basic_articles: :extras]).where(published: true, cars:{published: true}, basic_articles: {published: true, requires_extra: true}).map{ |r| r.id } | |
return self.where(id: result) | |
end | |
end |