Skip to content

Instantly share code, notes, and snippets.

View OleksiyRudenko's full-sized avatar
💻
Delivering

Oleksiy Rudenko OleksiyRudenko

💻
Delivering
View GitHub Profile

git rebase

В общем случае команда git rebase добавляет все коммиты из ветки, на которой вы находитесь, следующими за коммитом, который вы передаете git rebase как аргумент. Если передать первым аргументом ветку, Git найдет последний общий коммит между текущей веткой и целевой веткой и добавит коммиты из текущей в целевую один за одним. Можно представить себе, что git rebase по очереди "накатывает" каждый из коммитов вашей ветки на целевой коммит. При этом у всех "накатанных" коммитов изменяются метаданные (например, родительский коммит), поэтому с точки зрения Git это теперь новые коммиты.

На семинаре мы познакомились с двумя случаями применения git rebase.

Случай 1: объединение веток, git rebase как альтернатива git merge

Для того, чтобы объединить две ветки в одну (например, когда работа над задачей закончена и нужно влить это задачу в ветку master), часто используют команду git merge. Это команда объединяет ветки путем создания отдельного коммита, у которого два родителя - комм

// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var domStyle = document.createElement("style");
domStyle.append(
'* { color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }\
* * { background-color: rgba(0,255,0,.2) !important; }\
* * * { background-color: rgba(0,0,255,.2) !important; }\
* * * * { background-color: rgba(255,0,255,.2) !important; }\
* * * * * { background-color: rgba(0,255,255,.2) !important; }\
@Nachtalb
Nachtalb / telegram-desktop-multiple-accounts.rst
Last active March 22, 2024 06:08
Add multiple accounts in Telegram Desktop [Linux | MacOSX | Windows]

Home task

In Memory Pair Game Project:

  1. Create package.json
  2. Install eslint, prettier and pluginf for code editor/IDE
  3. Read explanations to all errors forund by eslint according to eslint-config-airbnb

Installation step-by-step

  1. Create package in a directory: Option 1:

Make you code more DRY, SOLID and clear with OOP

This is a quick guide for people who don’t feel confident with OOP concepts yet, but want to make first steps towards improving their code using OOP principles.

Recipes

If you don’t know where to start, try to look for the following patterns and apply provided recipes. Here are some problem you can find and possible solutions:

Problem Recipes
Code repetition: literals (numbers, string) that you use more than once Use power of constants: remove code repetition (less literals in code), reduce typing errors, get better IDE support. Bonus: document your code by giving meaningful names to values.
Code repetition: expressions Look for repeated patterns and put them into functions. Same bonuses with documenting your code.
@jboner
jboner / latency.txt
Last active April 25, 2024 01:18
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@gleuch
gleuch / gist:2475825
Created April 24, 2012 02:58
Javascript documentfragment to string (w/ text selection)
// selection range
var range = window.getSelection().getRangeAt(0);
// plain text of selected range (if you want it w/o html)
var text = window.getSelection();
// document fragment with html for selection
var fragment = range.cloneContents();
// make new element, insert document fragment, then get innerHTML!