Skip to content

Instantly share code, notes, and snippets.

View ArtemBorodinEvgenyevich's full-sized avatar
:shipit:
❨╯°□°❩╯︵┻━┻

Artem Borodin ArtemBorodinEvgenyevich

:shipit:
❨╯°□°❩╯︵┻━┻
  • Abak Press
  • Yekaterinburg
View GitHub Profile
@ArtemBorodinEvgenyevich
ArtemBorodinEvgenyevich / branch-fu.md
Created February 28, 2022 08:34 — forked from unbracketed/branch-fu.md
Moving commits between branches

Example: Moving up to a few commits to another branch

Branch A has commits (X,Y) that also need to be in Branch B. The cherry-pick operations should be done in the same chronological order that the commits appear in Branch A.

cherry-pick does support a range of commits, but if you have merge commits in that range, it gets really complicated

git checkout branch-B
git cherry-pick X
git cherry-pick Y
@ArtemBorodinEvgenyevich
ArtemBorodinEvgenyevich / dsl_annotations.rb
Last active January 20, 2022 05:43
Example of dsl annotation module
# frozen_string_literal: true
module Validation
def self.validate_title(title)
stripped = title.strip
return stripped if stripped.length < 30
raise 'Title should be less than 30 chars.' if stripped.length > 30
end
# frozen_string_literal: true
require 'uri'
require 'net/http'
require 'optparse'
# helpers methods for URLAnalyzer class
module AnalyzerUtils
def self.bytes_to_kilobytes(bytes)
(bytes.to_f / 1024).round(2)
@ArtemBorodinEvgenyevich
ArtemBorodinEvgenyevich / digtolcd.rb
Created November 21, 2021 21:40
Ruby digits to LCD task
# frozen_string_literal: true
# enhanced improvement for basic string class :)
class String
def i?
!!(self =~ /^\d+$/)
end
end
# LCD class for converting integers into LCD-like digits