Skip to content

Instantly share code, notes, and snippets.

View scmx's full-sized avatar

Albert Arvidsson scmx

View GitHub Profile
@scmx
scmx / hyper-term-cursor-hard-to-see.md
Created June 20, 2018 14:00
Hyper Term Fix cursor hard to see #hyper #hyperterm #macos #cursor #black #text #pointer

The text cursor in Hyper term can be very hard to see, so I looked into changing it to white or similar for better visibility. Here's a related issue about this vercel/hyper#1045

The currently proposed solutions didn't entirely work for me until I used css: instead of termCSS:.

~/.hyper.js

css: `
  .xterm {
 cursor: default;
@scmx
scmx / bash-prompt-git.md
Created May 9, 2018 12:32
Bash prompt with Git and autocompletion #bash #prompt #git #complete #autocomplete

Bash prompt with Git and autocompletion

First install HomeBrew and then use brew to install the bash-completion package

brew install bash-completion

After that you can open up your ~/.bashrc file and add the following:

# Load git prompt that display current branch etc
@scmx
scmx / screenshot-with-touchbar.md
Last active May 9, 2018 06:09
Mac OS Screenshot with TouchBar #macos #screenshot #touchbar #imagemagick #convert #append #resize

Mac OS Screenshot with TouchBar

Many know that there are some keyboard bindings on Mac OS for taking screen shots

  • <Cmd> + <Shift> + 3 Full screenshot
  • <Cmd> + <Shift> + 4 Choose rectangle of what to screenshot
  • <Cmd> + <Shift> + 4 + <Space> Choose an app to screenshot

But for those with a Macbook Pro with a Touch Bar there is also

  • <Cmd> + <Shift> + 6 Screenshot of TouchBar
@scmx
scmx / capybara-selenium-webdriver-slow-speed.md
Created May 5, 2018 07:46
Capybara Selenium WebDriver running at a lower speed using sleep command #capybara #selenium #rails #

Capybara Selenium WebDriver running at a lower speed using sleep command

Ever wanted to run your integration/end-to-end test suite at a lower speed so that you better could observe what's happening and perhaps make a recording of it?

Here's a a technique I've been using when writing tests with Capybara Selenium WebDriver.

Put this in test/test_helper.rb or maybe something like spec/support/capybara.rb.

@scmx
scmx / keybase.md
Last active January 29, 2018 07:23
keybase.md

Keybase proof

I hereby claim:

  • I am scmx on github.
  • I am albertarv (https://keybase.io/albertarv) on keybase.
  • I have a public key ASDpTXwwbwneSxsaoy4j2gb7eo0GyQI_3UGCJrYCIqx7Igo

To claim this, I am signing this object:

@scmx
scmx / split-git-commit-with-orig-head.md
Last active January 9, 2024 09:37
How to split a Git commit and preserve message using ORIG_HEAD #git #commit #ORIG_HEAD https://twitter.com/albertarv/status/954389020758495233

How to split a Git commit and preserve message using ORIG_HEAD

A colleague told me he'd accidentally committed something. Now he wanted to remove it from the previous commit and then put in a new commit. This is called splitting a commit, and here's the best way I know of how to do it.

Solution

  1. git reset --soft HEAD~ Undo the last commit, but preserve "Changes to be committed"
  2. git reset <some/path> Exclude what you want
  3. git commit -C ORIG_HEAD Commit with the same message as before, which was stored in ORIG_HEAD

Example

@scmx
scmx / killall-comtrol-strip.md
Last active July 13, 2017 20:29
How to fix a frozen MacBook Pro TouchBar (killall ControlStrip)

How to fix a frozen MacBook Pro TouchBar

tl;dr killall ControlStrip

After having used a MacBook Pro with a TouchBar for a few months, I've experienced a few times that the TouchBar can sometimes hang up so that none of the buttons work. I don't really use it that much, so I can just continue working, but it's annoying to not be able to change screen brightness etc.

The last few times I've just resorted to rebooting my computer after failing to google how to restart only the touchbar.

But today it was easier too google it. Cnet has an article that mentions various ways to fix it. For me it was enough to restart the ControlStrip, the rightmost part of the TouchBar.

@scmx
scmx / update-diverged-branch-with-git-checkout-B.md
Created April 7, 2017 07:01
Updating a local diverged git branch to latest remote without reset --hard. #git git checkout -B vs git reset --hard

Updating a local diverged git branch to latest remote without reset --hard

Sometimes you have a branch checked out locally that someone else owns and they do a force push. Perhaps it's during a review when they have pushed all the needed fixups and got them approved. So now they squash and force-push the branch. It's time for you to take a new look at the updated commits, so you checkout the branch and try to update it.

The situation

$ git checkout some-topic-branch
$ git pull
@scmx
scmx / ghpr.md
Last active July 1, 2017 10:56
Bash function for checking out a github pull request branch #git #github #pull-request #bash

Are you having trouble checking out someone's pullrequest from a terminal?

Example usage

git clone git@github.com:example/example.git
ghpr someuser:somebranch # Copy this from the PR

It does these things

  • Adds someuser as a git remote
@scmx
scmx / vscode-getting-up-to-speed.md
Last active November 6, 2019 08:33
VSCode Getting up to speed. #vscode Here are some extensions I found essential with when switching from #vim

Getting up to speed with Visual Studio Code

To open the command prompt <Cmd> + <Shift + p. Or use <Cmd> + p and type >

Open the command prompt and type >Extensions: Install Extensions, there you can search for and install the extensions below.

[rewrap][rewrap] Wrapping long lines at 80 columns

As a vim:er I'm used to selecting a few lines with V and then pressing gq to wrap them. Very handy for markdown files, git commit body etc.