Skip to content

Instantly share code, notes, and snippets.

Avatar
🇺🇦
Have fun

Roman Synkevych

🇺🇦
Have fun
View GitHub Profile
View post-checkout
#!/bin/sh
echo "post-checkout hook will be executed"
# source rvm and .rvmrc if present
[ -s "$HOME/.rvm/scripts/rvm" ] && . "$HOME/.rvm/scripts/rvm"
[ -s "$PWD/.rvmrc" ] && . "$PWD/.rvmrc"
# rollback migrations if present
OLDBRANCH=$1
@Synkevych
Synkevych / pre-push
Last active Apr 8, 2021
Run RSpec tests on pre-push - git hook for Rails projects
View pre-push
#!/bin/sh
changed_files=`git status --short`
if [ "$changed_files" ]; then
echo "There some changes:"
echo "$changed_files"
echo "please commit or reset them, before push."
exit 1
else
echo "There no changes, move on to the next task"
@Synkevych
Synkevych / pre-commit
Last active Nov 10, 2021
Run Rubocop on pre-commit - git hook for Rails projects.
View pre-commit
#!/usr/bin/env ruby
require 'English'
require 'rubocop'
ADDED_OR_MODIFIED = /A|AM|^M/.freeze
changed_files = `git status --porcelain`.split(/\n/).
select { |file_name_with_status|
file_name_with_status =~ ADDED_OR_MODIFIED
@Synkevych
Synkevych / setup_rails_dependencies.sh
Created Jan 10, 2021
Automatically configure all project dependencies based on Rails framework.
View setup_rails_dependencies.sh
#!/bin/bash
echo "This is a script to try automatically configure all project dependencies basid on Rails framework."
# exit on the first error
set -e
echo "Check Ruby version"
required_ruby_version=$(cat .ruby-version)
current_ruby_version=`/usr/bin/ruby -e 'puts RUBY_VERSION'`
@Synkevych
Synkevych / rails_shortcut.md
Last active Dec 2, 2021
Basic commands for working with a Rails project
View rails_shortcut.md

Rails commands

irb - command to launch ruby interpreter in any directory
rails c - command lets you interact with your Rails application from the command line
reload! - reload rails environment if you had changed model functionality
gem outdated - show all outdated gems on project
gem update [<gem_name>] - update a specific gem
./bin/webpack-dev-server - start webpacker dev server for fast compiling

rails new app_name --webpack=react --database=postgresql -T - create a new app with React, PostgreSQL, without tests

@Synkevych
Synkevych / linux_commands.md
Last active Dec 4, 2021
Bash Commands and Tips for Beginners
View linux_commands.md

Info about the system

whoami current user name
hostname current pc name
cat /etc/os-release - info about current system getent group sudo | cut -d: -f4 - show all sudo users
su - user2 - switch between users
sudo chmod a+rwx folderName/* add all access to the folder
chown -R username directory - add full permission directory and to all files and directories in that directory
chowd -R u+rX directory - the same as previous

View 404_redirect.html
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>CodePen - Space 404</title>
<style>
html,
body {
height: 100%;
width: 100%;
@Synkevych
Synkevych / cloudSettings
Last active Jul 24, 2021
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2021-07-24T21:59:37.624Z","extensionVersion":"v3.4.3"}
@Synkevych
Synkevych / cloudSettings
Last active Dec 18, 2020
First lessons for Python [tceh]
View cloudSettings
{"lastUpload":"2020-12-18T21:55:43.232Z","extensionVersion":"v3.4.2"}