Skip to content

Instantly share code, notes, and snippets.

View leemour's full-sized avatar

Viacheslav Ptsarev leemour

View GitHub Profile
@leemour
leemour / SASS rails
Last active December 14, 2015 15:29
Use SASS by default
// application.rb
config.sass.preferred_syntax = :sass
@leemour
leemour / No Ruby Docs
Last active December 14, 2015 15:39
.gemrc
echo "gem: --no-ri --no-rdoc" >> ~/.gemrc
@leemour
leemour / Gemfile Rails 3.2
Last active December 14, 2015 15:39
Gemfile 03.2015
source 'https://rubygems.org'
gem 'rails', '3.2.13'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem "haml", ">= 3.1.6"
gem "bootstrap-sass", ">= 2.0.4.0"
gem 'jquery-rails'
@leemour
leemour / TB tooltip
Last active December 14, 2015 16:49
Twitter Bootstrap enable Tooltip
%script $(function() {$("[rel='tooltip']").tooltip();});
@leemour
leemour / rvm
Last active December 14, 2015 23:59
RVM to .bashrc
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
@leemour
leemour / Gemfile Rails 4.0
Last active December 15, 2015 18:39
Gemfile Rails 4
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0.beta1'
gem 'sqlite3'
gem 'jquery-rails'
gem 'haml'
#gem "bootstrap-sass", ">= 2.0.4.0"
Some setup you must do manually if you haven't yet:
1. Ensure you have defined default url options in your environments files. Here
is an example of default_url_options appropriate for a development environment
in config/environments/development.rb:
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
In production, :host should be set to the actual host of your application.
@leemour
leemour / Padrino UTF-8
Created April 4, 2013 11:51
Making Haml force UTF-8 by fixing Tilt
#=> apps.rb
##
# Add your before load hooks here
#
Padrino.before_load do
# Encoding.default_internal = nil
# Encoding.default_external = 'UTF-8'
end
# this makes haml to treat templates as properly encoded (respect Encoding.default_external)
@leemour
leemour / Conditional Seeds
Last active December 15, 2015 19:19
Depending on environment
# Rails
case Rails.env
when "development"
...
when "production"
...
end
#Padrino
# Seed add you the ability to populate your db.
@leemour
leemour / Padrino DB testing
Created April 5, 2013 21:40
Setting environment for rake
Hey guys, sorry to bother but I figure while I have your attention.. I'm having trouble initializing my production & test databases. I'm using Postgres, but whenever I run migrate or reload, it automatically does it on the development database. This is problematic when I run padrino rake test.
So I tried doing padrino rake ar:drop:all and then padrino rake ar:create:all, and this does work.. only there seems to be no corresponding padrino rake ar:migrate:all. What do I do instead?
Oh! padrino rake ar:migrate -e test