π
β β‘ β’ β£ β€ β₯ β¦ β§ β¨ β©
π£
π
β β‘ β’ β£ β€ β₯ β¦ β§ β¨ β©
π£
β π
β β‘ β’ β£ β€ β₯ β¦ β§ β¨ β©
π£
β β β β β π
β β‘ β’ β£ β€ β₯ β¦ β§ β¨ β©
π£
β β π
β β‘ β’ β£ β€ β₯ β¦ β§ β¨ β©
π£
β β β β β β π β
β
β
β β‘ β’ β£ β€ β₯ β¦ β§ β¨ β©
π£
git bisect
in actionGIT is operating on DAG of commits that are tree representation of filesystem using SHA hashing for addressing almost everything
git log --graph --oneline --decorate
.git
βββ objects
β βββ 00
β β βββ 431bc7c5ed0017b1fca52f1122980774a146a9
β β βββ β¦
β βββ 01
β βββ 02
β βββ β¦
β βββ fd
β βββ fe
β βββ ff
β βββ info
β βββ pack
2 chars folder + 38 chars filename = 40 hex digits product of hashing
git cat-file -p aa823728ea7d592acc69b36875a482cdf3fd5c8d
$ echo sweet > YOUR_FILENAME
$ git init
$ git add .
$ find .git/objects -type f
.git/objects/aa/823728ea7d592acc69b36875a482cdf3fd5c8d.
"blob" SP "6" NUL "sweet" LF
where SP is a space, NUL is a zero byte and LF is a linefeed.
100644 blob 4687bc4f4462088a00aaff176e3cfd311a4f9e04 .babelrc
100644 blob fa8a4aacfa716aafd9ded87567fcfa4bed5e4061 .csscomb.json
100644 blob e717f5eb6387be229227ad8eba6a56f4cd904ade .editorconfig
100644 blob e9f486a694fece6be49c05422579c20f895b83e4 .env
040000 tree d327d6e018c025ba8932fa816bd5ace0221694bb bin
A list of tuples consisting of a mode, type, a hash and a filename
tree 5f21948d725eb30db0a79ef9666145d86d960a1c
parent 996b318d339c002fd3bcb38a0a149879b9c1c3af
parent 93c169a6a9c79b6e7282735eb2e2187421c73796
author ΠΠΆΠΎΠ½, ΠΏΡΠΎΡΡΠΎ ΠΠΆΠΎΠ½ <smd.deluzion@gmail.com> 1472120347 +0300
committer GitHub <noreply@github.com> 1472120347 +0300
Merge pull request #1 from sudodoki/merge-commit-demo
This is a commit to display commit with multiple items
It looks like you could mix together a few shell scripts and add a dash of C code to cook it up in a matter of hours: a melange of basic filesystem operations and SHA1 hashing, garnished with lock files and fsyncs for robustness. In fact, this accurately describes the earliest versions of Git. Nonetheless, apart from ingenious packing tricks to save space, and ingenious indexing tricks to save time, we now know how Git deftly changes a filesystem into a database perfect for version control.
{
data: 'root',
children: [
{
data: 'A',
children: [
{data: 'B'},
{data: 'C'}
]
},
{data: 'B'}
]
}
['root',
['A',
['C', 'D']],
['B']
]
['root', 'A', 'B', 'C', 'D']
var tree = ['root', ['A', ['C', 'D']], ['B']]
function dfs([el, ...children], fn) {
fn(el);
children.forEach((node) => dfs(node, fn));
}
dfs(tree, console.log.bind(console)); /* root A C D B */
var tree = ['root', 'A', 'B', 'C', 'D'];
const hleft = (i) => (i + 1) * 2 - 1
const hright = (i) => (i + 1) * 2
function _dfs(tree, el, fn) {
if (!tree[el]) { return null; }
fn(tree[el])
if (hleft(el) < tree.length) {
_dfs(tree, hleft(el), fn)
_dfs(tree, hright(el), fn)
}
}
function dfs(tree, fn) {
_dfs(tree, 0, fn)
}
dfs(tree, console.log.bind(console)); /* root A C D B */
var tree = ['root', ['A', ['C', 'D']], ['B']]
function bfs(tree, fn) {
var queue = [];
queue.push(tree);
next = queue.shift();
while (next) {
const [data, ...children] = next;
fn(data);
queue = queue.concat(children);
next = queue.shift();
}
}
bfs(tree, console.log.bind(console)); /* root A B C D */
var tree = ['root', 'A', 'B', 'C', 'D'];
function bfs(tree, fn) {
tree.filter(i=>i).map((el) => fn(el));
}
bfs(tree, console.log.bind(console)); /* root A B C D */
const fib = (n) =>
n <= 1 ?
1
: fib(n - 1) + fib(n - 2)
VM111:1 Uncaught RangeError: Maximum call stack size exceeded(β¦)
const answers = [1, 1]
const fib = (n) => {
if (!answers[n]) {
for (let i = 2; i <= n; i++) {
answers[i] = answers[i - 1] + answers[i - 2];
}
}
return answers[n];
}
Infinity
result[y][x] = Math.max(
result[y - 1][x] + costMatrix.INSERTION(),
result[y][x - 1] + costMatrix.DELETION(),
result[y - 1][x - 1] +
costMatrix.CHANGE(firstWord[x - 1], secondWord[y - 1])
);
and there's so much more (heuristics to detect file rename, ref-packs, etc)β¦
Images by @ShakedBrains