A (more) complete cheatsheet for Arel, including NamedFunction functions, raw SQL and window functions.
posts = Arel::Table.new(:posts)
posts = Post.arel_table # ActiveRecord{
    "window.zoomLevel": 0,
    "editor.minimap.enabled": false,
    "breadcrumbs.enabled": true,
    "workbench.activityBar.visible": true,
    "window.menuBarVisibility": "toggle",
    "workbench.statusBar.visible": true,
    "workbench.colorTheme": "Omni",
 "workbench.iconTheme": "material-icon-theme",| time_namelookup: %{time_namelookup}\n | |
| time_connect: %{time_connect}\n | |
| time_appconnect: %{time_appconnect}\n | |
| time_pretransfer: %{time_pretransfer}\n | |
| time_redirect: %{time_redirect}\n | |
| time_starttransfer: %{time_starttransfer}\n | |
| ----------\n | |
| time_total: %{time_total}\n | 
| $ git rebase --interactive 'SHORT_SHA^' | |
| # In the default editor, modify `pick` to `edit` in the line whose commit you want to modify. | |
| # Make your changes and then commit them with the same message you had before: | |
| $ git commit --all --amend --no-edit | |
| $ git rebase --continue | 
| pg_dump -U <username> -W -Fc <databasename> > <filename>.dump | |
| scp -i ~/.ssh/cx_<id>_pkey <user>@<ip>:<filename>.dump <filename>.dump | |
| pg_restore -c -U postgres -d <databasename> <filename>.dump | 
| // ... | |
| private MyService myService; | |
| private boolean messengerBound = false; | |
| @Override | |
| protected void onStart() { | |
| super.onStart(); | |
| Intent intent = new Intent(this, PlayerService.class); | |
| bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE); | 
| REGEX = /([0-9]{2,3}).*([\.mp4|\.mkv|.rmvb|.avi]{4,5})/ | |
| Dir['*'].each do |file_name| | |
| if (match = REGEX.match(file_name)) && File.exist?(file_name) | |
| new_name = "#{match[1]}#{match[2]}" | |
| File.rename(file_name, new_name) | |
| end | |
| end | 
| require 'mina/bundler' | |
| require 'mina/rails' | |
| require 'mina/git' | |
| require 'mina/rvm' | |
| set :user, 'w2b' | |
| set :forward_agent, true | |
| set :domain, 'w2b.co' | |
| set :port, '22' | 
Um balancete é um resumo contábil das movimentações financeiras da empresa.
Um balancete tem 3 grupos: Ativo, Passivo e Contas de resultado. Neste teste vamos focar apenas nos dois primeiros.
Cada grupo (código de 1 digito) tem uma série de subgrupos (código de dois dígitos), cada subgrupo contém uma série de contas sintéticas (código de três digitos) e cada conta sintética contém várias contas analíticas (código de 4 dígitos).
| #!/bin/sh | |
| cd /home/user/app/ || exit | |
| unset GIT_DIR | |
| git reset --hard | |
| git pull origin master -f | |
| bundle install --gemfile "Gemfile" --path "bundle" --deployment --without development test | |
| bundle exec rake db:migrate RAILS_ENV=production | |
| bundle exec rake assets:precompile | |
| touch tmp/restart.txt |