Skip to content

Instantly share code, notes, and snippets.

View leemour's full-sized avatar

Viacheslav Ptsarev leemour

View GitHub Profile
@leemour
leemour / TB tooltip
Last active December 14, 2015 16:49
Twitter Bootstrap enable Tooltip
%script $(function() {$("[rel='tooltip']").tooltip();});
@EvilFaeton
EvilFaeton / devise.ru.yml
Last active May 11, 2019 07:40
Russian I18n locale for devise.
ru:
devise:
confirmations:
confirmed: "Ваша учётная запись подтверждена. Теперь вы вошли в систему."
send_instructions: "В течение нескольких минут вы получите письмо с инструкциями по подтверждению вашей учётной записи."
send_paranoid_instructions: "Если ваш адрес email есть в нашей базе данных, то в течение нескольких минут вы получите письмо с инструкциями по подтверждению вашей учётной записи."
failure:
already_authenticated: "Вы уже вошли в систему."
inactive: "Ваша учётная запись ещё не активирована."
invalid: "Неверный адрес email или пароль."
@leemour
leemour / rvm
Last active December 14, 2015 23:59
RVM to .bashrc
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
@edw
edw / heroku-pg-dump-schema.sh
Last active May 6, 2022 17:33
Dump a schema from a Heroku app's database.
#!/bin/sh
# Usage: heroku-pg-dump-schema.sh HEROKU-APP-NAME DB-ENV-VAR-NAME SCHEMA-NAME
app=$1
env_var=$2
schema=$3
db_url=`heroku config -s --app ${app} | grep ${env_var}`
@marcamillion
marcamillion / console.rb
Created March 27, 2013 15:50
Implementing HABTM counter_cache - between 2 models (Tag, Question)
## I imagine this could be done in the migration, but it was giving me problems so I moved it to the model
## and just did it on the command line
> Tag.reset_questions_count
@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