Skip to content

Instantly share code, notes, and snippets.

DanHerbert /
Last active Oct 16, 2021
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

READ THIS Very Important Update

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

knadh /
Last active Sep 24, 2021
Elapsed and execution time for commands in ZSH

Elapsed and execution time display for commands in ZSH

Append this to your ~/.zshrc file.

function preexec() {
  timer=$(($(date +%s%0N)/1000000))
haasn /
Last active Sep 17, 2021
Firefox bullshit removal via about:config

Firefox bullshit removal

Updated: Just use qutebrowser (and disable javascript). The web is done for.

MicahElliott /
Created Nov 29, 2010
Convert values between RGB hex codes and xterm-256 color codes.
#! /usr/bin/env python
""" Convert values between RGB hex codes and xterm-256 color codes.
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
atcuno / gist:3425484ac5cce5298932
Last active Sep 14, 2021
HowTo: Privacy & Security Conscious Browsing
View gist:3425484ac5cce5298932

The purpose of this document is to make recommendations on how to browse in a privacy and security conscious manner. This information is compiled from a number of sources, which are referenced throughout the document, as well as my own experiences with the described technologies.

I welcome contributions and comments on the information contained. Please see the How to Contribute section for information on contributing your own knowledge.

Table of Contents

romainl / Vim_pushing_built-in_features_beyond_their_limits.markdown
Last active Sep 8, 2021
Vim: pushing built-in features beyond their limits
View Vim_pushing_built-in_features_beyond_their_limits.markdown

Vim: pushing built-in features beyond their limits

The situation

Searching can be an efficient way to navigate the current buffer.

The first search commands we learn are usually / and ?. These are seriously cool, especially with the incsearch option enabled which lets us keep typing to refine our search pattern. / and ? really shine when all we want is to jump to something we already have our eyeballs on but they are not fit for every situation:

  • when we want to search something that's not directly there, those two commands can make us loose context very quickly,
  • when we need to compare the matches.
sindresorhus /
Created Oct 16, 2012
Benchmark results of the fastest way to check if a git branch is dirty

Tested against the WebKit git repo by entering the repo with 1 file dirty.

git diff --quiet --ignore-submodules HEAD # Will tell if there are any uncomitted changes, staged or not.
0.6 sec

git diff-index --quiet HEAD # Only tracked
2 sec

Dv92 / styles.less
Last active Nov 12, 2018
Atom: how to show invisibile characters on selected text like sublime text does
View styles.less
atom-text-editor::shadow {
.editor-contents--private {
.invisible-character {
visibility: hidden;
&.has-selection {
.invisible-character {
visibility: visible;