This file contains hidden or 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
namespace :deploy do | |
namespace :assets do | |
task :precompile, :roles => assets_role, :except => { :no_release => true } do | |
run "cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile:primary" | |
end | |
end | |
end |
This file contains hidden or 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
add_line = "config statement" | |
bash "add_to_config" do | |
code <<-EOH | |
grep '#{add_line}' /etc/config || echo '#{add_line}' >> /etc/config | |
EOH | |
end |
This file contains hidden or 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
<?php | |
class MY_Exceptions extends CI_Exceptions { | |
function My_Exceptions() | |
{ | |
parent::CI_Exceptions(); | |
} | |
function show_error($heading, $message, $template = 'error_general', $status_code = 500) | |
{ |
This file contains hidden or 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
Host * | |
ControlPath ~/.ssh/master-socket/-%r@%h:%p | |
ControlMaster auto | |
ControlPersist 4h |
This file contains hidden or 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
#!/bin/sh | |
APP_ROOT=/var/www/current | |
PID=/var/www/current/tmp/pids/unicorn.pid | |
ENV=production | |
CMD="sudo -u ubuntu /opt/ruby-enterprise-1.8.7-2011.03/bin/bundle exec /opt/ruby-enterprise-1.8.7-2011.03/bin/unicorn_rails -E $ENV -c /var/www/current/config/unicorn.rb -D" | |
old_pid="$PID.oldbin" | |
cd $APP_ROOT || exit 1 |
This file contains hidden or 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
#!/bin/sh | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the nginx web server | |
# Description: starts nginx using start-stop-daemon |
This file contains hidden or 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
for (int i = 0; i < length; i += 4) { | |
blue = m_OriginalPixelBuf[i]; | |
green = m_OriginalPixelBuf[i+1]; | |
red = m_OriginalPixelBuf[i+2]; | |
red = pow(red / 255.0f, 1.3f) * 255.0; | |
green = pow(green / 255.0f, 1.3f) * 255.0; | |
blue = pow(blue / 255.0f, 1.3f) * 255.0; | |
// Ensure that pixel is not more than 255 |
This file contains hidden or 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 AvatarUploader < CarrierWave::Uploader::Base | |
include CarrierWave::MiniMagick | |
def extension_white_list | |
model.skip_avatar_extension_check ? nil : %w(jpg jpeg gif png bmp) | |
end | |
end |
This file contains hidden or 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 Forum | |
include Mongoid::Document | |
include Mongoid::Timestamps | |
field :posts_count, :type => Integer, :default => 0 | |
has_many_related :posts | |
end |
This file contains hidden or 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
# put this in config/initializers/carrierwave.rb | |
module CarrierWave | |
module MiniMagick | |
def quality(percentage) | |
manipulate! do |img| | |
img.quality(percentage) | |
img = yield(img) if block_given? | |
img | |
end | |
end |