Skip to content

Instantly share code, notes, and snippets.

@gmgp
gmgp / heroku.rake
Created July 22, 2010 16:25 — forked from jqr/heroku.rake
namespace :heroku do
desc "Generate the Heroku gems manifest from gem dependencies"
task :gems do
RAILS_ENV='production'
Rake::Task[:environment].invoke
list = Rails.configuration.gems.collect do |g|
command, *options = g.send(:install_command)
options.join(" ") + "\n"
end
it:
errors:
messages:
not_found: "non trovato"
already_confirmed: "è stato già confermato"
not_locked: "non era bloccato"
devise:
failure:
unauthenticated: "Devi accedere o registrarti per continuare."
@gmgp
gmgp / spec_helper.rb
Created November 21, 2011 12:30 — forked from bsodmike/spec_helper.rb
RSpec + Cucumber BDD Stack for Rails 3 with Spork and Guard

RSpec + Cucumber BDD Stack for Rails 3 with Spork and Guard

Steps to follow, Ref:

  • Update Gemfile
  • bundle install
  • rails g rspec:install
  • Edit .rspec
@gmgp
gmgp / gist:1836228
Created February 15, 2012 14:34 — forked from fro/gist:1683557
the_sortable_tree gem: erb version of partials
# _children.html.erb
<%= content_tag :ol, raw(children) %>
# _controls.html.erb
<%-
edit = link_to '', polymorphic_url(opts[:namespace] + [node], :action => :edit), :title => t('.edit_this'), :class => 'button edit'
if opts[:has_children]
delete = link_to('', url_for(opts[:namespace] + [node]),
:title => t('.delete'),
:method => :delete,
@gmgp
gmgp / setup.md
Last active December 19, 2015 16:39 — forked from leesmith/setup.md

Ruby on Rails development setup on Ubuntu 12.04

System update

# change mirror to ubuntu.osuosl.org first
sudo apt-get update

Install common libraries

# Copy and paste this to the rails console to test your email settings
# Rails 3.2
class TestMailer < ActionMailer::Base
default :from => "me@mysite.com"
def welcome_email
mail(:to => "other@elsewhere.com", :subject => "Test mail", :body => "Test mail body")
end
@gmgp
gmgp / gitconf_procedure
Created February 7, 2015 08:34
two git in the same folder one for code one for configuration
# only folder b1 under configuration
# all others files are program files
#
# create and use a alias bash gitconf
mkdir PROG
echo content >> PROG/readme
mkdir PROG/FOLDER_A
echo content >> PROG/FOLDER_A/filea-1
@gmgp
gmgp / basegitconfig
Created February 7, 2015 08:41
base git config creation
touch ~/.gitconfig
cat >~/.gitconfig << EOL
[color]
diff = auto
status = auto
branch = auto
ui = true
[color "status"]
changed = yellow
@gmgp
gmgp / istruzioni
Created March 17, 2015 16:20
shellycloud iter
# after gems
bundle exec shelly add -o <name organitation>
# Edit cloudfile
# push edit
git push shelly master
# import production db
shelly backup import postgresql dump.sql --reset
@gmgp
gmgp / clear_dev_logs.rb
Last active August 29, 2015 14:28 — forked from leifcr/gist:9462906
# config/initializers/clear_dev_logs.rb
# This snippet simply clears your logs when they are too large.
# Large logs for development are usually something you don't want.
# Every time you run rails server or rails console it checks the size
# of your development logfile and truncates it.
if Rails.env.development?
MAX_LOG_SIZE = 1.megabytes
DEV_LOG_FILE = File.join(Rails.root, 'log', 'development.log')