str = 'Привет'
puts str # => Привет
puts str.downcase # => Привет
require 'active_support/all' # not required inside Rails app
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
config.vm.box = "precise32" | |
config.vm.box_url = "http://files.vagrantup.com/precise32.box" | |
config.vm.network :forwarded_port, guest: 3000, host: 3000 | |
config.vm.hostname = "ruby-dev-server" | |
config.vm.provision :shell, path: "install.sh" |
function apt_download() { | |
PACKAGE=$1 | |
URI=`apt-cache show $PACKAGE | grep "Filename:" | cut -f 2 -d " "` | |
wget http://archive.ubuntu.com/ubuntu/$URI | |
} |
reinstall: lxrun /install /y
Uninstall: lxrun /uninstall /full /y
Uninstall, but keep user folder: lxrun /uninstall /y
find /var/www -not -type d -exec file "{}" ";" | grep CRLF |
# Make nano default editor: | |
git config --global core.editor 'nano' | |
# git log2 | better log (one liners): | |
git config --global alias.log2 "log --pretty=format:'%C(yellow) %h %C(cyan) %cd %C(white) %s %C(red) (%an)'" | |
# git network | network (github network in terminal): | |
git config --global alias.network "log -20 --pretty=format:'%C(yellow)%h%Creset\\ %C(green)%ar%C(cyan)%d\\ %Creset%s%C(yellow)\\ [%cn]' --graph --decorate --all" |
module MyApp | |
class Application < Rails::Application | |
if Rails.env == 'test' | |
require 'diagnostic' | |
config.middleware.use(MyApp::DiagnosticMiddleware) | |
end | |
end | |
end |
To enable the precompilation of all non.js/.css assets within vendor/assets
just add this to config/initializers/assets.rb
:
Rails.application.config.assets.precompile << Proc.new { |path, fn| fn =~ /vendor\/assets/ && !%w(.js .css).include?(File.extname(path)) }
Be aware that this will precompile ALL non .js/.css assets that you have there, some plugins or libraries might have .txt or other files around, and those would end up into your precompiled list also.
If you need to precompile images only, you could use this:
Rails.application.config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)
minify = true | |
px_steps = 2 | |
min_px = 0 | |
max_px = 200 | |
# ---------------------------------------------------------------------------------------- | |
margin_css = '' | |
padding_css = '' | |
arr = ([0] + (min_px..max_px).step(px_steps).to_a + [max_px]).uniq # make sure min and max are included |
# 1) Create your private key (any password will do, we remove it below) | |
$ cd ~/.ssh | |
$ openssl genrsa -des3 -out server.orig.key 2048 | |
# 2) Remove the password | |
$ openssl rsa -in server.orig.key -out server.key |