Skip to content

Instantly share code, notes, and snippets.

View galulex's full-sized avatar
🇺🇦
¯\_(ツ)_/¯

Alex Galushka galulex

🇺🇦
¯\_(ツ)_/¯
View GitHub Profile
@lengarvey
lengarvey / staging.rb
Created June 29, 2014 11:28
Enabling Rails 4.1 mail previews in staging (or any other env besides development)
# put this in your staging.rb file. Obviously you'll need more config than this it's just an example.
Rails.application.configure do
config.action_mailer.preview_path ||= defined?(Rails.root) ? "#{Rails.root}/test/mailers/previews" : nil
config.autoload_paths += [config.action_mailer.preview_path]
routes.append do
get '/rails/mailers' => "rails/mailers#index"
get '/rails/mailers/*path' => "rails/mailers#preview"
end
@denji
denji / nginx-tuning.md
Last active May 3, 2024 03:57
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@kugaevsky
kugaevsky / activerecord.ru.yml
Created September 16, 2012 21:45
ActiveRecord errors localiztion
ru:
activerecord:
errors:
messages:
taken: "%{model} с таким именем уже существует"
record_invalid: "Валидация не прошла: %{errors}"
restrict_dependent_destroy:
one: "Невозможно удалить запись, так как существуют зависимости: %{record}"
many: "Невозможно удалить записи, так как существуют зависимости: %{record} "
inclusion: "недопустимое значение"
@galulex
galulex / install.md
Last active February 28, 2021 14:15
Ruby On Rails Ubuntu 18.04 install

Developer libs

mysql, rmagic, curl, git, vim, sqlite, nodejs nokogiri...

sudo apt-get install libxslt1-dev libxml2-dev build-essential patch libsqlite3-dev libcurl4-openssl-dev curl git git-gui vim-gtk exuberant-ctags nodejs rar

Ruby

sudo apt-add-repository ppa:brightbox/ruby-ng

sudo apt-get update

@iangreenleaf
iangreenleaf / yaml.vim
Created March 15, 2011 17:38
Dumb-smart indentation for Yaml
" Vim indent file
" Language: Yaml
" Author: Ian Young
" Get it bundled for pathogen: https://github.com/avakhov/vim-yaml
if exists("b:did_indent")
finish
endif
"runtime! indent/ruby.vim
"unlet! b:did_indent
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')