Git -Xours -Xtheirs arguments

Git provides a helpful argument to prefer one branch or the other to “clobber” merge conflicts:

git merge main -Xours
git merge main -Xtheirs

I always get confused what the “X” means. I always assume “X” means mark which branch to clobber. Like “X” out their branch. Or “X” out our branch. Please wipe this mnemonic from your brain!

“X” means “PREFER”

“PREFER” the changes in their branch or “PREFER” the changes in our branch.

Jeez!

Links

Deferred Promise

Found myself in a situation where I wanted to execute a process and then check back on it later to be sure it had completed.

class MyClass {
  constructor() {
    this.readyPromise = new Promise(
      resolve => (this.readyResolve = resolve)
    );
  }

  async executeProcesses() {
    await // ...executing processes...
    this.readyResolve();
  }

  ready() { return this.readyPromise }
}
Continue reading “Deferred Promise”

Chrome extension MV2 access to page data

Chrome extensions exist in an “isolated world” to prevent global var collisions between the website and the extension that runs on a given website. This mostly applies to content_scripts in an extension.

E.g. window.foo: my extension declares foo in the global scope and the website the extension runs on also declares foo in the global scope. With “isolated world” scoping for the extension, this is not a worry since it doesn’t share scope with the web page it runs on.

Continue reading “Chrome extension MV2 access to page data”