Skip to content

Instantly share code, notes, and snippets.

View lbadura's full-sized avatar

Lukasz Badura lbadura

View GitHub Profile
class AttachedFile < ActiveRecord::Base
belongs_to :attachable, :polymorphic => true
attr_accessible :file, :plan_id
validates :file, :presence => true
mount_uploader :file do
def store_dir
"uploads/#{model.attachable_type.downcase.pluralize}"
end
end
Started GET "/en/advisor/offers/10,associate-accountant-krakow-hitachi" for 77.252.243.105 at 2011-11-16 14:39:38 +0100
Processing by Advisor::OffersController#show as HTML
Parameters: {"id"=>"10,associate-accountant-krakow-hitachi", "locale"=>"en"}
User Load (0.4ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 2 LIMIT 1
Role Load (0.3ms) SELECT `roles`.* FROM `roles` INNER JOIN `roles_users` ON `roles`.id = `roles_users`.role_id WHERE ((`roles_users`.user_id = 2))
Offer Load (0.3ms) SELECT `offers`.* FROM `offers` WHERE `offers`.`id` = 10 LIMIT 1
Company Load (0.2ms) SELECT `companies`.* FROM `companies` WHERE `companies`.`id` = 175 LIMIT 1
FacebookUser Load (0.2ms) SELECT `facebook_users`.* FROM `facebook_users` WHERE (`facebook_users`.user_id = 2) LIMIT 1
SQL (0.2ms) SELECT COUNT(*) FROM `offers` WHERE (`offers`.company_id = 175)
SQL (0.1ms) BEGIN
@lbadura
lbadura / installation.sh
Created September 19, 2011 12:24 — forked from mikhailov/installation.sh
Nginx+passenger application config: ssl redirection, http headers, passenger optimal settings. see details: http://mikhailov.posterous.com/nginx
$ cd /usr/src
$ wget http://nginx.org/download/nginx-0.8.52.tar.gz
$ tar xzvf ./nginx-0.8.52.tar.gz
$ rm ./nginx-0.8.52.tar.gz
$ gem install s3sync capistrano capistrano-ext passenger --no-ri --no-rdoc
$ passenger-install-nginx-module
# Automatically download and install Nginx? 2. No: I want to customize my Nginx installation
# Where is your Nginx source code located?: /usr/src/nginx-0.8.52
# Where do you want to install Nginx to?: /opt/nginx
@lbadura
lbadura / nginx
Created September 1, 2011 20:34 — forked from nofxx/nginx
nginx rc.d script archlinux
#!/bin/bash
# NGINX RC.D SCRIPT
# Archlinux
NGINX_CONFIG="/opt/nginx/conf/nginx.conf"
NGINX_BIN="/opt/nginx/sbin/"
#. /etc/conf.d/nginx
. /etc/rc.conf
. /etc/rc.d/functions
@lbadura
lbadura / gist:1185780
Created September 1, 2011 09:19
Current git branch in shell prompt
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "("${ref#refs/heads/}")"
}
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
PS1="\H$GREEN{$RED\W$GREEN}-$GREEN{$RED\$(parse_git_branch)$GREEN}-$YELLOW{$GREEN\$(date +%H:%M)$YELLOW}\n$GREEN$ "