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
84091/0x9c28d: 29323312 20 7 mmap(0x0, 0x82000, 0x3, 0x1002, 0x3000000, 0x100000001) = 0x7760000 0 | |
libSystem.B.dylib`__mmap+0xa | |
libSystem.B.dylib`large_malloc+0x471 | |
libSystem.B.dylib`szone_malloc_should_clear+0xd3e | |
libSystem.B.dylib`szone_realloc+0x844 | |
libSystem.B.dylib`malloc_zone_realloc+0x5c | |
libSystem.B.dylib`realloc+0xa9 | |
ruby`ruby_xrealloc+0x86 | |
ruby`str_buf_cat+0xcf |
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 ApplicationController < ActionController::Base | |
before_filter :ensure_proper_protocol | |
protected | |
def ssl_allowed_action? | |
(params[:controller] == 'users/sessions' && ['new', 'create'].include?(params[:action])) || | |
(params[:controller] == 'users/registrations' && ['new', 'create', 'edit', 'update'].include?(params[:action])) || | |
(params[:controller] == 'users/omniauth_callbacks') | |
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 |
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
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
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
#!/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
#!/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
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
<?php | |
class MY_Exceptions extends CI_Exceptions { | |
function My_Exceptions() | |
{ | |
parent::CI_Exceptions(); | |
} | |
function show_error($heading, $message, $template = 'error_general', $status_code = 500) | |
{ |