Skip to content

Instantly share code, notes, and snippets.

View michaelminter's full-sized avatar

Michael Minter michaelminter

View GitHub Profile
@michaelminter
michaelminter / destructuring.js
Created June 27, 2019 06:19 — forked from mikaelbr/destructuring.js
Complete collection of JavaScript destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
@michaelminter
michaelminter / api_logger.rb
Last active June 17, 2019 04:01 — forked from dblock/api_logger.rb
Rails Grape API logger
class ApiLogger < Grape::Middleware::Base
def before
Rails.logger.info "[api] Requested: #{request_log_data.to_json}\n" +
"[api] #{response_log_data[:description]} #{response_log_data[:source_file]}:#{response_log_data[:source_line]}"
end
private
def request_log_data

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

#!/bin/bash
WGET='/usr/bin/wget'
# input validation
if [ ! -n "$1" ]
then
echo "You must enter a url as the first parameter"
echo "Usage: $0 <url>"
exit
fi
@michaelminter
michaelminter / irb.bash
Last active December 24, 2015 00:49 — forked from codeprimate/gist:6719279
Call irb with gem option
irb -Ilib -rGEMNAME
@michaelminter
michaelminter / branch-color.sh
Created October 1, 2012 17:47 — forked from yujiberra/gist:1144329
Bash profile with color current git branch color coded by status
# Git status bash prompt
#
# In addition to printing the current working directory, this prompt will
# show a number of things if you are in a git repository:
# - The current branch you are in
# - Whether there are untracked files in the repository (there will be an
# asterisk after the branch nome if there are)
# - Whether there are any unmerged/unstaged/staged changes or if the directory
# is clean. See below for the colors that will be used, and change them if
# you'd like.