Skip to content

Instantly share code, notes, and snippets.

View jhult's full-sized avatar

Jonathan Hult jhult

View GitHub Profile
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active November 27, 2024 13:36
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

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.

@dannysmith
dannysmith / osx_setup.sh
Last active April 16, 2025 00:12
Sensible defaults for New Mac
#!/usr/bin/env bash
# ~/.osx — http://mths.be/osx
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
@glnds
glnds / less-cheatsheet.md
Last active April 9, 2025 18:45
Less Cheatsheet

Less Cheatsheet

less {filename}

Navigation
SPACE forward one window
b backward one window
d forward half window
@danharper
danharper / background.js
Last active April 29, 2025 04:09
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
@l15n
l15n / Local Branches
Last active September 17, 2021 16:17 — forked from schacon/gist:942899
Delete all remote branches on your fork `mine` which have already been merged into upstream `origin/master`
$ git branch --merged master |
grep -v '*' |
grep -v master |
xargs -L1 |
xargs git branch -d
@fxchen
fxchen / Google Contact Phone Number Cleaner.txt
Created November 30, 2012 00:43
This Excel Formula helps format phone numbers on Google Contacts. If your gmail contacts are unorganized mess like mine used to be.
How to Clean Up Google Contact Numbers
If your Gmail contact phone numbers are unorganized, this Excel formula can help you remove format the mobile phone numbers.
Note: I added a 1 for US numbers. I like my numbers formatted this way.
1. Export the numbers you want to clean to CSV (Use Google CSV)
2. Open in Excel. The U2 column was Mobile Phone column for the file I downloaded.
3. Place this formula starting in the V2 column (this will replace the Pager column, which I did not need) and copy downwards to do the same formula replacement.
=IF((LEFT(U2,0,1)="1"),SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(U2," ",""),".",""),")",""),"(",""),"-",""),CONCATENATE("1",SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(U2," ",""),".",""),")",""),"(",""),"-",""))
4. Copy from V2 (downwards) and do a Paste Special starting on U2 with "Value". This will replace your previous values for mobile phone with the clean ones.
5. Save.
@bryanhunter
bryanhunter / oo-banana.md
Created February 10, 2012 04:05
Joe Armstrong on reusability in software (OO-vs-functional)

I think the lack of reusability comes in object-oriented languages, not functional languages. Because the problem with object-oriented languages is they’ve got all this implicit environment that they carry around with them. You wanted a banana but what you got was a gorilla holding the banana and the entire jungle.

If you have referentially transparent code, if you have pure functions-- all the data comes in its input arguments and everything goes out and leaves no state behind-- it's incredibly reusable. You can just reuse it here, there, and everywhere.

-Joe Armstrong, Designer and implementer of the Erlang programming language