rails g migration add_x_column_to_y_table name:type name2:type2[:index]
rails g migration create_x_table name:type
val foobar: Foobar? = ... | |
foobar?.let { /* foobar is not null */ } ?: run { /* foobar is null */ } | |
// this might be cool except for the back ticks ` | |
fun <T, R> T.`else`(block: T.() -> R) = run(block) | |
foobar?.let { /* foobar is not null */ } ?: `else` { /* foobar is null */ } |
# make CapsLock behave like Ctrl: | |
setxkbmap -option ctrl:nocaps | |
# make short-pressed Ctrl behave like Escape: | |
xcape -e 'Control_L=Escape' |
wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz | |
sudo tar -xzf postman.tar.gz -C /opt | |
rm postman.tar.gz | |
sudo ln -sf /opt/Postman/Postman /usr/bin/postman | |
cat > ~/.local/share/applications/postman.desktop <<EOL | |
[Desktop Entry] | |
Encoding=UTF-8 | |
Name=Postman | |
Exec=postman |
bind R source-file ~/.tmux/reload.tmux |
rails g controller api/v6/controller_name create --no-helper --skip-template-engine --skip-routes
mkdir spec/requests/api/v6/controller_name
mv spec/controllers/api/v6/controller_name.rb spec/requests/api/v6/controller_name/
# Enables mouse | |
set -g mouse | |
set-window-option -g mode-keys vi | |
# CPU Status | |
set -g status-interval 1 # second | |
set -g status-right "#{prefix_highlight} CPU: #{cpu_icon} #{cpu_percentage} | %a %h-%d %H:%M " | |
# Sync Panes Status |
require 'cgi' | |
require 'json' | |
require 'active_support' | |
def verify_and_decrypt_session_cookie(cookie, secret_key_base) | |
cookie = CGI::unescape(cookie) | |
salt = 'encrypted cookie' | |
signed_salt = 'signed encrypted cookie' | |
key_generator = ActiveSupport::KeyGenerator.new(secret_key_base, iterations: 1000) | |
secret = key_generator.generate_key(salt)[0, ActiveSupport::MessageEncryptor.key_len] |