Skip to content

Instantly share code, notes, and snippets.

View dalpo's full-sized avatar
💭
I'm still learning...

Andrea Dal Ponte dalpo

💭
I'm still learning...
View GitHub Profile
# Configure colors, if available.
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
c_reset='\[\e[0m\]'
c_user='\[\033[1;33m\]'
c_path='\[\e[0;33m\]'
c_git_clean='\[\e[0;36m\]'
c_git_dirty='\[\e[0;35m\]'
else
c_reset=
c_user=
@dalpo
dalpo / railsready-debian-lenny.sh
Created April 27, 2012 13:36
Rails ready Debian Lenny
#!/bin/bash
#
# Author: Jakub Godawa <jakub.godawa@gmail.com>
# Licence: MIT
#
#
# Original script for Ubuntu 10.04 LTS: Josh Frye <joshfng@gmail.com>
#
# Contributions from: Wayne E. Seguin <wayneeseguin@gmail.com>
# A class-based template for jQuery plugins in Coffeescript
#
# $('.target').myPlugin({ paramA: 'not-foo' });
# $('.target').myPlugin('myMethod', 'Hello, world');
#
# Check out Alan Hogan's original jQuery plugin template:
# https://github.com/alanhogan/Coffeescript-jQuery-Plugin-Template
#
(($, window) ->
namespace :deploy do
task :setup_solr_data_dir do
run "mkdir -p #{shared_path}/solr/data"
end
end
namespace :solr do
desc "start solr"
task :start, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && RAILS_ENV=#{rails_env} bundle exec sunspot-solr start --port=8983 --data-directory=#{shared_path}/solr/data --pid-dir=#{shared_path}/pids"
module CarrierWave
module MiniMagick
def toaster_filter
manipulate! do |img|
img.modulate '150,80,100'
img.gamma 1.1
img.contrast
img.contrast
img.contrast
img.contrast
@dalpo
dalpo / cancan_link_helper.rb
Last active December 17, 2015 05:49
Cancan link Helper
@dalpo
dalpo / simple_form_bootstrap_datepicker.rb
Created May 12, 2013 13:42
Simple_form custom input for bootstrap-datepicker
module SimpleForm
module Inputs
class DatePickerInput < SimpleForm::Inputs::StringInput
def input_html_options
value = object.send(attribute_name)
options = {
value: value.nil?? nil : I18n.localize(value, format: :datepicker),
data: {
behaviour: 'datepicker'
}
@dalpo
dalpo / transactional_helper.rb
Created July 30, 2013 15:44
transactional_helper for rspec
def without_transactional_fixtures(&block)
self.use_transactional_fixtures = false
before(:all) do
if ENV["RAILS_ENV"].eql? 'test_ci'
DatabaseCleaner.strategy = :truncation
else
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.clean_with(:truncation)
end
@dalpo
dalpo / transactional_helper.rb
Created July 30, 2013 15:44
transactional_helper for rspec
def without_transactional_fixtures(&block)
self.use_transactional_fixtures = false
before(:all) do
if ENV["RAILS_ENV"].eql? 'test_ci'
DatabaseCleaner.strategy = :truncation
else
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.clean_with(:truncation)
end
@dalpo
dalpo / .powrc
Created September 12, 2013 19:39
powrc with .ruby-version
if [ -f "$rvm_path/scripts/rvm" ] && [ -f ".ruby-version" ]; then
source "$rvm_path/scripts/rvm"
if [ -f ".ruby-gemset" ]; then
rvm use `cat .ruby-version`@`cat .ruby-gemset`
else
rvm use `cat .ruby-version`
fi
fi