Skip to content

Instantly share code, notes, and snippets.

View manzhikov's full-sized avatar
🏠
Working from home

Ildar Manzhikov manzhikov

🏠
Working from home
View GitHub Profile
@manzhikov
manzhikov / notes_part1.md
Created June 26, 2024 13:13 — forked from jsheridanwells/notes_part1.md
Rails ToDo API w/ RSpec TDD

Build a RESTful JSON API w/ Rails and RSpec PART ONE

From this tutorial.

Dependency Setup

Gemfile.rb:

  1. Rspec-rails to development and test groups
group :development, :test do
  gem 'rspec-rails', '~> 3.5'
@manzhikov
manzhikov / 01_README.md
Created January 13, 2023 23:04 — forked from nicolas-brousse/01_README.md
Rails health check

HealthCheck

Install

Add the following line to your Gemfile

gem "server_health_check-rails"
@manzhikov
manzhikov / database_migration_best_practices.md
Created April 13, 2022 23:34 — forked from HelioCampos/database_migration_best_practices.md
Database migration best practices for Rails

Database migration best practices for Rails

Never ever change data on schema changes! [1]

Use rake tasks to change the data! [1]

This decouples a deployment from completed migrations. Give us control of the data manipulation proccess by encapsulatin it in on place. need to remember to:

  1. Run it in one of the ways bellow: a. Add this rake task the deployment script or;
@manzhikov
manzhikov / Dockerfile
Created March 30, 2022 01:54 — forked from jonyardley/Dockerfile
Precompile Ruby on Rails assets with Docker
ARG ASSET_HOST
RUN bundle exec rake ASSET_HOST=${ASSET_HOST} RAILS_ENV=production assets:precompile
time_namelookup: %{time_namelookup}s\n
time_connect: %{time_connect}s\n
time_appconnect: %{time_appconnect}s\n
time_pretransfer: %{time_pretransfer}s\n
time_redirect: %{time_redirect}s\n
time_starttransfer: %{time_starttransfer}s\n
----------\n
time_total: %{time_total}s\n
{
"Total": 17,
"Attachments": [
{
"FileName": "invoice.jpg"
}
],
"LineItems": [
{
"Description": "Sugar",
@manzhikov
manzhikov / db_backup.sh
Created June 1, 2021 14:39 — forked from hackedunit/db_backup.sh
Backup PostgreSQL dump to Microsoft Azure Blob Storage
#!/bin/bash
# Requires azure-cli to be installed
source $HOME/.profile
if [ "${POSTGRES_HOST}" = "" ]; then
if [ -n "${POSTGRES_PORT_5432_TCP_ADDR}" ]; then
POSTGRES_HOST=$POSTGRES_PORT_5432_TCP_ADDR
POSTGRES_PORT=$POSTGRES_PORT_5432_TCP_PORT
@manzhikov
manzhikov / iterm2.md
Created May 11, 2021 22:44 — forked from squarism/iterm2.md
iterm2 cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
@manzhikov
manzhikov / clean.md
Created April 8, 2021 22:47 — forked from Kevinrob/clean.md
Clean up microk8s registry
registry=localhost:32000
repositories=$(curl ${registry}/v2/_catalog)
for repo in $(echo "${repositories}" | jq -r '.repositories[]'); do
  echo $repo
  tags=$(curl -sSL "http://${registry}/v2/${repo}/tags/list" | jq -r '.tags[]')
  for tag in $tags; do
    echo $tag
    curl -v -sSL -X DELETE "http://${registry}/v2/${repo}/manifests/$(
 curl -sSL -I \
@manzhikov
manzhikov / .irbrc
Created January 7, 2021 17:32 — forked from swanson/.irbrc
.irbrc color coding Rails console by environment
# Add color coding based on Rails environment for safety
if defined? Rails
banner = if Rails.env.production?
"\e[41;97;1m #{Rails.env} \e[0m "
else
"\e[42;97;1m #{Rails.env} \e[0m "
end
# Build a custom prompt