Skip to content

Instantly share code, notes, and snippets.

View crivotz's full-sized avatar
🏠
Working from home

Mauro Locatelli crivotz

🏠
Working from home
View GitHub Profile
@crivotz
crivotz / carrier_wave
Created June 11, 2015 09:41
Check if image? and do resize
version :thumb, :if => :image? do
process :resize_to_fit => [50, 50]
end
protected
def image?(new_file)
new_file.content_type.include? 'image'
end
#! /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
@crivotz
crivotz / _search_form
Created February 9, 2015 08:57
Filter form with simple_form base on filterable by Justin Weiss ( http://goo.gl/xr10rK )
<%= simple_form_for :user, :method => 'get', :url => users_path, :html => {:class => ''} do |f| %>
<div class="form-group form-group-sm col-xs-12 col-sm-4 col-md-4 col-lg-3">
<%= f.input :username_like, input_html: { name: 'username_like', :value => params[:username_like] }, label: t('fields.user.username'), :required => false %>
<%= f.input :is_active_check, input_html: { name: 'is_active_check' }, label: t('fields.user.is_active'), as: :select, checked_value: true, unchecked_value: false, :required => false, :selected => params[:is_active_check], :include_blank => '' %>
<%= f.input :acl_id_ref_check, collection: Acl.all, input_html: { name: 'acl_id_ref_check' }, as: :select, label_method: :description, label: t('fields.user.acl_id'), value_method: :id, :selected => params[:acl_id_ref_check], :include_blank => '', :required => false %>
<%= f.input :locale, :as => :hidden, :input_html => {:name => 'locale', :value => params[:locale] } %>
<%= f.button :submit, t('search'), class: "btn-suc