Skip to content

Instantly share code, notes, and snippets.



View GitHub Profile
coliver /
Last active Sep 1, 2020
Rails Headful (Not Headless) Selenium Chrome Tests in Docker

This was tested on a Mac running 10.13.6 High Sierra.

Why? I wanted to be able to stop a system spec mid-run if I was having issues with it.

On the mac host:

Install brew

/bin/bash -c "$(curl -fsSL"
View gist:0e6e00a94f5b01be623316555f8a25e2
git log --merges --first-parent master \
--pretty=format:"%h %<(10,trunc)%aN %C(white)%<(15)%ar%Creset %C(red bold)%<(15)%D%Creset %s"
Explaining each argument:
--merges: only "merge" commits (more than 1 parent);
--first-parent master: only merges applied to master. This removes the entries where someone merged master into their branches;
--pretty-format: applies the following formatting:
%h: the commit short hash;
%<(10,trunc)%aN: author name, truncated at 10 chars;
%<(15)%ar: the relative commit time, padded to 15 chars;

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file. Create a file called .gitignore in your home directory and add anything you want to ignore. You then need to tell git where your global gitignore file is.


git config --global core.excludesfile ~/.gitignore


git config --global core.excludesfile %USERPROFILE%\.gitignore
coliver /
Created Mar 23, 2020 — forked from carlflor/
This fixes the Gemfile.lock conflict when doing git rebase

If both the upstream and your feature branch have made changes to Gemfile, you will likely receive merge conflicts on Gemfile.lock when you rebase your feature branch. Don't try to resolve these manually; you'll probably just screw it up. Instead do this:

    git checkout --ours Gemfile.lock
    git add Gemfile.lock
    git rebase --continue

This ensures that you get a correct Gemfile.lock at each step along the way.

View DefaultKeyBinding.dict
/* This file goes in ~/Library/KeyBindings */
/* Remap Home / End keys */
/* Home Button*/
"\UF729" = "moveToBeginningOfLine:";
/* End Button */
"\UF72B" = "moveToEndOfLine:";
/* Shift + Home Button */
"$\UF729" = "moveToBeginningOfLineAndModifySelection:";
/* Shift + End Button */
coliver / net_ntlm_monkeypatch.rb
Created Feb 27, 2019 — forked from antoniusostermann/net_ntlm_monkeypatch.rb
A monkey patch to solve the problem described in This monkey patch prioritizes ntlm over negotiate and makes it possible to use the httpi gem if server supports both / sends header including both arguments.
View net_ntlm_monkeypatch.rb
# A monkey patch concerning this issue:
# Basically, this monkey patch priors NTLM over Negotiate and not vice-versa
# All monkey patched spots are marked with "## MONKEY PATCHED"
# All in all, there are 2 monkey patched spots, both in private method "negotiate_ntlm_auth"
# Compare it with:
require "uri"
require "httpi/adapter/base"
require "httpi/response"
coliver / rubyntlm_with_net_http.rb
Created Feb 20, 2019 — forked from rodrei/rubyntlm_with_net_http.rb
Example: NTLM Authentication with NetHTTP
View rubyntlm_with_net_http.rb
uri = URI('')
user = ''
passwd = ''
Net::HTTP.start(, uri.port, :use_ssl => uri.scheme == 'https') do |http|
request =
t1 =
request['Authorization'] = 'NTLM ' + t1.encode64
response = http.request(request)
coliver /
Created Feb 21, 2018
How to fix a schema.rb conflict after a rebase
coliver /
Last active Apr 26, 2016
How to get a webcam working in a Windows 10 VM

Tested in VirtualBox 5.0.18

Linux Mint 17 Qiana host

Win10 guest

Ensure the VM boots up, windows update, install guest additions, shut down

  • Open VirtualBox
View rspec-mocks-to-mocha.rb
# I use RubyMine. In the find and replace box:
find: expect\((.*)\)\.to receive\((.*)\)(\.with\(.*\))?.and_return
replace: $1.expects($2).returns(
# This does most of the work.
You can’t perform that action at this time.