Skip to content

Instantly share code, notes, and snippets.

View VasylShevchenko's full-sized avatar
🏃‍♂️
Running

Vasyl Shevchenko VasylShevchenko

🏃‍♂️
Running
View GitHub Profile
@VasylShevchenko
VasylShevchenko / Breakpoints
Created August 5, 2019 21:06 — forked from janily/Breakpoints
Mobile-first CSS Media Queries Breakpoints
@media (min-width:320px) { /* smartphones, portrait iPhone, portrait 480x320 phones (Android) */ }
@media (min-width:480px) { /* smartphones, Android phones, landscape iPhone */ }
@media (min-width:600px) { /* portrait tablets, portrait iPad, e-readers (Nook/Kindle), landscape 800x480 phones (Android) */ }
@media (min-width:801px) { /* tablet, landscape iPad, lo-res laptops ands desktops */ }
@media (min-width:1025px) { /* big landscape tablets, laptops, and desktops */ }
@media (min-width:1281px) { /* hi-res laptops and desktops */ }
@VasylShevchenko
VasylShevchenko / box-shadow.html
Created August 6, 2019 13:15 — forked from ocean90/box-shadow.html
CSS3 Box Shadow, only top/right/bottom/left and all
<!DOCTYPE html>
<html>
<head>
<title>Box Shadow</title>
<style>
.box {
height: 150px;
width: 300px;
margin: 20px;
module Encryptable
def encrypt(key)
crypt.encrypt_and_sign(key)
end
def decrypt(key)
crypt.decrypt_and_verify(key)
end
private
module Encryptable
def encrypt(key)
crypt.encrypt_and_sign(key)
end
def decrypt(key)
crypt.decrypt_and_verify(key)
end
private
https://medium.com/launch-school/number-validation-with-regex-ruby-393954e46797
def number?(obj)
obj = obj.to_s unless obj.is_a? String
/\A[+-]?\d+(\.[\d]+)?\z/.match(obj)
end
/\A[+-]?\d+(\.\d+)?\z/
/ start of the regex
// 1
deployer$ sudo visudo
// add
deployer$ ALL=NOPASSWD: /bin/systemctl restart nginx, /bin/systemctl status nginx
deployer$ ALL=NOPASSWD: /bin/systemctl restart dotnet.service, /bin/systemctl status dotnet.service
// 2
// add dotnet.service
deployer$ sudo vim /etc/systemd/system/dotnet.service
// insert file dotnet.service see below
class String
def to_boolean
ActiveRecord::Type::Boolean.new.cast(self)
end
end
class NilClass
def to_boolean
false
end

Project workflow:

  1. Load/Reload waffle.
  • Get most current list of actions for the project.
  1. Choose a card from the backlog in waffle. If we're working separately, it's best to move that card that you've chosen into ready and perhaps assign it to yourself as well.
  • Make sure multiple team members aren't working on the same issue; ensure everyone knows what each other is working on.
  1. git checkout master
  2. git pull origin master
  • Ensure you're starting on the master branch and have the most recent changes pulled down.
  1. run rspec
  • Make sure there are no outstanding issues with code on master.
@VasylShevchenko
VasylShevchenko / rails_setup.md
Created March 13, 2020 21:29 — forked from ryanflach/rails_setup.md
Common setup for a new Rails project
  1. rails new <project_name> -d postgresql --skip-turbolinks --skip-spring -T
  • -d postgresql sets up the project to use PostgreSQL
  • --skip-turbolinks & --skip-spring creates a project that does not use turbolinks or spring
  • -T skips the creation of the test directory and use of Test::Unit
  1. In the Gemfile:
  • Available to all environments:
    • gem 'figaro' - store environment variables securely across your app (docs)
    • Uncomment gem 'bcrypt', '~> 3.1.7' if you will be hosting your own user accounts with passwords (docs)
  • Inside of group :test:
    • gem 'rspec-rails' - user rspec in place of minitest (docs)
require "get_process_mem"
def print_usage(description)
mb = GetProcessMem.new.mb
puts "#{ description } - MEMORY USAGE(MB): #{ mb.round }"
end
def print_usage_before_and_after
print_usage("Before")
yield