Skip to content

Instantly share code, notes, and snippets.

@svkmax
svkmax / MySQL_5-7_macOS.md
Created February 21, 2021 19:02 — forked from robhrt7/MySQL_5-7_macOS.md
Install MySQL 5.7 on macOS using Homebrew

This is a fork of original gist https://gist.github.com/nrollr/3f57fc15ded7dddddcc4e82fe137b58e, with slight changes on pointing to 5.7 version branch, instead of 8 (latest default of MySQL in Hombrew).

Install MySQL 5.7 on macOS

This procedure explains how to install MySQL using Homebrew on macOS (Sierra 10.12 and up)

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.
@svkmax
svkmax / gist:f4a11862d79617ce97fc6323dbf1c6ed
Created November 17, 2020 14:15 — forked from bkemper/gist:ca6ac68b174a047b5ccde3930c8568dc
How to edit a commit with interactive rebase

While on a branch with a couple of commits, you can edit a commit with interactive rebase. This should be used sparingly and only on branches and never on master.

  1. Checkout the branch

$ git checkout my-branch

  1. Get the ref of the commit that you want to edit from the commit log. (e.g. 67b191fc62eda52b5b208cc4de50df7144a03171)

$ git log

@svkmax
svkmax / example.rb
Last active April 16, 2021 08:10 — forked from NARKOZ/example.rb
Задание по рефакторингу
# Модели
class PromoMessage < ActiveRecord::Base
end
class User < ActiveRecord::Base
has_many :ads
scope :recent, -> { order("created_at DESC") }
end
class Ad < ActiveRecord::Base
@svkmax
svkmax / nginx.conf
Created July 23, 2019 13:10 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb - load your rails into a pry session

Debugger

@svkmax
svkmax / differ.rb
Created April 29, 2015 10:08
Differ
# The class takes an array of files and can calculate
# their differences using LCS algorithm (diff-lcs gem required)
# Author:: svkmax
class Differ
require 'diff-lcs'
##
# Create new differ instance
#
# At least two files should be specified as arguments
@svkmax
svkmax / request_builder.rb
Last active August 29, 2015 14:20
RequestBuilder
module RequestBuilder
DEBUG = false
require 'net/http'
require 'json'
require 'uri'
require 'mime-types'
require 'openssl'
require 'response_handler'
#uri_string - URI
#req_type - Post/Put/Get/Delete etc