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 |
#!/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 |
// ... | |
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); |
#!/usr/bin/env bash | |
sudo apt-get install build-essential zlib1g-dev curl git-core libgeoip-dev imagemagick vim libxslt-dev mysql-server mysql-client libmysql-ruby libmysqlclient-dev -y | |
cd | |
git clone https://github.com/sstephenson/rbenv.git .rbenv | |
cd .rbenv | |
mkdir plugins | |
cd plugins | |
git clone https://github.com/sstephenson/rbenv-vars.git | |
git clone https://github.com/sstephenson/ruby-build.git | |
git clone https://github.com/fesplugas/rbenv-installer.git |
# As root user | |
# Update the OS | |
sudo apt-get update | |
sudo apt-get upgrade | |
sudo apt-get dist-upgrade | |
# Setup Hostname & TimeZone | |
echo "{{HOSTNAME}}" > /etc/hostname | |
hostname -F /etc/hostname | |
dpkg-reconfigure tzdata |
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 |