Skip to content

Instantly share code, notes, and snippets.

View halhenke's full-sized avatar
:octocat:
Segge Fallt

Hal Henke halhenke

:octocat:
Segge Fallt
View GitHub Profile
@halhenke
halhenke / npm-reinstall.fish
Created August 3, 2016 15:22
When you want to install a package that npm & semvar might prevent you from upgrading (basic CLI uninstall/install)
function npm-reinstall -d "remove & then install package - changing package.json - so we can ignore semver restrictions
usage - `npm-reinstall -S|-D pkg1 pkg2 ...`"
npm uninstall $argv[1] $argv[2..-1]
npm install $argv[1] $argv[2..-1]
end
@halhenke
halhenke / npm-look.fish
Last active August 3, 2016 15:19
Rough equivalent to npm view but for local package.json (requires `jq` command line JSON parser)
function npm-look -d "look at specific fields from a local package.json - much like npm view - `npm-reinstall -S|-D pkg1 pkg2 ...`"
cat package.json | jq (string join '' '.' $argv[1])
end
function docker-switch-to-old-version -d "Switch to the old Docker Toolkit commands - Using VirtualBox"
mv /usr/local/bin/docker /usr/local/bin/docker.new
mv /usr/local/bin/docker-compose /usr/local/bin/docker-compose.new
mv /usr/local/bin/docker-machine /usr/local/bin/docker-machine.new
mv /usr/local/bin/docker.backup /usr/local/bin/docker
mv /usr/local/bin/docker-compose.backup /usr/local/bin/docker-compose
mv /usr/local/bin/docker-machine.backup /usr/local/bin/docker-machine
end
@halhenke
halhenke / docker-switch-to-new-version.fish
Created August 2, 2016 10:53
Switch from old executables of Docker Toolkit to Docker Mac Executables
function docker-switch-to-new-version -d "Switch to the new Docker for Mac commands - Using HyperVisor"
mv /usr/local/bin/docker /usr/local/bin/docker.backup
mv /usr/local/bin/docker-compose /usr/local/bin/docker-compose.backup
mv /usr/local/bin/docker-machine /usr/local/bin/docker-machine.backup
mv /usr/local/bin/docker.new /usr/local/bin/docker
mv /usr/local/bin/docker-compose.new /usr/local/bin/docker-compose
mv /usr/local/bin/docker-machine.new /usr/local/bin/docker-machine
end
@halhenke
halhenke / package.json
Last active January 13, 2016 18:19
Run npm shrinkwrap automatically after an install via npm script
"scripts": {
"goodInstall": "npm install",
"postgoodInstall": "npm shrinkwrap --dev",
}
// Install a devDependency with `npm run goodInstall -- -D react-animate`
@halhenke
halhenke / index.html
Created October 28, 2015 09:02
Zoom code for the Canvas from the XKCD Pixels comics - https://xkcd.com/1416/
<html data-ember-extension="1" class=""><head>
<link rel="stylesheet" type="text/css" href="/s/b0dcca.css" title="Default">
<title>xkcd: Pixels</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="shortcut icon" href="/s/919f27.ico" type="image/x-icon">
<link rel="icon" href="/s/919f27.ico" type="image/x-icon">
<link rel="alternate" type="application/atom+xml" title="Atom 1.0" href="/atom.xml">
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="/rss.xml">
<script async="" src="//www.google-analytics.com/analytics.js"></script><script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
@halhenke
halhenke / new_gist_file_0
Created September 23, 2015 02:21
From https://netpenthe.wordpress.com/2012/11/02/pause-capybara/ How to pause a Capybara test mid-xecution
print "Press Return to continue..."
STDIN.getc
@halhenke
halhenke / new_gist_file_0
Created September 10, 2015 09:05
From http://nerds.airbnb.com/github-pull-request-bookmarklet/ AirBNB Bookmarklet to hide comments in Pull Request
javascript:(function() { var username=prompt("Hide comment blocks including user:"); if (username!=null && username!="") { $(".comment-header-author:contains("+username+")").parents("tr.inline-comments").hide(); } })();
@halhenke
halhenke / new_gist_file_0
Created September 10, 2015 09:04
From http://nerds.airbnb.com/github-pull-request-bookmarklet/ AirBNB Pull Request Template Bookmarklet
javascript:(function() {var e = document.getElementById('pull_request_body');if (e) {e.value += '# What? Why?\n\n\n# How was it tested?\n\n\ncc project_narhwal @mLewisLogic @clizzin @Raphomet @LogicWolfe';}})();
@halhenke
halhenke / new_gist_file_0
Created September 8, 2015 07:44
From http://student.wordflyers.com/#/learn/grade_levels Get the maximum z-index (or potentially any style attribute on a page (uses jQuery)
(Math.max.apply(Math,
$.makeArray($('*')
.map(function () {
return $(this).css('z-index');
}).filter(function () {
return $.isNumeric(this);
}).map(function () {
return parseInt(this, 10);
}))));